@@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.height
1717import androidx.compose.foundation.layout.heightIn
1818import androidx.compose.foundation.layout.padding
1919import androidx.compose.foundation.layout.size
20+ import androidx.compose.foundation.layout.width
2021import androidx.compose.foundation.rememberScrollState
2122import androidx.compose.foundation.text.KeyboardOptions
2223import androidx.compose.foundation.verticalScroll
@@ -56,32 +57,26 @@ import network.loki.messenger.R
5657import network.loki.messenger.libsession_util.protocol.ProFeature
5758import network.loki.messenger.libsession_util.protocol.ProFeatures
5859import org.session.libsession.messaging.groups.LegacyGroupDeprecationManager
59- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.ChangeEnvironment
60- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.ClearTrustedDownloads
61- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.Copy07PrefixedBlindedPublicKey
62- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.CopyAccountId
63- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.HideDeprecationChangeDialog
64- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.HideEnvironmentWarningDialog
65- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.OverrideDeprecationState
66- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.ScheduleTokenNotification
67- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.ShowDeprecationChangeDialog
68- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.ShowEnvironmentWarningDialog
69- import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.GenerateContacts
60+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Commands.*
61+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Companion.FALSE
62+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Companion.NOT_SET
63+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Companion.SEEN_1
64+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Companion.SEEN_2
65+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Companion.SEEN_3
66+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Companion.SEEN_4
67+ import org.thoughtcrime.securesms.debugmenu.DebugMenuViewModel.Companion.TRUE
7068import org.thoughtcrime.securesms.pro.ProStatusManager
7169import org.thoughtcrime.securesms.ui.AlertDialog
7270import org.thoughtcrime.securesms.ui.Cell
7371import org.thoughtcrime.securesms.ui.DialogButtonData
72+ import org.thoughtcrime.securesms.ui.Divider
7473import org.thoughtcrime.securesms.ui.GetString
7574import org.thoughtcrime.securesms.ui.LoadingDialog
7675import org.thoughtcrime.securesms.ui.components.SlimFillButtonRect
7776import org.thoughtcrime.securesms.ui.components.BackAppBar
78- import org.thoughtcrime.securesms.ui.components.Button
79- import org.thoughtcrime.securesms.ui.components.ButtonType
8077import org.thoughtcrime.securesms.ui.components.DropDown
8178import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
8279import org.thoughtcrime.securesms.ui.components.SessionSwitch
83- import org.thoughtcrime.securesms.ui.components.SlimFillButtonRect
84- import org.thoughtcrime.securesms.ui.components.SlimFillButtonRect
8580import org.thoughtcrime.securesms.ui.theme.LocalColors
8681import org.thoughtcrime.securesms.ui.theme.LocalDimensions
8782import org.thoughtcrime.securesms.ui.theme.LocalType
@@ -223,7 +218,9 @@ fun DebugMenu(
223218 // Debug Logger
224219 DebugCell (
225220 " Debug Logger" ,
226- verticalArrangement = Arrangement .spacedBy(0 .dp)) {
221+ verticalArrangement = Arrangement .spacedBy(0 .dp)
222+ )
223+ {
227224 Spacer (modifier = Modifier .height(LocalDimensions .current.xxsSpacing))
228225
229226 SlimFillButtonRect (
@@ -254,7 +251,8 @@ fun DebugMenu(
254251 // Session Pro
255252 DebugCell (
256253 " Session Pro" ,
257- verticalArrangement = Arrangement .spacedBy(0 .dp)) {
254+ verticalArrangement = Arrangement .spacedBy(0 .dp))
255+ {
258256 Spacer (modifier = Modifier .height(LocalDimensions .current.xsSpacing))
259257
260258 Text (text = " Purchase a plan" )
@@ -420,6 +418,71 @@ fun DebugMenu(
420418 }
421419 }
422420
421+ // Donations
422+ DebugCell (" Donations" ) {
423+ Text (
424+ text = " First app install: ${uiState.firstInstall} " ,
425+ style = LocalType .current.base
426+ )
427+ Text (
428+ text = " Has donated: ${uiState.hasDonated} " ,
429+ style = LocalType .current.base
430+ )
431+ Text (
432+ text = " Has copied donate URL: ${uiState.hasCopiedDonationURL} " ,
433+ style = LocalType .current.base
434+ )
435+ Text (
436+ text = " Seen donation CTA amount: ${uiState.seenDonateCTAAmount} times" ,
437+ style = LocalType .current.base
438+ )
439+ Text (
440+ text = " Last seen donation CTA: ${uiState.lastSeenDonateCTA} " ,
441+ style = LocalType .current.base
442+ )
443+ Text (
444+ text = " Show CTA from positive review: ${uiState.showDonateCTAFromPositiveReview} " ,
445+ style = LocalType .current.base
446+ )
447+
448+ Spacer (modifier = Modifier .height(LocalDimensions .current.xxxsSpacing))
449+ Divider ()
450+ Spacer (modifier = Modifier .height(LocalDimensions .current.xxxsSpacing))
451+
452+ DebugDropDownRow (
453+ text = " Debug 'Has donated': " ,
454+ selectedText = uiState.hasDonatedDebug,
455+ values = listOf (NOT_SET , TRUE , FALSE ),
456+ onValueSelected = {
457+ sendCommand(SetDebugHasDonated (it))
458+ }
459+ )
460+ DebugDropDownRow (
461+ text = " Debug 'Has copied link': " ,
462+ selectedText = uiState.hasCopiedDonationURLDebug,
463+ values = listOf (NOT_SET , TRUE , FALSE ),
464+ onValueSelected = {
465+ sendCommand(SetDebugHasCopiedDonation (it))
466+ }
467+ )
468+ DebugDropDownRow (
469+ text = " Debug 'CTA seen amount': " ,
470+ selectedText = uiState.seenDonateCTAAmountDebug,
471+ values = listOf (NOT_SET , SEEN_1 , SEEN_2 , SEEN_3 , SEEN_4 ),
472+ onValueSelected = {
473+ sendCommand(SetDebugDonationCTAViews (it))
474+ }
475+ )
476+ DebugDropDownRow (
477+ text = " Debug 'Show donation from app review': " ,
478+ selectedText = uiState.showDonateCTAFromPositiveReviewDebug,
479+ values = listOf (NOT_SET , TRUE , FALSE ),
480+ onValueSelected = {
481+ sendCommand(SetDebugShowDonationFromReview (it))
482+ }
483+ )
484+ }
485+
423486 // Fake contacts
424487 DebugCell (" Generate fake contacts" ) {
425488 var prefix by remember { mutableStateOf(" User-" ) }
@@ -741,14 +804,15 @@ private fun DebugRow(
741804 Row (
742805 modifier = modifier.heightIn(min = minHeight),
743806 verticalAlignment = Alignment .CenterVertically ,
744- horizontalArrangement = Arrangement .spacedBy(LocalDimensions .current.xsSpacing)
745807 ) {
746808 Text (
747809 text = title,
748810 style = LocalType .current.base,
749811 modifier = Modifier .weight(1f )
750812 )
751813
814+ Spacer (modifier = Modifier .width(LocalDimensions .current.xsSpacing))
815+
752816 content()
753817 }
754818}
@@ -799,7 +863,30 @@ fun DebugCheckboxRow(
799863 )
800864 )
801865 }
866+ }
802867
868+ @Composable
869+ fun DebugDropDownRow (
870+ text : String ,
871+ selectedText : String ,
872+ values : List <String >,
873+ onValueSelected : (String ) -> Unit ,
874+ modifier : Modifier = Modifier ,
875+ minHeight : Dp = LocalDimensions .current.itemButtonIconSpacing,
876+ ) {
877+ DebugRow (
878+ title = text,
879+ minHeight = minHeight,
880+ modifier = modifier
881+ .fillMaxWidth(),
882+ ) {
883+ DropDown (
884+ modifier = Modifier .weight(1f , fill = false ),
885+ selectedText = selectedText,
886+ values = values,
887+ onValueSelected = onValueSelected
888+ )
889+ }
803890}
804891
805892@Composable
@@ -862,6 +949,16 @@ fun PreviewDebugMenu() {
862949 withinQuickRefund = true ,
863950 forceDeterministicEncryption = false ,
864951 debugAvatarReupload = true ,
952+ hasDonated = false ,
953+ hasCopiedDonationURL = false ,
954+ seenDonateCTAAmount = 0 ,
955+ lastSeenDonateCTA = " -" ,
956+ showDonateCTAFromPositiveReview = false ,
957+ hasDonatedDebug = " " ,
958+ hasCopiedDonationURLDebug = " " ,
959+ seenDonateCTAAmountDebug = " " ,
960+ showDonateCTAFromPositiveReviewDebug = " " ,
961+ firstInstall = " "
865962 ),
866963 sendCommand = {},
867964 onClose = {}
0 commit comments