Commit 83fae7df authored by wanglei's avatar wanglei

....

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