[RN] Consistency in Jitsi Meet SDK for iOS

1. Aligns the project structure of Jitsi Meet SDK for iOS with that for
   Android for better comprehension.

2. The command `react-native run-ios` uses the last Xcode project or
   workspace in the list of these sorted in alphabetical order. Which
   limits our freedom in naming. Thus having only an Xcode project in
   the root directory of the iOS project structure gives us back the
   freedom in naming.

3. Allows the Podspec to work for the app project in addition to the sdk
   project because we need Crashlytics in the app which is integrated
   via Cocoapods as well.

4. Further removes references to JitsiKit in the source code for the
   sake of consistent naming.
This commit is contained in:
Lyubo Marinov 2017-06-06 17:43:51 -05:00
parent b1100a9c7a
commit 2251a17f96
42 changed files with 215 additions and 227 deletions

View File

@ -1,9 +1,10 @@
platform :ios, '9.0'
workspace 'jitsi-meet'
project 'Jitsi Meet SDK.xcodeproj'
target 'JitsiMeet' do
project 'sdk/sdk.xcodeproj'
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
@ -20,7 +21,6 @@ target 'JitsiMeet' do
pod 'react-native-keep-awake', :path => '../node_modules/react-native-keep-awake'
pod 'react-native-webrtc', :path => '../node_modules/react-native-webrtc'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
end
post_install do |installer|

View File

@ -1,25 +1,29 @@
# Jitsi Meet SDK for iOS
This directory contains the source code for Jitsi Meet for iOS (the application)
and the Jitsi Meet SDK.
This directory contains the source code of the Jitsi Meet app and the Jitsi Meet
SDK for iOS.
## Jitsi Meet SDK
JitsiMeet is an iOS framework which embodies the Jitsi Meet experience,
gift-wrapped so other applications can use it. Using it is very simple. Use
a Storyboard or Interface Builder to add a `JitsiMeetView` to your
application.
JitsiMeet is an iOS framework which embodies the whole Jitsi Meet experience and
makes it reusable by third-party apps.
Then, once the view has loaded, set the delegate in your controller and load the
desired URL:
To get started:
1. Add a `JitsiMeetView` to your app using a Storyboard or Interface Builder,
for example.
2. Then, once the view has loaded, set the delegate in your controller and load
the desired URL:
```objc
- (void)viewDidLoad {
[super viewDidLoad];
JitsiMeetView *meetView = (JitsiMeetView*) self.view;
meetView.delegate = self;
[meetView loadURL:nil];
JitsiMeetView *view = (JitsiMeetView *) self.view;
view.delegate = self;
[view loadURL:nil];
}
```
@ -32,14 +36,14 @@ The `JitsiMeetView` class is the entrypoint to the SDK. It a subclass of
[meetView loadURL:[NSURL URLWithString:@"https://meet.jit.si/test123"]];
```
Loads the given URL and joins the room. If `null` is specified the welcome page
Loads the given URL and joins the room. If `null` is specified, the welcome page
is displayed instead.
#### Universal / deep linking
In order to support universal / deep linking, `JitsiMeetView` offers 2 class
methods that you application's delegate should call in order for the application
to follow those links. Example:
In order to support Universal / deep linking, `JitsiMeetView` offers 2 class
methods that you app's delegate should call in order for the app to follow those
links.
```objc
- (BOOL)application:(UIApplication *)application

View File

@ -33,17 +33,17 @@
/* Begin PBXFileReference section */
0B26BE6D1EC5BC3C00EEFB41 /* JitsiMeet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = JitsiMeet.framework; sourceTree = BUILT_PRODUCTS_DIR; };
0B412F1D1EDEE6E800B1A0A6 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = app/ViewController.h; sourceTree = "<group>"; };
0B412F1E1EDEE6E800B1A0A6 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ViewController.m; path = app/ViewController.m; sourceTree = "<group>"; };
0B412F201EDEE95300B1A0A6 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = app/Base.lproj/Main.storyboard; sourceTree = "<group>"; };
0B412F1D1EDEE6E800B1A0A6 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
0B412F1E1EDEE6E800B1A0A6 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
0B412F201EDEE95300B1A0A6 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* jitsi-meet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "jitsi-meet.app"; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = app/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = app/AppDelegate.m; sourceTree = "<group>"; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = app/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = app/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = app/main.m; sourceTree = "<group>"; };
B3B083EB1D4955FF0069CEE7 /* jitsi-meet.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "jitsi-meet.entitlements"; sourceTree = "<group>"; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
B3B083EB1D4955FF0069CEE7 /* app.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = app.entitlements; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -66,29 +66,29 @@
name = Frameworks;
sourceTree = "<group>";
};
13B07FAE1A68108700A75B9A /* app */ = {
13B07FAE1A68108700A75B9A /* src */ = {
isa = PBXGroup;
children = (
13B07FB71A68108700A75B9A /* main.m */,
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
0B412F1D1EDEE6E800B1A0A6 /* ViewController.h */,
0B412F1E1EDEE6E800B1A0A6 /* ViewController.m */,
13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
0B412F201EDEE95300B1A0A6 /* Main.storyboard */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
13B07FB61A68108700A75B9A /* Info.plist */,
13B07FB11A68108700A75B9A /* LaunchScreen.xib */,
13B07FB71A68108700A75B9A /* main.m */,
0B412F201EDEE95300B1A0A6 /* Main.storyboard */,
0B412F1D1EDEE6E800B1A0A6 /* ViewController.h */,
0B412F1E1EDEE6E800B1A0A6 /* ViewController.m */,
);
name = app;
path = src;
sourceTree = "<group>";
};
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
B3B083EB1D4955FF0069CEE7 /* app.entitlements */,
0B26BE711EC5BC4D00EEFB41 /* Frameworks */,
13B07FAE1A68108700A75B9A /* app */,
B3B083EB1D4955FF0069CEE7 /* jitsi-meet.entitlements */,
83CBBA001A601CBA00E9B192 /* Products */,
13B07FAE1A68108700A75B9A /* src */,
);
indentWidth = 2;
sourceTree = "<group>";
@ -145,7 +145,7 @@
};
};
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "jitsi-meet" */;
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "app" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@ -189,7 +189,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "utils/fixup-ats.sh";
shellScript = "../scripts/fixup-ats.sh";
};
0BBA83C41EC9F7600075A103 /* Run React packager */ = {
isa = PBXShellScriptBuildPhase;
@ -203,7 +203,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "utils/run-packager.sh";
shellScript = "../scripts/run-packager.sh";
};
B35383AD1DDA0083008F406A /* Adjust embedded framework architectures */ = {
isa = PBXShellScriptBuildPhase;
@ -217,7 +217,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "utils/fixup-frameworks.sh";
shellScript = "../scripts/fixup-frameworks.sh";
};
/* End PBXShellScriptBuildPhase section */
@ -241,7 +241,6 @@
13B07FB21A68108700A75B9A /* Base */,
);
name = LaunchScreen.xib;
path = app;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
@ -251,7 +250,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "jitsi-meet.entitlements";
CODE_SIGN_ENTITLEMENTS = app.entitlements;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
ENABLE_BITCODE = NO;
@ -260,7 +259,7 @@
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
INFOPLIST_FILE = app/Info.plist;
INFOPLIST_FILE = src/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
@ -279,7 +278,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = "jitsi-meet.entitlements";
CODE_SIGN_ENTITLEMENTS = app.entitlements;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@ -287,7 +286,7 @@
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
);
INFOPLIST_FILE = app/Info.plist;
INFOPLIST_FILE = src/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "$(inherited)";
@ -407,7 +406,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "jitsi-meet" */ = {
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "app" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83CBBA201A601CBA00E9B192 /* Debug */,

View File

@ -17,7 +17,7 @@
BlueprintIdentifier = "0BD906E41EC0C00300C8C18E"
BuildableName = "JitsiMeet.framework"
BlueprintName = "JitsiMeet"
ReferencedContainer = "container:Jitsi Meet SDK.xcodeproj">
ReferencedContainer = "container:sdk.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
@ -31,7 +31,7 @@
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "jitsi-meet.app"
BlueprintName = "jitsi-meet"
ReferencedContainer = "container:jitsi-meet.xcodeproj">
ReferencedContainer = "container:app.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@ -49,7 +49,7 @@
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "jitsi-meet.app"
BlueprintName = "jitsi-meet"
ReferencedContainer = "container:jitsi-meet.xcodeproj">
ReferencedContainer = "container:app.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@ -72,7 +72,7 @@
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "jitsi-meet.app"
BlueprintName = "jitsi-meet"
ReferencedContainer = "container:jitsi-meet.xcodeproj">
ReferencedContainer = "container:app.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
@ -91,7 +91,7 @@
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "jitsi-meet.app"
BlueprintName = "jitsi-meet"
ReferencedContainer = "container:jitsi-meet.xcodeproj">
ReferencedContainer = "container:app.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>

View File

@ -16,7 +16,6 @@
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (nonatomic, strong) UIWindow *window;

View File

@ -18,7 +18,6 @@
#import <JitsiMeet/JitsiMeet.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
@ -26,12 +25,11 @@
return YES;
}
#pragma mark linking delegate methods
#pragma mark Linking delegate methods
- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler
{
restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler {
return [JitsiMeetView application:application
continueUserActivity:userActivity
restorationHandler:restorationHandler];
@ -40,8 +38,7 @@ continueUserActivity:(NSUserActivity *)userActivity
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
annotation:(id)annotation {
return [JitsiMeetView application:application
openURL:url
sourceApplication:sourceApplication

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

View File

Before

Width:  |  Height:  |  Size: 167 KiB

After

Width:  |  Height:  |  Size: 167 KiB

View File

Before

Width:  |  Height:  |  Size: 278 KiB

After

Width:  |  Height:  |  Size: 278 KiB

View File

@ -18,7 +18,6 @@
#import <JitsiMeet/JitsiMeet.h>
@interface ViewController : UIViewController<JitsiMeetViewDelegate>
@end

View File

@ -22,16 +22,17 @@
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
JitsiMeetView *meetView = (JitsiMeetView*) self.view;
meetView.delegate = self;
[meetView loadURL:nil];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidLoad {
[super viewDidLoad];
JitsiMeetView *view = (JitsiMeetView *) self.view;
view.delegate = self;
[view loadURL:nil];
}
@end

View File

@ -20,6 +20,9 @@
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
return UIApplicationMain(
argc, argv,
nil,
NSStringFromClass([AppDelegate class]));
}
}

View File

@ -2,10 +2,10 @@
<Workspace
version = "1.0">
<FileRef
location = "group:Jitsi Meet SDK.xcodeproj">
location = "group:app/app.xcodeproj">
</FileRef>
<FileRef
location = "group:jitsi-meet.xcodeproj">
location = "group:sdk/sdk.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">

View File

@ -11,6 +11,6 @@ if [[ "$CONFIGURATION" = "Debug" ]]; then
exit 2
fi
else
open "$SRCROOT/../node_modules/react-native/packager/launchPackager.command" || echo "Can't start packager automatically"
open "$SRCROOT/../../node_modules/react-native/packager/launchPackager.command" || echo "Can't start packager automatically"
fi
fi

View File

@ -11,15 +11,15 @@
0B412F191EDEC65D00B1A0A6 /* JitsiMeetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */; };
0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
0B93EF7B1EC608550030D24D /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0B93EF7A1EC608550030D24D /* CoreText.framework */; };
0B93EF7E1EC9DDCD0030D24D /* JitsiRCTBridgeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B93EF7C1EC9DDCD0030D24D /* JitsiRCTBridgeWrapper.h */; };
0B93EF7F1EC9DDCD0030D24D /* JitsiRTCBridgeWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B93EF7D1EC9DDCD0030D24D /* JitsiRTCBridgeWrapper.m */; };
0B93EF7E1EC9DDCD0030D24D /* RCTBridgeWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B93EF7C1EC9DDCD0030D24D /* RCTBridgeWrapper.h */; };
0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B93EF7D1EC9DDCD0030D24D /* RCTBridgeWrapper.m */; };
0BCA495F1EC4B6C600B793EE /* AudioMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BCA495C1EC4B6C600B793EE /* AudioMode.m */; };
0BCA49601EC4B6C600B793EE /* POSIX.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BCA495D1EC4B6C600B793EE /* POSIX.m */; };
0BCA49611EC4B6C600B793EE /* Proximity.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BCA495E1EC4B6C600B793EE /* Proximity.m */; };
0BCA49641EC4B76D00B793EE /* WebRTC.framework in Copy embedded WebRTC framework */ = {isa = PBXBuildFile; fileRef = 0BCA49631EC4B76D00B793EE /* WebRTC.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
0BCA496C1EC4BBF900B793EE /* jitsi.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 0BCA496B1EC4BBF900B793EE /* jitsi.ttf */; };
0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD906E81EC0C00300C8C18E /* JitsiMeet.h */; settings = {ATTRIBUTES = (Public, ); }; };
399E84404A63DA0F3B34EB9C /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F102AB2F4BCDCF220A512816 /* libPods-JitsiMeet.a */; };
0F65EECE1D95DA94561BB47E /* libPods-JitsiMeet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -37,23 +37,23 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
062651321278D27A9BAEFAD4 /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-JitsiMeet.a"; sourceTree = BUILT_PRODUCTS_DIR; };
0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JitsiMeetView.h; sourceTree = "<group>"; };
0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetView.m; sourceTree = "<group>"; };
0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetViewDelegate.h; sourceTree = "<group>"; };
0B93EF7A1EC608550030D24D /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
0B93EF7C1EC9DDCD0030D24D /* JitsiRCTBridgeWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JitsiRCTBridgeWrapper.h; sourceTree = "<group>"; };
0B93EF7D1EC9DDCD0030D24D /* JitsiRTCBridgeWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JitsiRTCBridgeWrapper.m; sourceTree = "<group>"; };
0B93EF7C1EC9DDCD0030D24D /* RCTBridgeWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTBridgeWrapper.h; sourceTree = "<group>"; };
0B93EF7D1EC9DDCD0030D24D /* RCTBridgeWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBridgeWrapper.m; sourceTree = "<group>"; };
0BCA495C1EC4B6C600B793EE /* AudioMode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioMode.m; sourceTree = "<group>"; };
0BCA495D1EC4B6C600B793EE /* POSIX.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = POSIX.m; sourceTree = "<group>"; };
0BCA495E1EC4B6C600B793EE /* Proximity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Proximity.m; sourceTree = "<group>"; };
0BCA49631EC4B76D00B793EE /* WebRTC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebRTC.framework; path = "../node_modules/react-native-webrtc/ios/WebRTC.framework"; sourceTree = "<group>"; };
0BCA496B1EC4BBF900B793EE /* jitsi.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = jitsi.ttf; path = ../fonts/jitsi.ttf; sourceTree = "<group>"; };
0BCA49631EC4B76D00B793EE /* WebRTC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebRTC.framework; path = "../../node_modules/react-native-webrtc/ios/WebRTC.framework"; sourceTree = "<group>"; };
0BCA496B1EC4BBF900B793EE /* jitsi.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = jitsi.ttf; path = ../../fonts/jitsi.ttf; sourceTree = "<group>"; };
0BD906E51EC0C00300C8C18E /* JitsiMeet.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = JitsiMeet.framework; sourceTree = BUILT_PRODUCTS_DIR; };
0BD906E81EC0C00300C8C18E /* JitsiMeet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeet.h; sourceTree = "<group>"; };
0BD906E91EC0C00300C8C18E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E358F7AEFCB4033712107DF5 /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
F102AB2F4BCDCF220A512816 /* libPods-JitsiMeet.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-JitsiMeet.a"; sourceTree = BUILT_PRODUCTS_DIR; };
98E09B5C73D9036B4ED252FC /* Pods-JitsiMeet.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.debug.xcconfig"; sourceTree = "<group>"; };
9C77CA3CC919B081F1A52982 /* Pods-JitsiMeet.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeet.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -62,7 +62,7 @@
buildActionMask = 2147483647;
files = (
0B93EF7B1EC608550030D24D /* CoreText.framework in Frameworks */,
399E84404A63DA0F3B34EB9C /* libPods-JitsiMeet.a in Frameworks */,
0F65EECE1D95DA94561BB47E /* libPods-JitsiMeet.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -80,11 +80,11 @@
0BD906DB1EC0C00300C8C18E = {
isa = PBXGroup;
children = (
0BCA49681EC4BBE500B793EE /* Resources */,
0BD906E71EC0C00300C8C18E /* sdk */,
0BD906E61EC0C00300C8C18E /* Products */,
C2471A7E156487CC2009E5E0 /* Pods */,
9C3C6FA2341729836589B856 /* Frameworks */,
C5E72ADFC30ED96F9B35F076 /* Pods */,
0BD906E61EC0C00300C8C18E /* Products */,
0BCA49681EC4BBE500B793EE /* Resources */,
0BD906E71EC0C00300C8C18E /* src */,
);
sourceTree = "<group>";
};
@ -96,21 +96,21 @@
name = Products;
sourceTree = "<group>";
};
0BD906E71EC0C00300C8C18E /* sdk */ = {
0BD906E71EC0C00300C8C18E /* src */ = {
isa = PBXGroup;
children = (
0BD906E81EC0C00300C8C18E /* JitsiMeet.h */,
0BCA495C1EC4B6C600B793EE /* AudioMode.m */,
0BCA495D1EC4B6C600B793EE /* POSIX.m */,
0BCA495E1EC4B6C600B793EE /* Proximity.m */,
0BD906E91EC0C00300C8C18E /* Info.plist */,
0B93EF7C1EC9DDCD0030D24D /* JitsiRCTBridgeWrapper.h */,
0B93EF7D1EC9DDCD0030D24D /* JitsiRTCBridgeWrapper.m */,
0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */,
0BD906E81EC0C00300C8C18E /* JitsiMeet.h */,
0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */,
0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */,
0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */,
0B93EF7C1EC9DDCD0030D24D /* RCTBridgeWrapper.h */,
0B93EF7D1EC9DDCD0030D24D /* RCTBridgeWrapper.m */,
0BCA495D1EC4B6C600B793EE /* POSIX.m */,
0BCA495E1EC4B6C600B793EE /* Proximity.m */,
);
path = sdk;
path = src;
sourceTree = "<group>";
};
9C3C6FA2341729836589B856 /* Frameworks */ = {
@ -118,16 +118,16 @@
children = (
0B93EF7A1EC608550030D24D /* CoreText.framework */,
0BCA49631EC4B76D00B793EE /* WebRTC.framework */,
F102AB2F4BCDCF220A512816 /* libPods-JitsiMeet.a */,
03F2ADC957FF109849B7FCA1 /* libPods-JitsiMeet.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
C2471A7E156487CC2009E5E0 /* Pods */ = {
C5E72ADFC30ED96F9B35F076 /* Pods */ = {
isa = PBXGroup;
children = (
062651321278D27A9BAEFAD4 /* Pods-JitsiMeet.debug.xcconfig */,
E358F7AEFCB4033712107DF5 /* Pods-JitsiMeet.release.xcconfig */,
98E09B5C73D9036B4ED252FC /* Pods-JitsiMeet.debug.xcconfig */,
9C77CA3CC919B081F1A52982 /* Pods-JitsiMeet.release.xcconfig */,
);
name = Pods;
sourceTree = "<group>";
@ -140,7 +140,7 @@
buildActionMask = 2147483647;
files = (
0B412F181EDEC65D00B1A0A6 /* JitsiMeetView.h in Headers */,
0B93EF7E1EC9DDCD0030D24D /* JitsiRCTBridgeWrapper.h in Headers */,
0B93EF7E1EC9DDCD0030D24D /* RCTBridgeWrapper.h in Headers */,
0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */,
0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */,
);
@ -153,14 +153,14 @@
isa = PBXNativeTarget;
buildConfigurationList = 0BD906ED1EC0C00300C8C18E /* Build configuration list for PBXNativeTarget "JitsiMeet" */;
buildPhases = (
8203CAE533C18CEC8284C979 /* [CP] Check Pods Manifest.lock */,
26796D8589142D80C8AFDA51 /* [CP] Check Pods Manifest.lock */,
0BD906E01EC0C00300C8C18E /* Sources */,
0BD906E11EC0C00300C8C18E /* Frameworks */,
0BD906E21EC0C00300C8C18E /* Headers */,
0BD906E31EC0C00300C8C18E /* Resources */,
512A060342EDB080C9BBD5BA /* [CP] Copy Pods Resources */,
0BCA49621EC4B74500B793EE /* Copy embedded WebRTC framework */,
0BCA49651EC4B77500B793EE /* Package React bundle */,
C7BC10B338C94EEB98048E64 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@ -187,7 +187,7 @@
};
};
};
buildConfigurationList = 0BD906DF1EC0C00300C8C18E /* Build configuration list for PBXProject "Jitsi Meet SDK" */;
buildConfigurationList = 0BD906DF1EC0C00300C8C18E /* Build configuration list for PBXProject "sdk" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
@ -228,24 +228,9 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
shellScript = "export NODE_BINARY=node\n../../node_modules/react-native/packager/react-native-xcode.sh";
};
512A060342EDB080C9BBD5BA /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet-resources.sh\"\n";
showEnvVarsInLog = 0;
};
8203CAE533C18CEC8284C979 /* [CP] Check Pods Manifest.lock */ = {
26796D8589142D80C8AFDA51 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@ -260,6 +245,21 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
C7BC10B338C94EEB98048E64 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/../Pods/Target Support Files/Pods-JitsiMeet/Pods-JitsiMeet-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@ -267,7 +267,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
0B93EF7F1EC9DDCD0030D24D /* JitsiRTCBridgeWrapper.m in Sources */,
0B93EF7F1EC9DDCD0030D24D /* RCTBridgeWrapper.m in Sources */,
0BCA49601EC4B6C600B793EE /* POSIX.m in Sources */,
0BCA495F1EC4B6C600B793EE /* AudioMode.m in Sources */,
0BCA49611EC4B6C600B793EE /* Proximity.m in Sources */,
@ -380,7 +380,7 @@
};
0BD906EE1EC0C00300C8C18E /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 062651321278D27A9BAEFAD4 /* Pods-JitsiMeet.debug.xcconfig */;
baseConfigurationReference = 98E09B5C73D9036B4ED252FC /* Pods-JitsiMeet.debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
DEFINES_MODULE = YES;
@ -389,10 +389,10 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = sdk/Info.plist;
INFOPLIST_FILE = src/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.jitsi.JitsiKit;
PRODUCT_BUNDLE_IDENTIFIER = org.jitsi.JitsiMeetSDK.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
@ -400,7 +400,7 @@
};
0BD906EF1EC0C00300C8C18E /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = E358F7AEFCB4033712107DF5 /* Pods-JitsiMeet.release.xcconfig */;
baseConfigurationReference = 9C77CA3CC919B081F1A52982 /* Pods-JitsiMeet.release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
DEFINES_MODULE = YES;
@ -409,10 +409,10 @@
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_BITCODE = NO;
INFOPLIST_FILE = sdk/Info.plist;
INFOPLIST_FILE = src/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.jitsi.JitsiKit;
PRODUCT_BUNDLE_IDENTIFIER = org.jitsi.JitsiMeetSDK.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
@ -421,7 +421,7 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
0BD906DF1EC0C00300C8C18E /* Build configuration list for PBXProject "Jitsi Meet SDK" */ = {
0BD906DF1EC0C00300C8C18E /* Build configuration list for PBXProject "sdk" */ = {
isa = XCConfigurationList;
buildConfigurations = (
0BD906EB1EC0C00300C8C18E /* Debug */,

View File

@ -20,10 +20,10 @@
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
<key>JitsiKitFonts</key>
<key>JitsiMeetFonts</key>
<array>
<string>jitsi.ttf</string>
<string>FontAwesome.ttf</string>
<string>jitsi.ttf</string>
</array>
</dict>
</plist>

View File

@ -19,7 +19,6 @@
#import "JitsiMeetViewDelegate.h"
@interface JitsiMeetView : UIView
@property (nonatomic, weak, nullable) id<JitsiMeetViewDelegate> delegate;

View File

@ -21,8 +21,7 @@
#import <React/RCTRootView.h>
#import "JitsiMeetView.h"
#import "JitsiRCTBridgeWrapper.h"
#import "RCTBridgeWrapper.h"
/**
* A <tt>RCTFatalHandler</tt> implementation which swallows JavaScript errors.
@ -31,8 +30,7 @@
* effectively kill the application. <tt>_RCTFatal</tt> is suitable to be in
* accord with the Web i.e. not kill the application.
*/
RCTFatalHandler _RCTFatal = ^(NSError *error)
{
RCTFatalHandler _RCTFatal = ^(NSError *error) {
id jsStackTrace = error.userInfo[RCTJSStackTraceKey];
@try {
NSString *name
@ -48,20 +46,17 @@ RCTFatalHandler _RCTFatal = ^(NSError *error)
}
};
@interface JitsiMeetView() {
RCTRootView *rootView;
}
@end
@implementation JitsiMeetView
static JitsiRCTBridgeWrapper *jitsiBridge;
static RCTBridgeWrapper *bridgeWrapper;
#pragma mark linking delegate helpers
#pragma mark Linking delegate helpers
// https://facebook.github.io/react-native/docs/linking.html
+ (BOOL)application:(UIApplication *)application
@ -76,8 +71,7 @@ continueUserActivity:(NSUserActivity *)userActivity
+ (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
annotation:(id)annotation {
return [RCTLinkingManager application:application
openURL:url
sourceApplication:sourceApplication
@ -86,9 +80,8 @@ continueUserActivity:(NSUserActivity *)userActivity
#pragma mark initializers
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
- (instancetype)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder];
if (self) {
[self initialize];
}
@ -96,9 +89,8 @@ continueUserActivity:(NSUserActivity *)userActivity
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initialize];
}
@ -112,12 +104,12 @@ continueUserActivity:(NSUserActivity *)userActivity
* Loads the given URL and joins the specified conference. If the specified URL
* is null, the welcome page is shown.
*/
- (void)loadURL:(NSURL *)url
{
- (void)loadURL:(NSURL *)url {
NSDictionary *props = url ? @{ url : url.absoluteString } : nil;
if (rootView == nil) {
rootView
= [[RCTRootView alloc] initWithBridge:jitsiBridge.bridge
= [[RCTRootView alloc] initWithBridge:bridgeWrapper.bridge
moduleName:@"App"
initialProperties:props];
rootView.backgroundColor = self.backgroundColor;
@ -126,7 +118,7 @@ continueUserActivity:(NSUserActivity *)userActivity
[rootView setFrame:[self bounds]];
[self addSubview:rootView];
} else {
// Update props with the new URL
// Update props with the new URL.
rootView.appProperties = props;
}
}
@ -141,8 +133,7 @@ continueUserActivity:(NSUserActivity *)userActivity
* - loads the necessary custom fonts
* - registers a custom fatal error error handler for React
*/
- (void)initialize
{
- (void)initialize {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
@ -153,7 +144,7 @@ continueUserActivity:(NSUserActivity *)userActivity
= [UIColor colorWithRed:.07f green:.07f blue:.07f alpha:1];
// Initialize the React bridge.
jitsiBridge = [[JitsiRCTBridgeWrapper alloc] init];
bridgeWrapper = [[RCTBridgeWrapper alloc] init];
// Dynamically load custom bundled fonts.
[self loadCustomFonts];
@ -167,10 +158,9 @@ continueUserActivity:(NSUserActivity *)userActivity
* Helper function to dynamically load custom fonts. The UIAppFonts key in the
* plist file doesn't work for frameworks, so fonts have to be manually loaded.
*/
- (void)loadCustomFonts
{
- (void)loadCustomFonts {
NSBundle *bundle = [NSBundle bundleForClass:self.class];
NSArray *fonts = [bundle objectForInfoDictionaryKey:@"JitsiKitFonts"];
NSArray *fonts = [bundle objectForInfoDictionaryKey:@"JitsiMeetFonts"];
for (NSString *item in fonts) {
NSString *fontName = [item stringByDeletingPathExtension];
@ -181,8 +171,10 @@ continueUserActivity:(NSUserActivity *)userActivity
CGDataProviderRef provider
= CGDataProviderCreateWithCFData((__bridge CFDataRef)inData);
CGFontRef font = CGFontCreateWithDataProvider(provider);
if (!CTFontManagerRegisterGraphicsFont(font, &error)) {
CFStringRef errorDescription = CFErrorCopyDescription(error);
NSLog(@"Failed to load font: %@", errorDescription);
CFRelease(errorDescription);
}
@ -196,8 +188,7 @@ continueUserActivity:(NSUserActivity *)userActivity
* won't kill the process, it will swallow JS errors and print stack traces
* instead.
*/
- (void)registerFatalErrorHandler
{
- (void)registerFatalErrorHandler {
#if !DEBUG
// In the Release configuration, React Native will (intentionally) raise
// an unhandled NSException for an unhandled JavaScript error. This will

View File

@ -30,7 +30,7 @@
* singleton, however, so it's possible for us to create multiple instances of
* it, though that's not currently used.
*/
@interface JitsiRCTBridgeWrapper : NSObject<RCTBridgeDelegate>
@interface RCTBridgeWrapper : NSObject<RCTBridgeDelegate>
@property (nonatomic, readonly, strong) RCTBridge *bridge;

View File

@ -14,18 +14,16 @@
* limitations under the License.
*/
#include "JitsiRCTBridgeWrapper.h"
#include "RCTBridgeWrapper.h"
/*
* Wrapper around RCTBridge which also implements the RCTBridgeDelegate methods,
* allowing us to specify where the bundles are loaded from.
*/
@implementation JitsiRCTBridgeWrapper
@implementation RCTBridgeWrapper
- (instancetype)init
{
- (instancetype)init {
self = [super init];
if (self) {
_bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];
}
@ -36,16 +34,15 @@
#pragma mark helper methods for getting the packager URL
#if DEBUG
static NSURL *serverRootWithHost(NSString *host)
{
return [NSURL URLWithString:
static NSURL *serverRootWithHost(NSString *host) {
return
[NSURL URLWithString:
[NSString stringWithFormat:@"http://%@:8081/", host]];
}
- (BOOL)isPackagerRunning:(NSString *)host
{
NSURL *url = [serverRootWithHost(host)
URLByAppendingPathComponent:@"status"];
- (BOOL)isPackagerRunning:(NSString *)host {
NSURL *url
= [serverRootWithHost(host) URLByAppendingPathComponent:@"status"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSURLResponse *response;
NSData *data = [NSURLConnection sendSynchronousRequest:request
@ -53,17 +50,21 @@ static NSURL *serverRootWithHost(NSString *host)
error:NULL];
NSString *status = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
return [status isEqualToString:@"packager-status:running"];
}
- (NSString *)guessPackagerHost
{
- (NSString *)guessPackagerHost {
static NSString *ipGuess;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
NSString *ipPath = [[NSBundle bundleForClass:self.class]
pathForResource:@"ip" ofType:@"txt"];
ipGuess = [[NSString stringWithContentsOfFile:ipPath
NSString *ipPath
= [[NSBundle bundleForClass:self.class] pathForResource:@"ip"
ofType:@"txt"];
ipGuess
= [[NSString stringWithContentsOfFile:ipPath
encoding:NSUTF8StringEncoding
error:nil]
stringByTrimmingCharactersInSet:
@ -71,6 +72,7 @@ static NSURL *serverRootWithHost(NSString *host)
});
NSString *host = ipGuess ?: @"localhost";
if ([self isPackagerRunning:host]) {
return host;
}
@ -81,25 +83,24 @@ static NSURL *serverRootWithHost(NSString *host)
#pragma mark RCTBridgeDelegate methods
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge {
#if DEBUG
/*
* In debug mode, try to fetch the bundle from the packager, or fallback to
* the one inside the framework. The IP address for the packager host is
* fetched from the ip.txt file inside the framework.
*
* This duplicates some functionality present in RCTBundleURLProvider, but
* that mode is not designed to work inside a framework, because all
* resources are loaded from the main bundle.
*/
// In debug mode, try to fetch the bundle from the packager, or fallback to
// the one inside the framework. The IP address for the packager host is
// fetched from the ip.txt file inside the framework.
//
// This duplicates some functionality present in RCTBundleURLProvider, but
// that mode is not designed to work inside a framework, because all
// resources are loaded from the main bundle.
NSString *host = [self guessPackagerHost];
if (host != nil) {
NSString *path = @"/index.ios.bundle";
NSString *query = @"platform=ios&dev=true&minify=false";
NSURLComponents *components
= [NSURLComponents componentsWithURL:serverRootWithHost(host)
resolvingAgainstBaseURL:NO];
components.path = path;
components.query = query;
@ -107,11 +108,6 @@ static NSURL *serverRootWithHost(NSString *host)
}
#endif
return [self fallbackSourceURLForBridge:bridge];
}
- (NSURL *)fallbackSourceURLForBridge:(RCTBridge *)bridge
{
return [[NSBundle bundleForClass:self.class] URLForResource:@"main"
withExtension:@"jsbundle"];
}