From 440c93fc355cc1f698c3dcab72e4ec28cf0dc698 Mon Sep 17 00:00:00 2001 From: Mohammed Mohsin <59914433+mdmohsin7@users.noreply.github.com> Date: Thu, 21 Nov 2024 20:12:30 +0530 Subject: [PATCH] handle deeplinks on ios native side --- app/ios/Runner/AppDelegate.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/ios/Runner/AppDelegate.swift b/app/ios/Runner/AppDelegate.swift index 616f9f375..4ca16375f 100644 --- a/app/ios/Runner/AppDelegate.swift +++ b/app/ios/Runner/AppDelegate.swift @@ -1,6 +1,7 @@ import UIKit import Flutter import UserNotifications +import app_links @main @objc class AppDelegate: FlutterAppDelegate { @@ -14,6 +15,13 @@ import UserNotifications didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? ) -> Bool { GeneratedPluginRegistrant.register(with: self) + + // Retrieve the link from parameters + if let url = AppLinks.shared.getLink(launchOptions: launchOptions) { + // We have a link, propagate it to your Flutter app or not + AppLinks.shared.handleLink(url: url) + return true // Returning true will stop the propagation to other packages + } //Creates a method channel to handle notifications on kill let controller = window?.rootViewController as? FlutterViewController methodChannel = FlutterMethodChannel(name: "com.friend.ios/notifyOnKill", binaryMessenger: controller!.binaryMessenger)