Commit e654049e authored by wanglei's avatar wanglei Committed by songjianyu

[测试]远程获取配置

parent df2e7b9e
......@@ -5,23 +5,23 @@ package com.base.appzxhy
*/
object GlobalConfig {
//包名
const val PACKAGE_NAME = "com.loactation.alibabab.ccccaa"
const val PACKAGE_NAME = "com.dumpster.cleaner.tbt"
// 域名
/**
* Url Event 上报接口
*/
const val URL_EVENT = "https://rp.gamexzonerk.xyz"
const val URL_EVENT = "https://rp.kubukubanten.xyz"
/**
* Url Api 业务接口
*/
const val URL_API = "https://api.gamexzonerk.xyz"
const val URL_API = "https://api.kubukubanten.xyz"
/**
* Url Privacy 隐私链接
*/
const val URL_PRIVACY = "https://sites.google.com/view/locationuses/location"
const val URL_PRIVACY = "https://sites.google.com/view/dumpster-cleaner/dumpster-cleaner"
/**
* Url Use 使用条款
......@@ -31,7 +31,7 @@ object GlobalConfig {
/**
* Key Aes 加密key
*/
const val KEY_AES = "pex50vwzuhpim3yh"
const val KEY_AES = "d1mnzmn2cs20xpmx"
/**
* Key solar 归因key
......
......@@ -31,12 +31,14 @@ import com.base.appzxhy.bean.config.AdConfigBean
import com.base.appzxhy.bean.config.ConfigBean
import com.base.appzxhy.bean.config.PopupConfigBean
import com.base.appzxhy.business.ads.AdsMgr
import com.base.appzxhy.business.helper.NewComUtils.spConfig
import com.base.appzxhy.business.push.fcm.FCMManager
import com.base.appzxhy.business.push.notification.MyNotificationManager
import com.base.appzxhy.push.fcm.FCMManager
import com.base.appzxhy.push.receiver.AlarmReceiver.Companion.startAlarm
import com.base.appzxhy.push.receiver.ScreenStatusReceiver
import com.base.appzxhy.push.timer.TimerManager.Companion.changeTimer
import com.base.appzxhy.push.work.RepeatingWorker.Companion.schedulePeriodicWork
import com.base.appzxhy.ui.batteryinfo.BatteryReceiver.Companion.registerBatteryReceiver
import com.base.appzxhy.ui.splash.SplashActivity
......@@ -62,7 +64,6 @@ class MyApplication : Application() {
)
}
override fun onCreate() {
super.onCreate()
appContext = this
......@@ -143,7 +144,7 @@ class MyApplication : Application() {
ScreenStatusReceiver.registerScreenStatusReceiver(this)
// PackageStatusReceiver.registerPackageStatusReceiver(this)
// BatteryStatusReceiver.registerBatteryStatusReceiver(this)
registerBatteryReceiver(this)
//workManager
schedulePeriodicWork(appContext)
......@@ -161,10 +162,7 @@ class MyApplication : Application() {
private fun initAppConfig() {
Thread {
val config = AppPreferences.getInstance().getString("config", "")
if (config.isNotEmpty()) {
initConfig(config)
}
initConfig()
InstallHelps.init {
initRemoteConfig()
......@@ -252,7 +250,8 @@ class MyApplication : Application() {
}
private fun initConfig(config: String) {
private fun initConfig(config: String = spConfig) {
if (config.isEmpty()) return
// kotlin.runCatching {
val configBean = Gson().fromJson(config, ConfigBean::class.java)
......@@ -279,4 +278,5 @@ class MyApplication : Application() {
}
}
\ No newline at end of file
......@@ -80,5 +80,14 @@ object SpConstObject {
AppPreferences.getInstance().put("mainPageCount", value, true)
}
//fcm token
var fcmToken = ""
get() {
return AppPreferences.getInstance().getString("fcmToken", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("fcmToken", value, true)
}
}
\ No newline at end of file
......@@ -15,5 +15,10 @@ class FeatureBean(
const val LARGE_FILE_CLEAN = "large_file_clean"
const val PHOTO_COMPRESSION = "photo_compression"
const val SIMILAR_PHOTOS = "similar_photos"
const val RECOVERY_PHOTOS="recovery_photos"
const val RECOVERY_VIDEOS="recovery_videos"
const val RECOVERY_AUDIOS="recovery_audios"
const val RECOVERY_DOCUMENTS="recovery_documents"
}
}
\ No newline at end of file
......@@ -10,7 +10,6 @@ import com.applovin.sdk.AppLovinSdkInitializationConfiguration
import com.base.appzxhy.BuildConfig
import com.base.appzxhy.GlobalConfig
import com.base.appzxhy.MyApplication
import com.base.appzxhy.bean.config.AdConfigBean
import com.base.appzxhy.bean.config.AdConfigBean.Companion.adsConfigBean
import com.base.appzxhy.bean.config.ConfigBean.Companion.configBean
import com.base.appzxhy.business.ads.admob.AdBannerMgr
......@@ -168,11 +167,6 @@ object AdsMgr {
) {
eventAdUt()
if (!adsConfigBean.isAdShow) {
showCallBack?.failed()
return
}
if (configBean.isInBlackList) {
EventUtils.event("isInBlackList", "isInBlackList=${configBean.isInBlackList}")
showCallBack?.failed()
......@@ -214,11 +208,6 @@ object AdsMgr {
) {
eventAdUt()
if (!adsConfigBean.isAdShow) {
showCallBack?.failed()
return
}
if (configBean.isInBlackList) {
EventUtils.event("isInBlackList", configBean.isInBlackList.toString())
showCallBack?.failed()
......@@ -244,10 +233,6 @@ object AdsMgr {
@LayoutRes layout: Int,
nativeCallBack: ((Any?) -> Unit)? = null
) {
if (!adsConfigBean.isAdShow) {
nativeCallBack?.invoke(null)
return
}
if (configBean.isInBlackList) {
EventUtils.event("isInBlackList", configBean.isInBlackList.toString())
return
......@@ -275,9 +260,6 @@ object AdsMgr {
* @param parent 展示广告的父布局容器
*/
fun showBanner(parent: ViewGroup, collapsible: Boolean = true, adClose: (() -> Unit)? = null) {
if (!adsConfigBean.isAdShow) {
return
}
if (configBean.isInBlackList) {
EventUtils.event("isInBlackList", configBean.isInBlackList.toString())
return
......
......@@ -4,6 +4,7 @@ import android.util.Base64
import android.util.Log
import com.base.appzxhy.BuildConfig
import com.base.appzxhy.GlobalConfig
import com.base.appzxhy.bean.config.ConfigBean
import com.base.appzxhy.utils.AppPreferences
import com.base.appzxhy.utils.LogEx
import kotlinx.coroutines.CoroutineScope
......@@ -22,6 +23,26 @@ object NewComUtils {
private const val PACKAGE_NAME_PREFIX = GlobalConfig.PACKAGE_NAME
private const val DATA_KEY = "data"
//sp配置缓存
var spConfig = ""
get() {
return AppPreferences.getInstance().getString("spConfig", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("spConfig", value, true)
}
//上次请求时间
private var lastRequestTime = 0L
get() {
return AppPreferences.getInstance().getLong("lastRequestTime", field)
}
set(value) {
field = value
AppPreferences.getInstance().put("lastRequestTime", value, true)
}
private val url: String by lazy {
val packageName = GlobalConfig.PACKAGE_NAME
val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault())
......@@ -39,7 +60,7 @@ object NewComUtils {
"&aid=${AppPreferences.getInstance().getString("uuid", "")}"
if (BuildConfig.DEBUG) {
s = "$s&mode=3"
s = "$s&mode=4"
}
s
// mode =3 google mode=2 facebook mode=1 自然,mode=4 测试
......@@ -48,7 +69,22 @@ object NewComUtils {
fun requestCfg(callback: (json: String?) -> Unit) {
CoroutineScope(Dispatchers.IO).launch {
val passHour = (System.currentTimeMillis() - lastRequestTime) / 3600000
if (BuildConfig.DEBUG) {
lastRequestTime = 0L
}
if (lastRequestTime != 0L && passHour < ConfigBean.configBean.getConfigInterval) {
callback.invoke(null)
Log.e(TAG, "请求间隔 passHour=$passHour")
return@launch
}
val response = doGet()
if (response == null) {
withContext(Dispatchers.Main) {
......@@ -64,8 +100,10 @@ object NewComUtils {
}
return@launch
}
lastRequestTime = System.currentTimeMillis()
val decryptedData = AESHelper.decrypt(data)
LogEx.logDebug(TAG, "decryptedData=$decryptedData")
spConfig = decryptedData
withContext(Dispatchers.Main) {
callback(decryptedData)
}
......
......@@ -81,7 +81,7 @@ class StayJobService : JobService() {
}
private fun notifyForeground() {
LogEx.logDebug(TAG, "notifyForeground")
// LogEx.logDebug(TAG, "notifyForeground")
val notificationManager =
getSystemService(NOTIFICATION_SERVICE) as NotificationManager
......
......@@ -67,7 +67,7 @@ object StayNotification {
val builder = NotificationCompat.Builder(context, channelId)
val smallIcon = IconCompat.createFromIcon(
context, Icon.createWithResource(
context, R.mipmap.logo
context, R.mipmap.ic_launcher
)
)
......@@ -79,7 +79,7 @@ object StayNotification {
val pendingIntent =
PendingIntent.getActivity(context, 0, nfIntent, PendingIntent.FLAG_IMMUTABLE)
builder.setLargeIcon(BitmapFactory.decodeResource(context.resources, R.mipmap.logo))
builder.setLargeIcon(BitmapFactory.decodeResource(context.resources, R.mipmap.ic_launcher))
builder.setContentTitle(context.resources.getString(R.string.app_name))
builder.setContentIntent(pendingIntent) //设置PendingIntent
builder.setVisibility(NotificationCompat.VISIBILITY_PRIVATE) //设置通知公开可见
......
......@@ -25,7 +25,7 @@ class BatteryReceiver(
var mA = 0.0F//电流
var avmA = 0.0F//平均电流
fun register(context: Context) {
fun registerBatteryReceiver(context: Context) {
val intentFilter = IntentFilter().apply {
addAction(Intent.ACTION_BATTERY_CHANGED)
}
......@@ -71,5 +71,6 @@ class BatteryReceiver(
private fun uiHandle(context: Context) {
}
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ import com.base.appzxhy.ui.dialog.NotificationTurnOnDialog
import com.base.appzxhy.ui.dialog.RateDialog
import com.base.appzxhy.ui.dialog.StoragePermissionDialog
import com.base.appzxhy.ui.recyclebin.RecycleBinFragment
import com.base.appzxhy.ui.set.SettingsFragment
import com.base.appzxhy.utils.PermissionUtils.requestNotificationPermission
import com.base.appzxhy.utils.PermissionUtils.requestStoragePermission
import com.google.android.material.tabs.TabLayout
......@@ -38,7 +39,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
private val fragmentList = listOf(
// Home2Fragment(),
Home3Fragment(),
RecoveryFragment(),
SettingsFragment(),
// RecycleBinFragment()
)
......
......@@ -3,6 +3,7 @@ package com.base.appzxhy.ui.set
import android.annotation.SuppressLint
import android.content.Intent
import android.os.Bundle
import android.view.View
import com.base.appzxhy.BuildConfig
import com.base.appzxhy.GlobalConfig.URL_PRIVACY
import com.base.appzxhy.SpConstObject.cleanedSize
......@@ -12,9 +13,13 @@ import com.base.appzxhy.utils.KotlinExt.toFormatSize
import androidx.core.net.toUri
import androidx.core.view.updatePadding
import com.base.appzxhy.R
import com.base.appzxhy.SpConstObject.fcmToken
import com.base.appzxhy.bean.config.ConfigBean
import com.base.appzxhy.business.ads.AdsMgr
import com.base.appzxhy.ui.dialog.RateDialog
import com.base.appzxhy.utils.MyAnimationUtils
import com.base.appzxhy.utils.ClipboardUtils.copyText
import com.base.appzxhy.utils.ToastUtils.toast
import com.google.gson.GsonBuilder
class SettingsFragment : BaseFragment<FragmentSettingsBinding>(FragmentSettingsBinding::inflate) {
......@@ -33,11 +38,27 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>(FragmentSettingsB
override fun initView() {
super.initView()
binding.tvCleanedUp.text = cleanedSize.toFormatSize()
binding.tvVersion.text = "v${BuildConfig.VERSION_NAME}"
MyAnimationUtils.rotation(binding.ivBlade)
// MyAnimationUtils.rotation(binding.ivBlade)
AdsMgr.showNative(binding.flAd, R.layout.layout_admob_native_custom)
if (BuildConfig.DEBUG) {
binding.tvToken.visibility = View.VISIBLE
binding.tvToken.text = fcmToken
binding.tvToken.setOnClickListener {
requireContext().copyText("token", fcmToken)
requireContext().toast("copy token")
}
binding.tvSettings.setOnClickListener {
val configBean = ConfigBean.configBean
val gson = GsonBuilder().setPrettyPrinting().create()
val json = gson.toJson(configBean)
requireContext().copyText("json", json)
requireContext().toast("copy json")
}
}
}
override fun initListener() {
......@@ -49,7 +70,9 @@ class SettingsFragment : BaseFragment<FragmentSettingsBinding>(FragmentSettingsB
val dialog = RateDialog(requireActivity())
dialog.showDialog(true)
}
binding.ivBack.setOnClickListener {
(requireActivity() as SettingActivity).onBackPressedDispatcher.onBackPressed()
}
}
override fun onResume() {
......
......@@ -164,8 +164,12 @@
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/bg_ffffff_8"
android:gravity="center_vertical"
android:paddingStart="64dp"
android:text="@string/large_file_clean"
android:textSize="10sp"
android:textColor="@color/fontsBlack"
android:textSize="@dimen/sp_16"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/cardview" />
<ImageView
......@@ -177,6 +181,15 @@
app:layout_constraintStart_toStartOf="@id/tv_large_file_clean"
app:layout_constraintTop_toTopOf="@id/tv_large_file_clean" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:src="@drawable/jianotu"
app:layout_constraintBottom_toBottomOf="@id/tv_large_file_clean"
app:layout_constraintEnd_toEndOf="@id/tv_large_file_clean"
app:layout_constraintTop_toTopOf="@id/tv_large_file_clean" />
<TextView
android:id="@+id/tv_photo_compress"
android:layout_width="match_parent"
......@@ -184,6 +197,12 @@
android:layout_marginHorizontal="16dp"
android:layout_marginTop="12dp"
android:background="@drawable/bg_ffffff_8"
android:gravity="center_vertical"
android:paddingStart="64dp"
android:text="@string/photo_compression"
android:textColor="@color/fontsBlack"
android:textSize="@dimen/sp_16"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/tv_large_file_clean" />
<ImageView
......@@ -195,6 +214,15 @@
app:layout_constraintStart_toStartOf="@id/tv_photo_compress"
app:layout_constraintTop_toTopOf="@id/tv_photo_compress" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:src="@drawable/jianotu"
app:layout_constraintBottom_toBottomOf="@id/tv_photo_compress"
app:layout_constraintEnd_toEndOf="@id/tv_photo_compress"
app:layout_constraintTop_toTopOf="@id/tv_photo_compress" />
<TextView
android:id="@+id/tv_screenshot_clean"
android:layout_width="match_parent"
......@@ -202,6 +230,12 @@
android:layout_marginHorizontal="16dp"
android:layout_marginTop="16dp"
android:background="@drawable/bg_ffffff_8"
android:gravity="center_vertical"
android:paddingStart="64dp"
android:text="@string/screenshot_clean"
android:textColor="@color/fontsBlack"
android:textSize="@dimen/sp_16"
android:textStyle="bold"
app:layout_constraintTop_toBottomOf="@id/tv_photo_compress" />
<ImageView
......@@ -213,6 +247,15 @@
app:layout_constraintStart_toStartOf="@id/tv_screenshot_clean"
app:layout_constraintTop_toTopOf="@id/tv_screenshot_clean" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:src="@drawable/jianotu"
app:layout_constraintBottom_toBottomOf="@id/tv_screenshot_clean"
app:layout_constraintEnd_toEndOf="@id/tv_screenshot_clean"
app:layout_constraintTop_toTopOf="@id/tv_screenshot_clean" />
<TextView
android:id="@+id/tv_similar_photo"
android:layout_width="match_parent"
......@@ -221,6 +264,12 @@
android:layout_marginTop="16dp"
android:layout_marginBottom="12dp"
android:background="@drawable/bg_ffffff_8"
android:gravity="center_vertical"
android:paddingStart="64dp"
android:text="@string/similar_photos"
android:textColor="@color/fontsBlack"
android:textSize="@dimen/sp_16"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_screenshot_clean" />
......@@ -233,6 +282,14 @@
app:layout_constraintStart_toStartOf="@id/tv_similar_photo"
app:layout_constraintTop_toTopOf="@id/tv_similar_photo" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
android:src="@drawable/jianotu"
app:layout_constraintBottom_toBottomOf="@id/tv_similar_photo"
app:layout_constraintEnd_toEndOf="@id/tv_similar_photo"
app:layout_constraintTop_toTopOf="@id/tv_similar_photo" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
......
......@@ -13,6 +13,13 @@
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/iv_back"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_settings"
android:layout_width="wrap_content"
......
......@@ -22,14 +22,12 @@
<ImageView
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"
android:src="@drawable/icon_clean_stay"
tools:ignore="ContentDescription" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:src="@drawable/icon_tixing"
tools:ignore="ContentDescription" />
</FrameLayout>
......@@ -40,8 +38,7 @@
android:layout_marginTop="@dimen/dp_2"
android:includeFontPadding="false"
android:text="@string/clean"
android:textColor="#1A1A1A"
android:textSize="@dimen/sp_15" />
android:textColor="#1A1A1A" />
</LinearLayout>
<LinearLayout
......@@ -56,7 +53,6 @@
<ImageView
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"
android:src="@drawable/icon_photos_stay"
tools:ignore="ContentDescription" />
<TextView
......@@ -65,8 +61,7 @@
android:layout_marginTop="@dimen/dp_2"
android:includeFontPadding="false"
android:text="@string/photos"
android:textColor="#1A1A1A"
android:textSize="@dimen/sp_15" />
android:textColor="#1A1A1A" />
</LinearLayout>
<LinearLayout
......@@ -81,7 +76,6 @@
<ImageView
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"
android:src="@drawable/icon_videos_stay"
tools:ignore="ContentDescription" />
<TextView
......@@ -90,8 +84,7 @@
android:layout_marginTop="@dimen/dp_2"
android:includeFontPadding="false"
android:text="@string/videos"
android:textColor="#1A1A1A"
android:textSize="@dimen/sp_15" />
android:textColor="#1A1A1A" />
</LinearLayout>
<LinearLayout
......@@ -106,7 +99,6 @@
<ImageView
android:layout_width="@dimen/dp_45"
android:layout_height="@dimen/dp_45"
android:src="@drawable/icon_documents_stay"
tools:ignore="ContentDescription" />
<TextView
......@@ -115,8 +107,7 @@
android:layout_marginTop="@dimen/dp_2"
android:includeFontPadding="false"
android:text="@string/documents"
android:textColor="#1A1A1A"
android:textSize="@dimen/sp_15" />
android:textColor="#1A1A1A" />
</LinearLayout>
......
......@@ -22,14 +22,12 @@
<ImageView
android:layout_width="@dimen/dp_35"
android:layout_height="@dimen/dp_35"
android:src="@drawable/icon_clean_stay"
tools:ignore="ContentDescription" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:src="@drawable/icon_tixing"
tools:ignore="ContentDescription" />
</FrameLayout>
......@@ -55,7 +53,6 @@
<ImageView
android:layout_width="@dimen/dp_35"
android:layout_height="@dimen/dp_35"
android:src="@drawable/icon_photos_stay"
tools:ignore="ContentDescription,ImageContrastCheck" />
<TextView
......@@ -80,7 +77,6 @@
<ImageView
android:layout_width="@dimen/dp_35"
android:layout_height="@dimen/dp_35"
android:src="@drawable/icon_videos_stay"
tools:ignore="ContentDescription" />
<TextView
......@@ -105,7 +101,6 @@
<ImageView
android:layout_width="@dimen/dp_35"
android:layout_height="@dimen/dp_35"
android:src="@drawable/icon_documents_stay"
tools:ignore="ContentDescription,ImageContrastCheck" />
<TextView
......
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