Files
element-x-ios/ElementX/Sources/Screens/Settings/SettingsModels.swift
T
Stefan Ceriu 6f974a4422 Resetting the app after deletion and cleanup settings (#372)
* Fixes #361 - Reset everything if the app has been deleted since the last run

* Cleaned up and renamed the ElementSettings to ApplicationSettings. Removed its singleton and moved it to the service locator.

* Moved the ApplicationSettings to the Application folder

* Merged together the BuildSettings and ApplicationSettings

* Reset the UserDefaults too when resetting the application state

* Rename ServiceLocator.applicationSettings to just settings

* Fix indentation

* Rename ApplicationSettings to AppSettings

* Various tweaks following code review

* Fix unit tests
2022-12-16 10:02:22 +02:00

44 lines
1.1 KiB
Swift

//
// Copyright 2022 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Foundation
import UIKit
enum SettingsViewModelAction {
case close
case toggleAnalytics
case reportBug
case logout
}
struct SettingsViewState: BindableState {
var bindings: SettingsViewStateBindings
var userID: String
var userAvatar: UIImage?
var userDisplayName: String?
}
struct SettingsViewStateBindings {
var enableAnalytics = ServiceLocator.shared.settings.enableAnalytics
}
enum SettingsViewAction {
case close
case toggleAnalytics
case reportBug
case logout
}