Skip to content

Commit 75b3717

Browse files
Merge pull request #2061 from session-foundation/fix/pro-expiring-cta-reset
SES-5360 - reset expiry CTAs when user is back active
2 parents 408cce3 + c6f4bf0 commit 75b3717

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ interface TextSecurePreferences {
153153
fun setHasSeenProExpiring()
154154
fun hasSeenProExpired(): Boolean
155155
fun setHasSeenProExpired()
156+
fun clearProExpiryView()
156157
fun watchPostProStatus(): StateFlow<Boolean>
157158
fun setShownCallWarning(): Boolean
158159
fun setShownCallNotification(): Boolean
@@ -994,6 +995,11 @@ class AppTextSecurePreferences @Inject constructor(
994995
setBooleanPreference(HAS_SEEN_PRO_EXPIRED, true)
995996
}
996997

998+
override fun clearProExpiryView() {
999+
setBooleanPreference(HAS_SEEN_PRO_EXPIRED, false)
1000+
setBooleanPreference(HAS_SEEN_PRO_EXPIRING, false)
1001+
}
1002+
9971003
override fun watchPostProStatus(): StateFlow<Boolean> {
9981004
return postProLaunchState
9991005
}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ class HomeViewModel @Inject constructor(
232232
var showExpiring: Boolean = false
233233
var showExpired: Boolean = false
234234

235-
if(subscription.type is ProStatus.Active.Expiring
235+
if(subscription.type is ProStatus.Active &&
236+
(prefs.hasSeenProExpiring() || prefs.hasSeenProExpired())){
237+
prefs.clearProExpiryView() // reset expiry view if the user is active again
238+
} else if(subscription.type is ProStatus.Active.Expiring
236239
&& !prefs.hasSeenProExpiring()
237240
){
238241
val validUntil = subscription.type.renewingAt

0 commit comments

Comments
 (0)