Add app logo to OIDC and fix policy URL (#1590)

This commit is contained in:
Doug
2023-08-30 10:39:33 +01:00
committed by GitHub
parent a2623dd254
commit a472d443e0
14 changed files with 46 additions and 26 deletions
@@ -18,7 +18,11 @@ import Combine
import SwiftUI
final class LegalInformationScreenCoordinator: CoordinatorProtocol {
private let viewModel = LegalInformationScreenViewModel()
private let viewModel: LegalInformationScreenViewModel
init(appSettings: AppSettings) {
viewModel = LegalInformationScreenViewModel(appSettings: appSettings)
}
func toPresentable() -> AnyView {
AnyView(LegalInformationScreen(context: viewModel.context))
@@ -18,6 +18,10 @@ import Foundation
enum LegalInformationScreenViewModelAction { }
struct LegalInformationScreenViewState: BindableState { }
struct LegalInformationScreenViewState: BindableState {
let copyrightURL: URL
let acceptableUseURL: URL
let privacyURL: URL
}
enum LegalInformationScreenViewAction { }
@@ -20,7 +20,9 @@ import SwiftUI
typealias LegalInformationScreenViewModelType = StateStoreViewModel<LegalInformationScreenViewState, LegalInformationScreenViewAction>
class LegalInformationScreenViewModel: LegalInformationScreenViewModelType, LegalInformationScreenViewModelProtocol {
init() {
super.init(initialViewState: LegalInformationScreenViewState())
init(appSettings: AppSettings) {
super.init(initialViewState: LegalInformationScreenViewState(copyrightURL: appSettings.copyrightURL,
acceptableUseURL: appSettings.acceptableUseURL,
privacyURL: appSettings.privacyURL))
}
}
@@ -25,11 +25,11 @@ struct LegalInformationScreen: View {
Form {
Section {
ListRow(label: .plain(title: L10n.commonCopyright),
kind: .navigationLink { openURL("https://element.io/copyright") })
kind: .button { openURL(context.viewState.copyrightURL) })
ListRow(label: .plain(title: L10n.commonAcceptableUsePolicy),
kind: .navigationLink { openURL("https://element.io/acceptable-use-policy-terms") })
kind: .button { openURL(context.viewState.acceptableUseURL) })
ListRow(label: .plain(title: L10n.commonPrivacyPolicy),
kind: .navigationLink { openURL("https://element.io/privacy") })
kind: .button { openURL(context.viewState.privacyURL) })
}
}
.compoundList()
@@ -41,7 +41,7 @@ struct LegalInformationScreen: View {
// MARK: - Previews
struct LegalInformationScreen_Previews: PreviewProvider {
static let viewModel = LegalInformationScreenViewModel()
static let viewModel = LegalInformationScreenViewModel(appSettings: AppSettings())
static var previews: some View {
LegalInformationScreen(context: viewModel.context)
}
@@ -22,6 +22,7 @@ struct SettingsScreenCoordinatorParameters {
let userSession: UserSessionProtocol
let bugReportService: BugReportServiceProtocol
let notificationSettings: NotificationSettingsProxyProtocol
let appSettings: AppSettings
}
enum SettingsScreenCoordinatorAction {
@@ -132,7 +133,7 @@ final class SettingsScreenCoordinator: CoordinatorProtocol {
}
private func presentLegalInformationScreen() {
parameters.navigationStackCoordinator?.push(LegalInformationScreenCoordinator())
parameters.navigationStackCoordinator?.push(LegalInformationScreenCoordinator(appSettings: parameters.appSettings))
}
private func verifySession() {