Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
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
Easy Cleaner Junk
Commits
ede7d63d
Commit
ede7d63d
authored
Jul 08, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...ump
parent
d3e9a1f7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
92 additions
and
5 deletions
+92
-5
build.gradle
app/build.gradle
+4
-0
MyApplication.kt
.../main/java/com/test/easy/easycleanerjunk/MyApplication.kt
+5
-2
NewSplashActivity.kt
...easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
+3
-0
PrivacyAgreementManager.kt
...asycleanerjunk/activity/splash/PrivacyAgreementManager.kt
+21
-3
HomeFragment.kt
...va/com/test/easy/easycleanerjunk/fragment/HomeFragment.kt
+1
-0
ConfigHelper.kt
.../java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
+8
-0
UmpHelp.kt
.../main/java/com/test/easy/easycleanerjunk/helps/UmpHelp.kt
+50
-0
No files found.
app/build.gradle
View file @
ede7d63d
...
...
@@ -111,4 +111,8 @@ dependencies {
implementation
'com.makeramen:roundedimageview:2.3.0'
implementation
'com.mikhaellopez:circularprogressbar:3.1.0'
//Google UMP
//https://docs.tradplusad.com/docs/tradplussdk_android_doc_v6/privacy_policy/google_ump/
implementation
'com.google.android.ump:user-messaging-platform:2.1.0'
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/MyApplication.kt
View file @
ede7d63d
...
...
@@ -2,6 +2,7 @@ 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.text.TextUtils
...
...
@@ -43,7 +44,9 @@ class MyApplication : BaseApplication() {
fun
initApp
()
{
initNotificationWork
()
if
(
ConfigHelper
.
ifAgreePrivacy
)
{
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
if
(
ConfigHelper
.
umpGathered
)
{
MobileAds
.
initialize
(
this
)
{
initializationStatus
->
}
}
InstallHelps
.
init
()
}
...
...
@@ -59,7 +62,7 @@ class MyApplication : BaseApplication() {
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
())
.
startTimer
((
timerDelay
*
60
*
1000
).
toLong
(),
(
timerInterval
*
60
*
1000
).
toLong
())
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/NewSplashActivity.kt
View file @
ede7d63d
...
...
@@ -14,7 +14,10 @@ import com.test.easy.easycleanerjunk.fcm.NotificationUtil
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper.remainNotification
import
com.test.easy.easycleanerjunk.helps.ConfigHelper.umpGathered
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.helps.LogEx
import
com.test.easy.easycleanerjunk.helps.UmpHelp.requestUMP
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import
com.test.easy.easycleanerjunk.service.PermanentNotificationService
import
com.test.easy.easycleanerjunk.service.PermanentNotificationService.Companion.startNotification
...
...
app/src/main/java/com/test/easy/easycleanerjunk/activity/splash/PrivacyAgreementManager.kt
View file @
ede7d63d
...
...
@@ -10,9 +10,12 @@ import com.test.easy.easycleanerjunk.MyApplication
import
com.test.easy.easycleanerjunk.databinding.ActivityLayoutSplashBinding
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.helps.LogEx
import
com.test.easy.easycleanerjunk.helps.UmpHelp.requestUMP
class
PrivacyAgreementManager
{
private
val
TAG
=
"PrivacyAgreementManager"
private
val
binding
:
ActivityLayoutSplashBinding
...
...
@@ -58,9 +61,24 @@ class PrivacyAgreementManager {
// binding.idLlJindu.isVisible = true
// binding.idLlYinsi.isVisible = false
ConfigHelper
.
ifAgreePrivacy
=
true
(
context
.
application
as
MyApplication
).
initApp
()
listener
.
onAgreePrivacy
()
EventUtils
.
event
(
"app_start"
)
context
.
requestUMP
(
loadAndShowErrorAction
=
{},
formErrorAction
=
{},
gatheredAction
=
{
// LogEx.logDebug(TAG, "gatherAction $it")
// ConfigHelper.umpGathered = it
// (context.application as MyApplication).initApp()
//
// listener.onAgreePrivacy()
// EventUtils.event("app_start")
},
dialogAction
=
{
LogEx
.
logDebug
(
TAG
,
"dialogAction $it"
)
ConfigHelper
.
umpGathered
=
it
(
context
.
application
as
MyApplication
).
initApp
()
listener
.
onAgreePrivacy
()
EventUtils
.
event
(
"app_start"
)
})
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fragment/HomeFragment.kt
View file @
ede7d63d
...
...
@@ -18,6 +18,7 @@ import com.test.easy.easycleanerjunk.activity.whatsapp.WhatsAppCleanerAnimationA
import
com.test.easy.easycleanerjunk.databinding.FragmentLayoutHomeBinding
import
com.test.easy.easycleanerjunk.helps.BaseFragment
import
com.test.easy.easycleanerjunk.helps.KotlinExt.setOnClickListener
import
com.test.easy.easycleanerjunk.helps.UmpHelp.requestUMP
import
com.test.easy.easycleanerjunk.utils.BarUtils
class
HomeFragment
:
BaseFragment
<
FragmentLayoutHomeBinding
>()
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
View file @
ede7d63d
...
...
@@ -38,6 +38,14 @@ object ConfigHelper {
SPUtils
.
getInstance
().
put
(
"junkSizeClean"
,
value
)
}
var
umpGathered
=
true
get
()
{
return
SPUtils
.
getInstance
().
getBoolean
(
"umpGathered"
,
field
)
}
set
(
value
)
{
field
=
value
SPUtils
.
getInstance
().
put
(
"umpGathered"
,
value
,
true
)
}
var
ifAgreePrivacy
=
false
get
()
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/UmpHelp.kt
0 → 100644
View file @
ede7d63d
package
com.test.easy.easycleanerjunk.helps
import
android.app.Activity
import
com.google.android.ump.ConsentForm.OnConsentFormDismissedListener
import
com.google.android.ump.ConsentInformation.OnConsentInfoUpdateFailureListener
import
com.google.android.ump.ConsentRequestParameters
import
com.google.android.ump.FormError
import
com.google.android.ump.UserMessagingPlatform
object
UmpHelp
{
private
val
TAG
=
"UmpHelp"
fun
Activity
.
requestUMP
(
loadAndShowErrorAction
:
(()
->
Unit
)?
=
null
,
//加载弹出错误
formErrorAction
:
(()
->
Unit
)?
=
null
,
//请求错误
gatheredAction
:
((
flag
:
Boolean
)
->
Unit
)?
=
null
,
//已经授权过
dialogAction
:
((
flag
:
Boolean
)
->
Unit
)?
=
null
,
//dialog授权
)
{
val
params
=
ConsentRequestParameters
.
Builder
()
// 指示用户是否低于同意年龄; true 低于同意年龄
// 未满同意年龄的用户不会收到 GDPR 消息表单
.
setTagForUnderAgeOfConsent
(
false
)
.
build
()
val
consentInformation
=
UserMessagingPlatform
.
getConsentInformation
(
this
)
consentInformation
.
requestConsentInfoUpdate
(
this
,
params
,
{
UserMessagingPlatform
.
loadAndShowConsentFormIfRequired
(
this
)
{
loadAndShowError
:
FormError
?
->
if
(
loadAndShowError
!=
null
)
{
// Consent gathering failed.
LogEx
.
logDebug
(
TAG
,
"loadAndShowError=${loadAndShowError.errorCode} ${loadAndShowError.message}"
)
loadAndShowErrorAction
?.
invoke
()
}
// Consent has been gathered.
// 授权完成,初始化SDK
dialogAction
?.
invoke
(
consentInformation
.
canRequestAds
())
}
},
{
requestConsentError
:
FormError
?
->
LogEx
.
logDebug
(
TAG
,
"FormError=${requestConsentError?.errorCode} ${requestConsentError?.message}"
)
formErrorAction
?.
invoke
()
})
// 授权完成,初始化SDK
gatheredAction
?.
invoke
(
consentInformation
.
canRequestAds
())
}
}
\ No newline at end of file
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