Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
F
File Recovery RecycleBin
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
File Recovery RecycleBin
Commits
29c9560c
Commit
29c9560c
authored
Aug 06, 2024
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步配置接口,增加垃圾清理页面广告
parent
28a83394
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
20 deletions
+55
-20
CleanJunkActivity.kt
...ecoveryrecyclebin/activity/junkclean/CleanJunkActivity.kt
+35
-11
InstallHelps.kt
...ava/com/base/filerecoveryrecyclebin/utils/InstallHelps.kt
+5
-1
NewComUtils.kt
...java/com/base/filerecoveryrecyclebin/utils/NewComUtils.kt
+15
-8
No files found.
app/src/main/java/com/base/filerecoveryrecyclebin/activity/junkclean/CleanJunkActivity.kt
View file @
29c9560c
...
@@ -8,7 +8,6 @@ import android.view.View
...
@@ -8,7 +8,6 @@ import android.view.View
import
androidx.activity.OnBackPressedCallback
import
androidx.activity.OnBackPressedCallback
import
androidx.core.view.isVisible
import
androidx.core.view.isVisible
import
androidx.lifecycle.lifecycleScope
import
androidx.lifecycle.lifecycleScope
import
com.base.filerecoveryrecyclebin.BuildConfig
import
com.base.filerecoveryrecyclebin.R
import
com.base.filerecoveryrecyclebin.R
import
com.base.filerecoveryrecyclebin.activity.ResultActivity
import
com.base.filerecoveryrecyclebin.activity.ResultActivity
import
com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerAnimationActivity
import
com.base.filerecoveryrecyclebin.activity.photomanager.PhotoManagerAnimationActivity
...
@@ -108,20 +107,45 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
...
@@ -108,20 +107,45 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
when
(
binding
.
tvBtn
.
text
)
{
when
(
binding
.
tvBtn
.
text
)
{
"Got it"
->
{
"Got it"
->
{
startActivity
(
Intent
(
this
@CleanJunkActivity
,
ResultActivity
::
class
.
java
).
apply
{
if
(){
putExtra
(
"clean_size"
,
JUNK_CLEANER
)
AdmobMaxHelper
.
admobMaxShowInterstitialAd
(
this
,
false
){
putExtra
(
"from"
,
0
)
startActivity
(
Intent
(
this
@CleanJunkActivity
,
ResultActivity
::
class
.
java
).
apply
{
})
putExtra
(
"clean_size"
,
JUNK_CLEANER
)
putExtra
(
"from"
,
0
)
})
}
}
else
{
startActivity
(
Intent
(
this
@CleanJunkActivity
,
ResultActivity
::
class
.
java
).
apply
{
putExtra
(
"clean_size"
,
JUNK_CLEANER
)
putExtra
(
"from"
,
0
)
})
}
}
}
else
->
{
else
->
{
startActivity
(
if
(){
Intent
(
this
,
CleaningActivity
::
class
.
java
).
apply
{
AdmobMaxHelper
.
admobMaxShowInterstitialAd
(
this
,
false
){
val
list
=
junkExpandAdapter
.
getChoosePath
()
startActivity
(
putExtra
(
"list"
,
list
.
map
{
it
.
chilepath
}.
toTypedArray
())
Intent
(
this
,
CleaningActivity
::
class
.
java
).
apply
{
putExtra
(
"size"
,
list
.
sumOf
{
it
.
childSize
})
val
list
=
junkExpandAdapter
.
getChoosePath
()
putExtra
(
"list"
,
list
.
map
{
it
.
chilepath
}.
toTypedArray
())
putExtra
(
"size"
,
list
.
sumOf
{
it
.
childSize
})
}
)
}
}
)
}
else
{
startActivity
(
Intent
(
this
,
CleaningActivity
::
class
.
java
).
apply
{
val
list
=
junkExpandAdapter
.
getChoosePath
()
putExtra
(
"list"
,
list
.
map
{
it
.
chilepath
}.
toTypedArray
())
putExtra
(
"size"
,
list
.
sumOf
{
it
.
childSize
})
}
)
}
}
}
}
}
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/utils/InstallHelps.kt
View file @
29c9560c
...
@@ -2,6 +2,7 @@ package com.base.filerecoveryrecyclebin.utils
...
@@ -2,6 +2,7 @@ package com.base.filerecoveryrecyclebin.utils
import
android.os.Build
import
android.os.Build
import
android.text.TextUtils
import
android.text.TextUtils
import
androidx.annotation.RequiresApi
import
com.android.installreferrer.api.InstallReferrerClient
import
com.android.installreferrer.api.InstallReferrerClient
import
com.android.installreferrer.api.InstallReferrerStateListener
import
com.android.installreferrer.api.InstallReferrerStateListener
import
com.base.filerecoveryrecyclebin.BuildConfig
import
com.base.filerecoveryrecyclebin.BuildConfig
...
@@ -18,6 +19,7 @@ object InstallHelps {
...
@@ -18,6 +19,7 @@ object InstallHelps {
private
val
TAG
=
"InstallHelps"
private
val
TAG
=
"InstallHelps"
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
fun
init
()
{
fun
init
()
{
//InstallReferrer not empty
//InstallReferrer not empty
if
(!
TextUtils
.
isEmpty
(
AppPreferences
.
getInstance
().
getString
(
"install_source"
,
""
)))
{
if
(!
TextUtils
.
isEmpty
(
AppPreferences
.
getInstance
().
getString
(
"install_source"
,
""
)))
{
...
@@ -33,6 +35,7 @@ object InstallHelps {
...
@@ -33,6 +35,7 @@ object InstallHelps {
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
BaseApplication
.
context
).
build
()
val
referrerClient
=
InstallReferrerClient
.
newBuilder
(
BaseApplication
.
context
).
build
()
referrerClient
.
startConnection
(
object
:
InstallReferrerStateListener
{
referrerClient
.
startConnection
(
object
:
InstallReferrerStateListener
{
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
override
fun
onInstallReferrerSetupFinished
(
responseCode
:
Int
)
{
override
fun
onInstallReferrerSetupFinished
(
responseCode
:
Int
)
{
try
{
try
{
when
(
responseCode
)
{
when
(
responseCode
)
{
...
@@ -45,7 +48,7 @@ object InstallHelps {
...
@@ -45,7 +48,7 @@ object InstallHelps {
obj
.
put
(
"appInstallTime"
,
response
.
installBeginTimestampSeconds
)
obj
.
put
(
"appInstallTime"
,
response
.
installBeginTimestampSeconds
)
obj
.
put
(
"instantExperienceLaunched"
,
installInfo
.
toString
())
obj
.
put
(
"instantExperienceLaunched"
,
installInfo
.
toString
())
EventUtils
.
event
(
"install_referrer"
,
ext
=
obj
,
isSingleEvent
=
true
)
EventUtils
.
event
(
"install_referrer"
,
ext
=
obj
,
isSingleEvent
=
true
)
AppPreferences
.
getInstance
().
put
(
"referrer"
,
response
.
installReferrer
)
if
(
listOf
(
"gclid"
,
"facebook"
,
"instagram"
).
all
{
!
installInfo
.
contains
(
it
,
true
)
})
{
if
(
listOf
(
"gclid"
,
"facebook"
,
"instagram"
).
all
{
!
installInfo
.
contains
(
it
,
true
)
})
{
//自然用户
//自然用户
if
(
BuildConfig
.
DEBUG
){
if
(
BuildConfig
.
DEBUG
){
...
@@ -76,6 +79,7 @@ object InstallHelps {
...
@@ -76,6 +79,7 @@ object InstallHelps {
})
})
}
}
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
fun
requestCfg
(
callBackAd
:
Boolean
)
{
fun
requestCfg
(
callBackAd
:
Boolean
)
{
NewComUtils
.
requestCfg
{
NewComUtils
.
requestCfg
{
if
(
callBackAd
)
{
if
(
callBackAd
)
{
...
...
app/src/main/java/com/base/filerecoveryrecyclebin/utils/NewComUtils.kt
View file @
29c9560c
package
com.base.filerecoveryrecyclebin.utils
package
com.base.filerecoveryrecyclebin.utils
import
android.os.Build
import
android.util.Log
import
android.util.Log
import
androidx.annotation.RequiresApi
import
com.base.filerecoveryrecyclebin.BuildConfig
import
com.base.filerecoveryrecyclebin.ads.AdDisplayUtils
import
com.base.filerecoveryrecyclebin.ads.AdDisplayUtils
import
com.base.filerecoveryrecyclebin.bean.ConfigBean
import
com.base.filerecoveryrecyclebin.bean.ConfigBean
import
com.base.filerecoveryrecyclebin.help.ConfigHelper
import
com.base.filerecoveryrecyclebin.help.ConfigHelper
...
@@ -14,8 +17,10 @@ import java.io.BufferedReader
...
@@ -14,8 +17,10 @@ import java.io.BufferedReader
import
java.io.InputStreamReader
import
java.io.InputStreamReader
import
java.net.HttpURLConnection
import
java.net.HttpURLConnection
import
java.net.URL
import
java.net.URL
import
java.util.Base64
import
java.util.Locale
import
java.util.Locale
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
object
NewComUtils
{
object
NewComUtils
{
private
const
val
API_URL
=
ConfigHelper
.
apiUrl
private
const
val
API_URL
=
ConfigHelper
.
apiUrl
private
const
val
PACKAGE_NAME_PREFIX
=
ConfigHelper
.
packageName
private
const
val
PACKAGE_NAME_PREFIX
=
ConfigHelper
.
packageName
...
@@ -26,15 +31,17 @@ object NewComUtils {
...
@@ -26,15 +31,17 @@ object NewComUtils {
private
val
url
:
String
by
lazy
{
private
val
url
:
String
by
lazy
{
val
packageName
=
ConfigHelper
.
packageName
val
packageName
=
ConfigHelper
.
packageName
val
appCode
=
packageName
.
substringAfter
(
PACKAGE_NAME_PREFIX
).
take
(
5
).
toLowerCase
(
Locale
.
getDefault
())
val
appCode
=
packageName
.
substringAfter
(
PACKAGE_NAME_PREFIX
).
take
(
5
).
toLowerCase
(
Locale
.
getDefault
())
"$API_URL/${appCode}spk?pkg=$packageName&source=channel"
val
bRefer
=
Base64
.
getEncoder
().
encodeToString
(
AppPreferences
.
getInstance
().
getString
(
"referrer"
,
""
).
toByteArray
())
"$API_URL/${appCode}spk?pkg=$packageName&referrer=${bRefer}&vn=${BuildConfig.VERSION_NAME}&vc=${BuildConfig.VERSION_CODE}"
}
}
//origin user = only pick &source=origin
//origin user = only pick &source=origin
private
fun
getOriginUrl
():
String
{
//
private fun getOriginUrl(): String {
val
packageName
=
ConfigHelper
.
packageName
//
val packageName = ConfigHelper.packageName
val
appCode
=
packageName
.
substringAfter
(
PACKAGE_NAME_PREFIX
).
take
(
5
).
toLowerCase
(
Locale
.
getDefault
())
//
val appCode = packageName.substringAfter(PACKAGE_NAME_PREFIX).take(5).toLowerCase(Locale.getDefault())
return
"$API_URL/${appCode}spk?pkg=$packageName&source=origin"
//
return "$API_URL/${appCode}spk?pkg=$packageName&source=origin"
}
//
}
fun
requestCfg
(
callback
:
(
ConfigBean
?)
->
Unit
)
{
fun
requestCfg
(
callback
:
(
ConfigBean
?)
->
Unit
)
{
CoroutineScope
(
Dispatchers
.
IO
).
launch
{
CoroutineScope
(
Dispatchers
.
IO
).
launch
{
...
@@ -63,8 +70,8 @@ object NewComUtils {
...
@@ -63,8 +70,8 @@ object NewComUtils {
}
}
private
fun
doGet
():
String
?
{
private
fun
doGet
():
String
?
{
val
originFlag
=
AppPreferences
.
getInstance
().
getString
(
"install_source"
,
""
)
==
"origin"
//
val originFlag = AppPreferences.getInstance().getString("install_source", "") == "origin"
val
urlPath
=
if
(
originFlag
)
getOriginUrl
()
else
url
val
urlPath
=
url
Log
.
d
(
"okhttp"
,
urlPath
)
Log
.
d
(
"okhttp"
,
urlPath
)
try
{
try
{
val
conn
:
HttpURLConnection
=
URL
(
urlPath
).
openConnection
()
as
HttpURLConnection
val
conn
:
HttpURLConnection
=
URL
(
urlPath
).
openConnection
()
as
HttpURLConnection
...
...
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