Skip to content

Commit

Permalink
fix: invoke checkPasteboardOnInstall only when the app is opened for …
Browse files Browse the repository at this point in the history
…the very first time (RodrigoSMarques#345)
  • Loading branch information
korzonkiee committed Sep 4, 2024
1 parent 6ab26a3 commit 1e52f8a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ios/Classes/SwiftFlutterBranchSdkPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,19 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
}

public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any] = [:]) -> Bool {
let defaults = UserDefaults.standard

Branch.getInstance().registerPluginName(PLUGIN_NAME, version: getPluginVersion())

if #available(iOS 15.0, *) {
if #available(iOS 15.0, *)
// This is a fix to solve the following issue:
// - https://github.com/RodrigoSMarques/flutter_branch_sdk/issues/345
// - https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/issues/1412
if (defaults.string(forKey: "flutter_branch_sdk_first_open_key") == nil) {
Branch.getInstance().checkPasteboardOnInstall()
}

defaults.setValue("", forKey: "flutter_branch_sdk_first_open_key")
}

Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
Expand Down

0 comments on commit 1e52f8a

Please sign in to comment.