@ququplay/admob 5.3.2 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Package.swift +30 -0
- package/README.md +378 -150
- package/android/build.gradle +13 -13
- package/android/src/main/java/com/getcapacitor/community/admob/AdMob.java +17 -0
- package/android/src/main/java/com/getcapacitor/community/admob/banner/BannerExecutor.java +81 -91
- package/android/src/main/java/com/getcapacitor/community/admob/consent/AdConsentExecutor.java +45 -42
- package/android/src/main/java/com/getcapacitor/community/admob/interstitial/AdInterstitialExecutor.java +17 -21
- package/android/src/main/java/com/getcapacitor/community/admob/models/AdOptions.java +10 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewarded/AdRewardExecutor.java +19 -23
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/AdRewardInterstitialExecutor.java +80 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/RewardInterstitialAdPluginEvents.kt +12 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/RewardedInterstitialAdCallbackAndListeners.kt +50 -0
- package/android/src/main/java/com/getcapacitor/community/admob/rewardedinterstitial/models/SsvInfo.kt +20 -0
- package/dist/docs.json +433 -783
- package/dist/esm/banner/banner-definitions.interface.d.ts +18 -18
- package/dist/esm/definitions.d.ts +2 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interstitial/interstitial-definitions.interface.d.ts +5 -5
- package/dist/esm/private/validate-all-events-implemented.type.d.ts +1 -1
- package/dist/esm/reward/reward-definitions.interface.d.ts +12 -12
- package/dist/esm/reward-interstitial/index.d.ts +4 -0
- package/dist/esm/reward-interstitial/index.js +5 -0
- package/dist/esm/reward-interstitial/index.js.map +1 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-options.interface.d.ts +25 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-options.interface.js +2 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-options.interface.js.map +1 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.d.ts +32 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js +35 -0
- package/dist/esm/reward-interstitial/reward-interstitial-ad-plugin-events.enum.js.map +1 -0
- package/dist/esm/reward-interstitial/reward-interstitial-definitions.interface.d.ts +30 -0
- package/dist/esm/reward-interstitial/reward-interstitial-definitions.interface.js +2 -0
- package/dist/esm/reward-interstitial/reward-interstitial-definitions.interface.js.map +1 -0
- package/dist/esm/reward-interstitial/reward-interstitial-item.interface.d.ts +14 -0
- package/dist/esm/reward-interstitial/reward-interstitial-item.interface.js +2 -0
- package/dist/esm/reward-interstitial/reward-interstitial-item.interface.js.map +1 -0
- package/dist/esm/web.d.ts +2 -2
- package/dist/esm/web.js +12 -9
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +48 -12
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +49 -13
- package/dist/plugin.js.map +1 -1
- package/ios/{Plugin/Plugin.swift → Sources/AdMobPlugin/AdMobPlugin.swift} +50 -8
- package/ios/{Plugin → Sources/AdMobPlugin}/Banner/BannerExecutor.swift +11 -23
- package/ios/{Plugin → Sources/AdMobPlugin}/Consent/ConsentExecutor.swift +1 -1
- package/ios/{Plugin → Sources/AdMobPlugin}/Interstitial/AdInterstitialExecutor.swift +4 -4
- package/ios/{Plugin → Sources/AdMobPlugin}/Rewarded/AdRewardExecutor.swift +4 -4
- package/ios/Sources/AdMobPlugin/RewardedInterstitial/AdRewardInterstitialExecutor.swift +86 -0
- package/ios/Sources/AdMobPlugin/RewardedInterstitial/RewardInterstitialAdPluginEvents.swift +8 -0
- package/ios/Tests/AdMobPluginTests/AdMobPluginTests.swift +15 -0
- package/package.json +31 -35
- package/QuquplayAdmob.podspec +0 -19
- package/ios/Plugin/Info.plist +0 -24
- package/ios/Plugin/Plugin.h +0 -10
- package/ios/Plugin/Plugin.m +0 -23
- /package/ios/{Plugin → Sources/AdMobPlugin}/Banner/BannerAdPluginEvents.swift +0 -0
- /package/ios/{Plugin → Sources/AdMobPlugin}/Banner/BannerAdSizeEnum.swift +0 -0
- /package/ios/{Plugin → Sources/AdMobPlugin}/Helper/AuthorizationStatusEnum.swift +0 -0
- /package/ios/{Plugin → Sources/AdMobPlugin}/Interstitial/InterstitialAdPluginEvents.swift +0 -0
- /package/ios/{Plugin → Sources/AdMobPlugin}/Models/FullScreenAdEventName.swift +0 -0
- /package/ios/{Plugin → Sources/AdMobPlugin}/Rewarded/RewardAdPluginEvents.swift +0 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob.rewardedinterstitial;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import androidx.core.util.Supplier;
|
|
6
|
+
import com.getcapacitor.JSObject;
|
|
7
|
+
import com.getcapacitor.PluginCall;
|
|
8
|
+
import com.getcapacitor.PluginMethod;
|
|
9
|
+
import com.getcapacitor.community.admob.helpers.AdViewIdHelper;
|
|
10
|
+
import com.getcapacitor.community.admob.helpers.RequestHelper;
|
|
11
|
+
import com.getcapacitor.community.admob.models.AdMobPluginError;
|
|
12
|
+
import com.getcapacitor.community.admob.models.AdOptions;
|
|
13
|
+
import com.getcapacitor.community.admob.models.Executor;
|
|
14
|
+
import com.google.android.gms.ads.AdRequest;
|
|
15
|
+
import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAd;
|
|
16
|
+
import com.google.android.gms.common.util.BiConsumer;
|
|
17
|
+
|
|
18
|
+
public class AdRewardInterstitialExecutor extends Executor {
|
|
19
|
+
|
|
20
|
+
public static RewardedInterstitialAd mRewardedInterstitialAd;
|
|
21
|
+
|
|
22
|
+
public AdRewardInterstitialExecutor(
|
|
23
|
+
Supplier<Context> contextSupplier,
|
|
24
|
+
Supplier<Activity> activitySupplier,
|
|
25
|
+
BiConsumer<String, JSObject> notifyListenersFunction,
|
|
26
|
+
String pluginLogTag
|
|
27
|
+
) {
|
|
28
|
+
super(contextSupplier, activitySupplier, notifyListenersFunction, pluginLogTag, "AdRewardExecutor");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@PluginMethod
|
|
32
|
+
public void prepareRewardInterstitialAd(final PluginCall call, BiConsumer<String, JSObject> notifyListenersFunction) {
|
|
33
|
+
final AdOptions adOptions = AdOptions.getFactory().createRewardInterstitialOptions(call);
|
|
34
|
+
|
|
35
|
+
activitySupplier
|
|
36
|
+
.get()
|
|
37
|
+
.runOnUiThread(() -> {
|
|
38
|
+
try {
|
|
39
|
+
final AdRequest adRequest = RequestHelper.createRequest(adOptions);
|
|
40
|
+
final String id = AdViewIdHelper.getFinalAdId(adOptions, adRequest, logTag, contextSupplier.get());
|
|
41
|
+
RewardedInterstitialAd.load(
|
|
42
|
+
contextSupplier.get(),
|
|
43
|
+
id,
|
|
44
|
+
adRequest,
|
|
45
|
+
RewardedInterstitialAdCallbackAndListeners.INSTANCE.getRewardedAdLoadCallback(
|
|
46
|
+
call,
|
|
47
|
+
notifyListenersFunction,
|
|
48
|
+
adOptions
|
|
49
|
+
)
|
|
50
|
+
);
|
|
51
|
+
} catch (Exception ex) {
|
|
52
|
+
call.reject(ex.getLocalizedMessage(), ex);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@PluginMethod
|
|
58
|
+
public void showRewardInterstitialAd(final PluginCall call, BiConsumer<String, JSObject> notifyListenersFunction) {
|
|
59
|
+
if (mRewardedInterstitialAd == null) {
|
|
60
|
+
String errorMessage = "No Reward Video Ad can be show. It was not prepared or maybe it failed to be prepared.";
|
|
61
|
+
call.reject(errorMessage);
|
|
62
|
+
AdMobPluginError errorObject = new AdMobPluginError(-1, errorMessage);
|
|
63
|
+
notifyListenersFunction.accept(RewardInterstitialAdPluginEvents.FailedToLoad, errorObject);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
activitySupplier
|
|
69
|
+
.get()
|
|
70
|
+
.runOnUiThread(() -> {
|
|
71
|
+
mRewardedInterstitialAd.show(
|
|
72
|
+
activitySupplier.get(),
|
|
73
|
+
RewardedInterstitialAdCallbackAndListeners.INSTANCE.getOnUserEarnedRewardListener(call, notifyListenersFunction)
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
} catch (Exception ex) {
|
|
77
|
+
call.reject(ex.getLocalizedMessage(), ex);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob.rewardedinterstitial
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.community.admob.models.LoadPluginEventNames
|
|
4
|
+
|
|
5
|
+
object RewardInterstitialAdPluginEvents: LoadPluginEventNames {
|
|
6
|
+
const val Loaded = "onRewardedInterstitialAdLoaded"
|
|
7
|
+
const val FailedToLoad = "onRewardedInterstitialAdFailedToLoad"
|
|
8
|
+
const val Rewarded = "onRewardedInterstitialAdReward"
|
|
9
|
+
override val Showed = "onRewardedInterstitialAdShowed"
|
|
10
|
+
override val FailedToShow = "onRewardedInterstitialAdFailedToShow"
|
|
11
|
+
override val Dismissed = "onRewardedInterstitialAdDismissed"
|
|
12
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob.rewardedinterstitial
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.JSObject
|
|
4
|
+
import com.getcapacitor.PluginCall
|
|
5
|
+
import com.getcapacitor.community.admob.helpers.FullscreenPluginCallback
|
|
6
|
+
import com.getcapacitor.community.admob.models.AdMobPluginError
|
|
7
|
+
import com.getcapacitor.community.admob.models.AdOptions
|
|
8
|
+
import com.google.android.gms.ads.LoadAdError
|
|
9
|
+
import com.google.android.gms.ads.OnUserEarnedRewardListener
|
|
10
|
+
import com.google.android.gms.ads.rewarded.RewardItem
|
|
11
|
+
import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAd
|
|
12
|
+
import com.google.android.gms.ads.rewardedinterstitial.RewardedInterstitialAdLoadCallback
|
|
13
|
+
import com.google.android.gms.common.util.BiConsumer
|
|
14
|
+
|
|
15
|
+
object RewardedInterstitialAdCallbackAndListeners {
|
|
16
|
+
|
|
17
|
+
fun getOnUserEarnedRewardListener(call: PluginCall, notifyListenersFunction: BiConsumer<String, JSObject>): OnUserEarnedRewardListener {
|
|
18
|
+
return OnUserEarnedRewardListener { item: RewardItem ->
|
|
19
|
+
val response = JSObject()
|
|
20
|
+
response.put("type", item.type)
|
|
21
|
+
.put("amount", item.amount)
|
|
22
|
+
notifyListenersFunction.accept(RewardInterstitialAdPluginEvents.Rewarded, response)
|
|
23
|
+
call.resolve(response)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fun getRewardedAdLoadCallback(call: PluginCall, notifyListenersFunction: BiConsumer<String, JSObject>, adOptions: AdOptions): RewardedInterstitialAdLoadCallback {
|
|
28
|
+
return object : RewardedInterstitialAdLoadCallback() {
|
|
29
|
+
override fun onAdLoaded(ad: RewardedInterstitialAd) {
|
|
30
|
+
AdRewardInterstitialExecutor.mRewardedInterstitialAd = ad
|
|
31
|
+
AdRewardInterstitialExecutor.mRewardedInterstitialAd.fullScreenContentCallback = FullscreenPluginCallback(
|
|
32
|
+
RewardInterstitialAdPluginEvents, notifyListenersFunction)
|
|
33
|
+
|
|
34
|
+
val adInfo = JSObject()
|
|
35
|
+
adInfo.put("adUnitId", ad.adUnitId)
|
|
36
|
+
call.resolve(adInfo)
|
|
37
|
+
|
|
38
|
+
notifyListenersFunction.accept(RewardInterstitialAdPluginEvents.Loaded, adInfo)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun onAdFailedToLoad(adError: LoadAdError) {
|
|
42
|
+
val adMobError = AdMobPluginError(adError)
|
|
43
|
+
|
|
44
|
+
notifyListenersFunction.accept(RewardInterstitialAdPluginEvents.FailedToLoad, adMobError)
|
|
45
|
+
call.reject(adError.message)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
package com.getcapacitor.community.admob.rewardedinterstitial.models
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.PluginCall
|
|
4
|
+
|
|
5
|
+
class SsvInfo(
|
|
6
|
+
val customData: String? = null,
|
|
7
|
+
val userId: String? = null) {
|
|
8
|
+
|
|
9
|
+
constructor(pluginCall: PluginCall?) : this(
|
|
10
|
+
pluginCall?.getObject("ssv")?.getString("customData"),
|
|
11
|
+
pluginCall?.getObject("ssv")?.getString("userId")
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
constructor() : this(null, null)
|
|
15
|
+
|
|
16
|
+
val hasInfo
|
|
17
|
+
get(): Boolean {
|
|
18
|
+
return customData != null || userId != null
|
|
19
|
+
}
|
|
20
|
+
}
|