From 26acb2d3e7c0ead4502785a9a1f705a1f811e277 Mon Sep 17 00:00:00 2001 From: mx1700 Date: Sun, 23 Jun 2019 18:06:34 +0800 Subject: [PATCH] =?UTF-8?q?react-native-xg-push=20android=20=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- android/app/build.gradle | 35 +++++++++-- android/app/src/main/AndroidManifest.xml | 2 +- .../java/com/timepill/MainApplication.java | 63 ++++++++++--------- android/settings.gradle | 11 +++- ios/Timepill.xcodeproj/project.pbxproj | 20 +++++- package-lock.json | 58 ++++++++++++----- package.json | 5 +- 7 files changed, 135 insertions(+), 59 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index dbe6565..a6d7d27 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -73,7 +73,7 @@ import com.android.build.OutputFile */ project.ext.react = [ - entryFile: "index.js" + entryFile: "index.js" ] apply from: "../../node_modules/react-native/react.gradle" @@ -103,13 +103,26 @@ android { } defaultConfig { - applicationId "com.timepill" + applicationId "com.timepill.diary" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - missingDimensionStrategy "RNN.reactNativeVersion", "reactNative57_5" + missingDimensionStrategy "RNN.reactNativeVersion", "~" versionCode 1 versionName "1.0" - vectorDrawables.useSupportLibrary = true + vectorDrawables.useSupportLibrary = true + + ndk { + //根据需要 自行选择添加的对应cpu类型的.so库。 + abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a' + // 还可以添加 'x86', 'x86_64', 'mips', 'mips64' + } + + manifestPlaceholders = [ + XG_ACCESS_ID: '2100038490', + XG_ACCESS_KEY: 'A2NUN1219LNE', + HW_APPID: '', + PACKAGE_NAME: "com.timepill.diary" + ] } splits { abi { @@ -130,7 +143,7 @@ android { variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits - def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] + def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = @@ -142,6 +155,7 @@ android { dependencies { + implementation project(':react-native-smart-xgpush') implementation project(':rn-fetch-blob') implementation project(':react-native-image-crop-picker') implementation project(':react-native-image-resizer') @@ -154,6 +168,17 @@ dependencies { implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" implementation "com.facebook.react:react-native:+" // From node_modules + + implementation 'com.tencent.xinge:xinge:4.3.2-release' + //jg包 + implementation'com.tencent.jg:jg:1.1' + //wup包 + implementation 'com.tencent.wup:wup:1.0.0.E-Release' + //mid包,minSdkVersion 14 + implementation 'com.tencent.mid:mid:4.0.7-Release' + compile 'com.tencent.xinge:xghw:2.5.2.300-release' + compile 'com.tencent.xinge:mipush:3.2.2-release' + compile 'com.tencent.xinge:xgmz:3.2.2-release' } // Run this once to be able to run the application with BUCK diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 014be91..b67b990 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -15,7 +15,7 @@ android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" - android:allowBackup="false" + android:allowBackup="true" android:theme="@style/AppTheme"> getPackages() { - // Add additional packages you require here - // No need to add RnnPackage and MainReactPackage - return Arrays.asList( - // eg. new VectorIconsPackage() - new RNFetchBlobPackage(), - //new RNDeviceInfo(), - new VectorIconsPackage(), - new AsyncStoragePackage(), - new PickerPackage() - ); - } - - @Override - public List createAdditionalReactPackages() { - return getPackages(); - } + protected List getPackages() { + // Add additional packages you require here + // No need to add RnnPackage and MainReactPackage + return Arrays.asList( + // eg. new VectorIconsPackage() + new RNFetchBlobPackage(), + //new RNDeviceInfo(), + new VectorIconsPackage(), + new AsyncStoragePackage(), + new PickerPackage(), + new XGPushPackage() + ); + } + @Override + public List createAdditionalReactPackages() { + return getPackages(); + } } diff --git a/android/settings.gradle b/android/settings.gradle index c9fcc94..006c82f 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,17 +1,24 @@ rootProject.name = 'Timepill' +include ':app' + +include ':react-native-smart-xgpush' +project(':react-native-smart-xgpush').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-smart-xgpush/android') + include ':rn-fetch-blob' project(':rn-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/rn-fetch-blob/android') + include ':react-native-image-crop-picker' project(':react-native-image-crop-picker').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-crop-picker/android') + include ':react-native-image-resizer' project(':react-native-image-resizer').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-image-resizer/android') + include ':react-native-vector-icons' project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android') + include ':@react-native-community_async-storage' project(':@react-native-community_async-storage').projectDir = new File(rootProject.projectDir, '../node_modules/@react-native-community/async-storage/android') -include ':app' - include ':react-native-navigation' project(':react-native-navigation').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-navigation/lib/android/app/') diff --git a/ios/Timepill.xcodeproj/project.pbxproj b/ios/Timepill.xcodeproj/project.pbxproj index b8be9ae..abb5c86 100644 --- a/ios/Timepill.xcodeproj/project.pbxproj +++ b/ios/Timepill.xcodeproj/project.pbxproj @@ -5,7 +5,6 @@ }; objectVersion = 46; objects = { - /* Begin PBXBuildFile section */ 00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; }; 00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; }; @@ -64,6 +63,7 @@ ED297163215061F000B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED297162215061F000B7C4FE /* JavaScriptCore.framework */; }; ED2971652150620600B7C4FE /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2971642150620600B7C4FE /* JavaScriptCore.framework */; }; F343A722A8DB46C79081F2A0 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 81F0243DD71F467A964CAD89 /* Entypo.ttf */; }; + 85CC1DC101F845E7A6C77B00 /* libRCTXGPushModule.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E259EF5D4BD4D388D1C513C /* libRCTXGPushModule.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -477,6 +477,8 @@ ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; }; FE0D7FAFEDE44E168687B4B2 /* RNCAsyncStorage.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNCAsyncStorage.xcodeproj; path = "../node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.xcodeproj"; sourceTree = ""; }; + 4C4A99AB1DC742A48D0A1515 /* RCTXGPushModule.xcodeproj */ = {isa = PBXFileReference; name = "RCTXGPushModule.xcodeproj"; path = "../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + 3E259EF5D4BD4D388D1C513C /* libRCTXGPushModule.a */ = {isa = PBXFileReference; name = "libRCTXGPushModule.a"; path = "libRCTXGPushModule.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -514,6 +516,7 @@ 9678DE108DEC4C5A9D92EA1D /* libimageCropPicker.a in Frameworks */, 4156314F2297CFBE009EB583 /* QBImagePicker.framework in Frameworks */, 35DCFF50947D4FCBBF5A8921 /* libRNFetchBlob.a in Frameworks */, + 85CC1DC101F845E7A6C77B00 /* libRCTXGPushModule.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -785,6 +788,7 @@ DE970E03BCC84CE8A281A103 /* RCTImageResizer.xcodeproj */, BDBA91D5680B4ACA83A7844B /* imageCropPicker.xcodeproj */, 99151F1A82BD48E0B5416458 /* RNFetchBlob.xcodeproj */, + 4C4A99AB1DC742A48D0A1515 /* RCTXGPushModule.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -1534,6 +1538,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", + "$(SRCROOT)/../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule", ); INFOPLIST_FILE = TimepillTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -1548,6 +1553,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1572,6 +1578,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", + "$(SRCROOT)/../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule", ); INFOPLIST_FILE = TimepillTests/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 9.0; @@ -1586,6 +1593,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1611,6 +1619,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", + "$(SRCROOT)/../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule", ); INFOPLIST_FILE = Timepill/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1638,6 +1647,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", + "$(SRCROOT)/../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule", ); INFOPLIST_FILE = Timepill/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1672,6 +1682,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", + "$(SRCROOT)/../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule", ); INFOPLIST_FILE = "Timepill-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1685,6 +1696,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1718,6 +1730,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", + "$(SRCROOT)/../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule", ); INFOPLIST_FILE = "Timepill-tvOS/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; @@ -1731,6 +1744,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1763,6 +1777,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", + "$(SRCROOT)/../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule", ); INFOPLIST_FILE = "Timepill-tvOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1776,6 +1791,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", @@ -1808,6 +1824,7 @@ "$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer", "$(SRCROOT)/../node_modules/react-native-image-crop-picker/ios/**", "$(SRCROOT)/../node_modules/rn-fetch-blob/ios/**", + "$(SRCROOT)/../node_modules/react-native-smart-xgpush/ios/RCTXGPushModule", ); INFOPLIST_FILE = "Timepill-tvOSTests/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; @@ -1821,6 +1838,7 @@ "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", "\"$(SRCROOT)/$(TARGET_NAME)\"", + "\"$(SRCROOT)/$(TARGET_NAME)\"", ); OTHER_LDFLAGS = ( "-ObjC", diff --git a/package-lock.json b/package-lock.json index a76e885..1c480f9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5015,7 +5015,8 @@ }, "ansi-regex": { "version": "2.1.1", - "bundled": true + "bundled": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -5033,11 +5034,13 @@ }, "balanced-match": { "version": "1.0.0", - "bundled": true + "bundled": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5050,15 +5053,18 @@ }, "code-point-at": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "concat-map": { "version": "0.0.1", - "bundled": true + "bundled": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true + "bundled": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -5161,7 +5167,8 @@ }, "inherits": { "version": "2.0.3", - "bundled": true + "bundled": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -5171,6 +5178,7 @@ "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5183,17 +5191,20 @@ "minimatch": { "version": "3.0.4", "bundled": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } }, "minimist": { "version": "0.0.8", - "bundled": true + "bundled": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -5210,6 +5221,7 @@ "mkdirp": { "version": "0.5.1", "bundled": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -5282,7 +5294,8 @@ }, "number-is-nan": { "version": "1.0.1", - "bundled": true + "bundled": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -5292,6 +5305,7 @@ "once": { "version": "1.4.0", "bundled": true, + "optional": true, "requires": { "wrappy": "1" } @@ -5367,7 +5381,8 @@ }, "safe-buffer": { "version": "5.1.2", - "bundled": true + "bundled": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -5397,6 +5412,7 @@ "string-width": { "version": "1.0.2", "bundled": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -5414,6 +5430,7 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -5452,11 +5469,13 @@ }, "wrappy": { "version": "1.0.2", - "bundled": true + "bundled": true, + "optional": true }, "yallist": { "version": "3.0.3", - "bundled": true + "bundled": true, + "optional": true } } }, @@ -10830,9 +10849,9 @@ } }, "react-native-device-info": { - "version": "1.6.1", - "resolved": "https://registry.npm.taobao.org/react-native-device-info/download/react-native-device-info-1.6.1.tgz", - "integrity": "sha1-cXFx2a0c44NY6Pkq3iHUGnBH/AI=" + "version": "1.8.0", + "resolved": "https://registry.npm.taobao.org/react-native-device-info/download/react-native-device-info-1.8.0.tgz", + "integrity": "sha1-mKfjrbTj03fuupx1G9oDstf52jU=" }, "react-native-elements": { "version": "0.19.0", @@ -10846,9 +10865,9 @@ } }, "react-native-image-crop-picker": { - "version": "0.24.0", - "resolved": "https://registry.npm.taobao.org/react-native-image-crop-picker/download/react-native-image-crop-picker-0.24.0.tgz", - "integrity": "sha1-3xAVSPcpUb9m5WCIevc7EfMovdA=" + "version": "0.24.1", + "resolved": "https://registry.npm.taobao.org/react-native-image-crop-picker/download/react-native-image-crop-picker-0.24.1.tgz", + "integrity": "sha1-RAjiuyDjwILAGR4KzwyMeh6YBOo=" }, "react-native-image-pan-zoom": { "version": "2.1.11", @@ -10908,6 +10927,11 @@ "react-native-root-siblings": "^3.0.0" } }, + "react-native-smart-xgpush": { + "version": "0.0.6", + "resolved": "https://registry.npm.taobao.org/react-native-smart-xgpush/download/react-native-smart-xgpush-0.0.6.tgz", + "integrity": "sha1-pG4VqfBgG6nhlAfZYj/63UnH96I=" + }, "react-native-tab-view": { "version": "1.3.0", "resolved": "https://registry.npm.taobao.org/react-native-tab-view/download/react-native-tab-view-1.3.0.tgz", diff --git a/package.json b/package.json index 6827916..5d4b542 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,9 @@ "react-native": "0.59.5", "react-native-actionsheet-api": "^1.0.4", "react-native-datepicker": "^1.7.2", - "react-native-device-info": "^1.6.1", + "react-native-device-info": "^1.8.0", "react-native-elements": "^0.19.0", - "react-native-image-crop-picker": "^0.24.0", + "react-native-image-crop-picker": "^0.24.1", "react-native-image-pan-zoom": "^2.1.11", "react-native-image-progress": "^1.1.1", "react-native-image-resizer": "^1.0.0", @@ -24,6 +24,7 @@ "react-native-keyboard-spacer": "^0.4.1", "react-native-navigation": "^2.18.5", "react-native-root-toast": "^3.0.0", + "react-native-smart-xgpush": "0.0.6", "react-native-tab-view": "^1.3.0", "react-native-vector-icons": "^4.5.0", "rn-fetch-blob": "^0.10.15"