Skip to content

Commit 509244c

Browse files
committed
Donation v2 strings
1 parent a3cc8e8 commit 509244c

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

app/src/main/java/org/session/libsession/utilities/StringSubKeys.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@ object StringSubstitutionConstants {
6565
const val ACTION_TYPE_KEY: StringSubKey = "action_type"
6666
const val ACTIVATION_TYPE_KEY: StringSubKey = "activation_type"
6767
const val ENTITY_KEY: StringSubKey = "entity"
68+
const val DONATE_APPEAL_KEY: StringSubKey = "donate_appeal_name"
6869
}

app/src/main/java/org/thoughtcrime/securesms/home/HomeDialogs.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import org.thoughtcrime.securesms.home.HomeViewModel.Commands.HideUrlDialog
5252
import org.thoughtcrime.securesms.home.HomeViewModel.Commands.HideUserProfileModal
5353
import org.thoughtcrime.securesms.home.HomeViewModel.Commands.OnLinkCopied
5454
import org.thoughtcrime.securesms.home.HomeViewModel.Commands.OnLinkOpened
55-
import org.thoughtcrime.securesms.home.HomeViewModel.Commands.ShowDonationConfirmation
5655
import org.thoughtcrime.securesms.home.startconversation.StartConversationSheet
5756
import org.thoughtcrime.securesms.preferences.prosettings.ProSettingsDestination
5857
import org.thoughtcrime.securesms.ui.AlertDialog
@@ -69,6 +68,7 @@ import org.thoughtcrime.securesms.ui.PinProCTA
6968
import org.thoughtcrime.securesms.ui.UserProfileModal
7069
import org.thoughtcrime.securesms.ui.components.AccentFillButtonRect
7170
import org.thoughtcrime.securesms.ui.components.annotatedStringResource
71+
import org.thoughtcrime.securesms.ui.openUrl
7272
import org.thoughtcrime.securesms.ui.qaTag
7373
import org.thoughtcrime.securesms.ui.shimmerOverlay
7474
import org.thoughtcrime.securesms.ui.theme.LocalColors
@@ -77,6 +77,7 @@ import org.thoughtcrime.securesms.ui.theme.LocalType
7777
import org.thoughtcrime.securesms.ui.theme.PreviewTheme
7878
import org.thoughtcrime.securesms.ui.theme.SessionMaterialTheme
7979
import org.thoughtcrime.securesms.ui.theme.blackAlpha40
80+
import org.thoughtcrime.securesms.util.DonationManager.Companion.URL_DONATE
8081

8182
@Composable
8283
fun HomeDialogs(
@@ -271,15 +272,14 @@ fun DonationDialog(
271272
sendCommand(HideDonationCTADialog)
272273
}
273274

274-
val title = Phrase.from(context,R.string.donateSessionHelp) //todo DONV2 proper string
275-
.put(StringSubstitutionConstants.APP_NAME_KEY, NonTranslatableStringConstants.APP_NAME)
275+
val title = Phrase.from(context,R.string.donateSessionAppealTitle)
276+
.put(StringSubstitutionConstants.DONATE_APPEAL_KEY, NonTranslatableStringConstants.DONATE_APPEAL_NAME)
276277
.format()
277278

278-
val text = Phrase.from(context,R.string.donateSessionDescription) //todo DONV2 proper string
279+
val text = Phrase.from(context,R.string.donateSessionAppealDescription)
279280
.put(StringSubstitutionConstants.APP_NAME_KEY, NonTranslatableStringConstants.APP_NAME)
280281
.format()
281282

282-
283283
val titleColor: Color = LocalColors.current.text
284284

285285
BasicSessionAlertDialog(
@@ -347,10 +347,10 @@ fun DonationDialog(
347347
.qaTag(R.string.qa_cta_button_positive)
348348
.weight(1f)
349349
.shimmerOverlay(),
350-
text = "Read Appeal", //stringResource(R.string.donate), //todo DONV2 proper string
350+
text = stringResource(R.string.donateSessionAppealReadMore),
351351
onClick = {
352-
sendCommand(HideDonationCTADialog)
353-
sendCommand(ShowDonationConfirmation)
352+
context.openUrl(URL_DONATE)
353+
sendCommand(HomeViewModel.Commands.OnDonationLinkClicked)
354354
}
355355
)
356356
}

app/src/main/java/org/thoughtcrime/securesms/home/HomeViewModel.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import kotlinx.coroutines.flow.StateFlow
2020
import kotlinx.coroutines.flow.catch
2121
import kotlinx.coroutines.flow.combine
2222
import kotlinx.coroutines.flow.distinctUntilChanged
23-
import kotlinx.coroutines.flow.filter
2423
import kotlinx.coroutines.flow.flatMapLatest
2524
import kotlinx.coroutines.flow.map
2625
import kotlinx.coroutines.flow.onStart
@@ -406,8 +405,9 @@ class HomeViewModel @Inject constructor(
406405
_dialogsState.update { it.copy(donationCTA = false) }
407406
}
408407

409-
is Commands.ShowDonationConfirmation -> {
410-
showUrlDialog(URL_DONATE)
408+
is Commands.OnDonationLinkClicked -> {
409+
donationManager.onDonationSeen()
410+
_dialogsState.update { it.copy(donationCTA = false) }
411411
}
412412

413413
is Commands.HideUrlDialog -> {
@@ -533,7 +533,7 @@ class HomeViewModel @Inject constructor(
533533
data object HidePinCTADialog : Commands
534534
data object HideExpiringCTADialog : Commands
535535
data object HideExpiredCTADialog : Commands
536-
data object ShowDonationConfirmation : Commands
536+
data object OnDonationLinkClicked : Commands
537537
data object HideDonationCTADialog : Commands
538538
data object HideUserProfileModal : Commands
539539
data object HideUrlDialog : Commands

0 commit comments

Comments
 (0)