Commit 6a35fe5f authored by Ricki Hirner's avatar Ricki Hirner

Create gplay flavor without DonateDialogFragment; version bump to 1.6.1

parent 462a6af7
Pipeline #37994192 passed with stage
in 10 minutes and 59 seconds
......@@ -19,8 +19,8 @@ android {
minSdkVersion 19
targetSdkVersion 28
versionCode 24
versionName "1.6"
versionCode 25
versionName "1.6.1"
}
buildTypes {
release {
......@@ -28,6 +28,16 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
flavorDimensions "distribution"
productFlavors {
standard {
}
gplay {
versionNameSuffix "-gplay"
}
}
packagingOptions {
exclude 'LICENSE'
exclude 'META-INF/LICENSE.txt'
......
......@@ -66,11 +66,11 @@ class CalendarListActivity:
calendar_list.onItemClickListener = this
calendar_list.emptyView = emptyInfo
if (getPreferences(0).getLong(DonateDialogFragment.PREF_NEXT_REMINDER, 0) < System.currentTimeMillis()) {
val installer = packageManager.getInstallerPackageName(BuildConfig.APPLICATION_ID)
if (installer == null || installer.startsWith("org.fdroid"))
DonateDialogFragment().show(supportFragmentManager, "donate")
}
// startup fragments
if (savedInstanceState == null)
ServiceLoader
.load(StartupFragment::class.java)
.forEach { it.initiate(this, supportFragmentManager) }
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_CALENDAR) == PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_CALENDAR) == PackageManager.PERMISSION_GRANTED)
......
package at.bitfire.icsdroid.ui
import android.app.Activity
import androidx.fragment.app.FragmentManager
interface StartupFragment {
fun initiate(activity: Activity, fragmentManager: FragmentManager)
}
\ No newline at end of file
......@@ -8,10 +8,12 @@
package at.bitfire.icsdroid.ui;
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager
import at.bitfire.icsdroid.Constants
import at.bitfire.icsdroid.R
......@@ -27,13 +29,13 @@ class DonateDialogFragment: DialogFragment() {
.setTitle(R.string.donate_title)
.setMessage(R.string.donate_message)
.setPositiveButton(R.string.donate_now) { _, _ ->
activity!!.getPreferences(0).edit()
requireActivity().getPreferences(0).edit()
.putLong(PREF_NEXT_REMINDER, System.currentTimeMillis() + 60*86400000L)
.apply()
startActivity(Intent(Intent.ACTION_VIEW, Constants.donationUri))
}
.setNegativeButton(R.string.donate_later) { _, _ ->
activity!!.getPreferences(0).edit()
requireActivity().getPreferences(0).edit()
.putLong(PREF_NEXT_REMINDER, System.currentTimeMillis() + 14*86400000L)
.apply()
dismiss()
......@@ -41,4 +43,14 @@ class DonateDialogFragment: DialogFragment() {
.setCancelable(false)
.create()!!
class Factory: StartupFragment {
override fun initiate(activity: Activity, fragmentManager: FragmentManager) {
if (activity.getPreferences(0).getLong(PREF_NEXT_REMINDER, 0) < System.currentTimeMillis())
DonateDialogFragment().show(fragmentManager, "donate")
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment