[admob][android] Move RewardedEventTypes to statics

This commit is contained in:
Elliot Hesp 2017-05-27 17:27:22 +01:00
parent 9a944dffc5
commit e4ee402aef
2 changed files with 11 additions and 2 deletions

View File

@ -72,8 +72,13 @@ export default class RewardedVideo {
* @returns {null}
*/
on(eventType, listenerCb) {
if ((eventType !== 'onRewarded' || eventType !== 'onRewardedVideoStarted') && !statics.EventTypes[eventType]) {
console.warn(`Invalid event type provided, must be one of: ${Object.keys(statics.EventTypes).join(', ')}, onRewarded, onRewardedVideoStarted`);
const types = {
...statics.EventTypes,
...statics.RewardedVideoEventTypes,
};
if (!types[eventType]) {
console.warn(`Invalid event type provided, must be one of: ${Object.keys(types).join(', ')}`);
return null;
}

View File

@ -67,4 +67,8 @@ export const statics = {
onAdClosed: 'onAdClosed',
onAdFailedToLoad: 'onAdFailedToLoad',
},
RewardedVideoEventTypes: {
onRewarded: 'onRewarded',
onRewardedVideoStarted: 'onRewardedVideoStarted',
},
};