Last active
October 4, 2022 13:28
-
-
Save cci-rmirza/2ea3db2c5982fda0eaf1ceb258dafc10 to your computer and use it in GitHub Desktop.
Login and Logout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension LoginViewController: MembershipShowing { | |
func login(outletNumber: String, password: String) { | |
API.authProvider.request(.login(outletNumber: outletNumber, password: password)) { result in | |
CountlyExceptionHandler.sendLog(result.value, result.error, methodName: AuthService.login(outletNumber: "", password: "").path) | |
switch result { | |
case .failure(let error): | |
// Redacted code because it's unrelated to Countly | |
case .success(let response): | |
// Redacted code because it's unrelated to Countly | |
let deviceIDType = Countly.sharedInstance().deviceIDType() | |
if deviceIDType == CLYDeviceIDType.custom { | |
Countly.sharedInstance().setNewDeviceID(outletNumber, onServer: false) | |
} else { | |
Countly.sharedInstance().setNewDeviceID(outletNumber, onServer: true) | |
} | |
} | |
} | |
static func logout() { | |
API.authProvider.request(AuthService.logout(sessionId: id)) { _ in | |
// Redacted code because it's unrelated to Countly | |
Countly.sharedInstance().userLoggedOut() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment