From f26c5570df4109774cff9539e84fcadb0fd1e51d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 9 Apr 2019 12:51:28 +0200 Subject: [PATCH] ios: update sample PiP app - Xcode 10.2 + Swift 5 - Latest SDK API - Fix warnings --- .../example-pip-app.xcodeproj/project.pbxproj | 12 +++++-- ios/example-pip-app/src/AppDelegate.swift | 12 +++---- ios/example-pip-app/src/Info.plist | 4 +++ ios/example-pip-app/src/ViewController.swift | 31 +++++++------------ 4 files changed, 31 insertions(+), 28 deletions(-) diff --git a/ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj b/ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj index 49e95137c..2b4b9ddda 100644 --- a/ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj +++ b/ios/example-pip-app/example-pip-app.xcodeproj/project.pbxproj @@ -128,7 +128,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 0920; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Atlassian Inc"; TargetAttributes = { C6F99C36204DE6BE0001F710 = { @@ -264,6 +264,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -271,6 +272,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -321,6 +323,7 @@ CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; @@ -328,6 +331,7 @@ CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; @@ -360,6 +364,7 @@ C6F99C4A204DE6BE0001F710 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; FRAMEWORK_SEARCH_PATHS = "../../node_modules/react-native-webrtc/ios"; @@ -368,7 +373,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jitsi.example-pip-app"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -376,6 +381,7 @@ C6F99C4B204DE6BE0001F710 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; FRAMEWORK_SEARCH_PATHS = "../../node_modules/react-native-webrtc/ios"; @@ -384,7 +390,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.jitsi.example-pip-app"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/ios/example-pip-app/src/AppDelegate.swift b/ios/example-pip-app/src/AppDelegate.swift index c1203393b..cb18da33f 100644 --- a/ios/example-pip-app/src/AppDelegate.swift +++ b/ios/example-pip-app/src/AppDelegate.swift @@ -22,20 +22,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { guard let launchOptions = launchOptions else { return false } - return JitsiMeetView.application(application, didFinishLaunchingWithOptions: launchOptions) + return JitsiMeet.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) } // MARK: - Linking delegate methods func application(_ application: UIApplication, continue userActivity: NSUserActivity, - restorationHandler: @escaping ([Any]?) -> Void) -> Bool { - return JitsiMeetView.application(application, continue: userActivity, restorationHandler: restorationHandler) + restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { + return JitsiMeet.sharedInstance().application(application, continue: userActivity, restorationHandler: restorationHandler) } - func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { - return JitsiMeetView.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation) + func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { + return JitsiMeet.sharedInstance().application(app, open: url, options: options) } } diff --git a/ios/example-pip-app/src/Info.plist b/ios/example-pip-app/src/Info.plist index ff67a0ed6..5524b34f3 100644 --- a/ios/example-pip-app/src/Info.plist +++ b/ios/example-pip-app/src/Info.plist @@ -2,6 +2,10 @@ + NSMicrophoneUsageDescription + The microphone is needed for making calls + NSCameraUsageDescription + The camera is needed for making calls CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable diff --git a/ios/example-pip-app/src/ViewController.swift b/ios/example-pip-app/src/ViewController.swift index fdef0e303..9bd2c13b9 100644 --- a/ios/example-pip-app/src/ViewController.swift +++ b/ios/example-pip-app/src/ViewController.swift @@ -1,5 +1,6 @@ /* - * Copyright @ 2017-present Atlassian Pty Ltd + * Copyright @ 2019-present 8x8, Inc. + * Copyright @ 2017-2018 Atlassian Pty Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,11 +44,12 @@ class ViewController: UIViewController { // create and configure jitsimeet view let jitsiMeetView = JitsiMeetView() - jitsiMeetView.welcomePageEnabled = true - jitsiMeetView.pictureInPictureEnabled = true - jitsiMeetView.load(nil) jitsiMeetView.delegate = self self.jitsiMeetView = jitsiMeetView + let options = JitsiMeetConferenceOptions.fromBuilder { (builder) in + builder.welcomePageEnabled = true + } + jitsiMeetView.join(options) // Enable jitsimeet view to be a view that can be displayed // on top of all the things, and let the coordinator to manage @@ -68,13 +70,12 @@ class ViewController: UIViewController { } extension ViewController: JitsiMeetViewDelegate { - - func conferenceFailed(_ data: [AnyHashable : Any]!) { - hideJitsiMeetViewAndCleanUp() - } - - func conferenceLeft(_ data: [AnyHashable : Any]!) { - hideJitsiMeetViewAndCleanUp() + func conferenceTerminated(_ data: [AnyHashable : Any]!) { + DispatchQueue.main.async { + self.pipViewCoordinator?.hide() { _ in + self.cleanUp() + } + } } func enterPicture(inPicture data: [AnyHashable : Any]!) { @@ -82,12 +83,4 @@ extension ViewController: JitsiMeetViewDelegate { self.pipViewCoordinator?.enterPictureInPicture() } } - - private func hideJitsiMeetViewAndCleanUp() { - DispatchQueue.main.async { - self.pipViewCoordinator?.hide() { _ in - self.cleanUp() - } - } - } }