mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:11:45 +00:00
Add app logo to OIDC and fix policy URL (#1590)
This commit is contained in:
@@ -102,6 +102,17 @@ final class AppSettings {
|
||||
@UserPreference(key: UserDefaultsKeys.hasShownWelcomeScreen, defaultValue: false, storageType: .userDefaults(store))
|
||||
var hasShownWelcomeScreen: Bool
|
||||
|
||||
/// A URL where users can go read more about the app.
|
||||
let websiteURL: URL = "https://element.io"
|
||||
/// A URL that contains the app's logo that may be used when showing content in a web view.
|
||||
let logoURL: URL = "https://element.io/mobile-icon.png"
|
||||
/// A URL that contains that app's copyright notice.
|
||||
let copyrightURL: URL = "https://element.io/copyright"
|
||||
/// A URL that contains the app's Terms of use.
|
||||
let acceptableUseURL: URL = "https://element.io/acceptable-use-policy-terms"
|
||||
/// A URL that contains the app's Privacy Policy.
|
||||
let privacyURL: URL = "https://element.io/privacy"
|
||||
|
||||
// MARK: - Authentication
|
||||
|
||||
/// The URL that is opened when tapping the Learn more button on the sliding sync alert during authentication.
|
||||
@@ -109,12 +120,6 @@ final class AppSettings {
|
||||
|
||||
/// The redirect URL used for OIDC.
|
||||
let oidcRedirectURL: URL = "io.element:/callback"
|
||||
/// The app's main URL shown when using OIDC.
|
||||
let oidcClientURL: URL = "https://element.io"
|
||||
/// The app's Terms of Service URL shown when using OIDC.
|
||||
let oidcTermsURL: URL = "https://element.io/user-terms-of-service"
|
||||
/// The app's Privacy Policy URL shown when using OIDC.
|
||||
let oidcPolicyURL: URL = "https://element.io/privacy"
|
||||
/// Any pre-defined static client registrations for OIDC issuers.
|
||||
let oidcStaticRegistrations: [URL: String] = ["https://id.thirdroom.io/realms/thirdroom": "elementx"]
|
||||
|
||||
|
||||
@@ -311,7 +311,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
||||
userIndicatorController: userIndicatorController,
|
||||
userSession: userSession,
|
||||
bugReportService: bugReportService,
|
||||
notificationSettings: userSession.clientProxy.notificationSettings())
|
||||
notificationSettings: userSession.clientProxy.notificationSettings(),
|
||||
appSettings: appSettings)
|
||||
let settingsScreenCoordinator = SettingsScreenCoordinator(parameters: parameters)
|
||||
settingsScreenCoordinator.callback = { [weak self] action in
|
||||
guard let self else { return }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Generated using Sourcery 2.0.2 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// Generated using Sourcery 2.0.3 — https://github.com/krzysztofzablocki/Sourcery
|
||||
// DO NOT EDIT
|
||||
|
||||
// swiftlint:disable all
|
||||
|
||||
+5
-1
@@ -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))
|
||||
|
||||
+5
-1
@@ -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 { }
|
||||
|
||||
+4
-2
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -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() {
|
||||
|
||||
@@ -33,9 +33,10 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
|
||||
|
||||
let oidcConfiguration = OidcConfiguration(clientName: InfoPlistReader.main.bundleDisplayName,
|
||||
redirectUri: appSettings.oidcRedirectURL.absoluteString,
|
||||
clientUri: appSettings.oidcClientURL.absoluteString,
|
||||
tosUri: appSettings.oidcTermsURL.absoluteString,
|
||||
policyUri: appSettings.oidcPolicyURL.absoluteString,
|
||||
clientUri: appSettings.websiteURL.absoluteString,
|
||||
logoUri: appSettings.logoURL.absoluteString,
|
||||
tosUri: appSettings.acceptableUseURL.absoluteString,
|
||||
policyUri: appSettings.privacyURL.absoluteString,
|
||||
staticRegistrations: appSettings.oidcStaticRegistrations.mapKeys { $0.absoluteString })
|
||||
|
||||
authenticationService = AuthenticationService(basePath: userSessionStore.baseDirectory.path,
|
||||
|
||||
@@ -171,7 +171,8 @@ class MockScreen: Identifiable {
|
||||
userIndicatorController: nil,
|
||||
userSession: MockUserSession(clientProxy: clientProxy, mediaProvider: MockMediaProvider()),
|
||||
bugReportService: BugReportServiceMock(),
|
||||
notificationSettings: NotificationSettingsProxyMock(with: .init())))
|
||||
notificationSettings: NotificationSettingsProxyMock(with: .init()),
|
||||
appSettings: ServiceLocator.shared.settings))
|
||||
navigationStackCoordinator.setRootCoordinator(coordinator)
|
||||
return navigationStackCoordinator
|
||||
case .bugReport:
|
||||
|
||||
Reference in New Issue
Block a user