fixed build error

This commit is contained in:
Mariotaku Lee 2017-01-01 23:02:13 +08:00
parent c628ae9996
commit 3dbaf3726d
3 changed files with 10 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import nl.komponents.kovenant.ui.failUi
import nl.komponents.kovenant.ui.successUi import nl.komponents.kovenant.ui.successUi
import org.mariotaku.twidere.Constants import org.mariotaku.twidere.Constants
import org.mariotaku.twidere.constant.IntentConstants.INTENT_PACKAGE_PREFIX import org.mariotaku.twidere.constant.IntentConstants.INTENT_PACKAGE_PREFIX
import org.mariotaku.twidere.constant.PURCHASE_RESPONSE_NOT_PURCHASED
import org.mariotaku.twidere.fragment.ProgressDialogFragment import org.mariotaku.twidere.fragment.ProgressDialogFragment
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
@ -137,6 +138,7 @@ class GooglePlayInAppPurchaseActivity : BaseActivity(), BillingProcessor.IBillin
val resultCode = when (billingResponse) { val resultCode = when (billingResponse) {
BILLING_RESPONSE_RESULT_OK -> Activity.RESULT_OK BILLING_RESPONSE_RESULT_OK -> Activity.RESULT_OK
BILLING_RESPONSE_RESULT_USER_CANCELED -> Activity.RESULT_CANCELED BILLING_RESPONSE_RESULT_USER_CANCELED -> Activity.RESULT_CANCELED
BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED -> PURCHASE_RESPONSE_NOT_PURCHASED
else -> billingResponse else -> billingResponse
} }
return resultCode return resultCode

View File

@ -0,0 +1,6 @@
package org.mariotaku.twidere.constant
/**
* Created by mariotaku on 2017/1/1.
*/
const val PURCHASE_RESPONSE_NOT_PURCHASED = 1

View File

@ -7,10 +7,10 @@ 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 android.widget.Toast
import com.anjlab.android.iab.v3.Constants.BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED
import kotlinx.android.synthetic.main.fragment_extra_features_introduction.* import kotlinx.android.synthetic.main.fragment_extra_features_introduction.*
import kotlinx.android.synthetic.main.layout_extra_features_introduction.* import kotlinx.android.synthetic.main.layout_extra_features_introduction.*
import org.mariotaku.twidere.R import org.mariotaku.twidere.R
import org.mariotaku.twidere.constant.PURCHASE_RESPONSE_NOT_PURCHASED
import org.mariotaku.twidere.fragment.BaseSupportFragment import org.mariotaku.twidere.fragment.BaseSupportFragment
import org.mariotaku.twidere.util.premium.ExtraFeaturesChecker import org.mariotaku.twidere.util.premium.ExtraFeaturesChecker
@ -54,7 +54,7 @@ class ExtraFeaturesIntroductionCardFragment : BaseSupportFragment() {
REQUEST_RESTORE_PURCHASE -> { REQUEST_RESTORE_PURCHASE -> {
if (requestCode == Activity.RESULT_OK) { if (requestCode == Activity.RESULT_OK) {
activity?.recreate() activity?.recreate()
} else if (resultCode == BILLING_RESPONSE_RESULT_ITEM_NOT_OWNED) { } else if (resultCode == PURCHASE_RESPONSE_NOT_PURCHASED) {
Toast.makeText(context, R.string.message_extra_features_not_purchased, Toast.LENGTH_SHORT).show() Toast.makeText(context, R.string.message_extra_features_not_purchased, Toast.LENGTH_SHORT).show()
} }
} }