2020-08-07 12:59:48 +02:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
class PreferencesViewModel: ObservableObject {
|
|
|
|
let handle: String
|
2020-08-16 22:30:28 +02:00
|
|
|
let shouldShowNotificationTypePreferences: Bool
|
2020-08-07 12:59:48 +02:00
|
|
|
|
2020-08-09 01:08:47 +02:00
|
|
|
private let identityService: IdentityService
|
2020-08-07 12:59:48 +02:00
|
|
|
|
2020-08-09 01:08:47 +02:00
|
|
|
init(identityService: IdentityService) {
|
|
|
|
self.identityService = identityService
|
|
|
|
handle = identityService.identity.handle
|
2020-08-16 22:30:28 +02:00
|
|
|
|
|
|
|
shouldShowNotificationTypePreferences = identityService.identity.lastRegisteredDeviceToken != nil
|
2020-08-07 12:59:48 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
extension PreferencesViewModel {
|
|
|
|
func postingReadingPreferencesViewModel() -> PostingReadingPreferencesViewModel {
|
2020-08-09 01:08:47 +02:00
|
|
|
PostingReadingPreferencesViewModel(identityService: identityService)
|
2020-08-07 12:59:48 +02:00
|
|
|
}
|
2020-08-14 23:41:55 +02:00
|
|
|
|
|
|
|
func notificationTypesPreferencesViewModel() -> NotificationTypesPreferencesViewModel {
|
|
|
|
NotificationTypesPreferencesViewModel(identityService: identityService)
|
|
|
|
}
|
2020-08-07 12:59:48 +02:00
|
|
|
}
|