Skip to content

Commit bb56482

Browse files
committed
Sub ui
1 parent dd906e9 commit bb56482

File tree

15 files changed

+206
-40
lines changed

15 files changed

+206
-40
lines changed

android/android_framework/res/src/main/res/values-ar/app_strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,8 +1477,8 @@ Compatibility notice: If the default permission management function is not compa
14771477
<string name="module_donate_title">Get Premium</string>
14781478

14791479
<string name="module_donate_donated">Verified, thanks</string>
1480-
<string name="module_donate_donated_available">Premium feature</string>
1481-
<string name="module_donate_donated_available_message">Donated to get Premium to unlock this feature.\n\nTips: Try it out first, feel it is available and satisfied, and then purchase the advanced features~</string>
1480+
<string name="module_donate_donated_available">Premium</string>
1481+
<string name="module_donate_donated_available_message">Donated to get Premium to unlock this feature.</string>
14821482

14831483
<string name="module_donate_get_play">Get play version</string>
14841484
<string name="module_donate_copy_email">Copy email</string>

android/android_framework/res/src/main/res/values-tr/app_strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,7 @@
15121512
<string name="module_donate_title">Premium Al</string>
15131513

15141514
<string name="module_donate_donated">Doğrulandı, teşekkürler</string>
1515-
<string name="module_donate_donated_available">Premium özellik</string>
1515+
<string name="module_donate_donated_available">Premium</string>
15161516
<string name="module_donate_donated_available_message">Bu özelliğin kilidini açmak için Premium satın aldınız.\n\nİpucu: Önce deneyin, uygun olup olmadığını görün, memnun kaldıktan sonra gelişmiş özellikleri satın alın~</string>
15171517

15181518
<string name="module_donate_get_play">Play sürümünü al</string>

android/android_framework/res/src/main/res/values-zh-rCN/app_strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,8 +1479,8 @@
14791479

14801480
<string name="module_donate_title">订阅高级版</string>
14811481
<string name="module_donate_donated">已订阅</string>
1482-
<string name="module_donate_donated_available">免费版不可用</string>
1483-
<string name="module_donate_donated_available_message">激活高级版后解锁该功能。\n\n提示:先试用,觉得可用、满意再购买高级功能~</string>
1482+
<string name="module_donate_donated_available">高级版</string>
1483+
<string name="module_donate_donated_available_message">激活高级版后解锁该功能。</string>
14841484

14851485
<string name="module_donate_get_play">获取Play版本</string>
14861486
<string name="module_donate_copy_email">复制邮箱地址</string>

android/android_framework/res/src/main/res/values-zh-rTW/app_strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,8 +1476,8 @@
14761476

14771477
<string name="module_donate_title">订阅高級版</string>
14781478
<string name="module_donate_donated">已订阅</string>
1479-
<string name="module_donate_donated_available">免費版不可用</string>
1480-
<string name="module_donate_donated_available_message">啟動高級版後解鎖該功能。 \n\n提示:先試用,覺得可用、滿意再購買高級功能~</string>
1479+
<string name="module_donate_donated_available">高級版</string>
1480+
<string name="module_donate_donated_available_message">啟動高級版後解鎖該功能。</string>
14811481

14821482
<string name="module_donate_get_play">取得Play版本</string>
14831483
<string name="module_donate_copy_email">複製郵件地址</string>

android/android_framework/res/src/main/res/values/app_strings.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,8 +1498,8 @@ If you are already a paid user of Thanox or Thanox Pro, you do not need to subsc
14981498
<string name="module_donate_title">Get Premium</string>
14991499

15001500
<string name="module_donate_donated">Verified, thanks</string>
1501-
<string name="module_donate_donated_available">Premium feature</string>
1502-
<string name="module_donate_donated_available_message">Donated to get Premium to unlock this feature.\n\nTips: Try it out first, feel it is available and satisfied, and then purchase the advanced features~</string>
1501+
<string name="module_donate_donated_available">Premium</string>
1502+
<string name="module_donate_donated_available_message">Donated to get Premium to unlock this feature.</string>
15031503

15041504
<string name="module_donate_get_play">Get play version</string>
15051505
<string name="module_donate_copy_email">Copy email</string>

android/app/src/main/java/now/fortuitous/thanos/main/AllNewNavScreen.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ import github.tornaco.android.thanos.module.compose.common.widget.LargeSpacer
9797
import github.tornaco.android.thanos.module.compose.common.widget.MD3Badge
9898
import github.tornaco.android.thanos.module.compose.common.widget.StandardSpacer
9999
import github.tornaco.android.thanos.module.compose.common.widget.TinySpacer
100+
import github.tornaco.android.thanos.module.compose.common.widget.rememberThanoxBottomSheetState
101+
import github.tornaco.android.thanos.support.FeatureAccessDialog
100102
import github.tornaco.android.thanos.support.subscribe.LVLStateHolder
101103
import kotlinx.coroutines.launch
102104
import now.fortuitous.thanos.settings.v2.SettingsScreen
@@ -189,6 +191,8 @@ fun AllNewNavScreen() {
189191
})
190192
}
191193
) { contentPadding ->
194+
val subscribeDialogState = rememberThanoxBottomSheetState()
195+
FeatureAccessDialog(subscribeDialogState)
192196
val pullRefreshState =
193197
rememberPullRefreshState(state.isLoading, {
194198
viewModel.refresh()
@@ -202,7 +206,11 @@ fun AllNewNavScreen() {
202206
NavContent(
203207
state = state,
204208
onFeatureItemClick = {
205-
viewModel.featureItemClick(activity, it.id)
209+
runCatching {
210+
PrebuiltFeatureLauncher(activity) {}.launch(it.id)
211+
}.onFailure {
212+
subscribeDialogState.show()
213+
}
206214
},
207215
onHeaderClick = {
208216
viewModel.headerClick(activity)

android/app/src/main/java/now/fortuitous/thanos/main/NavScreen.kt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ import github.tornaco.android.thanos.module.compose.common.widget.StandardSpacer
110110
import github.tornaco.android.thanos.module.compose.common.widget.ThanoxAlertDialog
111111
import github.tornaco.android.thanos.module.compose.common.widget.ThanoxMediumAppBarScaffold
112112
import github.tornaco.android.thanos.module.compose.common.widget.TinySpacer
113+
import github.tornaco.android.thanos.module.compose.common.widget.rememberThanoxBottomSheetState
113114
import github.tornaco.android.thanos.module.compose.common.widget.toAnnotatedString
115+
import github.tornaco.android.thanos.support.FeatureAccessDialog
114116
import github.tornaco.android.thanos.support.FeatureGrid
115117
import github.tornaco.android.thanos.support.clickableWithRippleBorderless
116118
import github.tornaco.android.thanos.support.subscribe.LVLStateHolder
@@ -200,6 +202,9 @@ fun NavScreen() {
200202
}
201203
}
202204
) { contentPadding ->
205+
val subscribeDialogState = rememberThanoxBottomSheetState()
206+
FeatureAccessDialog(subscribeDialogState)
207+
203208
val pullRefreshState =
204209
rememberPullRefreshState(state.isLoading, { viewModel.refresh() })
205210
Box(
@@ -212,7 +217,11 @@ fun NavScreen() {
212217
contentPadding = PaddingValues(0.dp),
213218
state = state,
214219
onFeatureItemClick = {
215-
viewModel.featureItemClick(activity, it.id)
220+
runCatching {
221+
PrebuiltFeatureLauncher(activity) {}.launch(it.id)
222+
}.onFailure {
223+
subscribeDialogState.show()
224+
}
216225
},
217226
onHeaderClick = {
218227
viewModel.headerClick(activity)

android/app/src/main/java/now/fortuitous/thanos/main/NavViewModel2.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,10 +298,6 @@ class NavViewModel2 @Inject constructor(@ApplicationContext private val context:
298298
}
299299
}
300300

301-
fun featureItemClick(activity: Activity, featureId: Int) {
302-
PrebuiltFeatureLauncher(activity) {}.launch(featureId)
303-
}
304-
305301
@SuppressLint("UseKtx")
306302
fun privacyStatementAccepted() {
307303
PreferenceManager.getDefaultSharedPreferences(context).edit()

android/app/src/main/java/now/fortuitous/thanos/main/PrebuiltFeatureLauncher.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class PrebuiltFeatureLauncher(
5151
context.sendBroadcast(Intent(T.Actions.ACTION_RUNNING_PROCESS_CLEAR))
5252
onProcessCleared()
5353
} else {
54-
AppFeatureManager.showSubscribeDialog(context)
54+
throw AccessBlocked
5555
}
5656
}
5757
}
@@ -75,7 +75,7 @@ class PrebuiltFeatureLauncher(
7575
if (it) {
7676
AioAppListActivity.start(context, featureId)
7777
} else {
78-
AppFeatureManager.showSubscribeDialog(context)
78+
throw AccessBlocked
7979
}
8080
}
8181
}
@@ -89,10 +89,10 @@ class PrebuiltFeatureLauncher(
8989
if (it) {
9090
ActivityTrampolineActivity.start(context)
9191
} else {
92-
AppFeatureManager.showSubscribeDialog(context)
9392
// Disable this feature, since it is free to use before.
9493
XLog.w("Disabling ActivityTrampoline.")
9594
activityStackSupervisor.isActivityTrampolineEnabled = false
95+
throw AccessBlocked
9696
}
9797
}
9898
}
@@ -130,7 +130,7 @@ class PrebuiltFeatureLauncher(
130130
if (it) {
131131
now.fortuitous.thanos.infinite.InfiniteZActivity.start(context)
132132
} else {
133-
AppFeatureManager.showSubscribeDialog(context)
133+
throw AccessBlocked
134134
}
135135
}
136136
}
@@ -144,7 +144,7 @@ class PrebuiltFeatureLauncher(
144144
if (it) {
145145
WechatPushDeleteMainActivity.start(context)
146146
} else {
147-
AppFeatureManager.showSubscribeDialog(context)
147+
throw AccessBlocked
148148
}
149149
}
150150
}
@@ -154,7 +154,7 @@ class PrebuiltFeatureLauncher(
154154
if (it) {
155155
WakeLockBlockerActivity.Starter.start(context)
156156
} else {
157-
AppFeatureManager.showSubscribeDialog(context)
157+
throw AccessBlocked
158158
}
159159
}
160160
}
@@ -166,4 +166,6 @@ class PrebuiltFeatureLauncher(
166166
DialogUtils.showNotActivated(context)
167167
}
168168
}
169-
}
169+
}
170+
171+
data object AccessBlocked : Error()

android/app/src/main/java/now/fortuitous/thanos/main/PrebuiltFeatureShortcutActivity.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5757
int featId = getIntent().getIntExtra(KEY_FEATURE_ID, Integer.MIN_VALUE);
5858
XLog.d("PrebuiltFeatureShortcutActivity, featId: " + featId);
5959
if (PrebuiltFeatureIds.INSTANCE.isValidId(featId)) {
60-
new PrebuiltFeatureLauncher(this, () -> null).launch(featId);
60+
try {
61+
new PrebuiltFeatureLauncher(this, () -> null).launch(featId);
62+
} catch (Throwable ignored) {
63+
}
6164
}
6265
finish();
6366
}

0 commit comments

Comments
 (0)