提交 95015694 authored 作者: vipcxj's avatar vipcxj

add: 热更新支持

上级 aa5d8ed7
......@@ -77,6 +77,7 @@ project.ext.react = [
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
/**
* Set this to true to create two separate APKs instead of one:
......@@ -103,7 +104,7 @@ android {
targetSdkVersion 25
multiDexEnabled true
versionCode 1
versionName "1.0"
versionName "1.0.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
......@@ -147,9 +148,10 @@ android {
}
dependencies {
compile project(':react-native-code-push')
compile project(':react-native-device-info')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:25.3.1"
compile "com.android.support:appcompat-v7:25.4.0"
compile 'com.android.support:multidex:1.0.1'
compile "com.facebook.react:react-native:+" // From node_modules
}
......
......@@ -6,6 +6,7 @@ import android.support.multidex.MultiDex;
import com.bolan.android.modules.IDCardReactPackage;
import com.facebook.react.ReactApplication;
import com.microsoft.codepush.react.CodePush;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
......@@ -18,6 +19,12 @@ import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
......@@ -27,6 +34,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CodePush(null, getApplicationContext(), BuildConfig.DEBUG),
new RNDeviceInfo(),
new IDCardReactPackage()
);
......
<resources>
<string moduleConfig="true" name="reactNativeCodePush_androidDeploymentKey"></string>
<string name="app_name">bolanManagerApp</string>
</resources>
......@@ -3,6 +3,10 @@
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
......@@ -20,5 +24,9 @@ allprojects {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
......@@ -18,4 +18,4 @@
# org.gradle.parallel=true
android.useDeprecatedNdk=true
org.gradle.jvmargs=-Xmx2048m
org.gradle.jvmargs=-Xmx4G
rootProject.name = 'bolanManagerApp'
include ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')
......
......@@ -38,6 +38,8 @@
ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
07BDEFA20656470B88D48554 /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DADBDDA7F504C5193847D2D /* libRNDeviceInfo.a */; };
53E9F8ADCC714D9693F0C068 /* libRNDeviceInfo-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 83554850969D48C684F45F7F /* libRNDeviceInfo-tvOS.a */; };
1A1EABAFBB254C51AA95A884 /* libCodePush.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5049A267195B4A6D95EE87C7 /* libCodePush.a */; };
BDC17299171149F2874B1AB8 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 83AC580FC9064DB19C36CE97 /* libz.tbd */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -268,6 +270,9 @@
20C53C1323F44CCBB35F0247 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; name = "RNDeviceInfo.xcodeproj"; path = "../node_modules/react-native-device-info/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
4DADBDDA7F504C5193847D2D /* libRNDeviceInfo.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo.a"; path = "libRNDeviceInfo.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
83554850969D48C684F45F7F /* libRNDeviceInfo-tvOS.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo-tvOS.a"; path = "libRNDeviceInfo-tvOS.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
F140EEF54B894D10B664588B /* CodePush.xcodeproj */ = {isa = PBXFileReference; name = "CodePush.xcodeproj"; path = "../node_modules/react-native-code-push/ios/CodePush.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
5049A267195B4A6D95EE87C7 /* libCodePush.a */ = {isa = PBXFileReference; name = "libCodePush.a"; path = "libCodePush.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
83AC580FC9064DB19C36CE97 /* libz.tbd */ = {isa = PBXFileReference; name = "libz.tbd"; path = "usr/lib/libz.tbd"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = sourcecode.text-based-dylib-definition; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -298,6 +303,8 @@
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
07BDEFA20656470B88D48554 /* libRNDeviceInfo.a in Frameworks */,
53E9F8ADCC714D9693F0C068 /* libRNDeviceInfo-tvOS.a in Frameworks */,
1A1EABAFBB254C51AA95A884 /* libCodePush.a in Frameworks */,
BDC17299171149F2874B1AB8 /* libz.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -467,6 +474,7 @@
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
20C53C1323F44CCBB35F0247 /* RNDeviceInfo.xcodeproj */,
F140EEF54B894D10B664588B /* CodePush.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
......@@ -487,6 +495,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */,
00E356EF1AD99517003FC87E /* bolanManagerAppTests */,
83CBBA001A601CBA00E9B192 /* Products */,
656C5749FA6F40FCAD750C45 /* Frameworks */,
);
indentWidth = 2;
sourceTree = "<group>";
......@@ -512,6 +521,15 @@
name = Products;
sourceTree = "<group>";
};
656C5749FA6F40FCAD750C45 /* Frameworks */ = {
isa = "PBXGroup";
children = (
83AC580FC9064DB19C36CE97 /* libz.tbd */,
);
name = Frameworks;
sourceTree = "<group>";
path = "";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
......@@ -1016,10 +1034,12 @@
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
);
};
name = Debug;
......@@ -1042,10 +1062,12 @@
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
);
};
name = Release;
......@@ -1068,6 +1090,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
);
};
name = Debug;
......@@ -1089,6 +1112,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
);
};
name = Release;
......@@ -1120,10 +1144,12 @@
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
);
};
name = Debug;
......@@ -1155,10 +1181,12 @@
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
"$(SRCROOT)/../node_modules/react-native-code-push/ios/CodePush/**",
);
};
name = Release;
......@@ -1185,6 +1213,7 @@
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
};
name = Debug;
......@@ -1211,6 +1240,7 @@
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
};
name = Release;
......
......@@ -8,6 +8,7 @@
*/
#import "AppDelegate.h"
#import <CodePush/CodePush.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
......@@ -18,7 +19,12 @@
{
NSURL *jsCodeLocation;
#ifdef DEBUG
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
#else
jsCodeLocation = [CodePush bundleURL];
#endif
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
moduleName:@"bolanManagerApp"
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
......@@ -39,9 +39,8 @@
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<string/>
<key>NSAppTransportSecurity</key>
<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
<dict>
<key>NSExceptionDomains</key>
<dict>
......@@ -52,5 +51,7 @@
</dict>
</dict>
</dict>
</dict>
<key>CodePushDeploymentKey</key>
<string>deployment-key-here</string>
</dict>
</plist>
\ No newline at end of file
......@@ -23,6 +23,7 @@
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"android-bundle": "react-native bundle --platform android --entry-file index.js --reset-cache --bundle-output android/app/src/main/assets/index.android.bundle --dev false --assets-dest android/app/src/main/res/",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js --watch",
"lint": "eslint --ext .js src test",
......@@ -40,6 +41,7 @@
"rc-form": "^1.4.8",
"react": "^16.0.0-beta.5",
"react-native": "^0.49.3",
"react-native-code-push": "^5.1.3-beta",
"react-native-device-info": "^0.12.1",
"react-navigation": "^1.0.0-beta.14",
"react-redux": "^5.0.6",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论