mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-04 21:37:45 +00:00
desktop: don't open a second badges page or profile form
These buttons stay clickable on desktop while their page is shown in another pane, so each click opened another copy: - "Support SimpleX" in the chat's large-file and badge alerts (Badges on the right): the alerts skip while Badges is open, on desktop only, as on Android the page covers the button; - "+ Add profile" in Your chat profiles and "Create chat profile" in the picker (form in the center): skip while the form is on top, keeping what was typed, before asking for authentication; the picker row still hides the picker.
This commit is contained in:
1 parent
abb06e9f10
commit
e07a5a283f
5 files changed
+11
-5
No files matched your search
+1
-1
@@ -333,7 +333,7 @@ fun showLargeFileAlert(fileSize: Long, incognito: Boolean, senderProfile: LocalP
|
||||
text = text,
|
||||
confirmText = generalGetString(MR.strings.ok),
|
||||
dismissText = generalGetString(MR.strings.badges_support_simplex_title),
|
||||
onDismiss = ::openBadgesView
|
||||
onDismiss = { if (!appPlatform.isDesktop || !ModalManager.end.hasModalOpen(ModalViewId.BADGES)) openBadgesView() }
|
||||
)
|
||||
} else {
|
||||
AlertManager.shared.showAlertMsg(title, text)
|
||||
|
||||
+5
-1
@@ -274,8 +274,12 @@ fun UserPicker(
|
||||
painterResource(MR.images.ic_manage_accounts),
|
||||
generalGetString(MR.strings.create_chat_profile),
|
||||
{
|
||||
if (ModalManager.center.isTopModalOpen(ModalViewId.CREATE_PROFILE)) {
|
||||
userPickerState.value = AnimatedViewState.HIDING
|
||||
return@UserPickerOptionRow
|
||||
}
|
||||
doWithAuth(generalGetString(MR.strings.auth_open_chat_profiles), generalGetString(MR.strings.auth_log_in_using_credential)) {
|
||||
ModalManager.center.showModalCloseable { close ->
|
||||
ModalManager.center.showModalCloseable(id = ModalViewId.CREATE_PROFILE) { close ->
|
||||
LaunchedEffect(Unit) {
|
||||
userPickerState.value = AnimatedViewState.HIDING
|
||||
}
|
||||
|
||||
+1
-1
@@ -252,7 +252,7 @@ fun showBadgeInfoAlert(name: String, badge: LocalBadge, uriHandler: UriHandler)
|
||||
text = supports,
|
||||
confirmText = generalGetString(MR.strings.ok),
|
||||
dismissText = generalGetString(MR.strings.badges_support_simplex_title),
|
||||
onDismiss = ::openBadgesView
|
||||
onDismiss = { if (!appPlatform.isDesktop || !ModalManager.end.hasModalOpen(ModalViewId.BADGES)) openBadgesView() }
|
||||
)
|
||||
} else {
|
||||
AlertManager.shared.showAlertMsg(title = title, text = supports)
|
||||
|
||||
+2
-1
@@ -94,7 +94,8 @@ enum class ModalViewId {
|
||||
CONTEXT_USER_PICKER_INCOGNITO,
|
||||
BADGE_LINK,
|
||||
BADGE_REDEEM_CODE,
|
||||
BADGES
|
||||
BADGES,
|
||||
CREATE_PROFILE
|
||||
}
|
||||
|
||||
class ModalManager(private val placement: ModalPlacement? = null) {
|
||||
|
||||
+2
-1
@@ -47,8 +47,9 @@ fun UserProfilesView(m: ChatModel, search: MutableState<String>, profileHidden:
|
||||
showHiddenProfilesNotice = m.controller.appPrefs.showHiddenProfilesNotice,
|
||||
visibleUsersCount = visibleUsersCount(m),
|
||||
addUser = {
|
||||
if (ModalManager.center.isTopModalOpen(ModalViewId.CREATE_PROFILE)) return@UserProfilesLayout
|
||||
withAuth {
|
||||
ModalManager.center.showModalCloseable { close ->
|
||||
ModalManager.center.showModalCloseable(id = ModalViewId.CREATE_PROFILE) { close ->
|
||||
CreateProfile(m, close)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user