#1317 - Features on QKSMS+ will link to respective part of app

Should help reduce the number of emails telling me the upgrade didn't work
This commit is contained in:
moezbhatti
2019-06-09 00:03:24 -04:00
parent 17f71e9aba
commit ec89c97b45
4 changed files with 43 additions and 0 deletions
@@ -24,6 +24,7 @@ import androidx.core.view.children
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelProviders
import com.jakewharton.rxbinding2.view.clicks
import com.jakewharton.rxbinding2.view.enabled
import com.moez.QKSMS.BuildConfig
import com.moez.QKSMS.R
import com.moez.QKSMS.common.base.QkThemedActivity
@@ -36,6 +37,7 @@ import com.moez.QKSMS.common.util.extensions.setVisible
import com.moez.QKSMS.common.widget.PreferenceView
import com.moez.QKSMS.feature.plus.experiment.UpgradeButtonExperiment
import dagger.android.AndroidInjection
import io.reactivex.Observable
import kotlinx.android.synthetic.main.collapsing_toolbar.*
import kotlinx.android.synthetic.main.preference_view.view.*
import kotlinx.android.synthetic.main.qksms_plus_activity.*
@@ -52,6 +54,11 @@ class PlusActivity : QkThemedActivity(), PlusView {
override val upgradeIntent by lazy { upgrade.clicks() }
override val upgradeDonateIntent by lazy { upgradeDonate.clicks() }
override val donateIntent by lazy { donate.clicks() }
override val themeClicks by lazy { themes.clicks() }
override val scheduleClicks by lazy { schedule.clicks() }
override val backupClicks by lazy { backup.clicks() }
override val delayedClicks by lazy { delayed.clicks() }
override val nightClicks by lazy { night.clicks() }
override fun onCreate(savedInstanceState: Bundle?) {
AndroidInjection.inject(this)
@@ -97,6 +104,12 @@ class PlusActivity : QkThemedActivity(), PlusView {
free.setVisible(fdroid)
toUpgrade.setVisible(!fdroid && !state.upgraded)
upgraded.setVisible(!fdroid && state.upgraded)
themes.isEnabled = state.upgraded
schedule.isEnabled = state.upgraded
backup.isEnabled = state.upgraded
delayed.isEnabled = state.upgraded
night.isEnabled = state.upgraded
}
override fun initiatePurchaseFlow(billingManager: BillingManager, sku: String) {
@@ -27,6 +27,11 @@ interface PlusView : QkView<PlusState> {
val upgradeIntent: Observable<Unit>
val upgradeDonateIntent: Observable<Unit>
val donateIntent: Observable<*>
val themeClicks: Observable<*>
val scheduleClicks: Observable<*>
val backupClicks: Observable<*>
val delayedClicks: Observable<*>
val nightClicks: Observable<*>
fun initiatePurchaseFlow(billingManager: BillingManager, sku: String)
@@ -62,6 +62,26 @@ class PlusViewModel @Inject constructor(
view.donateIntent
.autoDisposable(view.scope())
.subscribe { navigator.showDonation() }
view.themeClicks
.autoDisposable(view.scope())
.subscribe { navigator.showSettings() }
view.scheduleClicks
.autoDisposable(view.scope())
.subscribe { navigator.showScheduled() }
view.backupClicks
.autoDisposable(view.scope())
.subscribe { navigator.showBackup() }
view.delayedClicks
.autoDisposable(view.scope())
.subscribe { navigator.showSettings() }
view.nightClicks
.autoDisposable(view.scope())
.subscribe { navigator.showSettings() }
}
}
@@ -162,6 +162,7 @@
android:background="?android:attr/divider" />
<com.moez.QKSMS.common.widget.PreferenceView
android:id="@+id/themes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_palette_black_24dp"
@@ -169,6 +170,7 @@
app:title="@string/qksms_plus_themes_title" />
<com.moez.QKSMS.common.widget.PreferenceView
android:id="@+id/schedule"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_event_black_24dp"
@@ -176,6 +178,7 @@
app:title="@string/qksms_plus_scheduled_title" />
<com.moez.QKSMS.common.widget.PreferenceView
android:id="@+id/backup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_backup_black_24dp"
@@ -183,6 +186,7 @@
app:title="@string/qksms_plus_backup_title" />
<com.moez.QKSMS.common.widget.PreferenceView
android:id="@+id/delayed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_av_timer_black_24dp"
@@ -190,6 +194,7 @@
app:title="@string/qksms_plus_delayed_title" />
<com.moez.QKSMS.common.widget.PreferenceView
android:id="@+id/night"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:icon="@drawable/ic_invert_colors_black_24dp"