Commit 83fae7df authored by wanglei's avatar wanglei

....

parent 2beef962
......@@ -107,8 +107,9 @@ dependencies {
//firebase
implementation platform('com.google.firebase:firebase-bom:32.3.1')
implementation 'com.google.firebase:firebase-analytics:21.6.2'
implementation("com.google.firebase:firebase-messaging")
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-analytics:21.6.2'
//google 内购订阅
......
......@@ -25,9 +25,6 @@
android:supportsRtl="true"
android:theme="@style/Theme.DataRecovery"
tools:targetApi="34">
<activity
android:name=".billing.BillingActivity"
android:exported="false" />
<activity
android:name=".activity.SplashActivity"
android:exported="true"
......
......@@ -9,7 +9,6 @@ import com.base.filerecoveryrecyclebin.activity.SplashActivity
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.ads.admob.AdmobOpenUtils
import com.base.filerecoveryrecyclebin.bean.ConstObject.ifAgreePrivacy
import com.base.filerecoveryrecyclebin.billing.BillingClientLifecycle
import com.base.filerecoveryrecyclebin.fcm.FCMManager
import com.base.filerecoveryrecyclebin.fcm.RecoveryTimerManager
import com.base.filerecoveryrecyclebin.fcm.ScreenStatusReceiver
......@@ -32,8 +31,6 @@ class MyApplication : BaseApplication() {
private val TAG = "MyApplication"
var uuid = ""
val billingClientLifecycle: BillingClientLifecycle
get() = BillingClientLifecycle.getInstance(this)
companion object {
@JvmField
......
......@@ -7,10 +7,7 @@ import androidx.core.view.updatePadding
import androidx.lifecycle.lifecycleScope
import com.base.filerecoveryrecyclebin.adapter.MediaAdapter
import com.base.filerecoveryrecyclebin.ads.AdmobMaxHelper
import com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils
import com.base.filerecoveryrecyclebin.ads.admob.AdmobInterstitialUtils.showInterAdSp
import com.base.filerecoveryrecyclebin.ads.admob.AdmobNativeUtils
import com.base.filerecoveryrecyclebin.ads.max.AdMaxInterstitialUtils
import com.base.filerecoveryrecyclebin.bean.MediaBean
import com.base.filerecoveryrecyclebin.bean.MediaTimeBean
import com.base.filerecoveryrecyclebin.databinding.ActivityRepeatBinding
......
......@@ -21,6 +21,8 @@ object AdmobMaxHelper {
private val TAG = "AdmobMaxHelper"
var isAdInit = AtomicBoolean(false)
//Begin
fun initAdmobMaxAd() {
if (ConfigHelper.admobTrueMaxFlase) {
if (!isAdInit.get()) {
......@@ -34,7 +36,7 @@ object AdmobMaxHelper {
}
}
}
//End end
fun isOpenAdLoaded(): Boolean {
return if (ConfigHelper.admobTrueMaxFlase) {
AdmobOpenUtils.isOpenAdLoaded()
......
......@@ -182,6 +182,7 @@ object AdMaxInterstitialUtils {
obj.put("ad_type", "interAd")
EventUtils.event("ad_pull_start", ext = obj)
interstitialAd?.loadAd()
AdDisplayUtils.getInstance().incrementAdRequestCount()
return true
}
return false
......
......@@ -170,6 +170,7 @@ object AdMaxOpenUtils {
obj.put("ad_type", "openAd")
EventUtils.event("ad_pull_start", ext = obj)
appOpenAd?.loadAd()
AdDisplayUtils.getInstance().incrementAdRequestCount()
return true
}
return false
......
package com.base.filerecoveryrecyclebin.billing
import com.base.filerecoveryrecyclebin.databinding.ActivityBillingBinding
import com.base.filerecoveryrecyclebin.help.BaseActivity
class BillingActivity : BaseActivity<ActivityBillingBinding>() {
override val binding: ActivityBillingBinding by lazy {
ActivityBillingBinding.inflate(layoutInflater)
}
override fun initView() {
}
}
\ No newline at end of file
//package com.base.filerecoveryrecyclebin.billing
//
//import com.base.filerecoveryrecyclebin.databinding.ActivityBillingBinding
//import com.base.filerecoveryrecyclebin.help.BaseActivity
//
//class BillingActivity : BaseActivity<ActivityBillingBinding>() {
//
// override val binding: ActivityBillingBinding by lazy {
// ActivityBillingBinding.inflate(layoutInflater)
// }
//
//
// override fun initView() {
//
// }
//
//}
\ No newline at end of file
package com.base.filerecoveryrecyclebin.billing
import android.app.Application
import android.util.Log
import androidx.lifecycle.AndroidViewModel
import com.base.filerecoveryrecyclebin.MyApplication
import com.base.filerecoveryrecyclebin.bean.BiliConstants
import com.base.filerecoveryrecyclebin.utils.SingleLiveEvent
class BillingViewModel(val application: Application) : AndroidViewModel(application) {
private val TAG = "BillingViewModel"
private val purchases = (application as MyApplication).billingClientLifecycle.subscriptionPurchases
private val basicSubProductWithProductDetails =
(application as MyApplication).billingClientLifecycle.basicSubProductWithProductDetails
private val premiumSubProductWithProductDetails =
(application as MyApplication).billingClientLifecycle.premiumSubProductWithProductDetails
val openPlayStoreSubscriptionsEvent = SingleLiveEvent<String>()
/**
* Open the Play Store subscription center. If the user has exactly one product,
* then open the deeplink to the specific product.
*/
fun openPlayStoreSubscriptions() {
val hasBasic = deviceHasGooglePlaySubscription(purchases.value, BiliConstants.BASIC_PRODUCT)
val hasPremium = deviceHasGooglePlaySubscription(purchases.value, BiliConstants.BASIC_PRODUCT)
Log.d(TAG, "hasBasic: $hasBasic, hasPremium: $hasPremium")
when {
hasBasic && !hasPremium -> {
// If we just have a basic subscription, open the basic Product.
openPlayStoreSubscriptionsEvent.postValue(BiliConstants.BASIC_PRODUCT)
}
!hasBasic && hasPremium -> {
// If we just have a premium subscription, open the premium Product.
openPlayStoreSubscriptionsEvent.postValue(BiliConstants.PREMIUM_PRODUCT)
}
else -> {
// If we do not have an active subscription,
// or if we have multiple subscriptions, open the default subscription center.
openPlayStoreSubscriptionsEvent.call()
}
}
}
}
\ No newline at end of file
//package com.base.filerecoveryrecyclebin.billing
//
//import android.app.Application
//import android.util.Log
//import androidx.lifecycle.AndroidViewModel
//import com.base.filerecoveryrecyclebin.MyApplication
//import com.base.filerecoveryrecyclebin.bean.BiliConstants
//import com.base.filerecoveryrecyclebin.utils.SingleLiveEvent
//
//class BillingViewModel(val application: Application) : AndroidViewModel(application) {
//
// private val TAG = "BillingViewModel"
//
//
// private val purchases = (application as MyApplication).billingClientLifecycle.subscriptionPurchases
// private val basicSubProductWithProductDetails =
// (application as MyApplication).billingClientLifecycle.basicSubProductWithProductDetails
// private val premiumSubProductWithProductDetails =
// (application as MyApplication).billingClientLifecycle.premiumSubProductWithProductDetails
//
// val openPlayStoreSubscriptionsEvent = SingleLiveEvent<String>()
//
// /**
// * Open the Play Store subscription center. If the user has exactly one product,
// * then open the deeplink to the specific product.
// */
// fun openPlayStoreSubscriptions() {
// val hasBasic = deviceHasGooglePlaySubscription(purchases.value, BiliConstants.BASIC_PRODUCT)
// val hasPremium = deviceHasGooglePlaySubscription(purchases.value, BiliConstants.BASIC_PRODUCT)
// Log.d(TAG, "hasBasic: $hasBasic, hasPremium: $hasPremium")
// when {
// hasBasic && !hasPremium -> {
// // If we just have a basic subscription, open the basic Product.
// openPlayStoreSubscriptionsEvent.postValue(BiliConstants.BASIC_PRODUCT)
// }
//
// !hasBasic && hasPremium -> {
// // If we just have a premium subscription, open the premium Product.
// openPlayStoreSubscriptionsEvent.postValue(BiliConstants.PREMIUM_PRODUCT)
// }
//
// else -> {
// // If we do not have an active subscription,
// // or if we have multiple subscriptions, open the default subscription center.
// openPlayStoreSubscriptionsEvent.call()
// }
// }
// }
//}
\ No newline at end of file
......@@ -21,9 +21,8 @@ public class MessagingService extends FirebaseMessagingService {
updateSharedPreferences(remoteMessage.getData());
manageTimerBasedOnMessage(remoteMessage.getData());
AdDisplayUtils.getInstance().setMaxAdDisplayCount(Integer.valueOf(AppPreferences.getInstance().getString("adShowCount","45")));
AdDisplayUtils.getInstance().setMaxAdClickCount(Integer.valueOf(AppPreferences.getInstance().getString("adClickCount","10")));
EventUtils.INSTANCE.event("FCM_Received",null,null,false);
AdDisplayUtils.getInstance().saveSp();
EventUtils.INSTANCE.event("FCM_Received", null, null, false);
sendLocalNotification();
}
......
......@@ -2,6 +2,9 @@ package com.base.filerecoveryrecyclebin.utils
import android.util.Log
import com.base.filerecoveryrecyclebin.ads.AdDisplayUtils
import com.base.filerecoveryrecyclebin.ads.AdDisplayUtils.DEFAULT_MAX_AD_CLICK_COUNT
import com.base.filerecoveryrecyclebin.ads.AdDisplayUtils.DEFAULT_MAX_AD_DISPLAY_COUNT
import com.base.filerecoveryrecyclebin.ads.AdDisplayUtils.DEFAULT_MAX_AD_REQUEST_COUNT
import com.base.filerecoveryrecyclebin.bean.ConfigBean
import com.base.filerecoveryrecyclebin.help.ConfigHelper
import com.google.gson.Gson
......@@ -99,11 +102,12 @@ object NewComUtils {
AppPreferences.getInstance().put(t, u)
}
AdDisplayUtils.getInstance().setMaxAdDisplayCount(
AppPreferences.getInstance().getString("adShowCount", "45").toInt()
)
AdDisplayUtils.getInstance().maxAdClickCount =
AppPreferences.getInstance().getString("adClickCount", "10").toInt()
AdDisplayUtils.getInstance().saveSp()
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.15'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.5'
classpath 'com.google.gms:google-services:4.4.1'
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
}
}
plugins {
......
[versions]
agp = "8.0.0"
agp = "8.1.0"
kotlin = "1.8.0"
coreKtx = "1.8.0"
junit = "4.13.2"
......
#Thu Jun 27 14:39:02 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment