mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Replace the Report a Problem button with the app's version on the start screen. (#4262)
Tapping it 7-times will secretly reveal the bug report screen 🤫
This commit is contained in:
@@ -795,6 +795,7 @@
|
||||
"screen_notification_settings_system_notifications_action_required_content_link" = "system settings";
|
||||
"screen_notification_settings_system_notifications_turned_off" = "System notifications turned off";
|
||||
"screen_notification_settings_title" = "Notifications";
|
||||
"screen_onboarding_app_version" = "Version %1$@";
|
||||
"screen_onboarding_sign_in_manually" = "Sign in manually";
|
||||
"screen_onboarding_sign_in_to" = "Sign in to %1$@";
|
||||
"screen_onboarding_sign_in_with_qr_code" = "Sign in with QR code";
|
||||
|
||||
@@ -1782,6 +1782,10 @@ internal enum L10n {
|
||||
internal static var screenNotificationSettingsSystemNotificationsTurnedOff: String { return L10n.tr("Localizable", "screen_notification_settings_system_notifications_turned_off") }
|
||||
/// Notifications
|
||||
internal static var screenNotificationSettingsTitle: String { return L10n.tr("Localizable", "screen_notification_settings_title") }
|
||||
/// Version %1$@
|
||||
internal static func screenOnboardingAppVersion(_ p1: Any) -> String {
|
||||
return L10n.tr("Localizable", "screen_onboarding_app_version", String(describing: p1))
|
||||
}
|
||||
/// Sign in manually
|
||||
internal static var screenOnboardingSignInManually: String { return L10n.tr("Localizable", "screen_onboarding_sign_in_manually") }
|
||||
/// Sign in to %1$@
|
||||
|
||||
@@ -123,14 +123,14 @@ enum A11yIdentifiers {
|
||||
struct AuthenticationStartScreen {
|
||||
let signIn = "authentication_start-sign_in"
|
||||
let signInWithQr = "authentication_start-sign_in_with_qr"
|
||||
let reportAProblem = "authentication_start-report_a_problem"
|
||||
let appVersion = "authentication_start-app_version"
|
||||
let hidden = "authentication_start-hidden"
|
||||
}
|
||||
|
||||
struct ReportContent {
|
||||
let ignoreUser = "report_content-ignore_user"
|
||||
}
|
||||
|
||||
|
||||
struct RoomScreen {
|
||||
let name = "room-name"
|
||||
let avatar = "room-avatar"
|
||||
|
||||
-1
@@ -36,7 +36,6 @@ struct AuthenticationStartScreenViewState: BindableState {
|
||||
let serverName: String?
|
||||
let showCreateAccountButton: Bool
|
||||
let showQRCodeLoginButton: Bool
|
||||
let showReportProblemButton: Bool
|
||||
|
||||
var bindings = AuthenticationStartScreenViewStateBindings()
|
||||
|
||||
|
||||
+9
-7
@@ -16,6 +16,8 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType
|
||||
private let appSettings: AppSettings
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
|
||||
private let canReportProblem: Bool
|
||||
|
||||
private var actionsSubject: PassthroughSubject<AuthenticationStartScreenViewModelAction, Never> = .init()
|
||||
|
||||
var actions: AnyPublisher<AuthenticationStartScreenViewModelAction, Never> {
|
||||
@@ -31,6 +33,7 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType
|
||||
self.provisioningParameters = provisioningParameters
|
||||
self.appSettings = appSettings
|
||||
self.userIndicatorController = userIndicatorController
|
||||
canReportProblem = isBugReportServiceEnabled
|
||||
|
||||
let isQRCodeScanningSupported = !ProcessInfo.processInfo.isiOSAppOnMac
|
||||
|
||||
@@ -39,20 +42,17 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType
|
||||
// The assumption here being that if you're running a custom app, your users will already be created.
|
||||
AuthenticationStartScreenViewState(serverName: appSettings.accountProviders.count == 1 ? appSettings.accountProviders[0] : nil,
|
||||
showCreateAccountButton: false,
|
||||
showQRCodeLoginButton: isQRCodeScanningSupported,
|
||||
showReportProblemButton: isBugReportServiceEnabled)
|
||||
showQRCodeLoginButton: isQRCodeScanningSupported)
|
||||
} else if let provisioningParameters {
|
||||
// We only show the "Sign in to …" button when using a provisioning link.
|
||||
AuthenticationStartScreenViewState(serverName: provisioningParameters.accountProvider,
|
||||
showCreateAccountButton: false,
|
||||
showQRCodeLoginButton: false,
|
||||
showReportProblemButton: isBugReportServiceEnabled)
|
||||
showQRCodeLoginButton: false)
|
||||
} else {
|
||||
// The default configuration.
|
||||
AuthenticationStartScreenViewState(serverName: nil,
|
||||
showCreateAccountButton: appSettings.showCreateAccountButton,
|
||||
showQRCodeLoginButton: isQRCodeScanningSupported,
|
||||
showReportProblemButton: isBugReportServiceEnabled)
|
||||
showQRCodeLoginButton: isQRCodeScanningSupported)
|
||||
}
|
||||
|
||||
super.init(initialViewState: initialViewState)
|
||||
@@ -70,7 +70,9 @@ class AuthenticationStartScreenViewModel: AuthenticationStartScreenViewModelType
|
||||
case .register:
|
||||
actionsSubject.send(.register)
|
||||
case .reportProblem:
|
||||
actionsSubject.send(.reportProblem)
|
||||
if canReportProblem {
|
||||
actionsSubject.send(.reportProblem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
-15
@@ -35,18 +35,15 @@ struct AuthenticationStartScreen: View {
|
||||
}
|
||||
.frame(maxHeight: .infinity)
|
||||
.safeAreaInset(edge: .bottom) {
|
||||
if context.viewState.showReportProblemButton {
|
||||
Button {
|
||||
versionText
|
||||
.font(.compound.bodySM)
|
||||
.foregroundColor(.compound.textSecondary)
|
||||
.frame(maxWidth: .infinity)
|
||||
.padding(.bottom)
|
||||
.onTapGesture(count: 7) {
|
||||
context.send(viewAction: .reportProblem)
|
||||
} label: {
|
||||
Text(L10n.commonReportAProblem)
|
||||
.font(.compound.bodySM)
|
||||
.foregroundColor(.compound.textSecondary)
|
||||
.padding(.bottom)
|
||||
}
|
||||
.frame(width: geometry.size.width)
|
||||
.accessibilityIdentifier(A11yIdentifiers.authenticationStartScreen.reportAProblem)
|
||||
}
|
||||
.accessibilityIdentifier(A11yIdentifiers.authenticationStartScreen.appVersion)
|
||||
}
|
||||
}
|
||||
.navigationBarHidden(true)
|
||||
@@ -117,28 +114,31 @@ struct AuthenticationStartScreen: View {
|
||||
.padding(.horizontal, verticalSizeClass == .compact ? 128 : 24)
|
||||
.readableFrame()
|
||||
}
|
||||
|
||||
var versionText: Text {
|
||||
// Let's not deal with snapshotting a changing version string.
|
||||
let shortVersionString = ProcessInfo.isRunningTests ? "0.0.0" : InfoPlistReader.main.bundleShortVersionString
|
||||
return Text(L10n.screenOnboardingAppVersion(shortVersionString))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
struct AuthenticationStartScreen_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = makeViewModel()
|
||||
static let bugReportDisabledViewModel = makeViewModel(isBugReportServiceEnabled: false)
|
||||
static let provisionedViewModel = makeViewModel(provisionedServerName: "example.com")
|
||||
|
||||
static var previews: some View {
|
||||
AuthenticationStartScreen(context: viewModel.context)
|
||||
.previewDisplayName("Default")
|
||||
AuthenticationStartScreen(context: bugReportDisabledViewModel.context)
|
||||
.previewDisplayName("Bug report disabled")
|
||||
AuthenticationStartScreen(context: provisionedViewModel.context)
|
||||
.previewDisplayName("Provisioned")
|
||||
}
|
||||
|
||||
static func makeViewModel(isBugReportServiceEnabled: Bool = true, provisionedServerName: String? = nil) -> AuthenticationStartScreenViewModel {
|
||||
static func makeViewModel(provisionedServerName: String? = nil) -> AuthenticationStartScreenViewModel {
|
||||
AuthenticationStartScreenViewModel(authenticationService: AuthenticationService.mock,
|
||||
provisioningParameters: provisionedServerName.map { .init(accountProvider: $0, loginHint: nil) },
|
||||
isBugReportServiceEnabled: isBugReportServiceEnabled,
|
||||
isBugReportServiceEnabled: true,
|
||||
appSettings: ServiceLocator.shared.settings,
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
}
|
||||
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:816f085c82fc0866cc1052e8b16bc6cb035d5f69cdc8388dd44d8a5ced97b34e
|
||||
size 109090
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ba61a003238a0fb7b3188dca3f5735c386c9d2bd6488ae15d31376d3b1899a73
|
||||
size 126888
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d7b8b73c30044017dc8db3f5b540011fb9e502d68beabfae0f85daede922f342
|
||||
size 521551
|
||||
-3
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:3074c78aa668a0b9f194e85bbd41af06985c831e6680f4d7bc8c131f0acdb185
|
||||
size 544472
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9739d20915112a358519b0ad80382b27827df4b26dd504a08d71ebe3ec041ff3
|
||||
size 112019
|
||||
oid sha256:6158f690ffe1defeef9b583dd8267204ee733a45f2f5cf44d6696cc5af64789b
|
||||
size 111970
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d5727c77119c15ced3ed6e082ce49f62700182108d9e1180aec189eb263faa50
|
||||
size 131397
|
||||
oid sha256:514e4b542257ee77beb1c82896476935e1d8a1727d8a77384545cd94f8f87ea5
|
||||
size 132189
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:eb04e0fe5ea0927e4d5c6cf4106fc2701c82339b58e2e06ebe5cd98543075bd8
|
||||
size 511373
|
||||
oid sha256:43a70f508336cb1d5fe0f3679b700b3d6cd8e64182b549e40f42c8f8aa0374e0
|
||||
size 510930
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:50ee33846226e8d5ad192d544c4566cb6e7e92ff1f2b1181eb77d907f18e92c1
|
||||
size 534890
|
||||
oid sha256:7c7c51cd982fa0262784bf27f4a9bd295219a7733bc2ed4359d403bd81d2564f
|
||||
size 533667
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ea83e380f7edc4b64fc32bf9efe3e646a55e99674b2c23c0f6133c4068478735
|
||||
size 99912
|
||||
oid sha256:a1a60cca5b53f6998cb6c2bf2cf1a8dd2fdd1343ea76fd72df32bba1d07fd011
|
||||
size 99862
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ae0ab1353481ccf9413276e74e4ed133e40d1fcdb3a098a9aaa2109ac782edee
|
||||
size 118205
|
||||
oid sha256:9ab408cd8e4aa4f955a03f68d845a5ac4d57e90ebbbab6b3fa0502aa6d0407c9
|
||||
size 118992
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:23d5b99dffbf13745655e85d5710c600458786ee7006a5cc5595e760c9beecb8
|
||||
size 532099
|
||||
oid sha256:97d86af1a0f6eeb5d6933b13a6a5de3df8db1d2672d2e7cdf1f2fe83a0adbf64
|
||||
size 531619
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:8e07f75e8576371d2937b9595da7b9473261c8ea1deab9ad7aca3aa686ea510d
|
||||
size 559743
|
||||
oid sha256:bda2bb728b9f9179ea211c5de083c8f4b67a6ffc4cc2f484c81c9ec4bb40d013
|
||||
size 558660
|
||||
|
||||
@@ -229,8 +229,8 @@ class AuthenticationFlowCoordinatorUITests: XCTestCase {
|
||||
}
|
||||
|
||||
func verifyReportBugButton(_ app: XCUIApplication) async throws {
|
||||
// Splash Screen: Report a problem button.
|
||||
app.buttons[A11yIdentifiers.authenticationStartScreen.reportAProblem].tap()
|
||||
// Splash Screen: Tap the version 7 times to report a problem
|
||||
app.staticTexts[A11yIdentifiers.authenticationStartScreen.appVersion].tap(withNumberOfTaps: 7, numberOfTouches: 1)
|
||||
|
||||
// Bug report: Make sure it exists then cancel.
|
||||
XCTAssert(app.textFields[A11yIdentifiers.bugReportScreen.report].exists)
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:80fd069026bfa66edfa0dc3504e600e5d32fc1b081f255cc9c7dae7643bd3610
|
||||
size 1335111
|
||||
oid sha256:351886f6d3c32d3974f45355f02181cd7cd7d17e42307db3d2ff3f6cdd204a15
|
||||
size 1335074
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c0f65ff050c24acbff22f9687103ea0fe62bd50c20a9af97b5413393697fa173
|
||||
size 1207677
|
||||
oid sha256:2dfab1c0f961f1ff462a59ddc9808097a169d192c7e15dc6b6584c8e2c4c683a
|
||||
size 1207125
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:eea5297a9bded2679b86a8884ddab8e6ebb83ea41d9373759fa38c31cca05e34
|
||||
size 1371559
|
||||
oid sha256:b3b1f064daf87075db48349d38a059130a5d8013b5b1cdc151c2e7984d540bd3
|
||||
size 1371532
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:827b57b732448bab45b2bae268dad31c48b9576e3a9d96a4a382e0ce2e7aa531
|
||||
size 1210036
|
||||
oid sha256:014d8073cd74d1670c69e40223d28e43fd7b1cf78808e11e00f03fa57985c950
|
||||
size 1209397
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9f9b378ca59a6976c0a5ac40d1b670f5ed813334095f538e63cae6c539311fb0
|
||||
size 1337155
|
||||
oid sha256:48b1bec8ce9499d753b0e9a2d2bc747992b8c910d3b45383a99448c19e5d6137
|
||||
size 1336486
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:208e50e192c288069dd95ee88619b593b96b203a511c92539c27ddf0982a5aa4
|
||||
size 1210790
|
||||
oid sha256:0b7b0c0881194fb9a99d4872b303f61704cd29f289c1c1dda07f4ab15bad8869
|
||||
size 1209112
|
||||
|
||||
Reference in New Issue
Block a user