Disabling subscriptions

csv
Laurent 6 years ago
parent 48db243eb1
commit 492525d67c
  1. 52
      app/src/main/java/net/pokeranalytics/android/ui/fragment/FeedFragment.kt
  2. 4
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SettingRow.kt

@ -6,6 +6,7 @@ import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.Toast
import androidx.core.app.ActivityOptionsCompat import androidx.core.app.ActivityOptionsCompat
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.interpolator.view.animation.FastOutSlowInInterpolator import androidx.interpolator.view.animation.FastOutSlowInInterpolator
@ -32,7 +33,8 @@ import net.pokeranalytics.android.ui.interfaces.FilterableType
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager
import net.pokeranalytics.android.util.Preferences import net.pokeranalytics.android.util.Preferences
import net.pokeranalytics.android.util.billing.AppGuard import java.text.SimpleDateFormat
import java.util.*
class FeedFragment : FilterableFragment(), RowRepresentableDelegate { class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
@ -59,7 +61,7 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
private lateinit var feedTransactionAdapter: FeedTransactionRowRepresentableAdapter private lateinit var feedTransactionAdapter: FeedTransactionRowRepresentableAdapter
private lateinit var realmSessions: RealmResults<Session> private lateinit var realmSessions: RealmResults<Session>
private lateinit var realmTransactions: RealmResults<Transaction> private lateinit var realmTransactions: RealmResults<Transaction>
// private lateinit var betaLimitDate: Date private lateinit var betaLimitDate: Date
private var newSessionCreated: Boolean = false private var newSessionCreated: Boolean = false
private var adapterHasBeenSet: Boolean = false private var adapterHasBeenSet: Boolean = false
@ -205,8 +207,8 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
*/ */
private fun initData() { private fun initData() {
// val sdf = SimpleDateFormat("dd/M/yyyy hh:mm", Locale.getDefault()) val sdf = SimpleDateFormat("dd/M/yyyy hh:mm", Locale.getDefault())
// betaLimitDate = sdf.parse("17/7/2019 10:00") betaLimitDate = sdf.parse("17/7/2019 10:00")
this.currentFilterable = FilterableType.SESSION this.currentFilterable = FilterableType.SESSION
val viewManager = SmoothScrollLinearLayoutManager(requireContext()) val viewManager = SmoothScrollLinearLayoutManager(requireContext())
@ -272,19 +274,19 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
*/ */
private fun createNewSession(isTournament: Boolean) { private fun createNewSession(isTournament: Boolean) {
val sessionCount = this.feedSessionAdapter.realmResults.size // val sessionCount = this.feedSessionAdapter.realmResults.size
if (!AppGuard.isProUser && sessionCount >= AppGuard.MAX_SESSIONS_BEFORE_REQUESTING_SUBSCRIPTION) { // && !BuildConfig.DEBUG // if (!AppGuard.isProUser && sessionCount >= AppGuard.MAX_SESSIONS_BEFORE_REQUESTING_SUBSCRIPTION) { // && !BuildConfig.DEBUG
// Toast.makeText(context, "Please subscribe!", Toast.LENGTH_LONG).show() //// Toast.makeText(context, "Please subscribe!", Toast.LENGTH_LONG).show()
BillingActivity.newInstanceForResult(this, true) // BillingActivity.newInstanceForResult(this, true)
return
}
// Keep commented code for special versions
// if (Date().after(betaLimitDate)) {
// this.showEndOfBetaMessage()
// return // return
// } // }
// Keep commented code for special versions
if (Date().after(betaLimitDate)) {
this.showEndOfBetaMessage()
return
}
SessionActivity.newInstanceforResult(this, isTournament, requestCode = RequestCode.NEW_SESSION.value) SessionActivity.newInstanceforResult(this, isTournament, requestCode = RequestCode.NEW_SESSION.value)
newSessionCreated = true newSessionCreated = true
} }
@ -294,10 +296,10 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
*/ */
private fun createNewTransaction() { private fun createNewTransaction() {
// if (Date().after(betaLimitDate)) { if (Date().after(betaLimitDate)) {
// this.showEndOfBetaMessage() this.showEndOfBetaMessage()
// return return
// } }
EditableDataActivity.newInstanceForResult(this, LiveData.TRANSACTION, null, RequestCode.NEW_TRANSACTION.value) EditableDataActivity.newInstanceForResult(this, LiveData.TRANSACTION, null, RequestCode.NEW_TRANSACTION.value)
} }
@ -316,13 +318,13 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
* Show end of beta message * Show end of beta message
* Keep for possible future uses * Keep for possible future uses
*/ */
// private fun showEndOfBetaMessage() { private fun showEndOfBetaMessage() {
// Toast.makeText( Toast.makeText(
// context, context,
// "App version has ended. Thanks a lot for using it! Please update with the Google Play version to continue using the app.", "App version has ended. Thanks a lot for using it! Please update with the Google Play version to continue using the app.",
// Toast.LENGTH_LONG Toast.LENGTH_LONG
// ).show() ).show()
// } }
// Filter Handler // Filter Handler

@ -45,8 +45,8 @@ enum class SettingRow : RowRepresentable {
val rows = ArrayList<RowRepresentable>() val rows = ArrayList<RowRepresentable>()
rows.add(CustomizableRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.information)) rows.add(CustomizableRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.information))
// rows.addAll(arrayListOf(VERSION, RATE_APP, CONTACT_US, BUG_REPORT)) rows.addAll(arrayListOf(VERSION, RATE_APP, CONTACT_US, BUG_REPORT))
rows.addAll(arrayListOf(SUBSCRIPTION, VERSION, RATE_APP, CONTACT_US, BUG_REPORT)) // rows.addAll(arrayListOf(SUBSCRIPTION, VERSION, RATE_APP, CONTACT_US, BUG_REPORT))
rows.add(CustomizableRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.follow_us)) rows.add(CustomizableRowRepresentable(customViewType = RowViewType.HEADER_TITLE, resId = R.string.follow_us))
rows.addAll(arrayListOf(FOLLOW_US)) rows.addAll(arrayListOf(FOLLOW_US))

Loading…
Cancel
Save