Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit aa49d4b

Browse files
committed
Merge pull request #172 from Microsoft/RN-0.19
Upgrade to RN 0.19
2 parents ec23699 + 9fc51f5 commit aa49d4b

File tree

11 files changed

+333
-135
lines changed

11 files changed

+333
-135
lines changed

CodePush.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,14 +384,14 @@ - (void)savePendingUpdate:(NSString *)packageHash
384384
NSDictionary *newPackage = [CodePushPackage getPackage:updatePackage[PackageHashKey] error:&err];
385385

386386
if (err) {
387-
return reject(err);
387+
return reject([NSString stringWithFormat: @"%lu", (long)err.code], err.localizedDescription, err);
388388
}
389389

390390
resolve(newPackage);
391391
}
392392
// The download failed
393393
failCallback:^(NSError *err) {
394-
reject(err);
394+
reject([NSString stringWithFormat: @"%lu", (long)err.code], err.localizedDescription, err);
395395
}];
396396
});
397397
}
@@ -419,7 +419,7 @@ - (void)savePendingUpdate:(NSString *)packageHash
419419
NSMutableDictionary *package = [[CodePushPackage getCurrentPackage:&error] mutableCopy];
420420

421421
if (error) {
422-
reject(error);
422+
reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error);
423423
}
424424

425425
// Add the "isPending" virtual property to the package at this point, so that
@@ -445,7 +445,7 @@ - (void)savePendingUpdate:(NSString *)packageHash
445445
error:&error];
446446

447447
if (error) {
448-
reject(error);
448+
reject([NSString stringWithFormat: @"%lu", (long)error.code], error.localizedDescription, error);
449449
} else {
450450
[self savePendingUpdate:updatePackage[PackageHashKey]
451451
isLoading:NO];

Examples/CodePushDemoApp/.flowconfig

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,38 @@
77
# Some modules have their own node_modules with overlap
88
.*/node_modules/node-haste/.*
99

10-
# Ignore react-tools where there are overlaps, but don't ignore anything that
11-
# react-native relies on
12-
.*/node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js
13-
.*/node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js
14-
.*/node_modules/react-tools/src/browser/ui/React.js
15-
.*/node_modules/react-tools/src/core/ReactInstanceHandles.js
16-
.*/node_modules/react-tools/src/event/EventPropagators.js
10+
# Ugh
11+
.*/node_modules/babel.*
12+
.*/node_modules/babylon.*
13+
.*/node_modules/invariant.*
14+
15+
# Ignore react and fbjs where there are overlaps, but don't ignore
16+
# anything that react-native relies on
17+
.*/node_modules/fbjs/lib/Map.js
18+
.*/node_modules/fbjs/lib/Promise.js
19+
.*/node_modules/fbjs/lib/fetch.js
20+
.*/node_modules/fbjs/lib/ExecutionEnvironment.js
21+
.*/node_modules/fbjs/lib/isEmpty.js
22+
.*/node_modules/fbjs/lib/crc32.js
23+
.*/node_modules/fbjs/lib/ErrorUtils.js
24+
25+
# Flow has a built-in definition for the 'react' module which we prefer to use
26+
# over the currently-untyped source
27+
.*/node_modules/react/react.js
28+
.*/node_modules/react/lib/React.js
29+
.*/node_modules/react/lib/ReactDOM.js
1730

1831
# Ignore commoner tests
19-
.*/node_modules/react-tools/node_modules/commoner/test/.*
32+
.*/node_modules/commoner/test/.*
2033

2134
# See https://github.com/facebook/flow/issues/442
2235
.*/react-tools/node_modules/commoner/lib/reader.js
2336

2437
# Ignore jest
25-
.*/react-native/node_modules/jest-cli/.*
38+
.*/node_modules/jest-cli/.*
39+
40+
# Ignore Website
41+
.*/website/.*
2642

2743
[include]
2844

@@ -32,5 +48,18 @@ node_modules/react-native/Libraries/react-native/react-native-interface.js
3248
[options]
3349
module.system=haste
3450

51+
munge_underscores=true
52+
53+
module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
54+
module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'
55+
56+
suppress_type=$FlowIssue
57+
suppress_type=$FlowFixMe
58+
suppress_type=$FixMe
59+
60+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
61+
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-0]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
62+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
63+
3564
[version]
36-
0.11.0
65+
0.20.1
Lines changed: 101 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,80 @@
1-
apply plugin: 'com.android.application'
1+
apply plugin: "com.android.application"
2+
3+
import com.android.build.OutputFile
4+
5+
/**
6+
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
7+
* and bundleReleaseJsAndAssets).
8+
* These basically call `react-native bundle` with the correct arguments during the Android build
9+
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
10+
* bundle directly from the development server. Below you can see all the possible configurations
11+
* and their defaults. If you decide to add a configuration block, make sure to add it before the
12+
* `apply from: "react.gradle"` line.
13+
*
14+
* project.ext.react = [
15+
* // the name of the generated asset file containing your JS bundle
16+
* bundleAssetName: "index.android.bundle",
17+
*
18+
* // the entry file for bundle generation
19+
* entryFile: "index.android.js",
20+
*
21+
* // whether to bundle JS and assets in debug mode
22+
* bundleInDebug: false,
23+
*
24+
* // whether to bundle JS and assets in release mode
25+
* bundleInRelease: true,
26+
*
27+
* // whether to bundle JS and assets in another build variant (if configured).
28+
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
29+
* // The configuration property is in the format 'bundleIn${productFlavor}${buildType}'
30+
* // bundleInFreeDebug: true,
31+
* // bundleInPaidRelease: true,
32+
* // bundleInBeta: true,
33+
*
34+
* // the root of your project, i.e. where "package.json" lives
35+
* root: "../../",
36+
*
37+
* // where to put the JS bundle asset in debug mode
38+
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
39+
*
40+
* // where to put the JS bundle asset in release mode
41+
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
42+
*
43+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
44+
* // require('./image.png')), in debug mode
45+
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
46+
*
47+
* // where to put drawable resources / React Native assets, e.g. the ones you use via
48+
* // require('./image.png')), in release mode
49+
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
50+
*
51+
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
52+
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
53+
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
54+
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
55+
* // for example, you might want to remove it from here.
56+
* inputExcludes: ["android/**", "ios/**"]
57+
* ]
58+
*/
259

360
apply from: "react.gradle"
461

62+
/**
63+
* Set this to true to create three separate APKs instead of one:
64+
* - A universal APK that works on all devices
65+
* - An APK that only works on ARM devices
66+
* - An APK that only works on x86 devices
67+
* The advantage is the size of the APK is reduced by about 4MB.
68+
* Upload all the APKs to the Play Store and people will download
69+
* the correct one based on the CPU architecture of their device.
70+
*/
71+
def enableSeparateBuildPerCPUArchitecture = false
72+
73+
/**
74+
* Run Proguard to shrink the Java bytecode in release builds.
75+
*/
76+
def enableProguardInReleaseBuilds = true
77+
578
android {
679
compileSdkVersion 23
780
buildToolsVersion "23.0.1"
@@ -16,17 +89,38 @@ android {
1689
abiFilters "armeabi-v7a", "x86"
1790
}
1891
}
92+
splits {
93+
abi {
94+
enable enableSeparateBuildPerCPUArchitecture
95+
universalApk true
96+
reset()
97+
include "armeabi-v7a", "x86"
98+
}
99+
}
19100
buildTypes {
20101
release {
21-
minifyEnabled false
22-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
102+
minifyEnabled enableProguardInReleaseBuilds
103+
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
104+
}
105+
}
106+
// applicationVariants are e.g. debug, release
107+
applicationVariants.all { variant ->
108+
variant.outputs.each { output ->
109+
// For each separate APK per architecture, set a unique version code as described here:
110+
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
111+
def versionCodes = ["armeabi-v7a":1, "x86":2]
112+
def abi = output.getFilter(OutputFile.ABI)
113+
if (abi != null) { // null for the universal-debug, universal-release variants
114+
output.versionCodeOverride =
115+
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
116+
}
23117
}
24118
}
25119
}
26120

27121
dependencies {
28-
compile fileTree(dir: 'libs', include: ['*.jar'])
29-
compile 'com.android.support:appcompat-v7:23.0.0'
30-
compile 'com.facebook.react:react-native:0.15.1'
31-
compile project(':react-native-code-push')
122+
compile fileTree(dir: "libs", include: ["*.jar"])
123+
compile "com.android.support:appcompat-v7:23.0.1"
124+
compile "com.facebook.react:react-native:0.19.+"
125+
compile project(":react-native-code-push")
32126
}

Examples/CodePushDemoApp/android/app/proguard-rules.pro

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,53 @@
1515
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
1616
# public *;
1717
#}
18+
19+
# Disabling obfuscation is useful if you collect stack traces from production crashes
20+
# (unless you are using a system that supports de-obfuscate the stack traces).
21+
-dontobfuscate
22+
23+
# React Native
24+
25+
# Keep our interfaces so they can be used by other ProGuard rules.
26+
# See http://sourceforge.net/p/proguard/bugs/466/
27+
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
28+
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
29+
30+
# Do not strip any method/class that is annotated with @DoNotStrip
31+
-keep @com.facebook.proguard.annotations.DoNotStrip class *
32+
-keepclassmembers class * {
33+
@com.facebook.proguard.annotations.DoNotStrip *;
34+
}
35+
36+
-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
37+
void set*(***);
38+
*** get*();
39+
}
40+
41+
-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
42+
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
43+
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
44+
-keepclassmembers class * { @com.facebook.react.uimanager.UIProp <fields>; }
45+
-keepclassmembers class * { @com.facebook.react.uimanager.ReactProp <methods>; }
46+
-keepclassmembers class * { @com.facebook.react.uimanager.ReactPropGroup <methods>; }
47+
48+
-dontwarn com.facebook.react.**
49+
50+
# okhttp
51+
52+
-keepattributes Signature
53+
-keepattributes *Annotation*
54+
-keep class com.squareup.okhttp.** { *; }
55+
-keep interface com.squareup.okhttp.** { *; }
56+
-dontwarn com.squareup.okhttp.**
57+
58+
# okio
59+
60+
-keep class sun.misc.Unsafe { *; }
61+
-dontwarn java.nio.file.*
62+
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
63+
-dontwarn okio.**
64+
65+
# stetho
66+
67+
-dontwarn com.facebook.stetho.**

0 commit comments

Comments
 (0)