1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-11 08:55:54 +01:00
metatext-app-ios-iphone-ipad/Shared/View Models/PreferencesViewModel.swift
2020-08-16 13:30:28 -07:00

28 lines
887 B
Swift

// Copyright © 2020 Metabolist. All rights reserved.
import Foundation
class PreferencesViewModel: ObservableObject {
let handle: String
let shouldShowNotificationTypePreferences: Bool
private let identityService: IdentityService
init(identityService: IdentityService) {
self.identityService = identityService
handle = identityService.identity.handle
shouldShowNotificationTypePreferences = identityService.identity.lastRegisteredDeviceToken != nil
}
}
extension PreferencesViewModel {
func postingReadingPreferencesViewModel() -> PostingReadingPreferencesViewModel {
PostingReadingPreferencesViewModel(identityService: identityService)
}
func notificationTypesPreferencesViewModel() -> NotificationTypesPreferencesViewModel {
NotificationTypesPreferencesViewModel(identityService: identityService)
}
}