Hide notification type prefs unless registered
This commit is contained in:
parent
c64fa26b09
commit
f6568abad9
|
@ -4,12 +4,15 @@ import Foundation
|
||||||
|
|
||||||
class PreferencesViewModel: ObservableObject {
|
class PreferencesViewModel: ObservableObject {
|
||||||
let handle: String
|
let handle: String
|
||||||
|
let shouldShowNotificationTypePreferences: Bool
|
||||||
|
|
||||||
private let identityService: IdentityService
|
private let identityService: IdentityService
|
||||||
|
|
||||||
init(identityService: IdentityService) {
|
init(identityService: IdentityService) {
|
||||||
self.identityService = identityService
|
self.identityService = identityService
|
||||||
handle = identityService.identity.handle
|
handle = identityService.identity.handle
|
||||||
|
|
||||||
|
shouldShowNotificationTypePreferences = identityService.identity.lastRegisteredDeviceToken != nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,13 @@ struct PreferencesView: View {
|
||||||
NavigationLink("preferences.posting-reading",
|
NavigationLink("preferences.posting-reading",
|
||||||
destination: PostingReadingPreferencesView(
|
destination: PostingReadingPreferencesView(
|
||||||
viewModel: viewModel.postingReadingPreferencesViewModel()))
|
viewModel: viewModel.postingReadingPreferencesViewModel()))
|
||||||
|
if viewModel.shouldShowNotificationTypePreferences {
|
||||||
NavigationLink("preferences.notification-types",
|
NavigationLink("preferences.notification-types",
|
||||||
destination: NotificationTypesPreferencesView(
|
destination: NotificationTypesPreferencesView(
|
||||||
viewModel: viewModel.notificationTypesPreferencesViewModel()))
|
viewModel: viewModel.notificationTypesPreferencesViewModel()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.navigationTitle("preferences")
|
.navigationTitle("preferences")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue