1
1
package org.thoughtcrime.securesms.preferences
2
2
3
3
import android.Manifest
4
- import android.app.Activity
5
4
import android.content.Context
6
5
import android.content.Intent
7
6
import android.graphics.BitmapFactory
@@ -36,7 +35,6 @@ import androidx.compose.foundation.layout.height
36
35
import androidx.compose.foundation.layout.padding
37
36
import androidx.compose.foundation.layout.size
38
37
import androidx.compose.foundation.shape.CircleShape
39
- import androidx.compose.foundation.shape.RoundedCornerShape
40
38
import androidx.compose.material3.ExperimentalMaterial3Api
41
39
import androidx.compose.material3.Text
42
40
import androidx.compose.material3.rememberModalBottomSheetState
@@ -178,7 +176,7 @@ class SettingsActivity : ScreenLockActionBarActivity() {
178
176
viewModel.permanentlyHidePassword()
179
177
}
180
178
}
181
- private var showDonateDialog : Boolean by mutableStateOf(false )
179
+ private var urlToOPen : String? by mutableStateOf(null )
182
180
private var showAvatarDialog: Boolean by mutableStateOf(false )
183
181
private var showAvatarPickerOptionCamera: Boolean by mutableStateOf(false )
184
182
private var showAvatarPickerOptions: Boolean by mutableStateOf(false )
@@ -207,14 +205,14 @@ class SettingsActivity : ScreenLockActionBarActivity() {
207
205
// set the compose dialog content
208
206
binding.composeLayout.setThemedContent {
209
207
SettingsComposeContent (
210
- showDonateDialog = showDonateDialog ,
208
+ showUrlDialog = urlToOPen ,
211
209
showAvatarDialog = showAvatarDialog,
212
210
startAvatarSelection = ::startAvatarSelection,
213
211
saveAvatar = viewModel::saveAvatar,
214
212
removeAvatar = viewModel::removeAvatar,
215
213
showAvatarPickerOptions = showAvatarPickerOptions,
216
214
showCamera = showAvatarPickerOptionCamera,
217
- hideDonateDialog = { showDonateDialog = false },
215
+ hideUrlDialog = { urlToOPen = null },
218
216
onSheetDismissRequest = { showAvatarPickerOptions = false },
219
217
onGalleryPicked = {
220
218
pickPhotoLauncher.launch(PickVisualMediaRequest (ActivityResultContracts .PickVisualMedia .ImageOnly ))
@@ -272,7 +270,7 @@ class SettingsActivity : ScreenLockActionBarActivity() {
272
270
}
273
271
274
272
binding.sentLogoImageView.setSafeOnClickListener {
275
- openUrl( " https://token.getsession.org" )
273
+ urlToOPen = " https://token.getsession.org"
276
274
}
277
275
278
276
applyCommonWindowInsetsOnViews(mainScrollView = binding.scrollView)
@@ -538,7 +536,7 @@ class SettingsActivity : ScreenLockActionBarActivity() {
538
536
modifier = Modifier .qaTag(R .string.qa_settings_item_donate),
539
537
colors = primaryTextButtonColors()
540
538
) {
541
- showDonateDialog = true
539
+ urlToOPen = " https://session.foundation/donate#app "
542
540
}
543
541
Divider ()
544
542
@@ -601,7 +599,7 @@ class SettingsActivity : ScreenLockActionBarActivity() {
601
599
LargeItemButton (R .string.sessionNotifications, R .drawable.ic_volume_2, Modifier .contentDescription(R .string.AccessibilityId_notifications )) { push<NotificationSettingsActivity >() }
602
600
Divider ()
603
601
604
- LargeItemButton (R .string.sessionConversations, R .drawable.ic_message_square , Modifier .contentDescription(R .string.AccessibilityId_sessionConversations )) { push<ChatSettingsActivity >() }
602
+ LargeItemButton (R .string.sessionConversations, R .drawable.ic_users_round , Modifier .contentDescription(R .string.AccessibilityId_sessionConversations )) { push<ChatSettingsActivity >() }
605
603
Divider ()
606
604
607
605
LargeItemButton (R .string.sessionAppearance, R .drawable.ic_paintbrush_vertical, Modifier .contentDescription(R .string.AccessibilityId_sessionAppearance )) { push<AppearanceSettingsActivity >() }
@@ -644,12 +642,12 @@ class SettingsActivity : ScreenLockActionBarActivity() {
644
642
645
643
@Composable
646
644
fun SettingsComposeContent (
647
- showDonateDialog : Boolean ,
645
+ showUrlDialog : String? ,
648
646
showAvatarDialog : Boolean ,
649
647
startAvatarSelection : ()-> Unit ,
650
648
saveAvatar : ()-> Unit ,
651
649
removeAvatar : ()-> Unit ,
652
- hideDonateDialog : ()-> Unit ,
650
+ hideUrlDialog : ()-> Unit ,
653
651
showAvatarPickerOptions : Boolean ,
654
652
showCamera : Boolean ,
655
653
onSheetDismissRequest : () -> Unit ,
@@ -666,10 +664,10 @@ class SettingsActivity : ScreenLockActionBarActivity() {
666
664
}
667
665
668
666
// donate confirmationAdd commentMore actions
669
- if (showDonateDialog ){
667
+ if (showUrlDialog != null ){
670
668
OpenURLAlertDialog (
671
- url = " https://session.foundation/donate#app " ,
672
- onDismissRequest = hideDonateDialog
669
+ url = showUrlDialog ,
670
+ onDismissRequest = hideUrlDialog
673
671
)
674
672
}
675
673
0 commit comments