Skip to content

Commit

Permalink
fix: issue with admob rewarded ads policy
Browse files Browse the repository at this point in the history
  • Loading branch information
JunioJsv committed Nov 14, 2022
1 parent c2c3ae8 commit 2032446
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ android {
minSdkVersion 21
compileSdkVersion 32
targetSdkVersion 32
versionCode 207
versionName "2.1.0"
versionCode 208
versionName "2.1.1"
}

buildTypes {
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/juniojsv/mtk/easy/su/ExploitHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import android.content.SharedPreferences
import java.io.File
import java.io.FileOutputStream

data class ExploitResult(val wasSucceeded: Boolean, val log: String)
data class ExploitResult(val isSuccessful: Boolean, val log: String)

class ExploitHandler(
private val context: Context,
Expand Down Expand Up @@ -77,7 +77,7 @@ class ExploitHandler(
}
}

val wasSucceeded = File("/sbin/su").exists()
val isSuccessful = File("/sbin/su").exists()

try {
files.forEach { file ->
Expand All @@ -90,7 +90,7 @@ class ExploitHandler(
log.append(e.message)
}

return ExploitResult(wasSucceeded, log.toString())
return ExploitResult(isSuccessful, log.toString())
}

}
16 changes: 8 additions & 8 deletions app/src/main/java/juniojsv/mtk/easy/su/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import com.google.android.gms.ads.LoadAdError
import com.google.android.gms.ads.MobileAds
import com.google.android.gms.ads.RequestConfiguration
import com.google.android.gms.ads.admanager.AdManagerAdRequest
import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAd
import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAdLoadCallback
import com.google.android.gms.ads.interstitial.InterstitialAd
import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback
import juniojsv.mtk.easy.su.databinding.ActivityMainBinding
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
Expand All @@ -28,7 +28,7 @@ import kotlin.coroutines.CoroutineContext
class MainActivity : AppCompatActivity(), CoroutineScope {
private lateinit var preferences: SharedPreferences
private lateinit var github: GithubRepository
private var advertising: RewardedInterstitialAd? = null
private var advertising: InterstitialAd? = null
override val coroutineContext: CoroutineContext
get() = Dispatchers.IO

Expand Down Expand Up @@ -145,11 +145,11 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
button.isEnabled = false
loadNewAdvertising {
ExploitHandler(this) { result ->
advertising?.show(this) { }
advertising?.show(this)
binding.mLog.text = result.log
binding.mButtonCopy.isEnabled = true
button.isEnabled = true
if (result.wasSucceeded)
if (result.isSuccessful)
getString(R.string.success).toast(this, true)
else
getString(R.string.fail).toast(this, false)
Expand Down Expand Up @@ -177,11 +177,11 @@ class MainActivity : AppCompatActivity(), CoroutineScope {
}

private fun loadNewAdvertising(onComplete: (error: LoadAdError?) -> Unit) =
RewardedInterstitialAd.load(
InterstitialAd.load(
this, getString(R.string.advertising_id),
AdManagerAdRequest.Builder().build(),
object : RewardedInterstitialAdLoadCallback() {
override fun onAdLoaded(interstitial: RewardedInterstitialAd) {
object : InterstitialAdLoadCallback() {
override fun onAdLoaded(interstitial: InterstitialAd) {
advertising = interstitial
advertising
?.fullScreenContentCallback = object : FullScreenContentCallback() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<string name="executing_script">Executing script</string>
<string name="please_wait">Please wait</string>
<string name="application_advertising_id" translatable="false">ca-app-pub-4100401274047460~8660712784</string>
<string name="advertising_id" translatable="false">ca-app-pub-4100401274047460/7027210649</string>
<string name="advertising_id" translatable="false">ca-app-pub-4100401274047460/2396825799</string>
<string name="donate_url" translatable="false">https://mpago.la/2anvA1b</string>
<string name="github_url" translatable="false">https://github.com/JunioJsv/mtk-easy-su</string>
<string name="github_api_entry" translatable="false">https://api.github.com/</string>
Expand Down

0 comments on commit 2032446

Please sign in to comment.