diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 6c738da9..88277029 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -13,7 +13,7 @@ import workmanager_apple didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { UNUserNotificationCenter.current().delegate = self - + if let registrar = self.registrar(forPlugin: "VideoCompressionChannel") { VideoCompressionChannel.register(with: registrar.messenger()) } @@ -32,20 +32,22 @@ import workmanager_apple WorkmanagerPlugin.registerBGProcessingTask( withIdentifier: "eu.twonly.processing_task" ) - + return super.application(application, didFinishLaunchingWithOptions: launchOptions) } - override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { + override func application( + _ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:] + ) -> Bool { - let sharingIntent = SwiftFlutterSharingIntentPlugin.instance - if sharingIntent.hasSameSchemePrefix(url: url) { - return sharingIntent.application(app, open: url, options: options) - } + let sharingIntent = SwiftFlutterSharingIntentPlugin.instance + if sharingIntent.hasSameSchemePrefix(url: url) { + return sharingIntent.application(app, open: url, options: options) + } - // Proceed url handling for other Flutter libraries like app_links - return super.application(app, open: url, options:options) - } + // Proceed url handling for other Flutter libraries like app_links + return super.application(app, open: url, options: options) + } func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) @@ -58,7 +60,8 @@ import workmanager_apple NSLog( "Application delegate method userNotificationCenter:didReceive:withCompletionHandler: is called with user info: %@", response.notification.request.content.userInfo) - //... + super.userNotificationCenter( + center, didReceive: response, withCompletionHandler: completionHandler) } override func userNotificationCenter( @@ -86,4 +89,4 @@ import workmanager_apple completionHandler([.alert, .sound]) } -} +} \ No newline at end of file diff --git a/lib/src/visual/views/home.view.dart b/lib/src/visual/views/home.view.dart index d0386ca2..76ec2f61 100644 --- a/lib/src/visual/views/home.view.dart +++ b/lib/src/visual/views/home.view.dart @@ -40,7 +40,7 @@ class HomeViewState extends State { Timer? _disableCameraTimer; final MainCameraController _mainCameraController = MainCameraController(); - final PageController _homeViewPageController = PageController(initialPage: 1); + late final PageController _homeViewPageController; StreamSubscription>? _intentStreamSub; StreamSubscription? _deepLinkSub; @@ -53,12 +53,21 @@ class HomeViewState extends State { @override void initState() { super.initState(); + var initialPage = widget.initialPage; + if (initialPage == 1 && !userService.currentUser.startWithCameraOpen) { + initialPage = 0; + } + _activePageIdx = initialPage; + _homeViewPageController = PageController(initialPage: initialPage); + _mainCameraController.setState = () { if (mounted) setState(() {}); }; _homeViewPageIndexSub = streamHomeViewPageIndex.stream.listen((index) { - _homeViewPageController.jumpToPage(index); + if (_homeViewPageController.hasClients) { + _homeViewPageController.jumpToPage(index); + } setState(() { _activePageIdx = index; });