Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Unreleased

- Free apps show one rating prompt after five days on Play and one support prompt after ten days on all flavors.
- Simplify distribution flags and remove obsolete Pro upgrade and feature-lock APIs.
- Keep Thank You access to custom fonts and shared customization.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class AboutActivity : BaseComposeActivity() {
val resources = context.resources
AppThemeSurface {
val showGoogleRelations =
remember { !resources.getBoolean(R.bool.hide_google_relations) }
remember { resources.getBoolean(R.bool.is_google_play_build) }
val showGithubRelations = showGithubRelations()
val showDonationLinks = remember { !isThankYouInstalled() || !showGoogleRelations }
val onEmailClickAlertDialogState = getOnEmailClickAlertDialogState()
Expand Down Expand Up @@ -135,11 +135,8 @@ class AboutActivity : BaseComposeActivity() {

@Composable
private fun getPackageInfo(): Pair<String, String> {
var versionName = remember { intent.getStringExtra(APP_VERSION_NAME) ?: "" }
val versionName = remember { intent.getStringExtra(APP_VERSION_NAME) ?: "" }
val packageName = remember { intent.getStringExtra(APP_PACKAGE_NAME) ?: "" }
if (baseConfig.appId.removeSuffix(".debug").endsWith(".pro")) {
versionName += " ${getString(R.string.pro)}"
}

val fullVersion = stringResource(R.string.version_placeholder, versionName)
return Pair(fullVersion, packageName)
Expand Down Expand Up @@ -240,8 +237,8 @@ class AboutActivity : BaseComposeActivity() {

private fun onInviteClick() {
val storeUrl = when {
resources.getBoolean(R.bool.hide_google_relations) -> getGithubUrl()
else -> getStoreUrl()
resources.getBoolean(R.bool.is_google_play_build) -> getStoreUrl()
else -> getGithubUrl()
}

val text = String.format(getString(R.string.share_text), appName, storeUrl)
Expand All @@ -261,10 +258,10 @@ class AboutActivity : BaseComposeActivity() {
}

private fun onDonateClick() {
if (resources.getBoolean(R.bool.hide_google_relations)) {
startActivity(Intent(applicationContext, DonationActivity::class.java))
} else {
if (resources.getBoolean(R.bool.is_google_play_build)) {
launchPurchaseThankYouIntent()
} else {
startActivity(Intent(applicationContext, DonationActivity::class.java))
}
}

Expand All @@ -282,7 +279,7 @@ class AboutActivity : BaseComposeActivity() {
}

private fun onPrivacyPolicyClick() {
val appId = baseConfig.appId.removeSuffix(".debug").removeSuffix(".pro")
val appId = baseConfig.appId.removeSuffix(".debug")
.removePrefix("org.fossify.")
val url = "https://www.fossify.org/policy/$appId"
launchViewIntent(url)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,7 @@ abstract class BaseSimpleActivity : EdgeToEdgeActivity() {
}

private fun getExportSettingsFilename(): String {
val appName = baseConfig.appId.removeSuffix(".debug").removeSuffix(".pro")
val appName = baseConfig.appId.removeSuffix(".debug")
.removePrefix("org.fossify.")
return "$appName-settings_${getCurrentFormattedDateTime()}"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.fossify.commons.extensions.getProperTextColor
import org.fossify.commons.extensions.getThemeId
import org.fossify.commons.extensions.isDynamicTheme
import org.fossify.commons.extensions.isFontFile
import org.fossify.commons.extensions.isOrWasThankYouInstalled
import org.fossify.commons.extensions.hasThankYouUnlock
import org.fossify.commons.extensions.isThankYouFontsSupported
import org.fossify.commons.extensions.isSystemInDarkMode
import org.fossify.commons.extensions.isThankYouInstalled
Expand Down Expand Up @@ -607,8 +607,8 @@ class CustomizationActivity : BaseSimpleActivity() {
val selectedType = selected as Int
if (selectedType == FONT_TYPE_CUSTOM) {
if (
!resources.getBoolean(R.bool.hide_google_relations)
&& !isOrWasThankYouInstalled(allowPretend = false)
resources.getBoolean(R.bool.is_google_play_build)
&& !hasThankYouUnlock()
) {
PurchaseThankYouDialog(this)
return@RadioGroupDialog
Expand Down Expand Up @@ -917,7 +917,7 @@ class CustomizationActivity : BaseSimpleActivity() {

private fun showOrHideThankYouFeatures() {
val showThankYouFeatures = canAccessGlobalConfig()
|| !resources.getBoolean(R.bool.hide_google_relations)
|| resources.getBoolean(R.bool.is_google_play_build)
binding.applyToAllNote.beVisibleIf(!canAccessGlobalConfig())
binding.applyToAllHolder.beVisibleIf(showThankYouFeatures)
binding.applyToAllDivider.root.beVisibleIf(showThankYouFeatures)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@ import org.fossify.commons.R
import org.fossify.commons.extensions.baseConfig
import org.fossify.commons.extensions.checkAppIconColor
import org.fossify.commons.extensions.getAppIconColors
import org.fossify.commons.extensions.getCanAppBeUpgraded
import org.fossify.commons.extensions.getInternalStoragePath
import org.fossify.commons.extensions.isAProApp
import org.fossify.commons.extensions.isAppInstalledOnSDCard
import org.fossify.commons.extensions.isOrWasThankYouInstalled
import org.fossify.commons.extensions.launchViewIntent
import org.fossify.commons.extensions.random
import org.fossify.commons.extensions.showAutomaticSupportPromptIfEligible
import org.fossify.commons.extensions.toggleAppIconColor
import org.fossify.commons.extensions.updateSDCardPath
import org.fossify.commons.helpers.isOreoMr1Plus
import org.fossify.commons.models.Release

fun ComponentActivity.appLaunchedCompose(
appId: String,
showUpgradeDialog: () -> Unit,
showDonateDialog: () -> Unit,
) {
baseConfig.internalStoragePath = getInternalStoragePath()
updateSDCardPath()
Expand Down Expand Up @@ -64,15 +59,7 @@ fun ComponentActivity.appLaunchedCompose(
}

baseConfig.appRunCount++
if (baseConfig.appRunCount % 30 == 0 && !isAProApp()) {
if (!resources.getBoolean(R.bool.hide_google_relations)) {
if (getCanAppBeUpgraded()) {
showUpgradeDialog()
} else if (!isOrWasThankYouInstalled()) {
showDonateDialog()
}
}
}
showAutomaticSupportPromptIfEligible()
}

fun ComponentActivity.checkWhatsNewCompose(releases: List<Release>, currVersion: Int, showWhatsNewDialog: (List<Release>) -> Unit) {
Expand All @@ -91,10 +78,6 @@ fun ComponentActivity.checkWhatsNewCompose(releases: List<Release>, currVersion:
baseConfig.lastVersion = currVersion
}

fun ComponentActivity.upgradeToPro() {
launchViewIntent("https://fossify.org/upgrade_to_pro")
}

const val DEVELOPER_PLAY_STORE_URL = "https://play.google.com/store/apps/dev?id=7297838378654322558"
const val FAKE_VERSION_APP_LABEL =
"You are using a fake version of the app. For your own safety download the original one from www.fossify.org. Thanks"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.fossify.commons.dialogs

import android.app.Activity
import android.content.Intent
import android.text.Html
import android.text.method.LinkMovementMethod
import android.widget.TextView
Expand All @@ -22,6 +23,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.sp
import androidx.compose.ui.window.DialogProperties
import org.fossify.commons.R
import org.fossify.commons.activities.DonationActivity
import org.fossify.commons.compose.alert_dialog.*
import org.fossify.commons.compose.components.LinkifyTextComponent
import org.fossify.commons.compose.extensions.MyDevices
Expand All @@ -32,35 +34,49 @@ import org.fossify.commons.compose.theme.SimpleTheme
import org.fossify.commons.databinding.DialogDonateBinding
import org.fossify.commons.extensions.*

class DonateDialog(val activity: Activity) {
class DonateDialog(val activity: Activity, onShown: () -> Unit = {}) {
init {
val isGooglePlayBuild = activity.resources.getBoolean(R.bool.is_google_play_build)
val positiveButtonId = if (isGooglePlayBuild) R.string.purchase else R.string.donate
val view = DialogDonateBinding.inflate(activity.layoutInflater, null, false).apply {
dialogDonateImage.applyColorFilter(activity.getProperTextColor())
dialogDonateText.text = Html.fromHtml(activity.getString(R.string.donate_short))
val messageId = if (isGooglePlayBuild) R.string.donate_short else R.string.donation_prompt
dialogDonateText.text = Html.fromHtml(activity.getString(messageId))
dialogDonateText.movementMethod = LinkMovementMethod.getInstance()
dialogDonateImage.setOnClickListener {
activity.launchViewIntent(R.string.thank_you_url)
activity.openDonationOptions()
}
}

activity.getAlertDialogBuilder()
.setPositiveButton(R.string.purchase) { _, _ -> activity.launchViewIntent(R.string.thank_you_url) }
.setPositiveButton(positiveButtonId) { _, _ -> activity.openDonationOptions() }
.setNegativeButton(R.string.later, null)
.apply {
activity.setupDialogStuff(view.root, this, cancelOnTouchOutside = false)
activity.setupDialogStuff(view.root, this) { dialog ->
if (dialog.isShowing) {
onShown()
}
}
}
}
}

private fun Activity.openDonationOptions() {
if (resources.getBoolean(R.bool.is_google_play_build)) {
launchPurchaseThankYouIntent()
} else {
startActivity(Intent(this, DonationActivity::class.java))
}
}

@Composable
fun DonateAlertDialog(
alertDialogState: AlertDialogState,
modifier: Modifier = Modifier
) {
val localContext = LocalContext.current.getActivity()
val donateIntent = {
localContext.launchViewIntent(R.string.thank_you_url)
}
val isGooglePlayBuild = localContext.resources.getBoolean(R.bool.is_google_play_build)
val donateIntent = { localContext.openDonationOptions() }
androidx.compose.material3.AlertDialog(
containerColor = dialogContainerColor,
modifier = modifier
Expand All @@ -81,7 +97,7 @@ fun DonateAlertDialog(
donateIntent()
alertDialogState.hide()
}) {
Text(text = stringResource(id = R.string.purchase))
Text(text = stringResource(id = if (isGooglePlayBuild) R.string.purchase else R.string.donate))
}
},
title = {
Expand All @@ -107,7 +123,7 @@ fun DonateAlertDialog(
}
},
text = {
val source = stringResource(id = R.string.donate_short)
val source = stringResource(id = if (isGooglePlayBuild) R.string.donate_short else R.string.donation_prompt)
LinkifyTextComponent(
fontSize = 16.sp,
removeUnderlines = false,
Expand Down

This file was deleted.

Loading
Loading