Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaozhan committed Oct 28, 2021
2 parents 19a538d + b0f336b commit b544836
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ import com.google.android.gms.ads.interstitial.InterstitialAdLoadCallback
import com.google.android.gms.ads.rewarded.RewardedAd
import com.google.android.gms.ads.rewarded.RewardedAdLoadCallback

class AdManagerImpl(private val context: Context) : AdManager {
class AdManagerImpl : AdManager {

init {
kermit.d { "AdManagerImpl init" }
MobileAds.initialize(context)
MobileAds.setAppVolume(0.0f)
MobileAds.setAppMuted(true)
}

override fun getBannerAd(
context: Context,
width: Int,
adId: String
): ViewGroup {
Expand All @@ -47,7 +47,7 @@ class AdManagerImpl(private val context: Context) : AdManager {
activity: Activity,
adId: String
) = InterstitialAd.load(
context,
activity,
adId,
getAdRequest(),
object : InterstitialAdLoadCallback() {
Expand All @@ -68,7 +68,7 @@ class AdManagerImpl(private val context: Context) : AdManager {
onAdLoaded: () -> Unit,
onReward: () -> Unit
) = RewardedAd.load(
context,
activity,
adId,
getAdRequest(),
object : RewardedAdLoadCallback() {
Expand Down
8 changes: 8 additions & 0 deletions ad/src/google/java/com/github/mustafaozhan/ad/Ads.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.github.mustafaozhan.ad

import android.content.Context
import com.google.android.gms.ads.MobileAds

fun initAds(context: Context) {
MobileAds.initialize(context)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import android.content.Context
import android.view.ViewGroup
import android.widget.FrameLayout

class AdManagerImpl(private val context: Context) : AdManager {
class AdManagerImpl : AdManager {

override fun getBannerAd(width: Int, adId: String): ViewGroup {
override fun getBannerAd(
context: Context,
width: Int,
adId: String
): ViewGroup {
return FrameLayout(context)
}

Expand Down
5 changes: 5 additions & 0 deletions ad/src/huawei/java/com/github/mustafaozhan/ad/Ads.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.github.mustafaozhan.ad

import android.content.Context

fun initAds(context: Context) = Unit
2 changes: 2 additions & 0 deletions ad/src/main/java/com/github/mustafaozhan/ad/AdManager.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.github.mustafaozhan.ad

import android.app.Activity
import android.content.Context
import android.view.ViewGroup

interface AdManager {

fun getBannerAd(
context: Context,
width: Int,
adId: String
): ViewGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.github.mustafaozhan.ccc.android.app

import android.app.Application
import com.github.mustafaozhan.ad.initAds
import com.github.mustafaozhan.ccc.android.di.platformModule
import com.github.mustafaozhan.ccc.client.di.initAndroid
import com.github.mustafaozhan.logmob.initCrashlytics
Expand All @@ -16,6 +17,7 @@ class CCCApplication : Application() {
override fun onCreate() {
super.onCreate()
initLogger()
initAds(this)
initAndroid(
context = this,
platformModule = platformModule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import org.koin.dsl.module

var platformModule = module {
single<BillingManager> { BillingManagerImpl(get()) }
single<AdManager> { AdManagerImpl(get()) }
single<AdManager> { AdManagerImpl() }
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import com.github.mustafaozhan.ccc.client.model.RemoveAdData
import com.github.mustafaozhan.ccc.client.model.RemoveAdType
import com.github.mustafaozhan.logmob.kermit
import com.github.mustafaozhan.scopemob.castTo
import java.io.FileNotFoundException
import mustafaozhan.github.com.mycurrencies.R
import java.io.FileNotFoundException

fun ImageView.setBackgroundByName(
name: String
Expand All @@ -51,7 +51,7 @@ fun FrameLayout.setBannerAd(
isExpired: Boolean
) = if (isExpired) {
removeAllViews()
addView(adManager.getBannerAd(width, adId))
addView(adManager.getBannerAd(context, width, adId))
visible()
} else {
gone()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class BillingManagerImpl(private val context: Context) :

this.billingClient = BillingClient
.newBuilder(context.applicationContext)
.enablePendingPurchases()
.setListener(this)
.enablePendingPurchases()
.build()

this.billingClient.startConnection(this)
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ object Versions {
const val ADMOB = "20.4.0"
const val NAVIGATION = "2.3.5"
const val PLAY_CORE = "1.10.2"
const val KOTLIN_X_DATE_TIME = "0.2.1"
const val KOTLIN_X_DATE_TIME = "0.3.1"
const val COROUTINES = "1.5.2-native-mt"
const val BILLING = "4.0.0"
const val LEAK_CANARY = "2.7"
const val SQL_DELIGHT = "1.5.2"
const val LIFECYCLE = "2.4.0-rc01"
const val LIFECYCLE = "2.4.0"
const val MOKO_RESOURCES = "0.17.2"
const val DEPENDENCY_UPDATES = "0.39.0"
const val BUILD_HEALTH = "0.78.0"
Expand Down

0 comments on commit b544836

Please sign in to comment.