@blipit/react-native 0.5.0 → 0.6.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.
@@ -16,8 +16,8 @@ Pod::Spec.new do |s|
16
16
  s.swift_version = "5.9"
17
17
  s.dependency "React-Core"
18
18
  if defined?(spm_dependency)
19
- spm_dependency(s, url: "https://github.com/blipit-io/blipit-swift", requirement: { kind: "upToNextMinorVersion", minimumVersion: "0.5.0" }, products: ["BlipitSwift"])
19
+ spm_dependency(s, url: "https://github.com/blipit-io/blipit-swift", requirement: { kind: "upToNextMinorVersion", minimumVersion: "0.6.0" }, products: ["BlipitSwift"])
20
20
  else
21
- s.dependency "BlipitSwift", "~> 0.5.0"
21
+ s.dependency "BlipitSwift", "~> 0.6.0"
22
22
  end
23
23
  end
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 0.6.0
2
+
3
+ - Shake to report (`shakeToReport`, off by default): one shake opens the bug reporter on the current screen, never while one is already open.
4
+ - Screenshot to report (`screenshotToReport`, off by default): after a normal screenshot, a small prompt asks "Report a bug with this screen?" and opens the reporter with Blipit's own capture. iOS, and Android 14 or later; the gallery is never read.
5
+ - Two-finger press and hold (`twoFingerReport`, off by default) opens the reporter; touches are only watched, never consumed.
6
+ - Report after a crash (`reportAfterCrash`, off by default): on the first launch after a fatal JavaScript error or native crash, the person is asked what they were doing; the report carries the crash `event_id`, so the crash issue and the report link to each other.
7
+ - Which screen? picker (`screenPicker`, on by default, since it only changes the reporter UI): when `showReport()` is called from a menu, the person picks the current screen or one of the last 3 screens from `trackNavigation`. Snapshots stay in memory, are dropped after 3 minutes in the background or on `setEnabled(false)`, and only the chosen one is uploaded.
8
+ - The floating Report a bug button can be turned on from app.blipit.io for everyone or for testers only, matched on the server against the user set with `setUser`; `<BlipitReporter showButton>` keeps working.
9
+ - Needs blipit-android v0.6.0 and blipit-swift 0.6.0. The native module is now an event emitter (`BlipitReportTrigger`).
10
+ - Prompts and the picker are translated into the reporter's 11 languages, right to left in Arabic.
11
+ - Platform mismatch: when Blipit refuses data because the key belongs to a project for another platform (HTTP 409 platform_mismatch), the SDK logs one clear error (`console.error`) and stops sending for the rest of the launch. Events, sessions and bug reports from JavaScript stop; native crashes stop through blipit-android and blipit-swift 0.6.0.
12
+
1
13
  ## 0.5.0
2
14
 
3
15
  - Runs on blipit-nuggets, Blipit's own capture core. `@sentry/react-native` is no longer a dependency; uninstall it. Events go to Blipit's own `POST /api/v1/events` with the `X-Blipit-Key` header, sessions to `/api/v1/sessions`.
package/README.md CHANGED
@@ -64,6 +64,11 @@ Events wait in a queue of up to 30, stored on the device, so errors seen offline
64
64
  | `autoSessionTracking` | `true` | |
65
65
  | `enableNative` | `true` | `false` if you start blipit-android or blipit-swift yourself |
66
66
  | `waitForReady` | `false` | Watch startup until `reportReady()` |
67
+ | `shakeToReport` | `false` | Shaking the phone opens the bug reporter on the current screen |
68
+ | `screenshotToReport` | `false` | After a normal screenshot, offer "Report a bug with this screen?" |
69
+ | `twoFingerReport` | `false` | A two-finger press and hold (about 1 s) opens the bug reporter |
70
+ | `reportAfterCrash` | `false` | On the first launch after a crash, ask what the person was doing |
71
+ | `screenPicker` | `true` | `showReport()` lets the person pick which recent screen the bug is on |
67
72
 
68
73
  ## Manual capture
69
74
 
@@ -112,6 +117,39 @@ Blipit.showReport();
112
117
 
113
118
  The reporter asks first: Take a screenshot or Skip. The screenshot opens full screen with the tools above and below it; pinch or double-tap to zoom, mark the problem, then add a title and what happened and send. Without `react-native-view-shot` the report is sent as text. Reports arrive under Bug reports at app.blipit.io.
114
119
 
120
+ ### Report from the screen with the bug
121
+
122
+ A "Report a bug" item in a Profile or Settings menu takes a screenshot of that menu, not of the screen with the problem. Turn on the ways that start the reporter where the bug is:
123
+
124
+ ```tsx
125
+ Blipit.init({
126
+ key: "<public key>",
127
+ project: <project id>,
128
+ shakeToReport: true,
129
+ screenshotToReport: true,
130
+ twoFingerReport: true,
131
+ reportAfterCrash: true,
132
+ });
133
+ ```
134
+
135
+ - **Shake to report**: one shake opens one reporter on the current screen. Shakes are ignored while a reporter or a Blipit prompt is open.
136
+ - **Screenshot to report**: when the person takes a normal screenshot, a small prompt asks "Report a bug with this screen?" (Report / Not now, gone after 6 seconds). Report opens the reporter with Blipit's own capture of the screen; the screenshot in the gallery is never read. iOS, and Android 14 or later; older Android versions do nothing.
137
+ - **Two-finger press**: hold two fingers still on the screen for about a second. Blipit only watches touches, so your buttons, lists and gestures keep working.
138
+ - **Report after a crash**: on the first launch after a crash Blipit caught (a fatal JavaScript error or a native crash), a prompt asks "The app closed unexpectedly. Tell us what you were doing?". Tell us opens the reporter (text only, or with a screenshot of the current screen) and the report is linked to that crash: the crash issue shows the report and the report shows the crash. It asks once per crash.
139
+ - **Which screen?** (`screenPicker`, on by default): with `trackNavigation(ref)` set up, Blipit keeps a small snapshot of the last 3 screens the person visited, in memory only. When `showReport()` is called from a menu and the person picks Take a screenshot, they choose the current screen or one of those before marking it up. Only the chosen image is uploaded. Snapshots never touch the disk, crash files or logs, and are dropped after 3 minutes in the background or when `setEnabled(false)` is called. Turn it off with `screenPicker: false`.
140
+
141
+ Shake, screenshot, two-finger and crash detection run in Blipit's native Android and iOS SDKs and open this JavaScript reporter, so `BlipitReporter` must wrap the app and `enableNative` must stay on.
142
+
143
+ ### Floating button for testers only
144
+
145
+ At app.blipit.io, Bug reports, Widget settings, set "Floating button" to Off, Everyone or Testers only, and list your testers' user ids or emails. Blipit asks the server whether to show the Report a bug button for the person set with `setUser`, so the tester list never ships in the app:
146
+
147
+ ```tsx
148
+ Blipit.setUser({ id: user.id, email: user.email });
149
+ ```
150
+
151
+ The button follows that answer after start and after each `setUser`. `<BlipitReporter showButton>` still shows it for everyone.
152
+
115
153
  ## Stuck screens and flows
116
154
 
117
155
  Some failures never crash: the splash screen keeps spinning, or a sign-in promise never settles. Tell Blipit when the app is ready and wrap the flows that must finish:
@@ -144,17 +182,19 @@ What the SDK collects: error type, message and stack, breadcrumbs listed above,
144
182
  - App Privacy answers in App Store Connect: Diagnostics, Crash Data and Other Diagnostic Data, not used for tracking. If you call `setUser`, also declare User ID and, if you pass it, Email Address, linked to the user, purpose App Functionality.
145
183
  - No App Tracking Transparency prompt is needed: the SDK never reads the IDFA and links no AdSupport or AppTrackingTransparency framework.
146
184
  - blipit-swift ships its own privacy manifest; Xcode merges both into the app's privacy report.
185
+ - Report triggers use public UIKit only: shake is UIKit's motion event (not CoreMotion, so no motion permission and nothing to declare), screenshot to report listens to `UIApplication.userDidTakeScreenshotNotification` and never reads the photo library, and the two-finger press is a gesture recognizer that does not cancel touches. No private API and no new required-reason API.
147
186
 
148
187
  ### Google Play
149
188
 
150
- - The module adds no permissions to the manifest. `INTERNET` comes from React Native itself.
189
+ - The module adds no permissions of its own. blipit-android 0.6.0 declares `DETECT_SCREEN_CAPTURE`, a normal install-time permission with no prompt, used only on Android 14 or later when `screenshotToReport` is on. Shake uses the accelerometer through `SensorManager` while the app is open, which needs no permission. `INTERNET` comes from React Native itself.
190
+ - Data safety: screenshot to report only learns that a screenshot was taken; it reads no screenshot, photo, gallery or storage data. A bug report sends only what the person chooses to send (their text, the screen they marked up, an optional email).
151
191
  - Data safety form: Crash logs and Diagnostics, collected, not shared, encrypted in transit (HTTPS), purpose App functionality. Add User IDs and Email address if you call `setUser`.
152
192
  - No advertising ID, no device identifiers beyond the model name; nothing that Play's Families policy forbids. For child-directed apps keep `setUser` to an internal id.
153
193
  - Queued events are stored in the app's no-backup folder, so they are not copied by Android backups.
154
194
 
155
195
  ### Huawei AppGallery
156
196
 
157
- - No Google Mobile Services: the module and blipit-android depend on no `com.google.android.gms` or Firebase library, so the app runs on HarmonyOS and Huawei phones without GMS.
197
+ - No Google Mobile Services: the module and blipit-android depend on no `com.google.android.gms` or Firebase library, so the app runs on HarmonyOS and Huawei phones without GMS. Shake, screenshot, two-finger and crash prompts work the same there.
158
198
  - In your privacy statement and the AppGallery Connect privacy section, list crash and diagnostic data sent to Blipit (Louward Labs FZC LLC) for app stability, the same items as the Google Play Data safety form above.
159
199
 
160
200
  ## Moving from 0.4
@@ -28,5 +28,5 @@ repositories {
28
28
 
29
29
  dependencies {
30
30
  implementation "com.facebook.react:react-android"
31
- implementation "com.github.blipit-io:blipit-android:v0.5.0"
31
+ implementation "com.github.blipit-io:blipit-android:v0.6.0"
32
32
  }
@@ -1,9 +1,12 @@
1
1
  package io.blipit.reactnative
2
2
 
3
3
  import android.os.Build
4
+ import com.facebook.react.bridge.Arguments
4
5
  import com.facebook.react.bridge.ReactApplicationContext
5
6
  import com.facebook.react.bridge.ReactContextBaseJavaModule
6
7
  import com.facebook.react.bridge.ReactMethod
8
+ import com.facebook.react.bridge.ReadableMap
9
+ import com.facebook.react.modules.core.DeviceEventManagerModule
7
10
  import io.blipit.android.Blipit
8
11
  import io.blipit.android.BlipitOptions
9
12
  import java.io.File
@@ -26,7 +29,7 @@ class BlipitNuggetsModule(private val context: ReactApplicationContext) : ReactC
26
29
  }
27
30
 
28
31
  @ReactMethod
29
- fun start(key: String, project: String, environment: String?, release: String?, endpoint: String) {
32
+ fun start(key: String, project: String, environment: String?, release: String?, endpoint: String, triggers: ReadableMap?) {
30
33
  synchronized(BlipitNuggetsModule::class.java) {
31
34
  if (started) return
32
35
  runCatching {
@@ -36,12 +39,44 @@ class BlipitNuggetsModule(private val context: ReactApplicationContext) : ReactC
36
39
  this.environment = environment
37
40
  this.release = release
38
41
  this.endpoint = endpoint
42
+ shakeToReport = flag(triggers, "shakeToReport")
43
+ screenshotToReport = flag(triggers, "screenshotToReport")
44
+ twoFingerReport = flag(triggers, "twoFingerReport")
45
+ reportAfterCrash = flag(triggers, "reportAfterCrash")
46
+ screenPicker = false
39
47
  })
40
48
  started = true
41
49
  }
42
50
  }
51
+ runCatching {
52
+ Blipit.setReportHandler { trigger, crashId -> emit(trigger, crashId) }
53
+ context.currentActivity?.let { Blipit.attach(it) }
54
+ }
43
55
  }
44
56
 
57
+ private fun flag(map: ReadableMap?, name: String): Boolean = runCatching { map?.hasKey(name) == true && map.getBoolean(name) }.getOrDefault(false)
58
+
59
+ private fun emit(trigger: String, crashId: String?) {
60
+ runCatching {
61
+ val body = Arguments.createMap().apply {
62
+ putString("trigger", trigger)
63
+ if (crashId != null) putString("crashId", crashId) else putNull("crashId")
64
+ }
65
+ context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java).emit("BlipitReportTrigger", body)
66
+ }
67
+ }
68
+
69
+ @ReactMethod
70
+ fun promptAfterCrash(eventId: String) {
71
+ if (started) runCatching { Blipit.promptAfterCrash(eventId) }
72
+ }
73
+
74
+ @ReactMethod
75
+ fun addListener(eventName: String) {}
76
+
77
+ @ReactMethod
78
+ fun removeListeners(count: Double) {}
79
+
45
80
  @ReactMethod
46
81
  fun setUser(id: String?, email: String?, username: String?) {
47
82
  if (started) runCatching { Blipit.setUser(id, email, username) }