From 12f845e91c040448933e4fbb6c96c34ab75643b3 Mon Sep 17 00:00:00 2001 From: Rickard Ekman Date: Mon, 27 Jun 2016 13:53:00 +0200 Subject: [PATCH] Upgrade example to 0.29 --- example/.flowconfig | 70 ++----------------- example/.gitignore | 1 + example/android/app/proguard-rules.pro | 3 + .../android/app/src/main/AndroidManifest.xml | 1 + .../main/java/com/example/MainActivity.java | 32 --------- .../java/com/example/MainApplication.java | 39 +++++++++++ example/index.android.js | 4 +- example/package.json | 4 +- 8 files changed, 56 insertions(+), 98 deletions(-) create mode 100644 example/android/app/src/main/java/com/example/MainApplication.java diff --git a/example/.flowconfig b/example/.flowconfig index 45fd3ccb..e28e2f5b 100644 --- a/example/.flowconfig +++ b/example/.flowconfig @@ -1,71 +1,13 @@ [ignore] # We fork some components by platform. -.*/*.web.js .*/*.android.js -# Some modules have their own node_modules with overlap -.*/node_modules/node-haste/.* - -# Ugh -.*/node_modules/babel.* -.*/node_modules/babylon.* -.*/node_modules/invariant.* - -# Ignore react and fbjs where there are overlaps, but don't ignore -# anything that react-native relies on -.*/node_modules/fbjs/lib/Map.js -.*/node_modules/fbjs/lib/ErrorUtils.js - -# Flow has a built-in definition for the 'react' module which we prefer to use -# over the currently-untyped source -.*/node_modules/react/react.js -.*/node_modules/react/lib/React.js -.*/node_modules/react/lib/ReactDOM.js - -.*/__mocks__/.* -.*/__tests__/.* - -.*/commoner/test/source/widget/share.js - -# Ignore commoner tests -.*/node_modules/commoner/test/.* - -# See https://github.com/facebook/flow/issues/442 -.*/react-tools/node_modules/commoner/lib/reader.js - -# Ignore jest -.*/node_modules/jest-cli/.* - -# Ignore Website -.*/website/.* - -# Ignore generators +# Ignore templates with `@flow` in header .*/local-cli/generator.* -# Ignore BUCK generated folders -.*\.buckd/ - -# Ignore RNPM -.*/local-cli/rnpm/.* - -.*/node_modules/is-my-json-valid/test/.*\.json -.*/node_modules/iconv-lite/encodings/tables/.*\.json +# Ignore malformed json .*/node_modules/y18n/test/.*\.json -.*/node_modules/spdx-license-ids/spdx-license-ids.json -.*/node_modules/spdx-exceptions/index.json -.*/node_modules/resolve/test/subdirs/node_modules/a/b/c/x.json -.*/node_modules/resolve/lib/core.json -.*/node_modules/jsonparse/samplejson/.*\.json -.*/node_modules/json5/test/.*\.json -.*/node_modules/ua-parser-js/test/.*\.json -.*/node_modules/builtin-modules/builtin-modules.json -.*/node_modules/binary-extensions/binary-extensions.json -.*/node_modules/url-regex/tlds.json -.*/node_modules/joi/.*\.json -.*/node_modules/isemail/.*\.json -.*/node_modules/tr46/.*\.json - [include] @@ -80,6 +22,8 @@ module.system=haste esproposal.class_static_fields=enable esproposal.class_instance_fields=enable +experimental.strict_type_args=true + munge_underscores=true module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' @@ -89,9 +33,9 @@ suppress_type=$FlowIssue suppress_type=$FlowFixMe suppress_type=$FixMe -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-5]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +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\\)*\\$FlowFixedInNextDeploy [version] -^0.25.0 +^0.27.0 diff --git a/example/.gitignore b/example/.gitignore index 42c9490e..eb1535e4 100644 --- a/example/.gitignore +++ b/example/.gitignore @@ -24,6 +24,7 @@ project.xcworkspace # Android/IJ # +*.iml .idea .gradle local.properties diff --git a/example/android/app/proguard-rules.pro b/example/android/app/proguard-rules.pro index 9852871b..48361a90 100644 --- a/example/android/app/proguard-rules.pro +++ b/example/android/app/proguard-rules.pro @@ -26,11 +26,14 @@ # See http://sourceforge.net/p/proguard/bugs/466/ -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters +-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip # Do not strip any method/class that is annotated with @DoNotStrip -keep @com.facebook.proguard.annotations.DoNotStrip class * +-keep @com.facebook.common.internal.DoNotStrip class * -keepclassmembers class * { @com.facebook.proguard.annotations.DoNotStrip *; + @com.facebook.common.internal.DoNotStrip *; } -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index f1833472..677f0759 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -11,6 +11,7 @@ android:targetSdkVersion="22" /> getPackages() { - return Arrays.asList( - new MainReactPackage(), - mBraintreePackage = new BraintreePackage(this) - ); - } - - @Override - public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - mBraintreePackage.handleActivityResult(requestCode, resultCode, data); - } } diff --git a/example/android/app/src/main/java/com/example/MainApplication.java b/example/android/app/src/main/java/com/example/MainApplication.java new file mode 100644 index 00000000..9def4f4c --- /dev/null +++ b/example/android/app/src/main/java/com/example/MainApplication.java @@ -0,0 +1,39 @@ +package com.example; + +import android.app.Application; +import android.util.Log; + +import com.facebook.react.ReactApplication; +import com.facebook.react.ReactInstanceManager; +import com.facebook.react.ReactNativeHost; +import com.facebook.react.ReactPackage; +import com.facebook.react.shell.MainReactPackage; + +import java.util.Arrays; +import java.util.List; + +import android.content.Intent; +import com.pw.droplet.braintree.BraintreePackage; + +public class MainApplication extends Application implements ReactApplication { + + private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { + @Override + protected boolean getUseDeveloperSupport() { + return BuildConfig.DEBUG; + } + + @Override + protected List getPackages() { + return Arrays.asList( + new MainReactPackage(), + new BraintreePackage() + ); + } + }; + + @Override + public ReactNativeHost getReactNativeHost() { + return mReactNativeHost; + } +} diff --git a/example/index.android.js b/example/index.android.js index 5fb7bf22..28c6d759 100644 --- a/example/index.android.js +++ b/example/index.android.js @@ -18,16 +18,18 @@ class example extends Component { const token = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiI5YzRiYWQxMmEzNzc1ZmRjNDJjMmJiMzkwMWQ4ODhlODQwZTkzZDYxYzgyOTgyYjU1MDBlZDNhYzUzZWRkMjM5fGNyZWF0ZWRfYXQ9MjAxNi0wNi0xOFQxNDoyMjo1MS43Mzc1OTcwMjcrMDAwMFx1MDAyNm1lcmNoYW50X2lkPWNjOWY2OHZ3Y2NrdDYzdGpcdTAwMjZwdWJsaWNfa2V5PW0ycGJ4a3F4Yzl5ZHQyYzIiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvY2M5ZjY4dndjY2t0NjN0ai9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzL2NjOWY2OHZ3Y2NrdDYzdGovY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tL2NjOWY2OHZ3Y2NrdDYzdGoifSwidGhyZWVEU2VjdXJlRW5hYmxlZCI6dHJ1ZSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFsIjp7ImRpc3BsYXlOYW1lIjoiV2h5d2FpdCB0ZXN0IiwiY2xpZW50SWQiOm51bGwsInByaXZhY3lVcmwiOiJodHRwOi8vZXhhbXBsZS5jb20vcHAiLCJ1c2VyQWdyZWVtZW50VXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3RvcyIsImJhc2VVcmwiOiJodHRwczovL2Fzc2V0cy5icmFpbnRyZWVnYXRld2F5LmNvbSIsImFzc2V0c1VybCI6Imh0dHBzOi8vY2hlY2tvdXQucGF5cGFsLmNvbSIsImRpcmVjdEJhc2VVcmwiOm51bGwsImFsbG93SHR0cCI6dHJ1ZSwiZW52aXJvbm1lbnROb05ldHdvcmsiOnRydWUsImVudmlyb25tZW50Ijoib2ZmbGluZSIsInVudmV0dGVkTWVyY2hhbnQiOmZhbHNlLCJicmFpbnRyZWVDbGllbnRJZCI6Im1hc3RlcmNsaWVudDMiLCJiaWxsaW5nQWdyZWVtZW50c0VuYWJsZWQiOnRydWUsIm1lcmNoYW50QWNjb3VudElkIjoiV2h5d2FpdF9zdmVuc2tfdGVzdDIiLCJjdXJyZW5jeUlzb0NvZGUiOiJTRUsifSwiY29pbmJhc2VFbmFibGVkIjpmYWxzZSwibWVyY2hhbnRJZCI6ImNjOWY2OHZ3Y2NrdDYzdGoiLCJ2ZW5tbyI6Im9mZiJ9"; BTClient.setup(token) .then(function(success) { - console.log('success') + console.log(success) // BTClient.getCardNonce("4111111111111111", "10", "20").then(function(nonce) {console.log(nonce)}).catch(function(err) {console.log('error')}) }) .catch(function(err) {console.log(err)}); BTClient.showPaymentViewController() .then(function(nonce) { //payment succeeded, pass nonce to server + console.log(nonce) }) .catch(function(err) { //error handling + console.log(error) }); } diff --git a/example/package.json b/example/package.json index fff74e76..ef69f9e0 100644 --- a/example/package.json +++ b/example/package.json @@ -6,8 +6,8 @@ "start": "node node_modules/react-native/local-cli/cli.js start" }, "dependencies": { - "react": "^15.1.0", - "react-native": "0.27.2", + "react": "15.2.0-rc.1", + "react-native": "0.29.0-rc.0", "react-native-braintree-xplat": "file:../" } }