forked from upstream-mirrors/quik
Squashed commit of the following:
commit 1f890b96beb893c866ed9b47d8e3a9ac6e20662f Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed Jan 31 17:41:22 2018 -0500 Clean up bindView in PlusViewModel commit c71f4853d385df66a79f9372ecf29507cb64152b Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed Jan 31 02:14:37 2018 -0500 Move QKSMS+ to sliding menu commit a23d1dd6d314935cd96c530e3419a3a2ca4cab27 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed Jan 31 00:28:42 2018 -0500 Make selected plan more visible commit 540cda206ede1d3b81d7d42438257f76f9f07cd4 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Wed Jan 31 00:27:03 2018 -0500 Allow changing dynamic textcolor programatically commit 859325dd5ffa7aa5958ae2eb5c9eac62bcb8f7bd Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 22:26:41 2018 -0500 Dark mode support for ripple selected state commit 6a1d5c387fe0a08ef05573f3f07a1cd82b1a37ec Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 22:18:27 2018 -0500 Remove explicit upgrade button, click plan to buy commit 4a6e85b0c513c8604f8993f78add2b3910c0b49d Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 20:43:09 2018 -0500 Show thank you UI if user has upgraded commit 080fccf40b4461b6a833ba77fce1267bd8251281 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 17:52:02 2018 -0500 Allow changing plans commit ac122f138b1840de39f7a7bd1fb36727056233e1 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Tue Jan 30 16:33:59 2018 -0500 Allow purchase of subscription commit 3e689443ec197a929308d9add270ae6777cdeae1 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 23:21:31 2018 -0500 Allow selection of different plans commit d51a90160898b39de5ba4e69fdc8351e2fe7093c Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 19:42:56 2018 -0500 Collapsing toolbar for QKSMS+ activity commit 06c0d5a834884f144ad7e149b7dea3b0ba38b643 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 18:02:05 2018 -0500 Display pricing information in QKSMS+ activity commit c0be51eec5e1b091dbe8ba69f28c48e5379011f3 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 17:26:16 2018 -0500 Add ability to view QKSMS+ activity from settings commit 51e7782a274503401d53a22ccbe55eab2523f200 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 15:41:40 2018 -0500 Indicate currently selected theme commit 0b3bb3e24b3c40ac517cf05404638061f9b520b8 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 15:19:28 2018 -0500 Move ThemeAdapter package commit 828b6fe10afd6493884ee8d1c472dcd39f5371d4 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 15:10:14 2018 -0500 Evenly space theme swatches with other items and borders commit 220499c0676f03c282b201dfd67faa10f20a546d Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Mon Jan 29 14:45:47 2018 -0500 Evenly distribute theme swatches commit 4d0995da773f720411b22091fc58d03497d38438 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 22:53:49 2018 -0500 Use separate activity for Theme picker commit 3886c1890a6320667f9999071213f181e4e2de79 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 20:00:17 2018 -0500 Update more text commit 3e3995fdf58ee849f6fedabd895aff42f521e473 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 19:56:04 2018 -0500 Update text for blocking commit b8ffbf30761105abe1150279994c8d0ebd7a68b7 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 19:49:11 2018 -0500 Build layout for QKSMS+ activity commit 90518ad8291d5028ceb765ca60fe1d36a5edb33a Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 19:48:59 2018 -0500 Improve layout preview support for some custom views commit 3b301b641e1b747d0ac7192bb50e51d494fe6ef8 Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 02:22:54 2018 -0500 Use up-to-date material design colors commit e8c9cec67767c8702f1b6ccf7ee89c22e585132c Author: Moez Bhatti <moez.bhatti@gmail.com> Date: Sun Jan 28 01:21:24 2018 -0500 Add strings and icons for QKSMS+ features
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
|
||||
*
|
||||
* This file is part of QKSMS.
|
||||
*
|
||||
* QKSMS is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* QKSMS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package presentation.feature.plus
|
||||
|
||||
import com.uber.autodispose.android.lifecycle.scope
|
||||
import com.uber.autodispose.kotlin.autoDisposable
|
||||
import common.di.appComponent
|
||||
import common.util.BillingManager
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import presentation.common.base.QkViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
class PlusViewModel : QkViewModel<PlusView, PlusState>(PlusState()) {
|
||||
|
||||
@Inject lateinit var billingManager: BillingManager
|
||||
|
||||
init {
|
||||
appComponent.inject(this)
|
||||
|
||||
disposables += billingManager.plusStatus
|
||||
.subscribe { plan ->
|
||||
newState { it.copy(currentPlan = plan) }
|
||||
}
|
||||
|
||||
disposables += billingManager.subscriptions
|
||||
.subscribe { subs ->
|
||||
newState {
|
||||
it.copy(
|
||||
supporterPrice = subs.firstOrNull { it.sku == BillingManager.SKU_3 }?.price ?: "",
|
||||
donorPrice = subs.firstOrNull { it.sku == BillingManager.SKU_5 }?.price ?: "",
|
||||
philanthropistPrice = subs.firstOrNull { it.sku == BillingManager.SKU_10 }?.price ?: "")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun bindView(view: PlusView) {
|
||||
super.bindView(view)
|
||||
|
||||
Observable.merge(
|
||||
view.supporterSelectedIntent.map { BillingManager.SKU_3 },
|
||||
view.donorSelectedIntent.map { BillingManager.SKU_5 },
|
||||
view.philanthropistSelectedIntent.map { BillingManager.SKU_10 })
|
||||
.autoDisposable(view.scope())
|
||||
.subscribe { sku -> view.initiatePurchaseFlow(billingManager, sku) }
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user