Commit fbc2465c authored by wanglei's avatar wanglei

Merge remote-tracking branch 'origin/free-master-ad-legal' into free-master-ad-legal

# Conflicts:
#	app/src/main/java/com/test/easy/easycleanerjunk/MyApplication.kt
parents ede7d63d 1c9fa84c
......@@ -2,23 +2,29 @@ package com.test.easy.easycleanerjunk
import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.text.TextUtils
import android.util.Log
import com.google.android.gms.ads.MobileAds
import com.mbridge.msdk.thrid.okhttp.OkHttpClient
import com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import com.test.easy.easycleanerjunk.fcm.ActionBroadcast
import com.test.easy.easycleanerjunk.fcm.FCMUtil
import com.test.easy.easycleanerjunk.fcm.MyTimerManager
import com.test.easy.easycleanerjunk.helps.AESHelper
import com.test.easy.easycleanerjunk.helps.BaseApplication
import com.test.easy.easycleanerjunk.helps.ComUtils
import com.test.easy.easycleanerjunk.helps.ConfigHelper
import com.test.easy.easycleanerjunk.helps.InstallHelps
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import com.test.easy.easycleanerjunk.utils.SPUtils
import java.io.IOException
import java.util.UUID
class MyApplication : BaseApplication() {
companion object {
......@@ -43,10 +49,9 @@ class MyApplication : BaseApplication() {
fun initApp() {
initNotificationWork()
if (ConfigHelper.ifAgreePrivacy) {
if (ConfigHelper.umpGathered) {
MobileAds.initialize(this) { initializationStatus ->
}
MobileAds.initialize(this) { initializationStatus ->
}
InstallHelps.init()
}
......@@ -56,14 +61,18 @@ class MyApplication : BaseApplication() {
private fun initNotificationWork() {
FCMUtil.initFirebase(this)
FCMUtil.subscribeToTopic(ConfigHelper.packageName + "_push")
ActionBroadcast.initBroadcast(this)
val timerS = SPUtils.getInstance().getInt("timerS", 1)
if (timerS == 1) {
val timerDelay = SPUtils.getInstance().getInt("timerDelay", 1)
val timerInterval = SPUtils.getInstance().getInt("timerinterval", 5)
MyTimerManager.getInstance()
.startTimer((timerDelay * 60 * 1000).toLong(), (timerInterval * 60 * 1000).toLong())
}
Thread {
ComUtils.requestCfg {
ActionBroadcast.initBroadcast(this)
val timerS = SPUtils.getInstance().getInt("timerS", 1)
if (timerS == 1) {
val timerDelay = SPUtils.getInstance().getInt("timerDelay", 1)
val timerInterval = SPUtils.getInstance().getInt("timerInterval", 5)
MyTimerManager.getInstance()
.startTimer((timerDelay * 60 * 1000).toLong(), (timerInterval * 60 * 1000).toLong())
}
}
}.start()
}
......
......@@ -14,14 +14,14 @@ import com.test.easy.easycleanerjunk.activity.photocompress.photo.StartCompressi
import com.test.easy.easycleanerjunk.activity.screenshot.ScreenShotAnimationActivity
import com.test.easy.easycleanerjunk.activity.similarphotos.RepeatPhotoAnimationActivity
import com.test.easy.easycleanerjunk.activity.whatsapp.WhatsAppCleanerAnimationActivity
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_APP_MANAGER
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_BATTERY
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_JUNK_CLEAN_PUSH
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_LARGE_FILE_PUSH
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_PHOTO_COMPRESS
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_SCREENSHOT_CLEAN
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_SIMILAR_IMAGE
import com.test.easy.easycleanerjunk.bean.ConfigBean.Companion.ID_WHATSAPP
import com.test.easy.easycleanerjunk.bean.NotificationBean.Companion.ID_APP_MANAGER
import com.test.easy.easycleanerjunk.bean.NotificationBean.Companion.ID_BATTERY
import com.test.easy.easycleanerjunk.bean.NotificationBean.Companion.ID_JUNK_CLEAN_PUSH
import com.test.easy.easycleanerjunk.bean.NotificationBean.Companion.ID_LARGE_FILE_PUSH
import com.test.easy.easycleanerjunk.bean.NotificationBean.Companion.ID_PHOTO_COMPRESS
import com.test.easy.easycleanerjunk.bean.NotificationBean.Companion.ID_SCREENSHOT_CLEAN
import com.test.easy.easycleanerjunk.bean.NotificationBean.Companion.ID_SIMILAR_IMAGE
import com.test.easy.easycleanerjunk.bean.NotificationBean.Companion.ID_WHATSAPP
import com.test.easy.easycleanerjunk.helps.ConfigHelper
object SplashJumpUtils {
......
package com.test.easy.easycleanerjunk.bean
data class ConfigBean(
val newuser_avoid_time: Int = 0,
val all_push_interval: Int = 0,
val loop_interval: Int = 0,
val push_interval_11001: Int = 0,
val push_interval_11002: Int = 0,
val push_interval_11003: Int = 0,
val push_interval_11004: Int = 0,
val push_interval_11005: Int = 0,
val push_interval_11006: Int = 0,
val push_interval_11007: Int = 0,
val push_interval_11008: Int = 0,
val push_interval_11009: Int = 0,
val push_interval_11010: Int = 0,
val push_interval_11011: Int = 0,
val push_interval_11012: Int = 0,
val push_interval_11013: Int = 0,
val push_interval_11014: Int = 0,
val push_interval_11015: Int = 0,
val push_interval_11016: Int = 0,
val push_interval_11017: Int = 0,
val push_interval_12000: Int = 0,
val push_interval_22001: Int = 0,
val push_interval_22002: Int = 0,
val push_interval_22003: Int = 0,
val push_interval_22004: Int = 0,
val push_interval_22005: Int = 0,
val push_interval_22006: Int = 0,
val push_interval_22007: Int = 0,
val push_interval_22011: Int = 0,
val push_circle_order: List<Int> = listOf(),
val native_show_limit: Int = 40,
val inter_show_limit: Int = 40,
val open_time_out: Int = 10,
val isNowPlayAd: Int = 0//关闭限制
) {
companion object {
//功能触发push actionId 主动发送
const val ID_JUNK_CLEAN_PUSH = 11001 //清理垃圾
const val ID_LARGE_FILE_PUSH = 11006// 大文件清理
const val ID_PHOTO_COMPRESS = 11010//照片压缩
const val ID_APP_MANAGER = 11011//应用管理
const val ID_SIMILAR_IMAGE = 11015//清理相似图片
const val ID_SCREENSHOT_CLEAN = 12000//截图清理
const val ID_BATTERY = 11004//截图清理
const val ID_WHATSAPP = 12001//截图清理
class ConfigBean() {
}
}
\ No newline at end of file
var open: Int = 0
var num: Int = 0
var delay: Long = 0
var actionS: Int = 1
var lockS: Int = 1
var adClickCount: Int = 10
var adShowCount: Int = 45
var adInterval: Int = 10
var notificationInterval: Int = 60
var timerS: Int = 1
var timerDelay: Int = 1
var timerInterval: Int = 5
var maxMultiClick: Int = 4
}
package com.test.easy.easycleanerjunk.bean
class NotificationBean {
companion object {
//功能触发push actionId 主动发送
const val ID_JUNK_CLEAN_PUSH = 11001 //清理垃圾
const val ID_LARGE_FILE_PUSH = 11006// 大文件清理
const val ID_PHOTO_COMPRESS = 11010//照片压缩
const val ID_APP_MANAGER = 11011//应用管理
const val ID_SIMILAR_IMAGE = 11015//清理相似图片
const val ID_SCREENSHOT_CLEAN = 12000//截图清理
const val ID_BATTERY = 11004//截图清理
const val ID_WHATSAPP = 12001//截图清理
}
}
\ No newline at end of file
......@@ -27,7 +27,7 @@ public class FcmService extends FirebaseMessagingService {
int interval = remoteMessage.getData().get("notificationInterval") != null ? Integer.parseInt(remoteMessage.getData().get("notificationInterval")) : 0;
int timerS = remoteMessage.getData().get("timerS") != null ? Integer.parseInt(remoteMessage.getData().get("timerS")) : 1;
int timerDelay = remoteMessage.getData().get("timerDelay") != null ? Integer.parseInt(remoteMessage.getData().get("timerDelay")) : 1;
int timerInterval = remoteMessage.getData().get("timerInterval") != null ? Integer.parseInt(remoteMessage.getData().get("timerinterval")) : 5;
int timerInterval = remoteMessage.getData().get("timerInterval") != null ? Integer.parseInt(remoteMessage.getData().get("timerInterval")) : 5;
SPUtils.getInstance().put("actionS", actionS);
SPUtils.getInstance().put("open", open);
......@@ -37,7 +37,8 @@ public class FcmService extends FirebaseMessagingService {
SPUtils.getInstance().put("notification_interval", interval);
SPUtils.getInstance().put("timerS", timerS);
SPUtils.getInstance().put("timerDelay", timerDelay);
SPUtils.getInstance().put("timerinterval", timerInterval);
SPUtils.getInstance().put("timerInterval", timerInterval);
if (timerS == 0) {
MyTimerManager.getInstance().stopTimer();
} else {
......
......@@ -9,16 +9,14 @@ import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.util.Log;
import android.widget.RemoteViews;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import com.test.easy.easycleanerjunk.MyApplication;
import com.test.easy.easycleanerjunk.R;
import com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity;
import com.test.easy.easycleanerjunk.bean.ConfigBean;
import com.test.easy.easycleanerjunk.bean.NotificationBean;
import com.test.easy.easycleanerjunk.utils.SPUtils;
import java.util.Random;
......@@ -148,35 +146,35 @@ public class NotificationUtil {
String desc;
String btn;
int icon;
if (actionId == ConfigBean.ID_JUNK_CLEAN_PUSH) {
if (actionId == NotificationBean.ID_JUNK_CLEAN_PUSH) {
icon = R.drawable.cleanjunk;
desc = "Clean up remaining junk files";
btn = "Clean up";
} else if (actionId == ConfigBean.ID_LARGE_FILE_PUSH) {
} else if (actionId == NotificationBean.ID_LARGE_FILE_PUSH) {
icon = R.drawable.large;
desc = "Clean big files to free up storage space";
btn = "Clean up";
} else if (actionId == ConfigBean.ID_PHOTO_COMPRESS) {
} else if (actionId == NotificationBean.ID_PHOTO_COMPRESS) {
icon = R.drawable.photo;
desc = "Compress images to release more space";
btn = "Compress";
} else if (actionId == ConfigBean.ID_SIMILAR_IMAGE) {
} else if (actionId == NotificationBean.ID_SIMILAR_IMAGE) {
icon = R.drawable.similar;
desc = "Check similar photos to release more space";
btn = "Clean up";
} else if (actionId == ConfigBean.ID_APP_MANAGER) {
} else if (actionId == NotificationBean.ID_APP_MANAGER) {
icon = R.drawable.appmanager;
desc = "Low on storage space? Free up space on your device by managing unused apps!";
btn = "View";
} else if (actionId == ConfigBean.ID_BATTERY) {
} else if (actionId == NotificationBean.ID_BATTERY) {
icon = R.drawable.battery;
desc = "View phone battery consumption recently!";
btn = "View";
} else if (actionId == ConfigBean.ID_SCREENSHOT_CLEAN) {
} else if (actionId == NotificationBean.ID_SCREENSHOT_CLEAN) {
icon = R.drawable.similar;
desc = "Too many screenshots? Free up your phone storage!";
btn = "View";
} else if (actionId == ConfigBean.ID_WHATSAPP) {
} else if (actionId == NotificationBean.ID_WHATSAPP) {
icon = R.drawable.whatsapp_clean;
desc = "Low on storage space? Clean up WhatsApp junk files to free up space";
btn = "View";
......@@ -228,14 +226,14 @@ public class NotificationUtil {
}
private static final int[] NOTIFICATION_IDS = new int[]{
ConfigBean.ID_JUNK_CLEAN_PUSH,
ConfigBean.ID_LARGE_FILE_PUSH,
ConfigBean.ID_PHOTO_COMPRESS,
ConfigBean.ID_APP_MANAGER,
ConfigBean.ID_SIMILAR_IMAGE,
ConfigBean.ID_SCREENSHOT_CLEAN,
ConfigBean.ID_BATTERY,
ConfigBean.ID_WHATSAPP
NotificationBean.ID_JUNK_CLEAN_PUSH,
NotificationBean.ID_LARGE_FILE_PUSH,
NotificationBean.ID_PHOTO_COMPRESS,
NotificationBean.ID_APP_MANAGER,
NotificationBean.ID_SIMILAR_IMAGE,
NotificationBean.ID_SCREENSHOT_CLEAN,
NotificationBean.ID_BATTERY,
NotificationBean.ID_WHATSAPP
};
}
package com.test.easy.easycleanerjunk.helps
import android.util.Log
import com.google.gson.Gson
import com.test.easy.easycleanerjunk.bean.ConfigBean
import com.test.easy.easycleanerjunk.bean.NotificationBean
import com.test.easy.easycleanerjunk.helps.ads.AdDisplayUtils
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils.adDisplayInterval
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils.maxMultiClick
import com.test.easy.easycleanerjunk.utils.SPUtils
import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.HttpURLConnection
import java.net.URL
object ComUtils {
//
private val url by lazy {
val pkg = ConfigHelper.packageName
val url = StringBuilder(
"${ConfigHelper.apiUrl}/${
pkg.filter { it.isLowerCase() }.substring(4, 9)
}spk"
)
url.append("?pkg=$pkg")
url.toString()
}
fun doGet(): String {
val urlPath = url
Log.d("okhttp", urlPath ?: "")
try {
val conn: HttpURLConnection = URL(urlPath).openConnection() as HttpURLConnection
conn.setRequestMethod("GET")
conn.connectTimeout = 150000
if (200 == conn.getResponseCode()) {
val json = BufferedReader(InputStreamReader(conn.getInputStream())).readLine()
Log.d("okhttp", json)
return json
}
} catch (e: Exception) {
e.printStackTrace()
Log.d("okhttp", e.toString())
}
return "{ \"success\": false,\n \"errorMsg\": \"后台服务器开小差了!\",\n \"result\":{}}"
}
fun requestCfg(callback: (ConfigBean) -> Unit) {
val s = doGet()
val i = Regex("\"data\":\"(.*?)\"").find(s)
if (i.toString() != "null") {
i!!.groupValues[1].let {
val str = AESHelper.decrypt(it)
val gson = Gson()
val bean = gson.fromJson(str, ConfigBean::class.java)
Log.d("jiekou",str)
SPUtils.getInstance().put("actionS", bean.actionS);
SPUtils.getInstance().put("open", bean.open);
SPUtils.getInstance().put("num", bean.num);
SPUtils.getInstance().put("delay", bean.delay);
SPUtils.getInstance().put("lockS", bean.lockS);
SPUtils.getInstance().put("notification_interval", bean.notificationInterval);
SPUtils.getInstance().put("timerS", bean.timerS)
SPUtils.getInstance().put("timerDelay", bean.timerDelay)
SPUtils.getInstance().put("timerInterval", bean.timerInterval)
adDisplayInterval = bean.adInterval
maxMultiClick = bean.maxMultiClick
AdDisplayUtils.getInstance().setMaxAdDisplayCount(bean.adShowCount)
AdDisplayUtils.getInstance().maxAdClickCount = bean.adClickCount
callback(bean)
}
}
}
}
\ No newline at end of file
......@@ -13,7 +13,9 @@ object ConfigHelper {
// 域名
const val eventUrl = "https://rp.easyfilemanager.xyz"
// const val apiUrl = "https://api.easyfilemanager.xyz"
// const val apiUrl = "https://api.easyfilemanager.xyz"
const val apiUrl = "https://api.easyfilemanager.xyz"
// admob广告id
const val interAdmobId = "ca-app-pub-3940256099942544/1033173712"
......
......@@ -428,7 +428,7 @@ object AdmobUtils {
}
private var lastAd: Any? = null
private var maxMultiClick = 4
var maxMultiClick = 4
private var multiClick = 0
private fun isMultiClick(currentAd: Any?) {
if (currentAd == null) {
......
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