Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Version 2 #165

Merged
merged 56 commits into from
Oct 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
736ac7a
update example to react-native 0.46
koenpunt Jul 6, 2017
2986dc4
reimplement PublisherBanner for iOS
koenpunt Jul 9, 2017
86f2f0d
remove initWithEventDispatcher
koenpunt Jul 9, 2017
2d548fd
add examples for multisize and events
koenpunt Jul 9, 2017
e66813a
add example for adSize="fluid" (not working tho)
koenpunt Jul 9, 2017
87cbc8b
export adSize as GADAdSize
koenpunt Jul 10, 2017
ae4702d
remove explicit proptype passing
koenpunt Jul 10, 2017
519a012
reimplement AdMobBanner like PublisherBanner (iOS)
koenpunt Jul 10, 2017
18e3715
add example for AdMobBanner
koenpunt Jul 10, 2017
6620a22
cleanup implementation and naming normalisation
koenpunt Jul 10, 2017
aebb242
add AdMobBanner.simulatorId
koenpunt Jul 10, 2017
ab200da
update event handling for rewarded video
koenpunt Jul 11, 2017
b4a87ac
update event handling for interstitials
koenpunt Jul 13, 2017
a50421f
add example for interstitial
koenpunt Jul 13, 2017
e5898bd
update `testDeviceID` prop to to `testDevices` [android]
koenpunt Jul 13, 2017
92b8192
bannerSize => adSize [android]
koenpunt Jul 13, 2017
532e9c8
unify android and ios example
koenpunt Jul 13, 2017
087acc2
export loadBanner command
koenpunt Jul 14, 2017
19e389a
make basic PublisherBanner work again on android
koenpunt Jul 14, 2017
9e33414
add beta tag
koenpunt Aug 1, 2017
a06719a
disable code minification
koenpunt Aug 1, 2017
990d5c7
fix null pointer exception when no adsize is set
koenpunt Aug 1, 2017
8a4efe7
implement admob banner the same as publisherbanner
koenpunt Aug 1, 2017
6ad1efd
dispatch onSizeChange on ad receive
koenpunt Aug 1, 2017
a4d2bdd
tag as 2.0.0 alpha
koenpunt Aug 1, 2017
082b400
ReadableArray.toArrayList is only available since react 0.46
koenpunt Aug 1, 2017
a89180f
require minimum of react native 0.44
koenpunt Aug 1, 2017
62d90ef
add minimal eslint configuration
koenpunt Aug 1, 2017
f18e1e9
use promises instead of callbacks for request and show (iOS)
koenpunt Aug 2, 2017
6149731
fix reward example
koenpunt Aug 2, 2017
3776a3c
convert native errors to javascript errors
koenpunt Aug 2, 2017
a28d0ca
update README
koenpunt Aug 2, 2017
239cbf7
use promises instead of callbacks for request and show (Android)
koenpunt Aug 2, 2017
a04e9f2
2.0.0-alpha.2
koenpunt Aug 2, 2017
45f1106
define readonly getter for simulatorId
koenpunt Aug 2, 2017
c02f32d
recreate adview when adUnitID is already set
koenpunt Aug 9, 2017
ecf2ecb
2.0.0-alpha.3
koenpunt Aug 9, 2017
3b03f5b
correctly export view constants on android
koenpunt Aug 10, 2017
2bd7ca5
2.0.0-alpha.4
koenpunt Aug 10, 2017
04b0a30
Removed override notation for deprecated method (createJSModules) of …
patw0929 Aug 2, 2017
0d834b0
2.0.0-alpha.5
koenpunt Sep 11, 2017
175b4b8
rename onAdmobDispatchAppEvent => onDidReceiveAppEvent
koenpunt Sep 28, 2017
eb1f6fe
update README
koenpunt Sep 28, 2017
ea0588f
fix error format to be handled correctly (iOS)
koenpunt Sep 28, 2017
79e10d6
fix error format to be handled correctly (Android)
koenpunt Sep 28, 2017
6b7e96c
log errors as warnings
koenpunt Sep 28, 2017
9a426ca
document onSizeChange prop in README
koenpunt Sep 28, 2017
7d894af
rename events and event properties
koenpunt Sep 29, 2017
467df3d
highlight code as jsx
koenpunt Sep 29, 2017
4ad6850
mention PR for ad targeting
koenpunt Sep 29, 2017
2425ef9
apply code formatting (iOS)
koenpunt Sep 29, 2017
ea1151a
apply code formatting (Android)
koenpunt Sep 29, 2017
9b7ae3a
disallow banner views from having subviews
koenpunt Sep 29, 2017
5498f15
remove some unused properties
koenpunt Oct 3, 2017
551c41f
2.0.0-beta.1
koenpunt Oct 3, 2017
e495e27
Merge branch 'master' into next
koenpunt Oct 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.js]
indent_size = 2
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/*.js
!/*.js
17 changes: 17 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"env": {
"es6": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6
},
"plugins": [
"react"
],
"rules": {
"comma-dangle": ["error", "always-multiline"],
"react/jsx-handler-names": "error"
}
}
3 changes: 3 additions & 0 deletions Example/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["react-native"]
}
34 changes: 19 additions & 15 deletions Example/.flowconfig
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

# We fork some components by platform.
.*/*.android.js
; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

# Ignore templates with `@flow` in header
.*/local-cli/generator.*
; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

# Ignore malformed json
.*/node_modules/y18n/test/.*\.json
; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js
.*/Libraries/react-native/ReactNative.js

[include]

Expand All @@ -17,25 +22,24 @@ node_modules/react-native/flow
flow/

[options]
module.system=haste

esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
emoji=true

experimental.strict_type_args=true
module.system=haste

munge_underscores=true

module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-7]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-7]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

unsafe.enable_getters_and_setters=true

[version]
^0.27.0
^0.47.0
1 change: 1 addition & 0 deletions Example/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pbxproj -text
20 changes: 16 additions & 4 deletions Example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,32 @@ DerivedData
project.xcworkspace
ios/GoogleMobileAds.framework/

# Android/IJ
# Android/IntelliJ
#
*.iml
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
*.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
13 changes: 10 additions & 3 deletions Example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ import com.android.build.OutputFile
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
Expand All @@ -58,7 +65,7 @@ import com.android.build.OutputFile
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"]
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
Expand Down Expand Up @@ -135,6 +142,6 @@ dependencies {
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
from configurations.compile
into 'libs'
}
4 changes: 4 additions & 0 deletions Example/android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@

-dontwarn com.facebook.react.**

# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
-dontwarn android.text.StaticLayout

# okhttp

-keepattributes Signature
Expand Down
3 changes: 2 additions & 1 deletion Example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
15 changes: 10 additions & 5 deletions Example/android/app/src/main/java/com/example/MainApplication.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.example;

import android.app.Application;
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.sbugert.rnadmob.RNAdMobPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.List;
Expand All @@ -17,21 +16,27 @@ public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNAdMobPackage()
new RNAdMobPackage()
);
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
return mReactNativeHost;
}

@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
2 changes: 0 additions & 2 deletions Example/android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<resources>


<string name="app_name">Example</string>
</resources>
2 changes: 1 addition & 1 deletion Example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.android.tools.build:gradle:2.2.3'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion Example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
12 changes: 6 additions & 6 deletions Example/android/keystores/BUCK
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
keystore(
name = 'debug',
store = 'debug.keystore',
properties = 'debug.keystore.properties',
visibility = [
'PUBLIC',
],
name = "debug",
properties = "debug.keystore.properties",
store = "debug.keystore",
visibility = [
"PUBLIC",
],
)
4 changes: 4 additions & 0 deletions Example/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "Example",
"displayName": "Example"
}
79 changes: 1 addition & 78 deletions Example/index.android.js
Original file line number Diff line number Diff line change
@@ -1,78 +1 @@
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Platform,
TouchableHighlight,
} from 'react-native';
import { AdMobRewarded } from 'react-native-admob';

export default class Example extends Component {

componentDidMount() {
AdMobRewarded.setTestDeviceID('EMULATOR');
AdMobRewarded.setAdUnitID('ca-app-pub-3940256099942544/1033173712');

AdMobRewarded.addEventListener('rewardedVideoDidRewardUser',
(type, amount) => console.log('rewardedVideoDidRewardUser', type, amount)
);
AdMobRewarded.addEventListener('rewardedVideoDidLoad',
() => console.log('rewardedVideoDidLoad')
);
AdMobRewarded.addEventListener('rewardedVideoDidFailToLoad',
(error) => console.log('rewardedVideoDidFailToLoad', error)
);
AdMobRewarded.addEventListener('rewardedVideoDidOpen',
() => console.log('rewardedVideoDidOpen')
);
AdMobRewarded.addEventListener('rewardedVideoDidClose',
() => {
console.log('rewardedVideoDidClose');
AdMobRewarded.requestAd((error) => error && console.log(error));
}
);
AdMobRewarded.addEventListener('rewardedVideoWillLeaveApplication',
() => console.log('rewardedVideoWillLeaveApplication')
);

AdMobRewarded.requestAd((error) => error && console.log(error));
}

componentWillUnmount() {
AdMobRewarded.removeAllListeners();
}

showRewarded() {
AdMobRewarded.showAd((error) => error && console.log(error));
}

render() {
return (
<View style={styles.container}>
<View style={{ flex: 1 }}>
<TouchableHighlight>
<Text onPress={this.showRewarded} style={styles.button}>
Show Rewarded Video and preload next
</Text>
</TouchableHighlight>
</View>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
marginTop: (Platform.OS === 'ios') ? 30 : 10,
flex: 1,
alignItems: 'center',
},
button: {
color: '#333333',
marginBottom: 15,
},
});

AppRegistry.registerComponent('Example', () => Example);
require('./index.js');
Loading