mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-10-22 13:11:55 +00:00
android: prevent access to chat list when accepting call in locked state (#7627)
* android: prevent access to chat list when accepting call in locked state * android: request auth on resume during a call --------- Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com> Co-authored-by: shum <github.shum@liber.li>
This commit is contained in:
8 files changed
+35
-22
No files matched your search
@@ -207,7 +207,7 @@ fun MainScreen() {
|
||||
SwitchingUsersView()
|
||||
}
|
||||
|
||||
if (unauthorized.value && !(chatModel.activeCallViewIsVisible.value && chatModel.showCallView.value)) {
|
||||
if (unauthorized.value) {
|
||||
LaunchedEffect(Unit) {
|
||||
// With these constrains when user presses back button while on ChatList, activity destroys and shows auth request
|
||||
// while the screen moves to a launcher. Detect it and prevent showing the auth
|
||||
@@ -221,7 +221,8 @@ fun MainScreen() {
|
||||
SplashView(true)
|
||||
ModalManager.fullscreen.showPasscodeInView()
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (!unauthorized.value || chatModel.activeCallViewIsVisible.value) {
|
||||
if (chatModel.showCallView.value) {
|
||||
if (appPlatform.isAndroid) {
|
||||
LaunchedEffect(Unit) {
|
||||
@@ -235,6 +236,8 @@ fun MainScreen() {
|
||||
ActiveCallView()
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!unauthorized.value) {
|
||||
ModalManager.fullscreen.showOneTimePasscodeInView()
|
||||
AlertManager.privacySensitive.showInView()
|
||||
if (onboarding == OnboardingStage.OnboardingComplete) {
|
||||
|
||||
@@ -269,7 +269,11 @@ object AppLock {
|
||||
fun elapsedRealtime(): Long = System.nanoTime() / 1_000_000
|
||||
|
||||
fun recheckAuthState() {
|
||||
if (ChatModel.showCallView.value) return
|
||||
if (ChatModel.showCallView.value) {
|
||||
// BiometricPrompt drops a prompt requested while MainActivity is stopped (call on lock screen), so request it again
|
||||
if (userAuthorized.value == false) runAuthenticate()
|
||||
return
|
||||
}
|
||||
val enteredBackgroundVal = enteredBackground.value
|
||||
val delay = ChatController.appPrefs.laLockDelay.get()
|
||||
if (enteredBackgroundVal == null || elapsedRealtime() - enteredBackgroundVal >= delay * 1000) {
|
||||
|
||||
+2
@@ -1,5 +1,6 @@
|
||||
package chat.simplex.common.platform
|
||||
|
||||
import chat.simplex.common.AppLock
|
||||
import chat.simplex.common.model.*
|
||||
import chat.simplex.common.views.call.RcvCallInvitation
|
||||
import chat.simplex.common.views.chatlist.acceptContactRequest
|
||||
@@ -96,6 +97,7 @@ abstract class NtfManager {
|
||||
}
|
||||
|
||||
fun acceptCallAction(chatId: ChatId) {
|
||||
AppLock.recheckAuthState()
|
||||
chatModel.clearOverlays.value = true
|
||||
val invitation = chatModel.callInvitations[chatId]
|
||||
if (invitation == null) {
|
||||
|
||||
Reference in new issue
Block a user