Skip to content

Commit

Permalink
feat(LockedAppView): Button should be loading while evaluating policy
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinperignon committed May 23, 2024
1 parent e0a8bd8 commit 3dd0b6b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Mail/Views/LockedAppView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct LockedAppView: View {

@EnvironmentObject var navigationState: RootViewState

@State private var isEvaluatingPolicy = false

var body: some View {
ZStack {
VStack(spacing: UIPadding.medium) {
Expand All @@ -49,6 +51,7 @@ struct LockedAppView: View {
.buttonStyle(.ikPlain)
.controlSize(.large)
.ikButtonFullWidth(true)
.ikButtonLoading(isEvaluatingPolicy)
}
.padding(.top, UIPadding.onBoardingLogoTop)
.padding(.bottom, value: .large)
Expand All @@ -61,12 +64,17 @@ struct LockedAppView: View {
}

private func unlockApp() {
guard !isEvaluatingPolicy else { return }

Task {
isEvaluatingPolicy = true
if await (try? appLockHelper.evaluatePolicy(reason: MailResourcesStrings.Localizable.lockAppTitle)) == true {
appLockHelper.setTime()
Task {
navigationState.transitionToRootViewDestination(.mainView)
}
} else {
isEvaluatingPolicy = false
}
}
}
Expand Down
1 change: 0 additions & 1 deletion MailCoreUI/Utils/SceneLifecycleModifier.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
/*
Infomaniak Mail - iOS App
Copyright (C) 2024 Infomaniak Network SA
Expand Down

0 comments on commit 3dd0b6b

Please sign in to comment.