├── .gitignore
├── README.md
├── RNBugly.podspec
├── android
├── build.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── java
│ └── com
│ └── bugly
│ ├── RNBuglyModule.java
│ └── RNBuglyPackage.java
├── index.js
├── ios
├── RNBugly.xcodeproj
│ └── project.pbxproj
└── RNBugly
│ ├── Bugly.framework
│ ├── Bugly
│ ├── Headers
│ │ ├── Bugly.h
│ │ ├── BuglyConfig.h
│ │ └── BuglyLog.h
│ └── Modules
│ │ └── module.modulemap
│ ├── RNBugly.h
│ └── RNBugly.m
├── package.json
├── scripts
├── postlink.js
└── postunlink.js
└── windows
├── .gitignore
├── .npmignore
├── RNBugly.sln
└── RNBugly
├── Properties
├── AssemblyInfo.cs
└── RNBugly.rd.xml
├── RNBugly.csproj
├── RNBuglyModule.cs
├── RNBuglyPackage.cs
└── project.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Runtime data
9 | pids
10 | *.pid
11 | *.seed
12 | *.pid.lock
13 |
14 | # Directory for instrumented libs generated by jscoverage/JSCover
15 | lib-cov
16 |
17 | # Coverage directory used by tools like istanbul
18 | coverage
19 |
20 | # nyc test coverage
21 | .nyc_output
22 |
23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24 | .grunt
25 |
26 | # Bower dependency directory (https://bower.io/)
27 | bower_components
28 |
29 | # node-waf configuration
30 | .lock-wscript
31 |
32 | # Compiled binary addons (http://nodejs.org/api/addons.html)
33 | build/Release
34 |
35 | # Dependency directories
36 | node_modules/
37 | jspm_packages/
38 |
39 | # Typescript v1 declaration files
40 | typings/
41 |
42 | # Optional npm cache directory
43 | .npm
44 |
45 | # Optional eslint cache
46 | .eslintcache
47 |
48 | # Optional REPL history
49 | .node_repl_history
50 |
51 | # Output of 'npm pack'
52 | *.tgz
53 |
54 | # Yarn Integrity file
55 | .yarn-integrity
56 |
57 | # dotenv environment variables file
58 | .env
59 |
60 | # Created by https://www.gitignore.io/api/xcode
61 |
62 | ### Xcode ###
63 | # Xcode
64 | #
65 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
66 |
67 | ## User settings
68 | ios/xcuserdata/
69 |
70 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
71 | ios/*.xcscmblueprint
72 | ios/*.xccheckout
73 |
74 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
75 | ios/build/
76 | ios/DerivedData/
77 | ios/*.moved-aside
78 | ios/*.pbxuser
79 | ios/!default.pbxuser
80 | ios/*.mode1v3
81 | ios/!default.mode1v3
82 | ios/*.mode2v3
83 | ios/!default.mode2v3
84 | ios/*.perspectivev3
85 | ios/!default.perspectivev3
86 |
87 | ### Xcode Patch ###
88 | ios/*.xcodeproj/*
89 | ios/!*.xcodeproj/project.pbxproj
90 | ios/!*.xcodeproj/xcshareddata/
91 | ios/!*.xcworkspace/contents.xcworkspacedata
92 | ios//*.gcno
93 |
94 |
95 | # End of https://www.gitignore.io/api/xcode
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # react-native-bugly
2 |
3 | ## Getting started
4 |
5 | `$ yarn add git+https://github.com/canyara/react-native-bugly.git`
6 |
7 | ### Mostly automatic installation
8 |
9 | `$ react-native link react-native-bugly`
10 |
11 | ### 配置
12 |
13 | #### iOS
14 |
15 | 使用 Bugly 的 Info.plist 配置初始化信息
16 | Bugly 支持读取 Info.plist 文件读取 SDK 初始化参数,可配置的参数如下:
17 |
18 | - Appid
19 | - Key: BuglyAppIDString
20 | - Value: 字符串类型
21 | - 渠道标识
22 | - Key: BuglyAppChannelString
23 | - Value: 字符串类型
24 | - 版本信息
25 | - Key: BuglyAppVersionString
26 | - Value: 字符串类型
27 | - 开启 Debug 信息显示
28 | - Key: BuglyDebugEnable
29 | - Value: BOOL 类型
30 |
31 | ### Manual installation
32 |
33 | #### iOS
34 |
35 | node node_modules/react-native-bugly/scripts/postlink
36 |
37 | #### Android
38 |
39 | 1. Open up `android/app/src/main/java/[...]/MainActivity.java`
40 |
41 | - Add `import com.reactlibrary.RNBuglyPackage;` to the imports at the top of the file
42 | - Add `new RNBuglyPackage()` to the list returned by the `getPackages()` method
43 |
44 | 2. Append the following lines to `android/settings.gradle`:
45 | ```
46 | include ':react-native-bugly'
47 | project(':react-native-bugly').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bugly/android')
48 | ```
49 | 3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
50 | ```
51 | compile project(':react-native-bugly')
52 | ```
53 |
54 | ## Usage
55 |
56 | #### Android
57 |
58 | AppDelegate.m
59 |
60 | ```objective-c
61 | #import "RNBugly.h"
62 | -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
63 | {
64 | //Add Bugly
65 | [RNBugly startWithAppId];
66 | }
67 | ```
68 |
69 | src/main/java/your_project/MainApplication
70 |
71 | ```java
72 | import com.tencent.bugly.crashreport.CrashReport;
73 |
74 | @Override
75 | public void onCreate() {
76 | super.onCreate();
77 | //bugly
78 | CrashReport.initCrashReport(getApplicationContext());
79 |
80 | ...
81 | }
82 | ```
83 |
84 | ```javascript
85 | import RNBugly from "react-native-bugly";
86 |
87 | RNBugly.updateAppVersion(version);
88 | RNBugly.setUserIdentifier(userId);
89 | ```
90 |
--------------------------------------------------------------------------------
/RNBugly.podspec:
--------------------------------------------------------------------------------
1 |
2 | Pod::Spec.new do |s|
3 | s.name = "RNBugly"
4 | s.version = "1.0.0"
5 | s.summary = "RNBugly"
6 | s.homepage = "https://github.com/canyara/react-native-bugly"
7 | s.license = "MIT"
8 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" }
9 | s.author = { "canyara" => "canyara@gmail.com" }
10 | s.platform = :ios, "7.0"
11 | s.source = { :git => "https://github.com/canyara/react-native-bugly.git", :tag => "master" }
12 | s.source_files = "ios/RNBugly/**/*.{h,m}"
13 | #s.requires_arc = true
14 | s.preserve_paths = "**/*.js"
15 |
16 | s.ios.frameworks = "SystemConfiguration", "Security"
17 | s.ios.library = 'z', 'c++'
18 |
19 | s.dependency "Bugly"
20 |
21 | #s.dependency "React"
22 | #s.dependency "others"
23 |
24 | end
25 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:1.3.1'
9 | }
10 | }
11 |
12 | def safeExtGet(prop, fallback) {
13 | rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
14 | }
15 |
16 | apply plugin: 'com.android.library'
17 |
18 | android {
19 | compileSdkVersion safeExtGet('compileSdkVersion', 23)
20 | buildToolsVersion safeExtGet('buildToolsVersion', '23.0.1')
21 |
22 | defaultConfig {
23 | minSdkVersion safeExtGet('minSdkVersion', 16)
24 | targetSdkVersion safeExtGet('targetSdkVersion', 22)
25 | versionCode 1
26 | versionName "1.0"
27 |
28 | ndk {
29 | // 设置支持的SO库架构
30 | abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a'//, 'x86', 'x86_64'
31 | }
32 | }
33 | lintOptions {
34 | abortOnError false
35 | }
36 | }
37 |
38 | repositories {
39 | mavenCentral()
40 | }
41 |
42 | dependencies {
43 | implementation 'com.facebook.react:react-native:+'
44 | implementation 'com.tencent.bugly:crashreport:latest.release' //其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如2.1.9
45 | implementation 'com.tencent.bugly:nativecrashreport:latest.release' //其中latest.release指代最新Bugly NDK版本号,也可以指定明确的版本号,例如3.0
46 | }
47 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/android/src/main/java/com/bugly/RNBuglyModule.java:
--------------------------------------------------------------------------------
1 |
2 | package com.bugly;
3 |
4 | import com.facebook.react.bridge.ReactApplicationContext;
5 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
6 | import com.facebook.react.bridge.ReactMethod;
7 | import com.facebook.react.bridge.Callback;
8 | import com.tencent.bugly.crashreport.CrashReport;
9 |
10 | public class RNBuglyModule extends ReactContextBaseJavaModule {
11 |
12 | private final ReactApplicationContext reactContext;
13 |
14 | public RNBuglyModule(ReactApplicationContext reactContext) {
15 | super(reactContext);
16 | this.reactContext = reactContext;
17 | }
18 |
19 | @Override
20 | public String getName() {
21 | return "RNBugly";
22 | }
23 |
24 | @ReactMethod
25 | public void setUserIdentifier(String userID) {
26 | CrashReport.setUserId(userID);
27 | }
28 |
29 | @ReactMethod
30 | public void updateAppVersion(String version) {
31 | CrashReport.setAppVersion(this.getReactApplicationContext(), version);
32 | }
33 | }
--------------------------------------------------------------------------------
/android/src/main/java/com/bugly/RNBuglyPackage.java:
--------------------------------------------------------------------------------
1 |
2 | package com.bugly;
3 |
4 | import java.util.Arrays;
5 | import java.util.Collections;
6 | import java.util.List;
7 |
8 | import com.facebook.react.ReactPackage;
9 | import com.facebook.react.bridge.NativeModule;
10 | import com.facebook.react.bridge.ReactApplicationContext;
11 | import com.facebook.react.uimanager.ViewManager;
12 | import com.facebook.react.bridge.JavaScriptModule;
13 |
14 | public class RNBuglyPackage implements ReactPackage {
15 | @Override
16 | public List createNativeModules(ReactApplicationContext reactContext) {
17 | return Arrays.asList(new RNBuglyModule(reactContext));
18 | }
19 |
20 | // Deprecated from RN 0.47
21 | public List> createJSModules() {
22 | return Collections.emptyList();
23 | }
24 |
25 | @Override
26 | public List createViewManagers(ReactApplicationContext reactContext) {
27 | return Collections.emptyList();
28 | }
29 | }
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 |
2 | import { NativeModules } from 'react-native';
3 |
4 | const { RNBugly } = NativeModules;
5 |
6 | export default RNBugly;
7 |
--------------------------------------------------------------------------------
/ios/RNBugly.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | EF3A9876206112E10029D47C /* RNBugly.m in Sources */ = {isa = PBXBuildFile; fileRef = EF3A9875206112E10029D47C /* RNBugly.m */; };
11 | /* End PBXBuildFile section */
12 |
13 | /* Begin PBXCopyFilesBuildPhase section */
14 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
15 | isa = PBXCopyFilesBuildPhase;
16 | buildActionMask = 2147483647;
17 | dstPath = "include/$(PRODUCT_NAME)";
18 | dstSubfolderSpec = 16;
19 | files = (
20 | );
21 | runOnlyForDeploymentPostprocessing = 0;
22 | };
23 | /* End PBXCopyFilesBuildPhase section */
24 |
25 | /* Begin PBXFileReference section */
26 | 134814201AA4EA6300B7C361 /* libRNBugly.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNBugly.a; sourceTree = BUILT_PRODUCTS_DIR; };
27 | EF3A9874206112E10029D47C /* RNBugly.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNBugly.h; sourceTree = ""; };
28 | EF3A9875206112E10029D47C /* RNBugly.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNBugly.m; sourceTree = ""; };
29 | /* End PBXFileReference section */
30 |
31 | /* Begin PBXFrameworksBuildPhase section */
32 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
33 | isa = PBXFrameworksBuildPhase;
34 | buildActionMask = 2147483647;
35 | files = (
36 | );
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXFrameworksBuildPhase section */
40 |
41 | /* Begin PBXGroup section */
42 | 134814211AA4EA7D00B7C361 /* Products */ = {
43 | isa = PBXGroup;
44 | children = (
45 | 134814201AA4EA6300B7C361 /* libRNBugly.a */,
46 | );
47 | name = Products;
48 | sourceTree = "";
49 | };
50 | 58B511D21A9E6C8500147676 = {
51 | isa = PBXGroup;
52 | children = (
53 | EF3A9873206112E10029D47C /* RNBugly */,
54 | 134814211AA4EA7D00B7C361 /* Products */,
55 | );
56 | sourceTree = "";
57 | };
58 | EF3A9873206112E10029D47C /* RNBugly */ = {
59 | isa = PBXGroup;
60 | children = (
61 | EF3A9874206112E10029D47C /* RNBugly.h */,
62 | EF3A9875206112E10029D47C /* RNBugly.m */,
63 | );
64 | path = RNBugly;
65 | sourceTree = "";
66 | };
67 | /* End PBXGroup section */
68 |
69 | /* Begin PBXNativeTarget section */
70 | 58B511DA1A9E6C8500147676 /* RNBugly */ = {
71 | isa = PBXNativeTarget;
72 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNBugly" */;
73 | buildPhases = (
74 | 58B511D71A9E6C8500147676 /* Sources */,
75 | 58B511D81A9E6C8500147676 /* Frameworks */,
76 | 58B511D91A9E6C8500147676 /* CopyFiles */,
77 | );
78 | buildRules = (
79 | );
80 | dependencies = (
81 | );
82 | name = RNBugly;
83 | productName = RCTDataManager;
84 | productReference = 134814201AA4EA6300B7C361 /* libRNBugly.a */;
85 | productType = "com.apple.product-type.library.static";
86 | };
87 | /* End PBXNativeTarget section */
88 |
89 | /* Begin PBXProject section */
90 | 58B511D31A9E6C8500147676 /* Project object */ = {
91 | isa = PBXProject;
92 | attributes = {
93 | LastUpgradeCheck = 0830;
94 | ORGANIZATIONNAME = Facebook;
95 | TargetAttributes = {
96 | 58B511DA1A9E6C8500147676 = {
97 | CreatedOnToolsVersion = 6.1.1;
98 | };
99 | };
100 | };
101 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNBugly" */;
102 | compatibilityVersion = "Xcode 3.2";
103 | developmentRegion = English;
104 | hasScannedForEncodings = 0;
105 | knownRegions = (
106 | en,
107 | );
108 | mainGroup = 58B511D21A9E6C8500147676;
109 | productRefGroup = 58B511D21A9E6C8500147676;
110 | projectDirPath = "";
111 | projectRoot = "";
112 | targets = (
113 | 58B511DA1A9E6C8500147676 /* RNBugly */,
114 | );
115 | };
116 | /* End PBXProject section */
117 |
118 | /* Begin PBXSourcesBuildPhase section */
119 | 58B511D71A9E6C8500147676 /* Sources */ = {
120 | isa = PBXSourcesBuildPhase;
121 | buildActionMask = 2147483647;
122 | files = (
123 | EF3A9876206112E10029D47C /* RNBugly.m in Sources */,
124 | );
125 | runOnlyForDeploymentPostprocessing = 0;
126 | };
127 | /* End PBXSourcesBuildPhase section */
128 |
129 | /* Begin XCBuildConfiguration section */
130 | 58B511ED1A9E6C8500147676 /* Debug */ = {
131 | isa = XCBuildConfiguration;
132 | buildSettings = {
133 | ALWAYS_SEARCH_USER_PATHS = NO;
134 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
135 | CLANG_CXX_LIBRARY = "libc++";
136 | CLANG_ENABLE_MODULES = YES;
137 | CLANG_ENABLE_OBJC_ARC = YES;
138 | CLANG_WARN_BOOL_CONVERSION = YES;
139 | CLANG_WARN_CONSTANT_CONVERSION = YES;
140 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
141 | CLANG_WARN_EMPTY_BODY = YES;
142 | CLANG_WARN_ENUM_CONVERSION = YES;
143 | CLANG_WARN_INFINITE_RECURSION = YES;
144 | CLANG_WARN_INT_CONVERSION = YES;
145 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
146 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
147 | CLANG_WARN_UNREACHABLE_CODE = YES;
148 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
149 | COPY_PHASE_STRIP = NO;
150 | ENABLE_STRICT_OBJC_MSGSEND = YES;
151 | ENABLE_TESTABILITY = YES;
152 | GCC_C_LANGUAGE_STANDARD = gnu99;
153 | GCC_DYNAMIC_NO_PIC = NO;
154 | GCC_NO_COMMON_BLOCKS = YES;
155 | GCC_OPTIMIZATION_LEVEL = 0;
156 | GCC_PREPROCESSOR_DEFINITIONS = (
157 | "DEBUG=1",
158 | "$(inherited)",
159 | );
160 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
161 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
162 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
163 | GCC_WARN_UNDECLARED_SELECTOR = YES;
164 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
165 | GCC_WARN_UNUSED_FUNCTION = YES;
166 | GCC_WARN_UNUSED_VARIABLE = YES;
167 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
168 | MTL_ENABLE_DEBUG_INFO = YES;
169 | ONLY_ACTIVE_ARCH = YES;
170 | OTHER_LDFLAGS = "-ObjC";
171 | SDKROOT = iphoneos;
172 | };
173 | name = Debug;
174 | };
175 | 58B511EE1A9E6C8500147676 /* Release */ = {
176 | isa = XCBuildConfiguration;
177 | buildSettings = {
178 | ALWAYS_SEARCH_USER_PATHS = NO;
179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
180 | CLANG_CXX_LIBRARY = "libc++";
181 | CLANG_ENABLE_MODULES = YES;
182 | CLANG_ENABLE_OBJC_ARC = YES;
183 | CLANG_WARN_BOOL_CONVERSION = YES;
184 | CLANG_WARN_CONSTANT_CONVERSION = YES;
185 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
186 | CLANG_WARN_EMPTY_BODY = YES;
187 | CLANG_WARN_ENUM_CONVERSION = YES;
188 | CLANG_WARN_INFINITE_RECURSION = YES;
189 | CLANG_WARN_INT_CONVERSION = YES;
190 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
191 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
192 | CLANG_WARN_UNREACHABLE_CODE = YES;
193 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
194 | COPY_PHASE_STRIP = YES;
195 | ENABLE_NS_ASSERTIONS = NO;
196 | ENABLE_STRICT_OBJC_MSGSEND = YES;
197 | GCC_C_LANGUAGE_STANDARD = gnu99;
198 | GCC_NO_COMMON_BLOCKS = YES;
199 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
200 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
201 | GCC_WARN_UNDECLARED_SELECTOR = YES;
202 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
203 | GCC_WARN_UNUSED_FUNCTION = YES;
204 | GCC_WARN_UNUSED_VARIABLE = YES;
205 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
206 | MTL_ENABLE_DEBUG_INFO = NO;
207 | OTHER_LDFLAGS = "-ObjC";
208 | SDKROOT = iphoneos;
209 | VALIDATE_PRODUCT = YES;
210 | };
211 | name = Release;
212 | };
213 | 58B511F01A9E6C8500147676 /* Debug */ = {
214 | isa = XCBuildConfiguration;
215 | buildSettings = {
216 | FRAMEWORK_SEARCH_PATHS = (
217 | "$(inherited)",
218 | "$(PROJECT_DIR)",
219 | "$(PROJECT_DIR)/RNBugly",
220 | );
221 | HEADER_SEARCH_PATHS = (
222 | "$(inherited)",
223 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
224 | "$(SRCROOT)/../../../React/**",
225 | "$(SRCROOT)/../../react-native/React/**",
226 | );
227 | LIBRARY_SEARCH_PATHS = "$(inherited)";
228 | OTHER_LDFLAGS = "-ObjC";
229 | PRODUCT_NAME = RNBugly;
230 | SKIP_INSTALL = YES;
231 | };
232 | name = Debug;
233 | };
234 | 58B511F11A9E6C8500147676 /* Release */ = {
235 | isa = XCBuildConfiguration;
236 | buildSettings = {
237 | FRAMEWORK_SEARCH_PATHS = (
238 | "$(inherited)",
239 | "$(PROJECT_DIR)",
240 | "$(PROJECT_DIR)/RNBugly",
241 | );
242 | HEADER_SEARCH_PATHS = (
243 | "$(inherited)",
244 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
245 | "$(SRCROOT)/../../../React/**",
246 | "$(SRCROOT)/../../react-native/React/**",
247 | );
248 | LIBRARY_SEARCH_PATHS = "$(inherited)";
249 | OTHER_LDFLAGS = "-ObjC";
250 | PRODUCT_NAME = RNBugly;
251 | SKIP_INSTALL = YES;
252 | };
253 | name = Release;
254 | };
255 | /* End XCBuildConfiguration section */
256 |
257 | /* Begin XCConfigurationList section */
258 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNBugly" */ = {
259 | isa = XCConfigurationList;
260 | buildConfigurations = (
261 | 58B511ED1A9E6C8500147676 /* Debug */,
262 | 58B511EE1A9E6C8500147676 /* Release */,
263 | );
264 | defaultConfigurationIsVisible = 0;
265 | defaultConfigurationName = Release;
266 | };
267 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNBugly" */ = {
268 | isa = XCConfigurationList;
269 | buildConfigurations = (
270 | 58B511F01A9E6C8500147676 /* Debug */,
271 | 58B511F11A9E6C8500147676 /* Release */,
272 | );
273 | defaultConfigurationIsVisible = 0;
274 | defaultConfigurationName = Release;
275 | };
276 | /* End XCConfigurationList section */
277 | };
278 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
279 | }
280 |
--------------------------------------------------------------------------------
/ios/RNBugly/Bugly.framework/Bugly:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/canyara/react-native-bugly/d3d49340d8ae4593d9f7edaabba2b46e7613e2f5/ios/RNBugly/Bugly.framework/Bugly
--------------------------------------------------------------------------------
/ios/RNBugly/Bugly.framework/Headers/Bugly.h:
--------------------------------------------------------------------------------
1 | //
2 | // Bugly.h
3 | //
4 | // Version: 2.5(0)
5 | //
6 | // Copyright (c) 2017年 Tencent. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "BuglyConfig.h"
12 | #import "BuglyLog.h"
13 |
14 | BLY_START_NONNULL
15 |
16 | @interface Bugly : NSObject
17 |
18 | /**
19 | * 初始化Bugly,使用默认BuglyConfig
20 | *
21 | * @param appId 注册Bugly分配的应用唯一标识
22 | */
23 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId;
24 |
25 | /**
26 | * 使用指定配置初始化Bugly
27 | *
28 | * @param appId 注册Bugly分配的应用唯一标识
29 | * @param config 传入配置的 BuglyConfig
30 | */
31 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId
32 | config:(BuglyConfig * BLY_NULLABLE)config;
33 |
34 | /**
35 | * 使用指定配置初始化Bugly
36 | *
37 | * @param appId 注册Bugly分配的应用唯一标识
38 | * @param development 是否开发设备
39 | * @param config 传入配置的 BuglyConfig
40 | */
41 | + (void)startWithAppId:(NSString * BLY_NULLABLE)appId
42 | developmentDevice:(BOOL)development
43 | config:(BuglyConfig * BLY_NULLABLE)config;
44 |
45 | /**
46 | * 设置用户标识
47 | *
48 | * @param userId 用户标识
49 | */
50 | + (void)setUserIdentifier:(NSString *)userId;
51 |
52 | /**
53 | * 更新版本信息
54 | *
55 | * @param version 应用版本信息
56 | */
57 | + (void)updateAppVersion:(NSString *)version;
58 |
59 | /**
60 | * 设置关键数据,随崩溃信息上报
61 | *
62 | * @param value KEY
63 | * @param key VALUE
64 | */
65 | + (void)setUserValue:(NSString *)value
66 | forKey:(NSString *)key;
67 |
68 | /**
69 | * 获取关键数据
70 | *
71 | * @return 关键数据
72 | */
73 | + (NSDictionary * BLY_NULLABLE)allUserValues;
74 |
75 | /**
76 | * 设置标签
77 | *
78 | * @param tag 标签ID,可在网站生成
79 | */
80 | + (void)setTag:(NSUInteger)tag;
81 |
82 | /**
83 | * 获取当前设置标签
84 | *
85 | * @return 当前标签ID
86 | */
87 | + (NSUInteger)currentTag;
88 |
89 | /**
90 | * 获取设备ID
91 | *
92 | * @return 设备ID
93 | */
94 | + (NSString *)buglyDeviceId;
95 |
96 | /**
97 | * 上报自定义Objective-C异常
98 | *
99 | * @param exception 异常信息
100 | */
101 | + (void)reportException:(NSException *)exception;
102 |
103 | /**
104 | * 上报错误
105 | *
106 | * @param error 错误信息
107 | */
108 | + (void)reportError:(NSError *)error;
109 |
110 | /**
111 | * @brief 上报自定义错误
112 | *
113 | * @param category 类型(Cocoa=3,CSharp=4,JS=5,Lua=6)
114 | * @param aName 名称
115 | * @param aReason 错误原因
116 | * @param aStackArray 堆栈
117 | * @param info 附加数据
118 | * @param terminate 上报后是否退出应用进程
119 | */
120 | + (void)reportExceptionWithCategory:(NSUInteger)category
121 | name:(NSString *)aName
122 | reason:(NSString *)aReason
123 | callStack:(NSArray *)aStackArray
124 | extraInfo:(NSDictionary *)info
125 | terminateApp:(BOOL)terminate;
126 |
127 | /**
128 | * SDK 版本信息
129 | *
130 | * @return SDK版本号
131 | */
132 | + (NSString *)sdkVersion;
133 |
134 | /**
135 | * App 是否发生了连续闪退
136 | * 如果 启动SDK 且 5秒内 闪退,且次数达到 3次 则判定为连续闪退
137 | *
138 | * @return 是否连续闪退
139 | */
140 | + (BOOL)isAppCrashedOnStartUpExceedTheLimit;
141 |
142 | BLY_END_NONNULL
143 |
144 | @end
145 |
--------------------------------------------------------------------------------
/ios/RNBugly/Bugly.framework/Headers/BuglyConfig.h:
--------------------------------------------------------------------------------
1 | //
2 | // BuglyConfig.h
3 | // Bugly
4 | //
5 | // Copyright (c) 2016年 Tencent. All rights reserved.
6 | //
7 |
8 | #pragma once
9 |
10 | #define BLY_UNAVAILABLE(x) __attribute__((unavailable(x)))
11 |
12 | #if __has_feature(nullability)
13 | #define BLY_NONNULL __nonnull
14 | #define BLY_NULLABLE __nullable
15 | #define BLY_START_NONNULL _Pragma("clang assume_nonnull begin")
16 | #define BLY_END_NONNULL _Pragma("clang assume_nonnull end")
17 | #else
18 | #define BLY_NONNULL
19 | #define BLY_NULLABLE
20 | #define BLY_START_NONNULL
21 | #define BLY_END_NONNULL
22 | #endif
23 |
24 | #import
25 |
26 | #import "BuglyLog.h"
27 |
28 | BLY_START_NONNULL
29 |
30 | @protocol BuglyDelegate
31 |
32 | @optional
33 | /**
34 | * 发生异常时回调
35 | *
36 | * @param exception 异常信息
37 | *
38 | * @return 返回需上报记录,随异常上报一起上报
39 | */
40 | - (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception;
41 |
42 | @end
43 |
44 | @interface BuglyConfig : NSObject
45 |
46 | /**
47 | * SDK Debug信息开关, 默认关闭
48 | */
49 | @property (nonatomic, assign) BOOL debugMode;
50 |
51 | /**
52 | * 设置自定义渠道标识
53 | */
54 | @property (nonatomic, copy) NSString *channel;
55 |
56 | /**
57 | * 设置自定义版本号
58 | */
59 | @property (nonatomic, copy) NSString *version;
60 |
61 | /**
62 | * 设置自定义设备唯一标识
63 | */
64 | @property (nonatomic, copy) NSString *deviceIdentifier;
65 |
66 | /**
67 | * 卡顿监控开关,默认关闭
68 | */
69 | @property (nonatomic) BOOL blockMonitorEnable;
70 |
71 | /**
72 | * 卡顿监控判断间隔,单位为秒
73 | */
74 | @property (nonatomic) NSTimeInterval blockMonitorTimeout;
75 |
76 | /**
77 | * 设置 App Groups Id (如有使用 Bugly iOS Extension SDK,请设置该值)
78 | */
79 | @property (nonatomic, copy) NSString *applicationGroupIdentifier;
80 |
81 | /**
82 | * 进程内还原开关,默认开启
83 | */
84 | @property (nonatomic) BOOL symbolicateInProcessEnable;
85 |
86 | /**
87 | * 非正常退出事件记录开关,默认关闭
88 | */
89 | @property (nonatomic) BOOL unexpectedTerminatingDetectionEnable;
90 |
91 | /**
92 | * 页面信息记录开关,默认开启
93 | */
94 | @property (nonatomic) BOOL viewControllerTrackingEnable;
95 |
96 | /**
97 | * Bugly Delegate
98 | */
99 | @property (nonatomic, assign) id delegate;
100 |
101 | /**
102 | * 控制自定义日志上报,默认值为BuglyLogLevelSilent,即关闭日志记录功能。
103 | * 如果设置为BuglyLogLevelWarn,则在崩溃时会上报Warn、Error接口打印的日志
104 | */
105 | @property (nonatomic, assign) BuglyLogLevel reportLogLevel;
106 |
107 | /**
108 | * 崩溃数据过滤器,如果崩溃堆栈的模块名包含过滤器中设置的关键字,则崩溃数据不会进行上报
109 | * 例如,过滤崩溃堆栈中包含搜狗输入法的数据,可以添加过滤器关键字SogouInputIPhone.dylib等
110 | */
111 | @property (nonatomic, copy) NSArray *excludeModuleFilter;
112 |
113 | /**
114 | * 控制台日志上报开关,默认开启
115 | */
116 | @property (nonatomic, assign) BOOL consolelogEnable;
117 |
118 | /**
119 | * 崩溃退出超时,如果监听到崩溃后,App一直没有退出,则到达超时时间后会自动abort进程退出
120 | * 默认值 5s, 单位 秒
121 | * 当赋值为0时,则不会自动abort进程退出
122 | */
123 | @property (nonatomic, assign) NSUInteger crashAbortTimeout;
124 |
125 | @end
126 | BLY_END_NONNULL
127 |
--------------------------------------------------------------------------------
/ios/RNBugly/Bugly.framework/Headers/BuglyLog.h:
--------------------------------------------------------------------------------
1 | //
2 | // BuglyLog.h
3 | // Bugly
4 | //
5 | // Copyright (c) 2017年 Tencent. All rights reserved.
6 | //
7 |
8 | #import
9 |
10 | // Log level for Bugly Log
11 | typedef NS_ENUM(NSUInteger, BuglyLogLevel) {
12 | BuglyLogLevelSilent = 0,
13 | BuglyLogLevelError = 1,
14 | BuglyLogLevelWarn = 2,
15 | BuglyLogLevelInfo = 3,
16 | BuglyLogLevelDebug = 4,
17 | BuglyLogLevelVerbose = 5,
18 | };
19 | #pragma mark -
20 |
21 | OBJC_EXTERN void BLYLog(BuglyLogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3);
22 |
23 | OBJC_EXTERN void BLYLogv(BuglyLogLevel level, NSString *format, va_list args) NS_FORMAT_FUNCTION(2, 0);
24 |
25 | #pragma mark -
26 | #define BUGLY_LOG_MACRO(_level, fmt, ...) [BuglyLog level:_level tag:nil log:fmt, ##__VA_ARGS__]
27 |
28 | #define BLYLogError(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelError, fmt, ##__VA_ARGS__)
29 | #define BLYLogWarn(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelWarn, fmt, ##__VA_ARGS__)
30 | #define BLYLogInfo(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelInfo, fmt, ##__VA_ARGS__)
31 | #define BLYLogDebug(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelDebug, fmt, ##__VA_ARGS__)
32 | #define BLYLogVerbose(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelVerbose, fmt, ##__VA_ARGS__)
33 |
34 | #pragma mark - Interface
35 | @interface BuglyLog : NSObject
36 |
37 | /**
38 | * @brief 初始化日志模块
39 | *
40 | * @param level 设置默认日志级别,默认BLYLogLevelSilent
41 | *
42 | * @param printConsole 是否打印到控制台,默认NO
43 | */
44 | + (void)initLogger:(BuglyLogLevel) level consolePrint:(BOOL)printConsole;
45 |
46 | /**
47 | * @brief 打印BLYLogLevelInfo日志
48 | *
49 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200
50 | */
51 | + (void)log:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2);
52 |
53 | /**
54 | * @brief 打印日志
55 | *
56 | * @param level 日志级别
57 | * @param message 日志内容 总日志大小限制为:字符串长度30k,条数200
58 | */
59 | + (void)level:(BuglyLogLevel) level logs:(NSString *)message;
60 |
61 | /**
62 | * @brief 打印日志
63 | *
64 | * @param level 日志级别
65 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200
66 | */
67 | + (void)level:(BuglyLogLevel) level log:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3);
68 |
69 | /**
70 | * @brief 打印日志
71 | *
72 | * @param level 日志级别
73 | * @param tag 日志模块分类
74 | * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200
75 | */
76 | + (void)level:(BuglyLogLevel) level tag:(NSString *) tag log:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4);
77 |
78 | @end
79 |
--------------------------------------------------------------------------------
/ios/RNBugly/Bugly.framework/Modules/module.modulemap:
--------------------------------------------------------------------------------
1 | framework module Bugly {
2 | umbrella header "Bugly.h"
3 |
4 | export *
5 | module * { export * }
6 |
7 | link framework "Foundation"
8 | link framework "Security"
9 | link framework "SystemConfiguration"
10 | link "c++"
11 | link "z"
12 | }
13 |
--------------------------------------------------------------------------------
/ios/RNBugly/RNBugly.h:
--------------------------------------------------------------------------------
1 |
2 | #if __has_include("RCTBridgeModule.h")
3 | #import "RCTBridgeModule.h"
4 | #else
5 | #import
6 | #endif
7 |
8 | @interface RNBugly : NSObject
9 |
10 | + (void)startWithAppId;
11 |
12 | @end
13 |
14 |
--------------------------------------------------------------------------------
/ios/RNBugly/RNBugly.m:
--------------------------------------------------------------------------------
1 |
2 | #import "RNBugly.h"
3 | #import
4 |
5 | @implementation RNBugly
6 |
7 | - (dispatch_queue_t)methodQueue
8 | {
9 | return dispatch_get_main_queue();
10 | }
11 | RCT_EXPORT_MODULE()
12 |
13 | + (void)startWithAppId
14 | {
15 | static dispatch_once_t onceToken;
16 | dispatch_once(&onceToken, ^{
17 | [Bugly startWithAppId:nil];
18 | });
19 | }
20 |
21 | RCT_EXPORT_METHOD(setUserIdentifier:(NSString *)userId)
22 | {
23 | [Bugly setUserIdentifier:userId];
24 | }
25 |
26 | RCT_EXPORT_METHOD(updateAppVersion:(NSString *)version)
27 | {
28 | [Bugly updateAppVersion:version];
29 | }
30 |
31 | @end
32 |
33 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-native-bugly",
3 | "version": "1.0.2",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [
10 | "react-native"
11 | ],
12 | "dependencies": {
13 | "glob": "^5.0.15",
14 | "inquirer": "1.1.2",
15 | "plist": "3.0.1",
16 | "lodash": "4.17.2",
17 | "xcode": "^1.0.0",
18 | "path": "^0.12.7"
19 | },
20 | "author": "canyara",
21 | "license": "MIT",
22 | "peerDependencies": {
23 | "react-native": "^0.57.0",
24 | "react-native-windows": "0.41.0-rc.1"
25 | },
26 | "rnpm": {
27 | "ios": {
28 | "sharedLibraries": [
29 | "libz",
30 | "libc++",
31 | "SystemConfiguration",
32 | "Security"
33 | ]
34 | },
35 | "commands": {
36 | "postlink": "node node_modules/react-native-bugly/scripts/postlink",
37 | "postunlink": "node node_modules/react-native-bugly/scripts/postunlink"
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/scripts/postlink.js:
--------------------------------------------------------------------------------
1 | var fs = require("fs");
2 | var glob = require("glob");
3 | var inquirer = require("inquirer");
4 | var xcode = require("xcode");
5 | var path = require("path");
6 | var plist = require("plist");
7 | var _ = require("lodash");
8 | var pbxFile = require("xcode/lib/pbxFile");
9 | var package = require("../../../package.json");
10 |
11 | console.log("react-native-bugly postlink start");
12 |
13 | var ignoreNodeModules = { ignore: "node_modules/**" };
14 | var appDelegatePaths = glob.sync("**/AppDelegate.m", ignoreNodeModules);
15 |
16 | // Fix for https://github.com/Microsoft/react-native-code-push/issues/477
17 | // Typical location of AppDelegate.m for newer RN versions: $PROJECT_ROOT/ios//AppDelegate.m
18 | // Let's try to find that path by filtering the whole array for any path containing
19 | // If we can't find it there, play dumb and pray it is the first path we find.
20 | var appDelegatePath =
21 | findFileByAppName(appDelegatePaths, package ? package.name : null) ||
22 | appDelegatePaths[0];
23 | var plistPath = glob.sync(
24 | path.join(path.dirname(appDelegatePath), "*Info.plist").replace(/\\/g, "/"),
25 | ignoreNodeModules
26 | )[0];
27 | // var appDelegateContents = fs.readFileSync(appDelegatePath, "utf8");
28 | var plistContents = fs.readFileSync(plistPath, "utf8");
29 |
30 | addFrameworkAndSearchPath();
31 |
32 | // Helper that filters an array with AppDelegate.m paths for a path with the app name inside it
33 | // Should cover nearly all cases
34 | function findFileByAppName(array, appName) {
35 | if (array.length === 0 || !appName) return null;
36 | for (var i = 0; i < array.length; i++) {
37 | var path = array[i];
38 | if (path && path.indexOf(appName) !== -1) {
39 | return path;
40 | }
41 | }
42 | return null;
43 | }
44 |
45 | function addFrameworkAndSearchPath() {
46 | var projectPath = glob.sync("**/project.pbxproj", ignoreNodeModules)[0];
47 | console.log(
48 | "react-native-bugly postlink addFrameworkAndSearchPath projectPath:" +
49 | projectPath
50 | );
51 | var project = xcode.project(projectPath);
52 |
53 | var frameworkPath = path.join(
54 | __dirname,
55 | "../node_modules/react-native-bugly/ios/RNBugly/Bugly.framework"
56 | );
57 | var project_dir = path.join(__dirname);
58 | var project_relative = path.relative(project_dir, frameworkPath);
59 | project.parse(function(error) {
60 | if (error) {
61 | console.log("xcode project error is", error);
62 | } else {
63 | var target = project.getFirstTarget().uuid;
64 | var file = new pbxFile(project_relative, {
65 | customFramework: true,
66 | target: target
67 | });
68 | file.uuid = project.generateUuid();
69 | file.fileRef = project.generateUuid();
70 | file.target = target;
71 | if (project.hasFile(file.path)) return false;
72 | project.addToPbxBuildFileSection(file); // PBXBuildFile
73 | project.addToPbxFileReferenceSection(file); // PBXFileReference
74 | project.addToFrameworksPbxGroup(file); // PBXGroup
75 | project.addToPbxFrameworksBuildPhase(file); // PBXFrameworksBuildPhase
76 | // project.addToFrameworkSearchPaths(file);
77 | addSearchPaths(
78 | project,
79 | '"$(SRCROOT)/../node_modules/react-native-bugly/ios/RNBugly/**"'
80 | );
81 | fs.writeFileSync(projectPath, project.writeSync());
82 | }
83 | });
84 | }
85 |
86 | function addSearchPaths(project, frameworkSearchPath) {
87 | const config = project.pbxXCBuildConfigurationSection();
88 | const INHERITED = '"$(inherited)"';
89 | Object.keys(config)
90 | .filter(ref => ref.indexOf("_comment") === -1)
91 | .forEach(ref => {
92 | const buildSettings = config[ref].buildSettings;
93 | console.log(
94 | "react-native-bugly postlink addSearchPaths buildSettings[PRODUCT_NAME]:" +
95 | buildSettings["PRODUCT_NAME"] +
96 | ", package.name:" +
97 | package.name
98 | );
99 | const shouldVisitBuildSettings = true; // buildSettings["PRODUCT_NAME"] === package.name;
100 | if (shouldVisitBuildSettings) {
101 | if (
102 | !buildSettings["FRAMEWORK_SEARCH_PATHS"] ||
103 | buildSettings["FRAMEWORK_SEARCH_PATHS"] === INHERITED
104 | ) {
105 | buildSettings["FRAMEWORK_SEARCH_PATHS"] = [INHERITED];
106 | }
107 | var framworkIndex = _.findIndex(
108 | buildSettings["FRAMEWORK_SEARCH_PATHS"],
109 | function(path) {
110 | return path == frameworkSearchPath;
111 | }
112 | );
113 | if (framworkIndex === -1) {
114 | buildSettings["FRAMEWORK_SEARCH_PATHS"].push(frameworkSearchPath);
115 | }
116 | }
117 | });
118 | }
119 |
--------------------------------------------------------------------------------
/scripts/postunlink.js:
--------------------------------------------------------------------------------
1 | var fs = require("fs");
2 | var glob = require("glob");
3 | var inquirer = require("inquirer");
4 | var path = require("path");
5 | var plist = require("plist");
6 | var xcode = require("xcode");
7 | var _ = require("lodash");
8 | var pbxFile = require("xcode/lib/pbxFile");
9 | var package = require("../../../package.json");
10 |
11 | console.log("react-native-bugly postunlink start");
12 |
13 | var ignoreNodeModules = { ignore: "node_modules/**" };
14 | var appDelegatePaths = glob.sync("**/AppDelegate.m", ignoreNodeModules);
15 |
16 | // Fix for https://github.com/Microsoft/react-native-code-push/issues/477
17 | // Typical location of AppDelegate.m for newer RN versions: $PROJECT_ROOT/ios//AppDelegate.m
18 | // Let's try to find that path by filtering the whole array for any path containing
19 | // If we can't find it there, play dumb and pray it is the first path we find.
20 | var appDelegatePath =
21 | findFileByAppName(appDelegatePaths, package ? package.name : null) ||
22 | appDelegatePaths[0];
23 | var plistPath = glob.sync(
24 | path.join(path.dirname(appDelegatePath), "*Info.plist").replace(/\\/g, "/"),
25 | ignoreNodeModules
26 | )[0];
27 |
28 | removeFrameworkAndSearchPath();
29 |
30 | // Helper that filters an array with AppDelegate.m paths for a path with the app name inside it
31 | // Should cover nearly all cases
32 | function findFileByAppName(array, appName) {
33 | if (array.length === 0 || !appName) return null;
34 | for (var i = 0; i < array.length; i++) {
35 | var path = array[i];
36 | if (path && path.indexOf(appName) !== -1) {
37 | return path;
38 | }
39 | }
40 | return null;
41 | }
42 |
43 | function removeFrameworkAndSearchPath() {
44 | var projectPath = glob.sync("**/project.pbxproj", ignoreNodeModules)[0];
45 | var project = xcode.project(projectPath);
46 | var frameworkPath = path.join(
47 | __dirname,
48 | "../node_modules/react-native-bugly/ios/RNBugly/Bugly.framework"
49 | );
50 | var project_dir = path.join(__dirname);
51 | var project_relative = path.relative(project_dir, frameworkPath);
52 | project.parse(function(error) {
53 | if (error) {
54 | console.log("xcode project error is", error);
55 | } else {
56 | var target = project.getFirstTarget().uuid;
57 | var file = new pbxFile(project_relative, {
58 | customFramework: true,
59 | target: target
60 | });
61 | file.target = target;
62 | project.removeFromPbxBuildFileSection(file); // PBXBuildFile
63 | project.removeFromPbxFileReferenceSection(file); // PBXFileReference
64 | project.removeFromFrameworksPbxGroup(file); // PBXGroup
65 | project.removeFromPbxFrameworksBuildPhase(file); // PBXFrameworksBuildPhase
66 | // project.removeFromFrameworkSearchPaths(file);
67 | removeSearchPaths(
68 | project,
69 | '"$(SRCROOT)/../node_modules/react-native-bugly/ios/RNBugly/**"'
70 | );
71 | fs.writeFileSync(projectPath, project.writeSync());
72 | }
73 | });
74 | }
75 |
76 | function removeSearchPaths(project, frameworkSearchPath) {
77 | const config = project.pbxXCBuildConfigurationSection();
78 | Object.keys(config)
79 | .filter(ref => ref.indexOf("_comment") === -1)
80 | .forEach(ref => {
81 | const buildSettings = config[ref].buildSettings;
82 | const shouldVisitBuildSettings =
83 | buildSettings["PRODUCT_NAME"] === package.name;
84 | if (shouldVisitBuildSettings) {
85 | if (buildSettings["FRAMEWORK_SEARCH_PATHS"]) {
86 | const paths = _.remove(
87 | buildSettings["FRAMEWORK_SEARCH_PATHS"],
88 | function(path) {
89 | return path !== frameworkSearchPath;
90 | }
91 | );
92 | buildSettings["FRAMEWORK_SEARCH_PATHS"] = paths;
93 | }
94 | }
95 | });
96 | }
97 |
--------------------------------------------------------------------------------
/windows/.gitignore:
--------------------------------------------------------------------------------
1 | *AppPackages*
2 | *BundleArtifacts*
3 | *ReactAssets*
4 |
5 | #OS junk files
6 | [Tt]humbs.db
7 | *.DS_Store
8 |
9 | #Visual Studio files
10 | *.[Oo]bj
11 | *.user
12 | *.aps
13 | *.pch
14 | *.vspscc
15 | *.vssscc
16 | *_i.c
17 | *_p.c
18 | *.ncb
19 | *.suo
20 | *.tlb
21 | *.tlh
22 | *.bak
23 | *.[Cc]ache
24 | *.ilk
25 | *.log
26 | *.lib
27 | *.sbr
28 | *.sdf
29 | *.opensdf
30 | *.opendb
31 | *.unsuccessfulbuild
32 | ipch/
33 | [Oo]bj/
34 | [Bb]in
35 | [Dd]ebug*/
36 | [Rr]elease*/
37 | Ankh.NoLoad
38 |
39 | #MonoDevelop
40 | *.pidb
41 | *.userprefs
42 |
43 | #Tooling
44 | _ReSharper*/
45 | *.resharper
46 | [Tt]est[Rr]esult*
47 | *.sass-cache
48 |
49 | #Project files
50 | [Bb]uild/
51 |
52 | #Subversion files
53 | .svn
54 |
55 | # Office Temp Files
56 | ~$*
57 |
58 | # vim Temp Files
59 | *~
60 |
61 | #NuGet
62 | packages/
63 | *.nupkg
64 |
65 | #ncrunch
66 | *ncrunch*
67 | *crunch*.local.xml
68 |
69 | # visual studio database projects
70 | *.dbmdl
71 |
72 | #Test files
73 | *.testsettings
74 |
75 | #Other files
76 | *.DotSettings
77 | .vs/
78 | *project.lock.json
79 |
--------------------------------------------------------------------------------
/windows/.npmignore:
--------------------------------------------------------------------------------
1 |
2 | # Make sure we don't publish build artifacts to NPM
3 | ARM/
4 | Debug/
5 | x64/
6 | x86/
7 | bin/
8 | obj/
9 | .vs/
10 |
--------------------------------------------------------------------------------
/windows/RNBugly.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 12.00
2 | # Visual Studio 14
3 | VisualStudioVersion = 14.0.25123.0
4 | MinimumVisualStudioVersion = 10.0.40219.1
5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RNBugly", "RNBugly\RNBugly.csproj", "{0BDC1FA0-2B7A-11E8-B963-895FED719869}"
6 | EndProject
7 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactNative", "..\node_modules\react-native-windows\ReactWindows\ReactNative\ReactNative.csproj", "{C7673AD5-E3AA-468C-A5FD-FA38154E205C}"
8 | EndProject
9 | Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ReactNative.Shared", "..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.shproj", "{EEA8B852-4D07-48E1-8294-A21AB5909FE5}"
10 | EndProject
11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ChakraBridge", "..\node_modules\react-native-windows\ReactWindows\ChakraBridge\ChakraBridge.vcxproj", "{4B72C796-16D5-4E3A-81C0-3E36F531E578}"
12 | EndProject
13 | Global
14 | GlobalSection(SharedMSBuildProjectFiles) = preSolution
15 | ..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{c7673ad5-e3aa-468c-a5fd-fa38154e205c}*SharedItemsImports = 4
16 | ..\node_modules\react-native-windows\ReactWindows\ReactNative.Shared\ReactNative.Shared.projitems*{eea8b852-4d07-48e1-8294-a21ab5909fe5}*SharedItemsImports = 13
17 | EndGlobalSection
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|ARM = Debug|ARM
20 | Debug|x64 = Debug|x64
21 | Debug|x86 = Debug|x86
22 | Development|ARM = Development|ARM
23 | Development|x64 = Development|x64
24 | Development|x86 = Development|x86
25 | Release|ARM = Release|ARM
26 | Release|x64 = Release|x64
27 | Release|x86 = Release|x86
28 | EndGlobalSection
29 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
30 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Debug|ARM.ActiveCfg = Debug|ARM
31 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Debug|ARM.Build.0 = Debug|ARM
32 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Debug|x64.ActiveCfg = Debug|x64
33 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Debug|x64.Build.0 = Debug|x64
34 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Debug|x86.ActiveCfg = Debug|x86
35 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Debug|x86.Build.0 = Debug|x86
36 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Development|ARM.ActiveCfg = Development|ARM
37 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Development|ARM.Build.0 = Development|ARM
38 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Development|x64.ActiveCfg = Development|x64
39 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Development|x64.Build.0 = Development|x64
40 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Development|x86.ActiveCfg = Development|x86
41 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Development|x86.Build.0 = Development|x86
42 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Release|ARM.ActiveCfg = Release|ARM
43 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Release|ARM.Build.0 = Release|ARM
44 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Release|x64.ActiveCfg = Release|x64
45 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Release|x64.Build.0 = Release|x64
46 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Release|x86.ActiveCfg = Release|x86
47 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}.Release|x86.Build.0 = Release|x86
48 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.ActiveCfg = Debug|ARM
49 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|ARM.Build.0 = Debug|ARM
50 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.ActiveCfg = Debug|x64
51 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x64.Build.0 = Debug|x64
52 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.ActiveCfg = Debug|x86
53 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Debug|x86.Build.0 = Debug|x86
54 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.ActiveCfg = Debug|ARM
55 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|ARM.Build.0 = Debug|ARM
56 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.ActiveCfg = Debug|x64
57 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x64.Build.0 = Debug|x64
58 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.ActiveCfg = Debug|x86
59 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Development|x86.Build.0 = Debug|x86
60 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.ActiveCfg = Release|ARM
61 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|ARM.Build.0 = Release|ARM
62 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.ActiveCfg = Release|x64
63 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x64.Build.0 = Release|x64
64 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.ActiveCfg = Release|x86
65 | {C7673AD5-E3AA-468C-A5FD-FA38154E205C}.Release|x86.Build.0 = Release|x86
66 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.ActiveCfg = Debug|ARM
67 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|ARM.Build.0 = Debug|ARM
68 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.ActiveCfg = Debug|x64
69 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x64.Build.0 = Debug|x64
70 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.ActiveCfg = Debug|Win32
71 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Debug|x86.Build.0 = Debug|Win32
72 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|ARM.ActiveCfg = Debug|ARM
73 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|ARM.Build.0 = Debug|ARM
74 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x64.ActiveCfg = Debug|x64
75 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x64.Build.0 = Debug|x64
76 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x86.ActiveCfg = Debug|Win32
77 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Development|x86.Build.0 = Debug|Win32
78 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.ActiveCfg = Release|ARM
79 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|ARM.Build.0 = Release|ARM
80 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.ActiveCfg = Release|x64
81 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x64.Build.0 = Release|x64
82 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.ActiveCfg = Release|Win32
83 | {4B72C796-16D5-4E3A-81C0-3E36F531E578}.Release|x86.Build.0 = Release|Win32
84 | EndGlobalSection
85 | GlobalSection(SolutionProperties) = preSolution
86 | HideSolutionNode = FALSE
87 | EndGlobalSection
88 | EndGlobal
89 |
--------------------------------------------------------------------------------
/windows/RNBugly/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("RNBugly")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("RNBugly")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Version information for an assembly consists of the following four values:
18 | //
19 | // Major Version
20 | // Minor Version
21 | // Build Number
22 | // Revision
23 | //
24 | // You can specify all the values or you can default the Build and Revision Numbers
25 | // by using the '*' as shown below:
26 | // [assembly: AssemblyVersion("1.0.*")]
27 | [assembly: AssemblyVersion("1.0.0.0")]
28 | [assembly: AssemblyFileVersion("1.0.0.0")]
29 | [assembly: ComVisible(false)]
30 |
--------------------------------------------------------------------------------
/windows/RNBugly/Properties/RNBugly.rd.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/windows/RNBugly/RNBugly.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x86
7 | {0BDC1FA0-2B7A-11E8-B963-895FED719869}
8 | Library
9 | Properties
10 | Bugly
11 | Bugly
12 | en-US
13 | UAP
14 | 10.0.10586.0
15 | 10.0.10240.0
16 | 14
17 | 512
18 | {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
19 | ..\..\node_modules
20 |
21 |
22 | ..\..
23 |
24 |
25 | x86
26 | true
27 | bin\x86\Debug\
28 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
29 | ;2008
30 | full
31 | x86
32 | false
33 | prompt
34 |
35 |
36 | x86
37 | bin\x86\Release\
38 | TRACE;NETFX_CORE;WINDOWS_UWP
39 | true
40 | ;2008
41 | pdbonly
42 | x86
43 | false
44 | prompt
45 |
46 |
47 | ARM
48 | true
49 | bin\ARM\Debug\
50 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
51 | ;2008
52 | full
53 | ARM
54 | false
55 | prompt
56 |
57 |
58 | ARM
59 | bin\ARM\Release\
60 | TRACE;NETFX_CORE;WINDOWS_UWP
61 | true
62 | ;2008
63 | pdbonly
64 | ARM
65 | false
66 | prompt
67 |
68 |
69 | x64
70 | true
71 | bin\x64\Debug\
72 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
73 | ;2008
74 | full
75 | x64
76 | false
77 | prompt
78 |
79 |
80 | x64
81 | bin\x64\Release\
82 | TRACE;NETFX_CORE;WINDOWS_UWP
83 | true
84 | ;2008
85 | pdbonly
86 | x64
87 | false
88 | prompt
89 |
90 |
91 | true
92 | bin\x86\Development\
93 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
94 | ;2008
95 | true
96 | full
97 | x86
98 | false
99 | prompt
100 | MinimumRecommendedRules.ruleset
101 |
102 |
103 | true
104 | bin\ARM\Development\
105 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
106 | ;2008
107 | true
108 | full
109 | ARM
110 | false
111 | prompt
112 | MinimumRecommendedRules.ruleset
113 |
114 |
115 | true
116 | bin\x64\Development\
117 | DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP
118 | ;2008
119 | true
120 | full
121 | x64
122 | false
123 | prompt
124 | MinimumRecommendedRules.ruleset
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 | {c7673ad5-e3aa-468c-a5fd-fa38154e205c}
139 | ReactNative
140 |
141 |
142 |
143 | 14.0
144 |
145 |
146 |
153 |
154 |
--------------------------------------------------------------------------------
/windows/RNBugly/RNBuglyModule.cs:
--------------------------------------------------------------------------------
1 | using ReactNative.Bridge;
2 | using System;
3 | using System.Collections.Generic;
4 | using Windows.ApplicationModel.Core;
5 | using Windows.UI.Core;
6 |
7 | namespace Bugly.RNBugly
8 | {
9 | ///
10 | /// A module that allows JS to share data.
11 | ///
12 | class RNBuglyModule : NativeModuleBase
13 | {
14 | ///
15 | /// Instantiates the .
16 | ///
17 | internal RNBuglyModule()
18 | {
19 |
20 | }
21 |
22 | ///
23 | /// The name of the native module.
24 | ///
25 | public override string Name
26 | {
27 | get
28 | {
29 | return "RNBugly";
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/windows/RNBugly/RNBuglyPackage.cs:
--------------------------------------------------------------------------------
1 | using ReactNative.Bridge;
2 | using ReactNative.Modules.Core;
3 | using ReactNative.UIManager;
4 | using System;
5 | using System.Collections.Generic;
6 |
7 | namespace Bugly.RNBugly
8 | {
9 | ///
10 | /// Package defining core framework modules (e.g., ).
11 | /// It should be used for modules that require special integration with
12 | /// other framework parts (e.g., with the list of packages to load view
13 | /// managers from).
14 | ///
15 | public class RNBuglyPackage : IReactPackage
16 | {
17 | ///
18 | /// Creates the list of native modules to register with the react
19 | /// instance.
20 | ///
21 | /// The react application context.
22 | /// The list of native modules.
23 | public IReadOnlyList CreateNativeModules(ReactContext reactContext)
24 | {
25 | return new List
26 | {
27 | new RNBuglyModule(),
28 | };
29 | }
30 |
31 | ///
32 | /// Creates the list of JavaScript modules to register with the
33 | /// react instance.
34 | ///
35 | /// The list of JavaScript modules.
36 | public IReadOnlyList CreateJavaScriptModulesConfig()
37 | {
38 | return new List(0);
39 | }
40 |
41 | ///
42 | /// Creates the list of view managers that should be registered with
43 | /// the .
44 | ///
45 | /// The react application context.
46 | /// The list of view managers.
47 | public IReadOnlyList CreateViewManagers(
48 | ReactContext reactContext)
49 | {
50 | return new List(0);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/windows/RNBugly/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2"
4 | },
5 | "frameworks": {
6 | "uap10.0": {}
7 | },
8 | "runtimes": {
9 | "win10-arm": {},
10 | "win10-arm-aot": {},
11 | "win10-x86": {},
12 | "win10-x86-aot": {},
13 | "win10-x64": {},
14 | "win10-x64-aot": {}
15 | }
16 | }
17 |
--------------------------------------------------------------------------------