Skip to content

Commit

Permalink
Adding check for activating and deactivating ConnectButtonController …
Browse files Browse the repository at this point in the history
…based on user login state
  • Loading branch information
ssathy2 committed Aug 18, 2021
1 parent ec72379 commit 394c146
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Examples/GroceryExpress/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
private let connectionRedirectHandler = ConnectionRedirectHandler(redirectURL: AppDelegate.connectionRedirectURL)

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

ConnectButtonController.synchronizationLoggingEnabled = true
ConnectButtonController.analyticsEnabled = true
ConnectButtonController.initialize(options: .init(enableSDKBackgroundProcess: true, showPermissionsPrompts: true))
if ConnectionCredentials(settings: .init()).isLoggedIn {
ConnectButtonController.activate(connections: [DisplayInformation.locationConnection.connectionId])
} else {
ConnectButtonController.deactivate()
}
ConnectButtonController.setBackgroundProcessClosures {
print("Background process started!")
} expirationHandler: {
Expand Down

0 comments on commit 394c146

Please sign in to comment.