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
+1 -1
View File
@@ -5575,7 +5575,7 @@
repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift"; repositoryURL = "https://github.com/matrix-org/matrix-rust-components-swift";
requirement = { requirement = {
kind = exactVersion; kind = exactVersion;
version = 1.1.2; version = 1.1.3;
}; };
}; };
821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = { 821C67C9A7F8CC3FD41B28B4 /* XCRemoteSwiftPackageReference "emojibase-bindings" */ = {
@@ -129,8 +129,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/matrix-org/matrix-rust-components-swift", "location" : "https://github.com/matrix-org/matrix-rust-components-swift",
"state" : { "state" : {
"revision" : "3cc7cbd7b93d2492525678b37324f11ccb7a1889", "revision" : "2599119dfacd12208896e8c52c58e424015ec997",
"version" : "1.1.2" "version" : "1.1.3"
} }
}, },
{ {
@@ -244,7 +244,7 @@
{ {
"identity" : "swiftui-introspect", "identity" : "swiftui-introspect",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/siteline/SwiftUI-Introspect.git", "location" : "https://github.com/siteline/SwiftUI-Introspect",
"state" : { "state" : {
"revision" : "b94da693e57eaf79d16464b8b7c90d09cba4e290", "revision" : "b94da693e57eaf79d16464b8b7c90d09cba4e290",
"version" : "0.9.2" "version" : "0.9.2"
+11 -6
View File
@@ -102,6 +102,17 @@ final class AppSettings {
@UserPreference(key: UserDefaultsKeys.hasShownWelcomeScreen, defaultValue: false, storageType: .userDefaults(store)) @UserPreference(key: UserDefaultsKeys.hasShownWelcomeScreen, defaultValue: false, storageType: .userDefaults(store))
var hasShownWelcomeScreen: Bool 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 // MARK: - Authentication
/// The URL that is opened when tapping the Learn more button on the sliding sync alert during 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. /// The redirect URL used for OIDC.
let oidcRedirectURL: URL = "io.element:/callback" 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. /// Any pre-defined static client registrations for OIDC issuers.
let oidcStaticRegistrations: [URL: String] = ["https://id.thirdroom.io/realms/thirdroom": "elementx"] let oidcStaticRegistrations: [URL: String] = ["https://id.thirdroom.io/realms/thirdroom": "elementx"]
@@ -311,7 +311,8 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
userIndicatorController: userIndicatorController, userIndicatorController: userIndicatorController,
userSession: userSession, userSession: userSession,
bugReportService: bugReportService, bugReportService: bugReportService,
notificationSettings: userSession.clientProxy.notificationSettings()) notificationSettings: userSession.clientProxy.notificationSettings(),
appSettings: appSettings)
let settingsScreenCoordinator = SettingsScreenCoordinator(parameters: parameters) let settingsScreenCoordinator = SettingsScreenCoordinator(parameters: parameters)
settingsScreenCoordinator.callback = { [weak self] action in settingsScreenCoordinator.callback = { [weak self] action in
guard let self else { return } 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 // DO NOT EDIT
// swiftlint:disable all // swiftlint:disable all
@@ -18,7 +18,11 @@ import Combine
import SwiftUI import SwiftUI
final class LegalInformationScreenCoordinator: CoordinatorProtocol { final class LegalInformationScreenCoordinator: CoordinatorProtocol {
private let viewModel = LegalInformationScreenViewModel() private let viewModel: LegalInformationScreenViewModel
init(appSettings: AppSettings) {
viewModel = LegalInformationScreenViewModel(appSettings: appSettings)
}
func toPresentable() -> AnyView { func toPresentable() -> AnyView {
AnyView(LegalInformationScreen(context: viewModel.context)) AnyView(LegalInformationScreen(context: viewModel.context))
@@ -18,6 +18,10 @@ import Foundation
enum LegalInformationScreenViewModelAction { } enum LegalInformationScreenViewModelAction { }
struct LegalInformationScreenViewState: BindableState { } struct LegalInformationScreenViewState: BindableState {
let copyrightURL: URL
let acceptableUseURL: URL
let privacyURL: URL
}
enum LegalInformationScreenViewAction { } enum LegalInformationScreenViewAction { }
@@ -20,7 +20,9 @@ import SwiftUI
typealias LegalInformationScreenViewModelType = StateStoreViewModel<LegalInformationScreenViewState, LegalInformationScreenViewAction> typealias LegalInformationScreenViewModelType = StateStoreViewModel<LegalInformationScreenViewState, LegalInformationScreenViewAction>
class LegalInformationScreenViewModel: LegalInformationScreenViewModelType, LegalInformationScreenViewModelProtocol { class LegalInformationScreenViewModel: LegalInformationScreenViewModelType, LegalInformationScreenViewModelProtocol {
init() { init(appSettings: AppSettings) {
super.init(initialViewState: LegalInformationScreenViewState()) super.init(initialViewState: LegalInformationScreenViewState(copyrightURL: appSettings.copyrightURL,
acceptableUseURL: appSettings.acceptableUseURL,
privacyURL: appSettings.privacyURL))
} }
} }
@@ -25,11 +25,11 @@ struct LegalInformationScreen: View {
Form { Form {
Section { Section {
ListRow(label: .plain(title: L10n.commonCopyright), 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), 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), ListRow(label: .plain(title: L10n.commonPrivacyPolicy),
kind: .navigationLink { openURL("https://element.io/privacy") }) kind: .button { openURL(context.viewState.privacyURL) })
} }
} }
.compoundList() .compoundList()
@@ -41,7 +41,7 @@ struct LegalInformationScreen: View {
// MARK: - Previews // MARK: - Previews
struct LegalInformationScreen_Previews: PreviewProvider { struct LegalInformationScreen_Previews: PreviewProvider {
static let viewModel = LegalInformationScreenViewModel() static let viewModel = LegalInformationScreenViewModel(appSettings: AppSettings())
static var previews: some View { static var previews: some View {
LegalInformationScreen(context: viewModel.context) LegalInformationScreen(context: viewModel.context)
} }
@@ -22,6 +22,7 @@ struct SettingsScreenCoordinatorParameters {
let userSession: UserSessionProtocol let userSession: UserSessionProtocol
let bugReportService: BugReportServiceProtocol let bugReportService: BugReportServiceProtocol
let notificationSettings: NotificationSettingsProxyProtocol let notificationSettings: NotificationSettingsProxyProtocol
let appSettings: AppSettings
} }
enum SettingsScreenCoordinatorAction { enum SettingsScreenCoordinatorAction {
@@ -132,7 +133,7 @@ final class SettingsScreenCoordinator: CoordinatorProtocol {
} }
private func presentLegalInformationScreen() { private func presentLegalInformationScreen() {
parameters.navigationStackCoordinator?.push(LegalInformationScreenCoordinator()) parameters.navigationStackCoordinator?.push(LegalInformationScreenCoordinator(appSettings: parameters.appSettings))
} }
private func verifySession() { private func verifySession() {
@@ -33,9 +33,10 @@ class AuthenticationServiceProxy: AuthenticationServiceProxyProtocol {
let oidcConfiguration = OidcConfiguration(clientName: InfoPlistReader.main.bundleDisplayName, let oidcConfiguration = OidcConfiguration(clientName: InfoPlistReader.main.bundleDisplayName,
redirectUri: appSettings.oidcRedirectURL.absoluteString, redirectUri: appSettings.oidcRedirectURL.absoluteString,
clientUri: appSettings.oidcClientURL.absoluteString, clientUri: appSettings.websiteURL.absoluteString,
tosUri: appSettings.oidcTermsURL.absoluteString, logoUri: appSettings.logoURL.absoluteString,
policyUri: appSettings.oidcPolicyURL.absoluteString, tosUri: appSettings.acceptableUseURL.absoluteString,
policyUri: appSettings.privacyURL.absoluteString,
staticRegistrations: appSettings.oidcStaticRegistrations.mapKeys { $0.absoluteString }) staticRegistrations: appSettings.oidcStaticRegistrations.mapKeys { $0.absoluteString })
authenticationService = AuthenticationService(basePath: userSessionStore.baseDirectory.path, authenticationService = AuthenticationService(basePath: userSessionStore.baseDirectory.path,
@@ -171,7 +171,8 @@ class MockScreen: Identifiable {
userIndicatorController: nil, userIndicatorController: nil,
userSession: MockUserSession(clientProxy: clientProxy, mediaProvider: MockMediaProvider()), userSession: MockUserSession(clientProxy: clientProxy, mediaProvider: MockMediaProvider()),
bugReportService: BugReportServiceMock(), bugReportService: BugReportServiceMock(),
notificationSettings: NotificationSettingsProxyMock(with: .init()))) notificationSettings: NotificationSettingsProxyMock(with: .init()),
appSettings: ServiceLocator.shared.settings))
navigationStackCoordinator.setRootCoordinator(coordinator) navigationStackCoordinator.setRootCoordinator(coordinator)
return navigationStackCoordinator return navigationStackCoordinator
case .bugReport: case .bugReport:
+1
View File
@@ -0,0 +1 @@
Add app logo and fix terms link for OIDC login (only affects fresh app installs).
+1 -1
View File
@@ -45,7 +45,7 @@ packages:
# Element/Matrix dependencies # Element/Matrix dependencies
MatrixRustSDK: MatrixRustSDK:
url: https://github.com/matrix-org/matrix-rust-components-swift url: https://github.com/matrix-org/matrix-rust-components-swift
exactVersion: 1.1.2 exactVersion: 1.1.3
# path: ../matrix-rust-sdk # path: ../matrix-rust-sdk
DesignKit: DesignKit:
path: DesignKit path: DesignKit