Feature/3732 pin login in new login flow

This commit is contained in:
Frank Rotermund
2022-11-29 10:56:18 +00:00
parent 89a98e94be
commit cb78e6d70f
6 changed files with 51 additions and 17 deletions

View File

@@ -411,7 +411,7 @@ class BWIBuildSettings: NSObject {
// MARK: - Onboarding
var onboardingShowAccountPersonalization = false
var onboardingEnableNewAuthenticationFlow = false
var onboardingEnableNewAuthenticationFlow = true
// ---

View File

@@ -43,7 +43,7 @@ when String # specific MatrixSDK released version
$matrixSDKVersionSpec = $matrixSDKVersion
end
$matrixSDKVersionSpec = { :git => 'https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios-matrix-sdk', :tag => 'v0.24.2_bwi_beta' }
$matrixSDKVersionSpec = { :git => 'https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios-matrix-sdk', :tag => 'v0.24.2_bwi' }
# Method to import the MatrixSDK
def import_MatrixSDK

View File

@@ -767,6 +767,10 @@ public class BWIL10n: NSObject {
public static var keyVerificationVerifiedThisSessionInformation: String {
return BWIL10n.tr("Bwi", "key_verification_verified_this_session_information")
}
///
public static var locationSharingCopyrightLabel: String {
return BWIL10n.tr("Bwi", "location_sharing_copyright_label")
}
/// Diagnosedaten senden
public static var matomoSettingsSendDiagnosticData: String {
return BWIL10n.tr("Bwi", "MATOMO_SETTINGS_SEND_DIAGNOSTIC_DATA")

View File

@@ -55,9 +55,6 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
// We will notify user only once on session failure
BOOL notifyOpenSessionFailure;
// The timer used to postpone server sync on failure
NSTimer* initialServerSyncTimer;
// Reachability observer
id reachabilityObserver;
@@ -941,9 +938,6 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
sessionStateObserver = nil;
}
[initialServerSyncTimer invalidate];
initialServerSyncTimer = nil;
if (userUpdateListener)
{
[mxSession.myUser removeListener:userUpdateListener];
@@ -1143,8 +1137,6 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
// Cancel pending actions
[[NSNotificationCenter defaultCenter] removeObserver:reachabilityObserver];
reachabilityObserver = nil;
[initialServerSyncTimer invalidate];
initialServerSyncTimer = nil;
MXLogDebug(@"[MXKAccount] Pause is delayed due to the session state: %@", [MXTools readableSessionState: mxSession.state]);
}
@@ -1634,8 +1626,6 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
// Cancel potential reachability observer and pending action
[[NSNotificationCenter defaultCenter] removeObserver:reachabilityObserver];
reachabilityObserver = nil;
[initialServerSyncTimer invalidate];
initialServerSyncTimer = nil;
// Sanity check
if (!mxSession || (mxSession.state != MXSessionStateStoreDataReady && mxSession.state != MXSessionStateInitialSyncFailed))
@@ -1702,8 +1692,8 @@ static NSArray<NSNumber*> *initialSyncSilentErrorsHTTPStatusCodes;
if (networkReachabilityManager.isReachable)
{
// The problem is not the network
// Postpone a new attempt in 10 sec
self->initialServerSyncTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(launchInitialServerSync) userInfo:self repeats:NO];
// If we have network, we retry immediately, otherwise the server may clear any cache it has computed thus far
[self launchInitialServerSync];
}
else
{

View File

@@ -160,8 +160,14 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
/// Displays the next view in the flow after the splash screen.
private func bwiSplashScreenCoordinator(_ coordinator: OnboardingBwiSplashScreenCoordinator, didCompleteWith result: OnboardingBwiSplashScreenViewModelResult) {
// splashScreenResult = result
showLegacyAuthenticationScreen()
startLoading()
if BWIBuildSettings.shared.onboardingEnableNewAuthenticationFlow {
beginAuthentication(with: .login) { [weak self] in
self?.stopLoading()
}
} else {
showLegacyAuthenticationScreen(forceAsRootModule: true)
}
}
/// Show an empty screen when configuring soft logout flow
@@ -342,6 +348,11 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
showAnalyticsPrompt(for: session)
return
}
// bwi Show SetPin Workflow after Login and before Passphrase workflow
else if PinCodePreferences.shared.forcePinProtection {
showPincodePromt(for: session)
return
}
// Otherwise onboarding is finished.
onboardingFinished = true
@@ -566,6 +577,17 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
completeIfReady()
}
private func showPincodePromt(for session: MXSession) {
// bwi show old coordinator flow similar to how its done for passphrase workflow
let pinCoordinator = SetPinCoordinator(session: session, viewMode: .setPinAfterLogin, pinCodePreferences: PinCodePreferences.shared)
pinCoordinator.delegate = self
navigationRouter.present(pinCoordinator.toPresentable(), animated: true)
add(childCoordinator: pinCoordinator)
pinCoordinator.start()
}
// MARK: - Finished
/// Calls the coordinator's completion handler if both `onboardingFinished` and `authenticationFinished`
@@ -664,3 +686,20 @@ extension OnboardingUseCaseViewModelResult {
}
}
}
extension OnboardingCoordinator: SetPinCoordinatorDelegate {
func setPinCoordinatorDidComplete(_ coordinator: SetPinCoordinatorType) {
navigationRouter.dismissModule(animated: true) { [weak self] in
self?.onboardingFinished = true
self?.completeIfReady()
}
}
func setPinCoordinatorDidCompleteWithReset(_ coordinator: SetPinCoordinatorType, dueToTooManyErrors: Bool) {
// bwi: should not happen on login -> Its better to remain stuck in onboarding if this happens
}
func setPinCoordinatorDidCancel(_ coordinator: SetPinCoordinatorType) {
// bwi: can't happen because canceling is not allowed for our flow
}
}

View File

@@ -61,7 +61,8 @@ class VoiceMessageAudioPlayer: NSObject {
}
var currentTime: TimeInterval {
return abs(CMTimeGetSeconds(audioPlayer?.currentTime() ?? .zero))
let currentTime = abs(CMTimeGetSeconds(audioPlayer?.currentTime() ?? .zero))
return currentTime.isFinite ? currentTime : .zero
}
var playerItems: [AVPlayerItem] {