fix: device revocation for a new account
Change-Id: I3a2bff584ea036f86178e2705bcab7dc71b2eeb5
diff --git a/Ring/Ring/Features/Me/Me/MeViewModel.swift b/Ring/Ring/Features/Me/Me/MeViewModel.swift
index aceb566..438fb0a 100644
--- a/Ring/Ring/Features/Me/Me/MeViewModel.swift
+++ b/Ring/Ring/Features/Me/Me/MeViewModel.swift
@@ -206,7 +206,21 @@
required init (with injectionBag: InjectionBag) {
self.accountService = injectionBag.accountService
self.nameService = injectionBag.nameService
- guard let accountId = self.accountService.currentAccount?.id else {return}
+ }
+
+ func linkDevice() {
+ self.stateSubject.onNext(MeState.linkNewDevice)
+ }
+
+ func showBlockedContacts() {
+ self.stateSubject.onNext(MeState.blockedContacts)
+ }
+
+ func revokeDevice(deviceId: String, accountPassword password: String) {
+ guard let accountId = self.accountService.currentAccount?.id else {
+ self.showActionState.value = .hideLoading
+ return
+ }
self.accountService.sharedResponseStream
.filter({ (deviceEvent) -> Bool in
return deviceEvent.eventType == ServiceEventType.deviceRevocationEnded
@@ -227,21 +241,6 @@
}
}
}).disposed(by: self.disposeBag)
- }
-
- func linkDevice() {
- self.stateSubject.onNext(MeState.linkNewDevice)
- }
-
- func showBlockedContacts() {
- self.stateSubject.onNext(MeState.blockedContacts)
- }
-
- func revokeDevice(deviceId: String, accountPassword password: String) {
- guard let accountId = self.accountService.currentAccount?.id else {
- self.showActionState.value = .hideLoading
- return
- }
self.accountService.revokeDevice(for: accountId, withPassword: password, deviceId: deviceId)
}