Skip to content

Commit 394c146

Browse files
committed
Adding check for activating and deactivating ConnectButtonController based on user login state
1 parent ec72379 commit 394c146

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Examples/GroceryExpress/AppDelegate.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1919
private let connectionRedirectHandler = ConnectionRedirectHandler(redirectURL: AppDelegate.connectionRedirectURL)
2020

2121
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
22-
2322
ConnectButtonController.synchronizationLoggingEnabled = true
2423
ConnectButtonController.analyticsEnabled = true
2524
ConnectButtonController.initialize(options: .init(enableSDKBackgroundProcess: true, showPermissionsPrompts: true))
25+
if ConnectionCredentials(settings: .init()).isLoggedIn {
26+
ConnectButtonController.activate(connections: [DisplayInformation.locationConnection.connectionId])
27+
} else {
28+
ConnectButtonController.deactivate()
29+
}
2630
ConnectButtonController.setBackgroundProcessClosures {
2731
print("Background process started!")
2832
} expirationHandler: {

0 commit comments

Comments
 (0)