|
|
|
|
@ -1,7 +1,9 @@ |
|
|
|
|
package net.pokeranalytics.android.ui.fragment |
|
|
|
|
|
|
|
|
|
import android.app.Activity |
|
|
|
|
import android.content.ActivityNotFoundException |
|
|
|
|
import android.content.Intent |
|
|
|
|
import android.net.Uri |
|
|
|
|
import android.os.Bundle |
|
|
|
|
import android.view.LayoutInflater |
|
|
|
|
import android.view.View |
|
|
|
|
@ -29,6 +31,8 @@ import net.pokeranalytics.android.util.Preferences |
|
|
|
|
import net.pokeranalytics.android.util.URL |
|
|
|
|
import net.pokeranalytics.android.util.UserDefaults |
|
|
|
|
import net.pokeranalytics.android.util.billing.AppGuard |
|
|
|
|
import net.pokeranalytics.android.util.billing.IAPProducts |
|
|
|
|
import timber.log.Timber |
|
|
|
|
import java.util.* |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -102,6 +106,8 @@ class SettingsFragment : PokerAnalyticsFragment(), RowRepresentableDelegate, Sta |
|
|
|
|
SettingRow.SUBSCRIPTION -> { |
|
|
|
|
if (!AppGuard.isProUser) { |
|
|
|
|
BillingActivity.newInstance(requireContext()) |
|
|
|
|
} else { |
|
|
|
|
this.openPlaystoreAccount() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
SettingRow.RATE_APP -> parentActivity?.openPlayStorePage() |
|
|
|
|
@ -160,4 +166,19 @@ class SettingsFragment : PokerAnalyticsFragment(), RowRepresentableDelegate, Sta |
|
|
|
|
startActivity(intent) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Open Google Play account |
|
|
|
|
*/ |
|
|
|
|
private fun openPlaystoreAccount() { |
|
|
|
|
|
|
|
|
|
val packageName = "net.pokeranalytics.android" |
|
|
|
|
val sku = IAPProducts.PRO.identifier |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/account/subscriptions?sku=$sku&package=$packageName"))) |
|
|
|
|
} catch (e: ActivityNotFoundException) { |
|
|
|
|
Timber.d(e) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |