@blipit/react-native 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ #import <React/RCTBridgeModule.h>
2
+
3
+ @interface RCT_EXTERN_MODULE(BlipitNuggets, NSObject)
4
+
5
+ RCT_EXTERN_METHOD(start:(NSString *)key project:(NSString *)project environment:(NSString *)environment release:(NSString *)release endpoint:(NSString *)endpoint)
6
+ RCT_EXTERN_METHOD(setUser:(NSString *)id email:(NSString *)email username:(NSString *)username)
7
+ RCT_EXTERN_METHOD(setTag:(NSString *)key value:(NSString *)value)
8
+ RCT_EXTERN_METHOD(setReplayConsent:(BOOL)granted)
9
+ RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(hasReplayConsent)
10
+ RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(save:(NSString *)data)
11
+ RCT_EXTERN__BLOCKING_SYNCHRONOUS_METHOD(load)
12
+
13
+ @end
@@ -0,0 +1,69 @@
1
+ import Foundation
2
+ import UIKit
3
+ import BlipitSwift
4
+
5
+ @objc(BlipitNuggets)
6
+ final class BlipitNuggets: NSObject {
7
+ private static var started = false
8
+ private static let lock = NSLock()
9
+
10
+ @objc static func requiresMainQueueSetup() -> Bool { false }
11
+
12
+ @objc func constantsToExport() -> [AnyHashable: Any]! {
13
+ let info = Bundle.main.infoDictionary ?? [:]
14
+ var size = utsname()
15
+ uname(&size)
16
+ let model = withUnsafePointer(to: &size.machine) { $0.withMemoryRebound(to: CChar.self, capacity: 1) { String(cString: $0) } }
17
+ return [
18
+ "appId": Bundle.main.bundleIdentifier ?? "",
19
+ "appVersion": info["CFBundleShortVersionString"] as? String ?? "",
20
+ "appBuild": info["CFBundleVersion"] as? String ?? "",
21
+ "model": model,
22
+ "osVersion": UIDevice.current.systemVersion,
23
+ ]
24
+ }
25
+
26
+ private var queue: URL {
27
+ let base = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
28
+ return base.appendingPathComponent("blipit-nuggets/queue.json")
29
+ }
30
+
31
+ @objc func start(_ key: String, project: String, environment: String?, release: String?, endpoint: String) {
32
+ BlipitNuggets.lock.lock()
33
+ defer { BlipitNuggets.lock.unlock() }
34
+ if BlipitNuggets.started { return }
35
+ BlipitNuggets.started = Blipit.start(key: key, project: project, environment: environment, release: release, endpoint: endpoint)
36
+ }
37
+
38
+ @objc func setUser(_ id: String?, email: String?, username: String?) {
39
+ if BlipitNuggets.started { Blipit.setUser(id: id, email: email, username: username) }
40
+ }
41
+
42
+ @objc func setTag(_ key: String, value: String) {
43
+ if BlipitNuggets.started { Blipit.setTag(key, value) }
44
+ }
45
+
46
+ @objc func setReplayConsent(_ granted: Bool) {}
47
+
48
+ @objc func hasReplayConsent() -> NSNumber { false }
49
+
50
+ @objc func save(_ data: String) -> NSNumber {
51
+ let url = queue
52
+ do {
53
+ var dir = url.deletingLastPathComponent()
54
+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)
55
+ var values = URLResourceValues()
56
+ values.isExcludedFromBackup = true
57
+ try? dir.setResourceValues(values)
58
+ try Data(data.utf8).write(to: url, options: [.atomic, .completeFileProtectionUntilFirstUserAuthentication])
59
+ return true
60
+ } catch {
61
+ return false
62
+ }
63
+ }
64
+
65
+ @objc func load() -> String? {
66
+ guard let data = try? Data(contentsOf: queue) else { return nil }
67
+ return String(data: data, encoding: .utf8)
68
+ }
69
+ }
@@ -0,0 +1,39 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>NSPrivacyTracking</key>
6
+ <false/>
7
+ <key>NSPrivacyTrackingDomains</key>
8
+ <array/>
9
+ <key>NSPrivacyCollectedDataTypes</key>
10
+ <array>
11
+ <dict>
12
+ <key>NSPrivacyCollectedDataType</key>
13
+ <string>NSPrivacyCollectedDataTypeCrashData</string>
14
+ <key>NSPrivacyCollectedDataTypeLinked</key>
15
+ <false/>
16
+ <key>NSPrivacyCollectedDataTypeTracking</key>
17
+ <false/>
18
+ <key>NSPrivacyCollectedDataTypePurposes</key>
19
+ <array>
20
+ <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
21
+ </array>
22
+ </dict>
23
+ <dict>
24
+ <key>NSPrivacyCollectedDataType</key>
25
+ <string>NSPrivacyCollectedDataTypeOtherDiagnosticData</string>
26
+ <key>NSPrivacyCollectedDataTypeLinked</key>
27
+ <false/>
28
+ <key>NSPrivacyCollectedDataTypeTracking</key>
29
+ <false/>
30
+ <key>NSPrivacyCollectedDataTypePurposes</key>
31
+ <array>
32
+ <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
33
+ </array>
34
+ </dict>
35
+ </array>
36
+ <key>NSPrivacyAccessedAPITypes</key>
37
+ <array/>
38
+ </dict>
39
+ </plist>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blipit/react-native",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "description": "Blipit error monitoring for React Native and Expo. Know your app broke before your users tell you.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -16,11 +16,14 @@
16
16
  },
17
17
  "files": [
18
18
  "dist",
19
+ "android/build.gradle",
20
+ "android/src",
21
+ "ios",
22
+ "BlipitReactNative.podspec",
19
23
  "CHANGELOG.md"
20
24
  ],
21
25
  "sideEffects": false,
22
26
  "peerDependencies": {
23
- "@sentry/react-native": ">=6",
24
27
  "react": ">=18",
25
28
  "react-native": ">=0.72",
26
29
  "react-native-view-shot": ">=3"
@@ -31,7 +34,6 @@
31
34
  }
32
35
  },
33
36
  "devDependencies": {
34
- "@sentry/react-native": "^8.28.0",
35
37
  "@types/node": "^22.0.0",
36
38
  "@types/react": "^19.0.0",
37
39
  "react": "^19.0.0",
@@ -56,11 +58,12 @@
56
58
  "react-native",
57
59
  "expo",
58
60
  "error-monitoring",
61
+ "crash-reporting",
59
62
  "blipit"
60
63
  ],
61
64
  "scripts": {
62
65
  "build": "tsup src/index.ts --format esm,cjs --dts --clean --external react-native-view-shot",
63
66
  "typecheck": "tsc -p tsconfig.json --noEmit",
64
- "test": "node --experimental-strip-types --experimental-test-module-mocks --import ./test/tsx-hook.mjs --test test/init.test.ts test/report.test.ts"
67
+ "test": "node --experimental-strip-types --experimental-test-module-mocks --import ./test/tsx-hook.mjs --test test/init.test.ts test/report.test.ts test/nuggets.test.ts test/stuck.test.ts"
65
68
  }
66
69
  }