Rewrite AppDelegate to be a SWIFT

This commit is contained in:
Tiago Jacobs 2022-03-03 22:14:05 -03:00
parent 8e31664914
commit 581ce57e94
10 changed files with 102 additions and 116 deletions

41
ios/AppDelegate.swift Normal file
View File

@ -0,0 +1,41 @@
import UIKit
import bigbluebutton_mobile_sdk
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, RCTBridgeDelegate {
var window: UIWindow?
var bridge: RCTBridge!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
bridge = RCTBridge(delegate: self, launchOptions: launchOptions)
let rootView = RCTRootView(bridge: bridge!, moduleName: Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String, initialProperties: nil)
if #available(iOS 13.0, *) {
rootView.backgroundColor = .systemBackground
} else {
rootView.backgroundColor = .white
}
let rootViewController = UIViewController()
rootViewController.view = rootView
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = rootViewController
self.window?.makeKeyAndVisible()
BigBlueButtonSDK.start()
return true
}
func sourceURL(for bridge: RCTBridge!) -> URL! {
//#if DEBUG
return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackResource:nil)
//#else
// let mainBundle = Bundle.main
// return mainBundle.url(forResource: "main", withExtension: "jsbundle")!
//#endif
}
}

View File

@ -8,13 +8,12 @@
/* Begin PBXBuildFile section */
00E356F31AD99517003FC87E /* BigBlueButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* BigBlueButtonTests.m */; };
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
6172F2D35A4C3AA820D92908 /* libPods-BigBlueButton.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6423831EA8574132BED9D8CC /* libPods-BigBlueButton.a */; };
7EF68E3733C33B6898317E18 /* libPods-BigBlueButton-BigBlueButtonTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ABFE59519B596E51CEFDCCC0 /* libPods-BigBlueButton-BigBlueButtonTests.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
D9268FF3D2DA9D8304F931DB /* libPods-BigBlueButton Broadcast.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 38E575479D3F0ED342457EBF /* libPods-BigBlueButton Broadcast.a */; };
F121360B27D1904500E25EBB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F121360A27D1904500E25EBB /* AppDelegate.swift */; };
F1F618E927BCA28B0085BEDE /* ReplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F1F618E827BCA28B0085BEDE /* ReplayKit.framework */; };
F1F618EC27BCA28B0085BEDE /* SampleHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1F618EB27BCA28B0085BEDE /* SampleHandler.swift */; };
F1F618F027BCA28B0085BEDE /* BigBlueButton Broadcast.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = F1F618E727BCA28B0085BEDE /* BigBlueButton Broadcast.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
@ -56,11 +55,8 @@
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* BigBlueButtonTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BigBlueButtonTests.m; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* BigBlueButton.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BigBlueButton.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = BigBlueButton/AppDelegate.h; sourceTree = "<group>"; };
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = BigBlueButton/AppDelegate.m; sourceTree = "<group>"; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = BigBlueButton/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = BigBlueButton/Info.plist; sourceTree = "<group>"; };
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = BigBlueButton/main.m; sourceTree = "<group>"; };
1D0AE47A65C8663E3B452821 /* Pods-BigBlueButton-BigBlueButtonTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BigBlueButton-BigBlueButtonTests.release.xcconfig"; path = "Target Support Files/Pods-BigBlueButton-BigBlueButtonTests/Pods-BigBlueButton-BigBlueButtonTests.release.xcconfig"; sourceTree = "<group>"; };
38E575479D3F0ED342457EBF /* libPods-BigBlueButton Broadcast.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-BigBlueButton Broadcast.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6423831EA8574132BED9D8CC /* libPods-BigBlueButton.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-BigBlueButton.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -72,6 +68,8 @@
D00AAFFCFCFDA5787532823F /* Pods-BigBlueButton.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BigBlueButton.release.xcconfig"; path = "Target Support Files/Pods-BigBlueButton/Pods-BigBlueButton.release.xcconfig"; sourceTree = "<group>"; };
D029435F40D9827BF73DEFDA /* Pods-BigBlueButton Broadcast.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BigBlueButton Broadcast.debug.xcconfig"; path = "Target Support Files/Pods-BigBlueButton Broadcast/Pods-BigBlueButton Broadcast.debug.xcconfig"; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
F121360927D1904500E25EBB /* swift-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "swift-Bridging-Header.h"; sourceTree = "<group>"; };
F121360A27D1904500E25EBB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
F1F618E727BCA28B0085BEDE /* BigBlueButton Broadcast.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "BigBlueButton Broadcast.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
F1F618E827BCA28B0085BEDE /* ReplayKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReplayKit.framework; path = System/Library/Frameworks/ReplayKit.framework; sourceTree = SDKROOT; };
F1F618EB27BCA28B0085BEDE /* SampleHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleHandler.swift; sourceTree = "<group>"; };
@ -134,12 +132,11 @@
13B07FAE1A68108700A75B9A /* BigBlueButton */ = {
isa = PBXGroup;
children = (
13B07FAF1A68108700A75B9A /* AppDelegate.h */,
13B07FB01A68108700A75B9A /* AppDelegate.m */,
13B07FB51A68108700A75B9A /* Images.xcassets */,
13B07FB61A68108700A75B9A /* Info.plist */,
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
13B07FB71A68108700A75B9A /* main.m */,
F121360A27D1904500E25EBB /* AppDelegate.swift */,
F121360927D1904500E25EBB /* swift-Bridging-Header.h */,
);
name = BigBlueButton;
sourceTree = "<group>";
@ -292,7 +289,7 @@
TestTargetID = 13B07F861A680F5B00A75B9A;
};
13B07F861A680F5B00A75B9A = {
LastSwiftMigration = 1120;
LastSwiftMigration = 1320;
};
F1F618E627BCA28B0085BEDE = {
CreatedOnToolsVersion = 13.2.1;
@ -528,8 +525,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
F121360B27D1904500E25EBB /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -561,6 +557,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 6C97AB639B58BBB4B15BBE30 /* Pods-BigBlueButton-BigBlueButtonTests.debug.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
@ -588,6 +585,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 1D0AE47A65C8663E3B452821 /* Pods-BigBlueButton-BigBlueButtonTests.release.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
COPY_PHASE_STRIP = NO;
INFOPLIST_FILE = BigBlueButtonTests/Info.plist;
@ -618,6 +616,7 @@
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = BigBlueButton/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -629,6 +628,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = org.bigbluebutton.mobile;
PRODUCT_NAME = BigBlueButton;
SWIFT_OBJC_BRIDGING_HEADER = "swift-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
@ -644,6 +644,7 @@
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
INFOPLIST_FILE = BigBlueButton/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -655,6 +656,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = org.bigbluebutton.mobile;
PRODUCT_NAME = BigBlueButton;
SWIFT_OBJC_BRIDGING_HEADER = "swift-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
@ -801,7 +803,7 @@
INFOPLIST_FILE = "BigBlueButton Broadcast/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "BigBlueButton Broadcast";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@ -840,7 +842,7 @@
INFOPLIST_FILE = "BigBlueButton Broadcast/Info.plist";
INFOPLIST_KEY_CFBundleDisplayName = "BigBlueButton Broadcast";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",

View File

@ -1,8 +0,0 @@
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate>
@property (nonatomic, strong) UIWindow *window;
@end

View File

@ -1,62 +0,0 @@
#import "AppDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#ifdef FB_SONARKIT_ENABLED
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifdef FB_SONARKIT_ENABLED
InitializeFlipper(application);
#endif
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"BigBlueButton"
initialProperties:nil];
if (@available(iOS 13.0, *)) {
rootView.backgroundColor = [UIColor systemBackgroundColor];
} else {
rootView.backgroundColor = [UIColor whiteColor];
}
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
UIViewController *rootViewController = [UIViewController new];
rootViewController.view = rootView;
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
return YES;
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}
@end

View File

@ -2,37 +2,52 @@
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}

View File

@ -1,9 +0,0 @@
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@ -1,8 +1,8 @@
PODS:
- bigbluebutton-mobile-sdk (0.1.6):
- bigbluebutton-mobile-sdk (0.1.7):
- React-Core
- WebRTC-lib
- bigbluebutton-mobile-sdk-common (0.1.6):
- bigbluebutton-mobile-sdk-common (0.1.7):
- WebRTC-lib
- boost (1.76.0)
- DoubleConversion (1.1.6)
@ -471,8 +471,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"
SPEC CHECKSUMS:
bigbluebutton-mobile-sdk: 19663f45d1ad1aa508dcd602c98454d4a268d6bc
bigbluebutton-mobile-sdk-common: a19235b74cfb9ba83f83e23afbae7c8c400c2a5c
bigbluebutton-mobile-sdk: 21fd7113a5bf0d791376af62fb480af997cea8ec
bigbluebutton-mobile-sdk-common: 77be58379eee95b767c160b9d09ffb7ce39983d0
boost: a7c83b31436843459a1961bfd74b96033dc77234
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
FBLazyVector: 244195e30d63d7f564c55da4410b9a24e8fbceaa

View File

@ -0,0 +1,7 @@
#import <React/RCTBridgeModule.h>
#import <React/RCTBridge.h>
#import <React/RCTEventDispatcher.h>
#import <React/RCTRootView.h>
#import <React/RCTUtils.h>
#import <React/RCTConvert.h>
#import <React/RCTBundleURLProvider.h>

View File

@ -16,7 +16,7 @@
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.5.0",
"@types/styled-components-react-native": "^5.1.3",
"bigbluebutton-mobile-sdk": "^0.1.6",
"bigbluebutton-mobile-sdk": "^0.1.7",
"i18next": "^21.6.12",
"i18next-browser-languagedetector": "^6.1.3",
"react": "17.0.2",

View File

@ -2165,10 +2165,10 @@ big-integer@1.6.x:
resolved "https://registry.yarnpkg.com/big-integer/-/big-integer-1.6.51.tgz#0df92a5d9880560d3ff2d5fd20245c889d130686"
integrity sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==
bigbluebutton-mobile-sdk@^0.1.6:
version "0.1.6"
resolved "https://registry.yarnpkg.com/bigbluebutton-mobile-sdk/-/bigbluebutton-mobile-sdk-0.1.6.tgz#8a8c096b607b019d5273fcd99a9d2709f7918fb9"
integrity sha512-hgbvd3hQVEmT3pQAB0BPSLeNlfLnSvFAZ0bsRmfY0STlj/g3g9x/tfOQ/bUM+fh/R5as7qKq81ILfSJfU8edCQ==
bigbluebutton-mobile-sdk@^0.1.7:
version "0.1.7"
resolved "https://registry.yarnpkg.com/bigbluebutton-mobile-sdk/-/bigbluebutton-mobile-sdk-0.1.7.tgz#a2bd573e632635a8f9933344be4ffda8ea990a83"
integrity sha512-rCrQ13goukMSxUyoqpsQTVLaAr3kK/oZsHHk0cdrthrVIi16XPSzSk3xe/lR5W9iI5cLwZPrel45v2gWI0VwYA==
dependencies:
react-native-webview "^11.17.2"