Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
swiftcleanerphonehelper
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
swiftcleanerphonehelper
Commits
d7b880c0
Commit
d7b880c0
authored
Dec 20, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
c5eabb6d
Pipeline
#1400
canceled with stages
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
33 deletions
+35
-33
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+0
-8
StartActivity.java
.../com/swiftcleaner/chovey/view/activity/StartActivity.java
+2
-0
ZxApplication.kt
app/src/main/java/com/zxdemo/ZxApplication.kt
+13
-6
ZxHttp.kt
app/src/main/java/com/zxdemo/http/ZxHttp.kt
+11
-8
InstallRefeerUtils.kt
app/src/main/java/com/zxdemo/utils/InstallRefeerUtils.kt
+4
-0
SpUtils.kt
app/src/main/java/com/zxdemo/utils/SpUtils.kt
+5
-11
No files found.
app/src/main/AndroidManifest.xml
View file @
d7b880c0
...
@@ -58,14 +58,6 @@
...
@@ -58,14 +58,6 @@
</intent-filter>
</intent-filter>
</activity>
</activity>
<!-- 注册广播 -->
<service
android:name=
".model.service.MyFirebaseMessagingService"
android:exported=
"false"
>
<intent-filter>
<action
android:name=
"com.google.firebase.MESSAGING_EVENT"
/>
</intent-filter>
</service>
<activity
<activity
...
...
app/src/main/java/com/swiftcleaner/chovey/view/activity/StartActivity.java
View file @
d7b880c0
...
@@ -30,6 +30,7 @@ import com.swiftcleaner.chovey.databinding.ActivityStartBinding;
...
@@ -30,6 +30,7 @@ import com.swiftcleaner.chovey.databinding.ActivityStartBinding;
import
com.swiftcleaner.chovey.model.bean.ConstObject
;
import
com.swiftcleaner.chovey.model.bean.ConstObject
;
import
com.swiftcleaner.chovey.model.util.PermissionUtils
;
import
com.swiftcleaner.chovey.model.util.PermissionUtils
;
import
com.swiftcleaner.chovey.view.MainActivity
;
import
com.swiftcleaner.chovey.view.MainActivity
;
import
com.zxdemo.ZxApplication
;
import
com.zxdemo.admob.AdmobHelper
;
import
com.zxdemo.admob.AdmobHelper
;
import
com.zxdemo.http.ZxHttp
;
import
com.zxdemo.http.ZxHttp
;
import
com.zxdemo.utils.NonBlockingCountdown
;
import
com.zxdemo.utils.NonBlockingCountdown
;
...
@@ -171,6 +172,7 @@ public class StartActivity extends AppCompatActivity {
...
@@ -171,6 +172,7 @@ public class StartActivity extends AppCompatActivity {
ConstObject
.
INSTANCE
.
setIfAgreePrivacy
(
true
);
ConstObject
.
INSTANCE
.
setIfAgreePrivacy
(
true
);
ZxHttp
.
INSTANCE
.
getHttpReportInterface
(
"app_start"
,
""
,
null
);
ZxHttp
.
INSTANCE
.
getHttpReportInterface
(
"app_start"
,
""
,
null
);
nonBlockingCountdown
.
start
(
outJumpTime
);
nonBlockingCountdown
.
start
(
outJumpTime
);
((
ZxApplication
)
getApplication
()).
initApp
();
showOpenAd
();
showOpenAd
();
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putBoolean
(
"isFirstTime"
,
false
);
editor
.
putBoolean
(
"isFirstTime"
,
false
);
...
...
app/src/main/java/com/zxdemo/ZxApplication.kt
View file @
d7b880c0
...
@@ -10,6 +10,7 @@ import android.os.Bundle
...
@@ -10,6 +10,7 @@ import android.os.Bundle
import
android.os.PowerManager
import
android.os.PowerManager
import
android.text.TextUtils
import
android.text.TextUtils
import
com.zxdemo.admob.AdmobHelper
import
com.zxdemo.admob.AdmobHelper
import
com.zxdemo.http.ZxHttp
import
com.zxdemo.receiver.AppInstallReceiver
import
com.zxdemo.receiver.AppInstallReceiver
import
com.zxdemo.receiver.BatteryStatusReceiver
import
com.zxdemo.receiver.BatteryStatusReceiver
import
com.zxdemo.receiver.UnlockReceiver
import
com.zxdemo.receiver.UnlockReceiver
...
@@ -47,16 +48,23 @@ class ZxApplication : Application() {
...
@@ -47,16 +48,23 @@ class ZxApplication : Application() {
context
=
applicationContext
context
=
applicationContext
initUUid
()
initUUid
()
initApp
()
sendBroadCast
()
sendBroadCast
()
registerActivityLifecycleCallbacks
()
registerActivityLifecycleCallbacks
()
val
powerManager
=
getSystemService
(
Context
.
POWER_SERVICE
)
as
PowerManager
val
powerManager
=
getSystemService
(
Context
.
POWER_SERVICE
)
as
PowerManager
isScreenOn
=
powerManager
.
isInteractive
isScreenOn
=
powerManager
.
isInteractive
InstallRefeerUtils
.
init
()
startOmgNotification
()
startOmgNotification
()
AdmobHelper
.
init
(
this
,
{},
{})
}
fun
initApp
()
{
FcmUtils
().
initFirebase
(
context
)
FcmUtils
().
subscribeToTopic
(
"${packname}_push"
)
InstallRefeerUtils
.
init
()
InstallRefeerUtils
.
callBack
=
{
AdmobHelper
.
init
(
this
,
{},
{})
}
}
}
...
@@ -76,8 +84,7 @@ class ZxApplication : Application() {
...
@@ -76,8 +84,7 @@ class ZxApplication : Application() {
runCatching
{
runCatching
{
context
.
registerReceiver
(
BatteryStatusReceiver
(),
filter
)
context
.
registerReceiver
(
BatteryStatusReceiver
(),
filter
)
}
}
FcmUtils
().
initFirebase
(
context
)
FcmUtils
().
subscribeToTopic
(
"${packname}_push"
)
// var config = SolarEngineConfig.Builder().build()
// var config = SolarEngineConfig.Builder().build()
// SolarEngineManager.getInstance()
// SolarEngineManager.getInstance()
...
...
app/src/main/java/com/zxdemo/http/ZxHttp.kt
View file @
d7b880c0
...
@@ -2,7 +2,6 @@ package com.zxdemo.http
...
@@ -2,7 +2,6 @@ package com.zxdemo.http
import
android.util.Log
import
android.util.Log
import
com.swiftcleaner.chovey.BuildConfig
import
com.swiftcleaner.chovey.BuildConfig
import
com.swiftcleaner.chovey.model.bean.ConstObject
import
com.swiftcleaner.chovey.model.bean.ConstObject.ifAgreePrivacy
import
com.swiftcleaner.chovey.model.bean.ConstObject.ifAgreePrivacy
import
com.zxdemo.ZxApplication
import
com.zxdemo.ZxApplication
import
com.zxdemo.utils.AESUtils
import
com.zxdemo.utils.AESUtils
...
@@ -22,7 +21,7 @@ object ZxHttp {
...
@@ -22,7 +21,7 @@ object ZxHttp {
fun
getHttpConfig
(
requestBack
:
()
->
Unit
)
{
fun
getHttpConfig
(
requestBack
:
()
->
Unit
)
{
var
referrer
=
""
var
referrer
=
""
va
r
referrerSp
=
SpUtils
.
getInstance
().
getString
(
"referrer"
,
""
)
va
l
referrerSp
=
SpUtils
.
getInstance
().
getString
(
"referrer"
,
""
)
if
(
referrerSp
.
isNotEmpty
())
{
if
(
referrerSp
.
isNotEmpty
())
{
referrer
=
android
.
util
.
Base64
.
encodeToString
(
referrer
.
toByteArray
(),
android
.
util
.
Base64
.
DEFAULT
)
referrer
=
android
.
util
.
Base64
.
encodeToString
(
referrer
.
toByteArray
(),
android
.
util
.
Base64
.
DEFAULT
)
}
}
...
@@ -34,19 +33,22 @@ object ZxHttp {
...
@@ -34,19 +33,22 @@ object ZxHttp {
urlstr
.
append
(
"&vc=${BuildConfig.VERSION_CODE}"
)
urlstr
.
append
(
"&vc=${BuildConfig.VERSION_CODE}"
)
urlstr
.
append
(
"&device=${ZxApplication.GID}"
)
urlstr
.
append
(
"&device=${ZxApplication.GID}"
)
urlstr
.
append
(
"&aid=${DeviceUtils.getUID()}"
)
urlstr
.
append
(
"&aid=${DeviceUtils.getUID()}"
)
if
(
BuildConfig
.
DEBUG
)
{
urlstr
.
append
(
"&mode=4"
)
}
Log
.
e
(
"getHttpConfig"
,
"urlstr=$urlstr"
)
HttpUtils
.
get
(
HttpUtils
.
get
(
urlstr
.
toString
(),
urlstr
.
toString
(),
object
:
object
:
Callback
{
Callback
{
override
fun
onFailure
(
call
:
Call
,
e
:
IOException
)
{
override
fun
onFailure
(
call
:
Call
,
e
:
IOException
)
{
// 请求失败时的处理逻辑
// 请求失败时的处理逻辑
e
.
printStackTrace
()
Log
.
e
(
"getHttpConfig"
,
"onFailure"
)
requestBack
.
invoke
()
}
}
override
fun
onResponse
(
call
:
Call
,
response
:
Response
)
{
override
fun
onResponse
(
call
:
Call
,
response
:
Response
)
{
requestBack
.
invoke
()
// 请求成功时的处理逻辑
try
{
try
{
val
responseString
=
response
.
body
?.
string
()
val
responseString
=
response
.
body
?.
string
()
if
(
responseString
!=
null
&&
responseString
.
contains
(
"result"
))
{
if
(
responseString
!=
null
&&
responseString
.
contains
(
"result"
))
{
...
@@ -56,8 +58,9 @@ object ZxHttp {
...
@@ -56,8 +58,9 @@ object ZxHttp {
var
result
=
jsonObject
.
getJSONObject
(
"result"
)
var
result
=
jsonObject
.
getJSONObject
(
"result"
)
var
data
=
result
.
getString
(
"data"
)
var
data
=
result
.
getString
(
"data"
)
var
decrypt
=
AESUtils
.
decrypt
(
data
.
toString
())
var
decrypt
=
AESUtils
.
decrypt
(
data
.
toString
())
Log
.
d
(
"TAG
"
,
"onResponse:decrypt--- $decrypt"
)
Log
.
e
(
"getHttpConfig
"
,
"onResponse:decrypt--- $decrypt"
)
SpUtils
.
getInstance
().
saveJsonObjectToSp
(
decrypt
)
SpUtils
.
getInstance
().
saveJsonObjectToSp
(
decrypt
)
requestBack
.
invoke
()
}
}
}
}
}
catch
(
e
:
IOException
)
{
}
catch
(
e
:
IOException
)
{
...
@@ -89,7 +92,7 @@ object ZxHttp {
...
@@ -89,7 +92,7 @@ object ZxHttp {
// 请求成功时的处理逻辑
// 请求成功时的处理逻辑
try
{
try
{
val
responseString
=
response
.
body
?.
string
()
val
responseString
=
response
.
body
?.
string
()
Log
.
d
(
"TAG"
,
"onResponse: $responseString"
)
Log
.
e
(
"TAG"
,
"onResponse: $responseString"
)
if
(
responseString
!=
null
&&
responseString
.
contains
(
"data"
))
{
if
(
responseString
!=
null
&&
responseString
.
contains
(
"data"
))
{
var
data
=
var
data
=
JSONObject
(
responseString
).
getJSONObject
(
"result"
).
getString
(
"data"
)
JSONObject
(
responseString
).
getJSONObject
(
"result"
).
getString
(
"data"
)
...
@@ -98,7 +101,7 @@ object ZxHttp {
...
@@ -98,7 +101,7 @@ object ZxHttp {
requestBack
.
invoke
(
0
)
requestBack
.
invoke
(
0
)
}
else
{
}
else
{
requestBack
.
invoke
(
1
)
requestBack
.
invoke
(
1
)
Log
.
d
(
"TAG"
,
"onResponse: 展示推送"
)
Log
.
e
(
"TAG"
,
"onResponse: 展示推送"
)
}
}
}
else
{
}
else
{
requestBack
.
invoke
(
1
)
requestBack
.
invoke
(
1
)
...
...
app/src/main/java/com/zxdemo/utils/InstallRefeerUtils.kt
View file @
d7b880c0
...
@@ -12,6 +12,9 @@ import com.zxdemo.http.ZxHttp
...
@@ -12,6 +12,9 @@ import com.zxdemo.http.ZxHttp
import
org.json.JSONObject
import
org.json.JSONObject
object
InstallRefeerUtils
{
object
InstallRefeerUtils
{
var
callBack
:
(()
->
Unit
)?
=
null
fun
init
()
{
fun
init
()
{
if
(
TextUtils
.
isEmpty
(
SpUtils
.
getInstance
().
getString
(
"ifcacheinstall"
)))
{
if
(
TextUtils
.
isEmpty
(
SpUtils
.
getInstance
().
getString
(
"ifcacheinstall"
)))
{
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
ZxApplication
.
context
).
build
()
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
ZxApplication
.
context
).
build
()
...
@@ -137,6 +140,7 @@ object InstallRefeerUtils {
...
@@ -137,6 +140,7 @@ object InstallRefeerUtils {
timerInterval
*
1000L
timerInterval
*
1000L
)
)
}
}
callBack
?.
invoke
()
}
}
}
}
}
}
\ No newline at end of file
app/src/main/java/com/zxdemo/utils/SpUtils.kt
View file @
d7b880c0
package
com.zxdemo.utils
package
com.zxdemo.utils
import
android.content.Context
import
android.content.Context
import
android.content.SharedPreferences
import
android.content.SharedPreferences
import
android.util.Log
import
com.zxdemo.ZxApplication
import
com.zxdemo.ZxApplication
import
com.zxdemo.http.ZxHttp
import
com.zxdemo.http.ZxHttp
import
org.json.JSONObject
import
org.json.JSONObject
...
@@ -101,24 +103,16 @@ class SpUtils private constructor(context: Context) {
...
@@ -101,24 +103,16 @@ class SpUtils private constructor(context: Context) {
fun
saveJsonObjectToSp
(
fun
saveJsonObjectToSp
(
json
:
String
,
json
:
String
,
)
{
)
{
if
(
json
.
is
NullOr
Empty
())
{
if
(
json
.
isEmpty
())
{
return
return
}
}
val
dateFormat
=
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
,
Locale
.
getDefault
())
var
saveDate
=
getString
(
"config_date"
)
if
(
saveDate
!=
""
)
{
val
savedDate
=
dateFormat
.
parse
(
saveDate
)
val
currentDate
=
Calendar
.
getInstance
().
time
if
(
isSameDay
(
savedDate
,
currentDate
))
{
// 如果是同一天,清除保存的次数
remove
(
"notice_current"
)
}
}
var
jsonObject
=
JSONObject
(
json
)
var
jsonObject
=
JSONObject
(
json
)
val
editor
=
sharedPreferences
.
edit
()
val
editor
=
sharedPreferences
.
edit
()
// 遍历JSONObject中的所有键值对
// 遍历JSONObject中的所有键值对
jsonObject
.
keys
().
forEachRemaining
{
key
->
jsonObject
.
keys
().
forEachRemaining
{
key
->
val
value
=
jsonObject
.
get
(
key
)
val
value
=
jsonObject
.
get
(
key
)
Log
.
e
(
"saveJsonObjectToSp"
,
"key=$key value=$value"
)
// 根据值的类型选择不同的存储方法
// 根据值的类型选择不同的存储方法
when
(
value
)
{
when
(
value
)
{
is
String
->
{
is
String
->
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment