From d77d2f0c5b8a00fc01af64fdb3aad95286bc0598 Mon Sep 17 00:00:00 2001 From: Alex Bumbu Date: Mon, 17 Oct 2022 13:33:44 +0300 Subject: [PATCH] fix(iOS, layout): fix iOS 16 layout This (partially) reverts commit ddab27e292bacbd131d55bc7bf01a7e0ac8ba893. We're reverting this to fix the iOS 16 layout problems caused by the interaction between the app rootViewControoler and JitsiMeetViewController, with the downside that using any RN components based on native view controllers will most likely be faulty. The solution for this would be to change the SDK's entry point to a view controller, instead of JitsiMeetView. --- ios/sdk/sdk.xcodeproj/project.pbxproj | 52 +++------ ios/sdk/src/JitsiMeetRenderingView.h | 30 ----- ios/sdk/src/JitsiMeetRenderingView.m | 83 ------------- ios/sdk/src/JitsiMeetView.m | 162 ++++++++++++++++++-------- ios/sdk/src/JitsiMeetViewController.h | 38 ------ ios/sdk/src/JitsiMeetViewController.m | 127 -------------------- 6 files changed, 126 insertions(+), 366 deletions(-) delete mode 100644 ios/sdk/src/JitsiMeetRenderingView.h delete mode 100644 ios/sdk/src/JitsiMeetRenderingView.m delete mode 100644 ios/sdk/src/JitsiMeetViewController.h delete mode 100644 ios/sdk/src/JitsiMeetViewController.m diff --git a/ios/sdk/sdk.xcodeproj/project.pbxproj b/ios/sdk/sdk.xcodeproj/project.pbxproj index 29c195d4c0..aa615de1c8 100644 --- a/ios/sdk/sdk.xcodeproj/project.pbxproj +++ b/ios/sdk/sdk.xcodeproj/project.pbxproj @@ -35,15 +35,13 @@ 4E0EF63C28CA4069005D1B03 /* JMCallKitProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E0EF63828CA4069005D1B03 /* JMCallKitProxy.m */; }; 4E51B76425E5345E0038575A /* ScheenshareEventEmiter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */; }; 4E51B76525E5345E0038575A /* ScheenshareEventEmiter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */; }; - 4EBA6E61286072E300B31882 /* JitsiMeetViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EBA6E5F286072E300B31882 /* JitsiMeetViewController.h */; }; - 4EBA6E62286072E300B31882 /* JitsiMeetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EBA6E60286072E300B31882 /* JitsiMeetViewController.m */; }; - 4EBA6E652860B1E800B31882 /* JitsiMeetRenderingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EBA6E632860B1E800B31882 /* JitsiMeetRenderingView.h */; }; - 4EBA6E662860B1E800B31882 /* JitsiMeetRenderingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EBA6E642860B1E800B31882 /* JitsiMeetRenderingView.m */; }; + 4E812F3328F9A4290087ACC9 /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E812F3228F9A4290087ACC9 /* JitsiMeetView+Private.h */; }; + 4E812F3428F9A4290087ACC9 /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E812F3228F9A4290087ACC9 /* JitsiMeetView+Private.h */; }; + 4E812F3928F9A4ED0087ACC9 /* JitsiMeetView+Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E812F3628F9A4ED0087ACC9 /* JitsiMeetView+Private.m */; }; + 4E812F3A28F9A4ED0087ACC9 /* JitsiMeetView+Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E812F3628F9A4ED0087ACC9 /* JitsiMeetView+Private.m */; }; 4ED4FFF32721B9B90074E620 /* JitsiAudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ED4FFF12721B9B90074E620 /* JitsiAudioSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4ED4FFF42721B9B90074E620 /* JitsiAudioSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ED4FFF22721B9B90074E620 /* JitsiAudioSession.m */; }; - 4EEC9630286C73A2008705FA /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EEC962E286C73A2008705FA /* JitsiMeetView+Private.h */; }; - 4EEC9631286C73A2008705FA /* JitsiMeetView+Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EEC962F286C73A2008705FA /* JitsiMeetView+Private.m */; }; - 6F08DF7D4458EE3CF3F36F6D /* BuildFile in Frameworks */ = {isa = PBXBuildFile; }; + 6F08DF7D4458EE3CF3F36F6D /* (null) in Frameworks */ = {isa = PBXBuildFile; }; 9A8EE79C77C17743BB66E8BD /* libPods-JitsiMeetSDKLite.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B46497DE9A95BDF5E312AF48 /* libPods-JitsiMeetSDKLite.a */; }; A4A934E9212F3ADB001E9388 /* Dropbox.m in Sources */ = {isa = PBXBuildFile; fileRef = A4A934E8212F3ADB001E9388 /* Dropbox.m */; }; C6245F5D2053091D0040BE68 /* image-resize@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C6245F5B2053091D0040BE68 /* image-resize@2x.png */; }; @@ -70,20 +68,16 @@ DE9A0134289A9A9A00E41CBB /* JitsiMeetSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = DEA9F283258A5D9900D4CD74 /* JitsiMeetSDK.h */; settings = {ATTRIBUTES = (Public, ); }; }; DE9A0135289A9A9A00E41CBB /* ScheenshareEventEmiter.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */; }; DE9A0136289A9A9A00E41CBB /* JitsiMeetBaseLogHandler+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = DE65AACB2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h */; }; - DE9A0137289A9A9A00E41CBB /* JitsiMeetRenderingView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EBA6E632860B1E800B31882 /* JitsiMeetRenderingView.h */; }; DE9A0138289A9A9A00E41CBB /* JitsiMeetViewDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 0B412F1B1EDEC80100B1A0A6 /* JitsiMeetViewDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; }; DE9A0139289A9A9A00E41CBB /* JitsiAudioSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 4ED4FFF12721B9B90074E620 /* JitsiAudioSession.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DE9A013A289A9A9A00E41CBB /* JitsiMeetView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EEC962E286C73A2008705FA /* JitsiMeetView+Private.h */; }; DE9A013B289A9A9A00E41CBB /* JitsiMeet.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BD906E81EC0C00300C8C18E /* JitsiMeet.h */; settings = {ATTRIBUTES = (Public, ); }; }; DE9A013C289A9A9A00E41CBB /* JitsiMeetLogger.h in Headers */ = {isa = PBXBuildFile; fileRef = DE81A2D22316AC4D00AE1940 /* JitsiMeetLogger.h */; settings = {ATTRIBUTES = (Public, ); }; }; DE9A013D289A9A9A00E41CBB /* LogUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = DE65AAC92317FFCD00290BEC /* LogUtils.h */; }; - DE9A013E289A9A9A00E41CBB /* JitsiMeetViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EBA6E5F286072E300B31882 /* JitsiMeetViewController.h */; }; DE9A013F289A9A9A00E41CBB /* JitsiMeetConferenceOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEAD3224220C497000E93636 /* JitsiMeetConferenceOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; DE9A0140289A9A9A00E41CBB /* ExternalAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = C81E9AB825AC5AD800B134D9 /* ExternalAPI.h */; }; DE9A0141289A9A9A00E41CBB /* InfoPlistUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = C8AFD27D2462C613000293D2 /* InfoPlistUtil.h */; settings = {ATTRIBUTES = (Public, ); }; }; DE9A0143289A9A9A00E41CBB /* CallKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BB9AD7A1F5EC8F4001C08DB /* CallKit.m */; }; DE9A0144289A9A9A00E41CBB /* JitsiMeetBaseLogHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = DE81A2DD2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m */; }; - DE9A0145289A9A9A00E41CBB /* JitsiMeetRenderingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EBA6E642860B1E800B31882 /* JitsiMeetRenderingView.m */; }; DE9A0146289A9A9A00E41CBB /* JitsiAudioSession.m in Sources */ = {isa = PBXBuildFile; fileRef = 4ED4FFF22721B9B90074E620 /* JitsiAudioSession.m */; }; DE9A0147289A9A9A00E41CBB /* AppInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BB9AD7C1F60356D001C08DB /* AppInfo.m */; }; DE9A0148289A9A9A00E41CBB /* LogBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = DE81A2D72316AC7600AE1940 /* LogBridge.m */; }; @@ -99,10 +93,8 @@ DE9A0152289A9A9A00E41CBB /* AudioMode.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BCA495C1EC4B6C600B793EE /* AudioMode.m */; }; DE9A0153289A9A9A00E41CBB /* Proximity.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BCA495E1EC4B6C600B793EE /* Proximity.m */; }; DE9A0155289A9A9A00E41CBB /* ReactUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = DEFE535521FB2E8300011A3A /* ReactUtils.m */; }; - DE9A0156289A9A9A00E41CBB /* JitsiMeetView+Private.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EEC962F286C73A2008705FA /* JitsiMeetView+Private.m */; }; DE9A0157289A9A9A00E41CBB /* DragGestureController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6A3425E204EF76800E062DD /* DragGestureController.swift */; }; DE9A0158289A9A9A00E41CBB /* ScheenshareEventEmiter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */; }; - DE9A015A289A9A9A00E41CBB /* JitsiMeetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4EBA6E60286072E300B31882 /* JitsiMeetViewController.m */; }; DE9A015C289A9A9A00E41CBB /* JitsiMeetLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = DE81A2D32316AC4D00AE1940 /* JitsiMeetLogger.m */; }; DE9A015E289A9A9A00E41CBB /* JitsiMeetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */; }; DE9A015F289A9A9A00E41CBB /* JitsiMeet.m in Sources */ = {isa = PBXBuildFile; fileRef = DEFE535321FB1BF800011A3A /* JitsiMeet.m */; }; @@ -148,15 +140,11 @@ 4E0EF63828CA4069005D1B03 /* JMCallKitProxy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JMCallKitProxy.m; sourceTree = ""; }; 4E51B76225E5345E0038575A /* ScheenshareEventEmiter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScheenshareEventEmiter.h; sourceTree = ""; }; 4E51B76325E5345E0038575A /* ScheenshareEventEmiter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ScheenshareEventEmiter.m; sourceTree = ""; }; - 4EBA6E5F286072E300B31882 /* JitsiMeetViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetViewController.h; sourceTree = ""; }; - 4EBA6E60286072E300B31882 /* JitsiMeetViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetViewController.m; sourceTree = ""; }; - 4EBA6E632860B1E800B31882 /* JitsiMeetRenderingView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiMeetRenderingView.h; sourceTree = ""; }; - 4EBA6E642860B1E800B31882 /* JitsiMeetRenderingView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiMeetRenderingView.m; sourceTree = ""; }; + 4E812F3228F9A4290087ACC9 /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = ""; }; + 4E812F3628F9A4ED0087ACC9 /* JitsiMeetView+Private.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "JitsiMeetView+Private.m"; sourceTree = ""; }; 4ED4FFF12721B9B90074E620 /* JitsiAudioSession.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JitsiAudioSession.h; sourceTree = ""; }; 4ED4FFF22721B9B90074E620 /* JitsiAudioSession.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = JitsiAudioSession.m; sourceTree = ""; }; 4ED4FFF52721BAE10074E620 /* JitsiAudioSession+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiAudioSession+Private.h"; sourceTree = ""; }; - 4EEC962E286C73A2008705FA /* JitsiMeetView+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JitsiMeetView+Private.h"; sourceTree = ""; }; - 4EEC962F286C73A2008705FA /* JitsiMeetView+Private.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "JitsiMeetView+Private.m"; sourceTree = ""; }; 86389F55993FAAF6AEB3FA3E /* Pods-JitsiMeetSDKLite.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeetSDKLite.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeetSDKLite/Pods-JitsiMeetSDKLite.release.xcconfig"; sourceTree = ""; }; 891FE43DAD30BC8976683100 /* Pods-JitsiMeetSDK.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeetSDK.release.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeetSDK/Pods-JitsiMeetSDK.release.xcconfig"; sourceTree = ""; }; 8F48C340DE0D91D1012976C5 /* Pods-JitsiMeetSDKLite.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JitsiMeetSDKLite.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-JitsiMeetSDKLite/Pods-JitsiMeetSDKLite.debug.xcconfig"; sourceTree = ""; }; @@ -206,7 +194,7 @@ files = ( 0BB9AD791F5EC6D7001C08DB /* Intents.framework in Frameworks */, 0BB9AD771F5EC6CE001C08DB /* CallKit.framework in Frameworks */, - 6F08DF7D4458EE3CF3F36F6D /* BuildFile in Frameworks */, + 6F08DF7D4458EE3CF3F36F6D /* (null) in Frameworks */, 3453F4A32680898C4A40E821 /* libPods-JitsiMeetSDK.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -281,14 +269,10 @@ DE81A2DC2317ED5400AE1940 /* JitsiMeetBaseLogHandler.h */, DE65AACB2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h */, DE81A2DD2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m */, + 4E812F3228F9A4290087ACC9 /* JitsiMeetView+Private.h */, + 4E812F3628F9A4ED0087ACC9 /* JitsiMeetView+Private.m */, 0B412F161EDEC65D00B1A0A6 /* JitsiMeetView.h */, - 4EEC962E286C73A2008705FA /* JitsiMeetView+Private.h */, - 4EEC962F286C73A2008705FA /* JitsiMeetView+Private.m */, 0B412F171EDEC65D00B1A0A6 /* JitsiMeetView.m */, - 4EBA6E632860B1E800B31882 /* JitsiMeetRenderingView.h */, - 4EBA6E642860B1E800B31882 /* JitsiMeetRenderingView.m */, - 4EBA6E5F286072E300B31882 /* JitsiMeetViewController.h */, - 4EBA6E60286072E300B31882 /* JitsiMeetViewController.m */, DE81A2D72316AC7600AE1940 /* LogBridge.m */, DE65AAC92317FFCD00290BEC /* LogUtils.h */, DEAFA777229EAD3B0033A7FA /* RNRootView.h */, @@ -383,20 +367,18 @@ DEA9F284258A5D9900D4CD74 /* JitsiMeetSDK.h in Headers */, 4E51B76425E5345E0038575A /* ScheenshareEventEmiter.h in Headers */, DE65AACC2318028300290BEC /* JitsiMeetBaseLogHandler+Private.h in Headers */, - 4EBA6E652860B1E800B31882 /* JitsiMeetRenderingView.h in Headers */, 0B412F221EDEF6EA00B1A0A6 /* JitsiMeetViewDelegate.h in Headers */, 4E0EF63528CA317E005D1B03 /* JMCallKitListener.h in Headers */, 4E0EF63028CA2FB3005D1B03 /* JMCallKitEmitter.h in Headers */, 4ED4FFF32721B9B90074E620 /* JitsiAudioSession.h in Headers */, 4E0EF63928CA4069005D1B03 /* JMCallKitProxy.h in Headers */, - 4EEC9630286C73A2008705FA /* JitsiMeetView+Private.h in Headers */, 0BD906EA1EC0C00300C8C18E /* JitsiMeet.h in Headers */, DE81A2D42316AC4D00AE1940 /* JitsiMeetLogger.h in Headers */, DE65AACA2317FFCD00290BEC /* LogUtils.h in Headers */, - 4EBA6E61286072E300B31882 /* JitsiMeetViewController.h in Headers */, DEAD3226220C497000E93636 /* JitsiMeetConferenceOptions.h in Headers */, C81E9AB925AC5AD800B134D9 /* ExternalAPI.h in Headers */, C8AFD27F2462C613000293D2 /* InfoPlistUtil.h in Headers */, + 4E812F3328F9A4290087ACC9 /* JitsiMeetView+Private.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -411,20 +393,18 @@ DE9A0134289A9A9A00E41CBB /* JitsiMeetSDK.h in Headers */, DE9A0135289A9A9A00E41CBB /* ScheenshareEventEmiter.h in Headers */, DE9A0136289A9A9A00E41CBB /* JitsiMeetBaseLogHandler+Private.h in Headers */, - DE9A0137289A9A9A00E41CBB /* JitsiMeetRenderingView.h in Headers */, DE9A0138289A9A9A00E41CBB /* JitsiMeetViewDelegate.h in Headers */, 4E0EF63628CA317E005D1B03 /* JMCallKitListener.h in Headers */, 4E0EF63128CA2FB3005D1B03 /* JMCallKitEmitter.h in Headers */, DE9A0139289A9A9A00E41CBB /* JitsiAudioSession.h in Headers */, 4E0EF63A28CA4069005D1B03 /* JMCallKitProxy.h in Headers */, - DE9A013A289A9A9A00E41CBB /* JitsiMeetView+Private.h in Headers */, DE9A013B289A9A9A00E41CBB /* JitsiMeet.h in Headers */, DE9A013C289A9A9A00E41CBB /* JitsiMeetLogger.h in Headers */, DE9A013D289A9A9A00E41CBB /* LogUtils.h in Headers */, - DE9A013E289A9A9A00E41CBB /* JitsiMeetViewController.h in Headers */, DE9A013F289A9A9A00E41CBB /* JitsiMeetConferenceOptions.h in Headers */, DE9A0140289A9A9A00E41CBB /* ExternalAPI.h in Headers */, DE9A0141289A9A9A00E41CBB /* InfoPlistUtil.h in Headers */, + 4E812F3428F9A4290087ACC9 /* JitsiMeetView+Private.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -686,8 +666,8 @@ 0BB9AD7B1F5EC8F4001C08DB /* CallKit.m in Sources */, DE81A2DF2317ED5400AE1940 /* JitsiMeetBaseLogHandler.m in Sources */, 4E0EF63B28CA4069005D1B03 /* JMCallKitProxy.m in Sources */, - 4EBA6E662860B1E800B31882 /* JitsiMeetRenderingView.m in Sources */, 4ED4FFF42721B9B90074E620 /* JitsiAudioSession.m in Sources */, + 4E812F3928F9A4ED0087ACC9 /* JitsiMeetView+Private.m in Sources */, 0BB9AD7D1F60356D001C08DB /* AppInfo.m in Sources */, DE81A2D92316AC7600AE1940 /* LogBridge.m in Sources */, DEAFA779229EAD520033A7FA /* RNRootView.m in Sources */, @@ -703,11 +683,9 @@ 0BCA49611EC4B6C600B793EE /* Proximity.m in Sources */, 4E0EF63228CA2FB3005D1B03 /* JMCallKitEmitter.m in Sources */, DEFE535621FB2E8300011A3A /* ReactUtils.m in Sources */, - 4EEC9631286C73A2008705FA /* JitsiMeetView+Private.m in Sources */, C6A34261204EF76800E062DD /* DragGestureController.swift in Sources */, 4E51B76525E5345E0038575A /* ScheenshareEventEmiter.m in Sources */, A4A934E9212F3ADB001E9388 /* Dropbox.m in Sources */, - 4EBA6E62286072E300B31882 /* JitsiMeetViewController.m in Sources */, DE81A2D52316AC4D00AE1940 /* JitsiMeetLogger.m in Sources */, 0B412F191EDEC65D00B1A0A6 /* JitsiMeetView.m in Sources */, DEFE535421FB1BF800011A3A /* JitsiMeet.m in Sources */, @@ -721,7 +699,6 @@ files = ( DE9A0143289A9A9A00E41CBB /* CallKit.m in Sources */, DE9A0144289A9A9A00E41CBB /* JitsiMeetBaseLogHandler.m in Sources */, - DE9A0145289A9A9A00E41CBB /* JitsiMeetRenderingView.m in Sources */, DE9A0146289A9A9A00E41CBB /* JitsiAudioSession.m in Sources */, 4E0EF63C28CA4069005D1B03 /* JMCallKitProxy.m in Sources */, DE9A0147289A9A9A00E41CBB /* AppInfo.m in Sources */, @@ -737,11 +714,10 @@ DE9A0151289A9A9A00E41CBB /* LocaleDetector.m in Sources */, DE9A0152289A9A9A00E41CBB /* AudioMode.m in Sources */, DE9A0153289A9A9A00E41CBB /* Proximity.m in Sources */, + 4E812F3A28F9A4ED0087ACC9 /* JitsiMeetView+Private.m in Sources */, DE9A0155289A9A9A00E41CBB /* ReactUtils.m in Sources */, - DE9A0156289A9A9A00E41CBB /* JitsiMeetView+Private.m in Sources */, DE9A0157289A9A9A00E41CBB /* DragGestureController.swift in Sources */, DE9A0158289A9A9A00E41CBB /* ScheenshareEventEmiter.m in Sources */, - DE9A015A289A9A9A00E41CBB /* JitsiMeetViewController.m in Sources */, DE9A015C289A9A9A00E41CBB /* JitsiMeetLogger.m in Sources */, 4E0EF63328CA2FB3005D1B03 /* JMCallKitEmitter.m in Sources */, DE9A015E289A9A9A00E41CBB /* JitsiMeetView.m in Sources */, diff --git a/ios/sdk/src/JitsiMeetRenderingView.h b/ios/sdk/src/JitsiMeetRenderingView.h deleted file mode 100644 index 2c918aa685..0000000000 --- a/ios/sdk/src/JitsiMeetRenderingView.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright @ 2022-present 8x8, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "JitsiMeetViewDelegate.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface JitsiMeetRenderingView : UIView - -@property (nonatomic, assign) BOOL isPiPEnabled; - -- (void)setProps:(NSDictionary *_Nonnull)newProps; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/sdk/src/JitsiMeetRenderingView.m b/ios/sdk/src/JitsiMeetRenderingView.m deleted file mode 100644 index 54abdce81e..0000000000 --- a/ios/sdk/src/JitsiMeetRenderingView.m +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright @ 2022-present 8x8, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#include - -#import "JitsiMeetRenderingView.h" -#import "ReactUtils.h" -#import "RNRootView.h" -#import "JitsiMeet+Private.h" - -/** - * Backwards compatibility: turn the boolean prop into a feature flag. - */ -static NSString *const PiPEnabledFeatureFlag = @"pip.enabled"; - -@interface JitsiMeetRenderingView () -@end - -@implementation JitsiMeetRenderingView { - /** - * React Native view where the entire content will be rendered. - */ - RNRootView *rootView; -} - -/** - * Passes the given props to the React Native application. The props which we pass - * are a combination of 3 different sources: - * - * - JitsiMeet.defaultConferenceOptions - * - This function's parameters - * - Some extras which are added by this function - */ -- (void)setProps:(NSDictionary *_Nonnull)newProps { - NSMutableDictionary *props = mergeProps([[JitsiMeet sharedInstance] getDefaultProps], newProps); - - // Set the PiP flag if it wasn't manually set. - NSMutableDictionary *featureFlags = props[@"flags"]; - // TODO: temporary implementation - if (featureFlags[PiPEnabledFeatureFlag] == nil) { - featureFlags[PiPEnabledFeatureFlag] = @(self.isPiPEnabled); - } - - // This method is supposed to be imperative i.e. a second - // invocation with one and the same URL is expected to join the respective - // conference again if the first invocation was followed by leaving the - // conference. However, React and, respectively, - // appProperties/initialProperties are declarative expressions i.e. one and - // the same URL will not trigger an automatic re-render in the JavaScript - // source code. The workaround implemented below introduces imperativeness - // in React Component props by defining a unique value per invocation. - props[@"timestamp"] = @(mach_absolute_time()); - - if (rootView) { - // Update props with the new URL. - rootView.appProperties = props; - } else { - RCTBridge *bridge = [[JitsiMeet sharedInstance] getReactBridge]; - rootView = [[RNRootView alloc] initWithBridge:bridge - moduleName:@"App" - initialProperties:props]; - rootView.backgroundColor = self.backgroundColor; - - // Add rootView as a subview which completely covers this one. - [rootView setFrame:[self bounds]]; - rootView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; - [self addSubview:rootView]; - } -} - -@end diff --git a/ios/sdk/src/JitsiMeetView.m b/ios/sdk/src/JitsiMeetView.m index 8992b9602b..53a09252b1 100644 --- a/ios/sdk/src/JitsiMeetView.m +++ b/ios/sdk/src/JitsiMeetView.m @@ -20,22 +20,23 @@ #import "ExternalAPI.h" #import "JitsiMeet+Private.h" #import "JitsiMeetConferenceOptions+Private.h" -#import "JitsiMeetView.h" -#import "JitsiMeetViewController.h" +#import "JitsiMeetView+Private.h" #import "ReactUtils.h" #import "RNRootView.h" -@interface JitsiMeetView () -@property (nonatomic, strong) JitsiMeetViewController *jitsiMeetViewController; -@property (nonatomic, strong) UINavigationController *navController; -@property (nonatomic, readonly) BOOL isPiPEnabled; +/** + * Backwards compatibility: turn the boolean prop into a feature flag. + */ +static NSString *const PiPEnabledFeatureFlag = @"pip.enabled"; -@end -@implementation JitsiMeetView - -@dynamic isPiPEnabled; +@implementation JitsiMeetView { + /** + * React Native view where the entire content will be rendered. + */ + RNRootView *rootView; +} #pragma mark Initializers @@ -66,10 +67,6 @@ return self; } -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - /** * Internal initialization: * @@ -77,57 +74,72 @@ * - initializes the external API scope */ - (void)initWithXXX { - self.jitsiMeetViewController = [[JitsiMeetViewController alloc] init]; - self.jitsiMeetViewController.view.frame = [self bounds]; - [self addSubview:self.jitsiMeetViewController.view]; + // Set a background color which is in accord with the JavaScript and Android + // parts of the application and causes less perceived visual flicker than + // the default background color. + self.backgroundColor + = [UIColor colorWithRed:.07f green:.07f blue:.07f alpha:1]; [self registerObservers]; } +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + #pragma mark API - (void)join:(JitsiMeetConferenceOptions *)options { - [self.jitsiMeetViewController join:options withPiP:self.isPiPEnabled]; + [self setProps:options == nil ? @{} : [options asProps]]; } - (void)leave { - [self.jitsiMeetViewController leave]; + [self setProps:@{}]; } - (void)hangUp { - [self.jitsiMeetViewController hangUp]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI sendHangUp]; } - (void)setAudioMuted:(BOOL)muted { - [self.jitsiMeetViewController setAudioMuted:muted]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI sendSetAudioMuted:muted]; } - (void)sendEndpointTextMessage:(NSString * _Nonnull)message :(NSString * _Nullable)to { - [self.jitsiMeetViewController sendEndpointTextMessage:message :to]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI sendEndpointTextMessage:message :to]; } - (void)toggleScreenShare:(BOOL)enabled { - [self.jitsiMeetViewController toggleScreenShare:enabled]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI toggleScreenShare:enabled]; } - (void)retrieveParticipantsInfo:(void (^ _Nonnull)(NSArray * _Nullable))completionHandler { - [self.jitsiMeetViewController retrieveParticipantsInfo:completionHandler]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI retrieveParticipantsInfo:completionHandler]; } - (void)openChat:(NSString*)to { - [self.jitsiMeetViewController openChat:to]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI openChat:to]; } - (void)closeChat { - [self.jitsiMeetViewController closeChat]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI closeChat]; } - (void)sendChatMessage:(NSString * _Nonnull)message :(NSString * _Nullable)to { - [self.jitsiMeetViewController sendChatMessage:message :to]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI sendChatMessage:message :to]; } - (void)setVideoMuted:(BOOL)muted { - [self.jitsiMeetViewController setVideoMuted:muted]; + ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; + [externalAPI sendSetVideoMuted:muted]; } - (void)setClosedCaptionsEnabled:(BOOL)enabled { @@ -135,47 +147,97 @@ [externalAPI sendSetClosedCaptionsEnabled:enabled]; } -#pragma mark Private - -- (BOOL)isPiPEnabled { - return self.delegate && [self.delegate respondsToSelector:@selector(enterPictureInPicture:)]; -} +#pragma mark Private methods - (void)registerObservers { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUpdateViewPropsNotification:) name:updateViewPropsNotificationName object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleSendEventNotification:) name:sendEventNotificationName object:nil]; + } + +- (void)handleUpdateViewPropsNotification:(NSNotification *)notification { + NSDictionary *props = [notification.userInfo objectForKey:@"props"]; + [self setProps:props]; } - (void)handleSendEventNotification:(NSNotification *)notification { NSString *eventName = notification.userInfo[@"name"]; NSString *eventData = notification.userInfo[@"data"]; - - SEL sel = NSSelectorFromString([self methodNameFromEventName:eventName]); + SEL sel = NSSelectorFromString([self methodNameFromEventName:eventName]); if (sel && [self.delegate respondsToSelector:sel]) { [self.delegate performSelector:sel withObject:eventData]; } } /** - * Converts a specific event name i.e. redux action type description to a - * method name. + * Converts a specific event name i.e. redux action type description to a + * method name. + * + * @param eventName The event name to convert to a method name. + * @return A method name constructed from the specified `eventName`. + */ + - (NSString *)methodNameFromEventName:(NSString *)eventName { + NSMutableString *methodName + = [NSMutableString stringWithCapacity:eventName.length]; + + for (NSString *c in [eventName componentsSeparatedByString:@"_"]) { + if (c.length) { + [methodName appendString: + methodName.length ? c.capitalizedString : c.lowercaseString]; + } + } + [methodName appendString:@":"]; + + return methodName; + } + +/** + * Passes the given props to the React Native application. The props which we pass + * are a combination of 3 different sources: * - * @param eventName The event name to convert to a method name. - * @return A method name constructed from the specified `eventName`. + * - JitsiMeet.defaultConferenceOptions + * - This function's parameters + * - Some extras which are added by this function */ -- (NSString *)methodNameFromEventName:(NSString *)eventName { - NSMutableString *methodName - = [NSMutableString stringWithCapacity:eventName.length]; +- (void)setProps:(NSDictionary *_Nonnull)newProps { + NSMutableDictionary *props = mergeProps([[JitsiMeet sharedInstance] getDefaultProps], newProps); - for (NSString *c in [eventName componentsSeparatedByString:@"_"]) { - if (c.length) { - [methodName appendString: - methodName.length ? c.capitalizedString : c.lowercaseString]; - } - } - [methodName appendString:@":"]; + // Set the PiP flag if it wasn't manually set. + NSMutableDictionary *featureFlags = props[@"flags"]; + if (featureFlags[PiPEnabledFeatureFlag] == nil) { + featureFlags[PiPEnabledFeatureFlag] + = [NSNumber numberWithBool: + self.delegate && [self.delegate respondsToSelector:@selector(enterPictureInPicture:)]]; + } - return methodName; + // This method is supposed to be imperative i.e. a second + // invocation with one and the same URL is expected to join the respective + // conference again if the first invocation was followed by leaving the + // conference. However, React and, respectively, + // appProperties/initialProperties are declarative expressions i.e. one and + // the same URL will not trigger an automatic re-render in the JavaScript + // source code. The workaround implemented below introduces imperativeness + // in React Component props by defining a unique value per invocation. + props[@"timestamp"] = @(mach_absolute_time()); + + if (rootView) { + // Update props with the new URL. + rootView.appProperties = props; + } else { + RCTBridge *bridge = [[JitsiMeet sharedInstance] getReactBridge]; + rootView + = [[RNRootView alloc] initWithBridge:bridge + moduleName:@"App" + initialProperties:props]; + rootView.backgroundColor = self.backgroundColor; + + // Add rootView as a subview which completely covers this one. + [rootView setFrame:[self bounds]]; + rootView.autoresizingMask + = UIViewAutoresizingFlexibleWidth + | UIViewAutoresizingFlexibleHeight; + [self addSubview:rootView]; + } } @end diff --git a/ios/sdk/src/JitsiMeetViewController.h b/ios/sdk/src/JitsiMeetViewController.h deleted file mode 100644 index cc469ab314..0000000000 --- a/ios/sdk/src/JitsiMeetViewController.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright @ 2022-present 8x8, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import -#import "JitsiMeetConferenceOptions.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface JitsiMeetViewController : UIViewController - -- (void)join:(JitsiMeetConferenceOptions *)options withPiP:(BOOL)enablePiP; -- (void)leave; -- (void)hangUp; -- (void)setAudioMuted:(BOOL)muted; -- (void)sendEndpointTextMessage:(NSString * _Nonnull)message :(NSString * _Nullable)to; -- (void)toggleScreenShare:(BOOL)enabled; -- (void)retrieveParticipantsInfo:(void (^ _Nonnull)(NSArray * _Nullable))completionHandler; -- (void)openChat:(NSString*)to; -- (void)closeChat; -- (void)sendChatMessage:(NSString * _Nonnull)message :(NSString * _Nullable)to; -- (void)setVideoMuted:(BOOL)muted; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/sdk/src/JitsiMeetViewController.m b/ios/sdk/src/JitsiMeetViewController.m deleted file mode 100644 index 78df28522b..0000000000 --- a/ios/sdk/src/JitsiMeetViewController.m +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright @ 2022-present 8x8, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#import "JitsiMeetViewController.h" -#import "JitsiMeet+Private.h" -#import "JitsiMeetConferenceOptions+Private.h" -#import "JitsiMeetRenderingView.h" -#import "JitsiMeetView+Private.h" - -@interface JitsiMeetViewController () - -@property (strong, nonatomic) JitsiMeetRenderingView *view; - -@end - -@implementation JitsiMeetViewController - -@dynamic view; - -- (instancetype)init { - self = [super init]; - if (self) { - [self registerObservers]; - } - - return self; -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)loadView { - [super loadView]; - - self.view = [[JitsiMeetRenderingView alloc] init]; - self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - // Set a background color which is in accord with the JavaScript and Android - // parts of the application and causes less perceived visual flicker than - // the default background color. - self.view.backgroundColor = [UIColor colorWithRed:.07f green:.07f blue:.07f alpha:1]; -} - -- (void)join:(JitsiMeetConferenceOptions *)options withPiP:(BOOL)enablePiP { - self.view.isPiPEnabled = enablePiP; - [self.view setProps:options == nil ? @{} : [options asProps]]; -} - -- (void)leave { - [self.view setProps:@{}]; -} - -- (void)hangUp { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI sendHangUp]; -} - -- (void)setAudioMuted:(BOOL)muted { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI sendSetAudioMuted:muted]; -} - -- (void)sendEndpointTextMessage:(NSString * _Nonnull)message :(NSString * _Nullable)to { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI sendEndpointTextMessage:message :to]; -} - -- (void)toggleScreenShare:(BOOL)enabled { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI toggleScreenShare:enabled]; -} - -- (void)retrieveParticipantsInfo:(void (^ _Nonnull)(NSArray * _Nullable))completionHandler { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI retrieveParticipantsInfo:completionHandler]; -} - -- (void)openChat:(NSString*)to { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI openChat:to]; -} - -- (void)closeChat { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI closeChat]; -} - -- (void)sendChatMessage:(NSString * _Nonnull)message :(NSString * _Nullable)to { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI sendChatMessage:message :to]; -} - -- (void)setVideoMuted:(BOOL)muted { - ExternalAPI *externalAPI = [[JitsiMeet sharedInstance] getExternalAPI]; - [externalAPI sendSetVideoMuted:muted]; -} - -#pragma mark Private - -- (void)registerObservers { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUpdateViewPropsNotification:) name:updateViewPropsNotificationName object:nil]; -} - -- (void)handleUpdateViewPropsNotification:(NSNotification *)notification { - NSDictionary *props = [notification.userInfo objectForKey:@"props"]; - [self.view setProps:props]; -} - -@end