@@ -47,14 +47,13 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
47
47
}
48
48
49
49
public func application( _ application: UIApplication , didFinishLaunchingWithOptions launchOptions: [ AnyHashable : Any ] = [ : ] ) -> Bool {
50
- branch = Branch . getInstance ( ) ;
51
- branch!. registerPluginName ( PLUGIN_NAME, version: getPluginVersion ( ) )
50
+ Branch . getInstance ( ) . registerPluginName ( PLUGIN_NAME, version: getPluginVersion ( ) )
52
51
53
52
if #available( iOS 15 . 0 , * ) {
54
- branch! . checkPasteboardOnInstall ( )
53
+ Branch . getInstance ( ) . checkPasteboardOnInstall ( )
55
54
}
56
55
57
- branch! . initSession ( launchOptions: launchOptions) { ( params, error) in
56
+ Branch . getInstance ( ) . initSession ( launchOptions: launchOptions) { ( params, error) in
58
57
if error == nil {
59
58
print ( " Branch InitSession params: \( String ( describing: params as? [ String : Any ] ) ) " )
60
59
guard let _ = self . eventSink else {
@@ -78,22 +77,22 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
78
77
}
79
78
80
79
public func application( _ app: UIApplication , open url: URL , options: [ UIApplication . OpenURLOptionsKey : Any ] = [ : ] ) -> Bool {
81
- let branchHandled = branch! . application ( app, open: url, options: options)
80
+ let branchHandled = Branch . getInstance ( ) . application ( app, open: url, options: options)
82
81
return branchHandled
83
82
}
84
83
85
84
public func application( _ app: UIApplication , open url: URL , sourceApplication: String , annotation: Any ) -> Bool {
86
- let branchHandled = branch! . application ( app, open: url, sourceApplication: sourceApplication, annotation: annotation)
85
+ let branchHandled = Branch . getInstance ( ) . application ( app, open: url, sourceApplication: sourceApplication, annotation: annotation)
87
86
return branchHandled
88
87
}
89
88
90
89
public func application( _ application: UIApplication , continue userActivity: NSUserActivity , restorationHandler: @escaping ( [ Any ] ) -> Void ) -> Bool {
91
- let handledByBranch = branch! . continue ( userActivity)
90
+ let handledByBranch = Branch . getInstance ( ) . continue ( userActivity)
92
91
return handledByBranch
93
92
}
94
93
95
94
public func application( _ application: UIApplication , didReceiveRemoteNotification userInfo: [ AnyHashable : Any ] ) {
96
- branch! . handlePushNotification ( userInfo)
95
+ Branch . getInstance ( ) . handlePushNotification ( userInfo)
97
96
}
98
97
99
98
//---------------------------------------------------------------------------------------------
@@ -260,17 +259,17 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
260
259
261
260
if ( !requestMetadata. isEmpty) {
262
261
for param in requestMetadata {
263
- branch! . setRequestMetadataKey ( param. key, value: param. value)
262
+ Branch . getInstance ( ) . setRequestMetadataKey ( param. key, value: param. value)
264
263
}
265
264
}
266
265
if ( !snapParameters. isEmpty) {
267
266
for param in snapParameters {
268
- branch! . addSnapPartnerParameter ( withName: param. key, value: param. value)
267
+ Branch . getInstance ( ) . addSnapPartnerParameter ( withName: param. key, value: param. value)
269
268
}
270
269
}
271
270
if ( !facebookParameters. isEmpty) {
272
271
for param in facebookParameters {
273
- branch! . addFacebookPartnerParameter ( withName: param. key, value: param. value)
272
+ Branch . getInstance ( ) . addFacebookPartnerParameter ( withName: param. key, value: param. value)
274
273
}
275
274
}
276
275
isInitialized = true
@@ -286,7 +285,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
286
285
287
286
let response : NSMutableDictionary ! = [ : ]
288
287
buo? . getShortUrl ( with: lp!) { ( url, error) in
289
- if ( ( error == nil ) || ( error != nil && url != nil ) ) {
288
+ if ( ( error == nil && url != nil ) || ( error != nil && url != nil ) ) {
290
289
NSLog ( " getShortUrl: %@ " , url!)
291
290
response [ " success " ] = NSNumber ( value: true )
292
291
response [ " url " ] = url!
0 commit comments