Skip to content

Commit e10cfce

Browse files
authored
feat: always show thank you feature in color customization (#141)
* feat: always show thank you feature in color customization Only affects gplay builds. See: https://en.wikipedia.org/wiki/First_law_of_thermodynamics * feat: use thank you as donation in gplay builds `R.bools.show_donate_in_about` is not needed anymore. * style: add names to call arguments
1 parent aa221af commit e10cfce

File tree

8 files changed

+202
-51
lines changed

8 files changed

+202
-51
lines changed

commons/src/main/kotlin/org/fossify/commons/activities/AboutActivity.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ import org.fossify.commons.compose.theme.AppThemeSurface
3030
import org.fossify.commons.dialogs.ConfirmationAdvancedAlertDialog
3131
import org.fossify.commons.extensions.baseConfig
3232
import org.fossify.commons.extensions.getStoreUrl
33+
import org.fossify.commons.extensions.isThankYouInstalled
3334
import org.fossify.commons.extensions.launchAppRatingPage
3435
import org.fossify.commons.extensions.launchMoreAppsFromUsIntent
36+
import org.fossify.commons.extensions.launchPurchaseThankYouIntent
3537
import org.fossify.commons.extensions.launchViewIntent
3638
import org.fossify.commons.extensions.showErrorToast
3739
import org.fossify.commons.extensions.toast
@@ -67,8 +69,7 @@ class AboutActivity : BaseComposeActivity() {
6769
val showGoogleRelations =
6870
remember { !resources.getBoolean(R.bool.hide_google_relations) }
6971
val showGithubRelations = showGithubRelations()
70-
val showDonationLinks =
71-
remember { resources.getBoolean(R.bool.show_donate_in_about) }
72+
val showDonationLinks = remember { !isThankYouInstalled() || !showGoogleRelations }
7273
val onEmailClickAlertDialogState = getOnEmailClickAlertDialogState()
7374
AboutScreen(
7475
goBack = ::finish,
@@ -258,7 +259,11 @@ class AboutActivity : BaseComposeActivity() {
258259
}
259260

260261
private fun onDonateClick() {
261-
startActivity(Intent(applicationContext, DonationActivity::class.java))
262+
if (resources.getBoolean(R.bool.hide_google_relations)) {
263+
startActivity(Intent(applicationContext, DonationActivity::class.java))
264+
} else {
265+
launchPurchaseThankYouIntent()
266+
}
262267
}
263268

264269
private fun onGithubClick() {

commons/src/main/kotlin/org/fossify/commons/activities/CustomizationActivity.kt

Lines changed: 163 additions & 37 deletions
Large diffs are not rendered by default.

commons/src/main/kotlin/org/fossify/commons/extensions/Activity.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,7 @@ fun BaseSimpleActivity.showOTGPermissionDialog(path: String) {
392392

393393
fun Activity.launchPurchaseThankYouIntent() {
394394
hideKeyboard()
395-
try {
396-
launchViewIntent("market://details?id=org.fossify.thankyou")
397-
} catch (ignored: Exception) {
398-
launchViewIntent(getString(R.string.thank_you_url))
399-
}
395+
launchViewIntent(getString(R.string.thank_you_url))
400396
}
401397

402398
fun Activity.launchUpgradeToProIntent() {

commons/src/main/res/layout/activity_customization.xml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,11 +219,37 @@
219219
tools:visibility="visible">
220220

221221
<org.fossify.commons.views.MyMaterialSwitch
222-
android:id="@+id/apply_to_all"
222+
android:id="@+id/apply_to_all_switch"
223223
style="@style/SettingsSwitchStyle"
224+
android:layout_width="wrap_content"
225+
android:layout_height="wrap_content"
226+
android:layout_alignParentEnd="true"
227+
android:layout_centerVertical="true" />
228+
229+
<LinearLayout
224230
android:layout_width="match_parent"
225231
android:layout_height="wrap_content"
226-
android:text="@string/apply_to_all_apps" />
232+
android:layout_alignParentStart="true"
233+
android:layout_centerVertical="true"
234+
android:layout_toStartOf="@id/apply_to_all_switch"
235+
android:orientation="vertical">
236+
237+
<org.fossify.commons.views.MyTextView
238+
android:id="@+id/apply_to_all_label"
239+
style="@style/SettingsTextLabelStyle"
240+
android:layout_width="match_parent"
241+
android:layout_height="wrap_content"
242+
android:text="@string/apply_to_all_apps" />
243+
244+
<org.fossify.commons.views.MyTextView
245+
android:id="@+id/apply_to_all_note"
246+
style="@style/SettingsTextValueStyle"
247+
android:layout_width="wrap_content"
248+
android:layout_height="wrap_content"
249+
android:text="@string/requires_fossify_thank_you"
250+
android:visibility="gone"
251+
tools:visibility="visible" />
252+
</LinearLayout>
227253

228254
</RelativeLayout>
229255

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<bool name="default_vibrate_on_press">false</bool> <!-- used in some apps like Calculator -->
4-
<bool name="show_donate_in_about">false</bool> <!-- we cannot show Donate in the Google Play version as we aren't a charity -->
54
<bool name="hide_google_relations">false</bool> <!-- hide everything related to Google, used in cases when our apps are preinstalled -->
65
<bool name="pretend_thank_you_installed">false</bool> <!-- do not require Thank You for color customization and widgets -->
76
</resources>

commons/src/main/res/values/strings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@
385385
<string name="shared_theme_note">Note that even though you are using the Pro app version, you still need Fossify Thank You for technical reasons. It takes care of the color synchronization.</string>
386386
<string name="purchase_thank_you">
387387
<![CDATA[
388-
Please purchase <a href="https://play.google.com/store/apps/details?id=org.fossify.thankyou">Fossify Thank You</a> to unlock this function and support the development. Thanks!
388+
Please purchase <a href="https://play.google.com/store/apps/details?id=org.fossify.thankyou">Fossify Thank You</a> to unlock this feature and support development. Thank you!
389389
]]>
390390
</string>
391391

@@ -690,6 +690,7 @@
690690
<!-- Settings -->
691691
<string name="settings">Settings</string>
692692
<string name="purchase_simple_thank_you">Purchase Fossify Thank You</string>
693+
<string name="requires_fossify_thank_you">Requires Fossify Thank You</string>
693694
<string name="general_settings">General</string>
694695
<string name="color_customization">Color customization</string>
695696
<string name="improved_color_customization">Improved color customization</string>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<bool name="show_donate_in_about">true</bool>
43
<bool name="hide_google_relations">true</bool>
54
<bool name="pretend_thank_you_installed">true</bool>
65
</resources>
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<bool name="show_donate_in_about">false</bool>
43
<bool name="hide_google_relations">false</bool>
54
<bool name="pretend_thank_you_installed">true</bool>
65
</resources>

0 commit comments

Comments
 (0)