react-native-carrot-quest 0.1.0 → 0.3.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.
- package/CarrotQuest.podspec +6 -5
- package/README.md +11 -7
- package/android/build.gradle +3 -3
- package/ios/CarrotQuest.swift +77 -6
- package/ios/CarrotQuestSetup.swift +25 -0
- package/lib/typescript/src/CarrotQuest.nitro.d.ts +12 -10
- package/lib/typescript/src/CarrotQuest.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_CarrotQuestLogEntry.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_bool.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_double.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_std__string.kt +0 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/HybridCarrotQuestSpec.kt +2 -0
- package/package.json +38 -5
- package/src/CarrotQuest.nitro.ts +12 -10
package/CarrotQuest.podspec
CHANGED
|
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.authors = package["author"]
|
|
12
12
|
|
|
13
13
|
s.platforms = { :ios => min_ios_version_supported }
|
|
14
|
-
s.source = { :git => "https://github.com/
|
|
14
|
+
s.source = { :git => "https://github.com/Ahmedhamed77/react-native-carrot-quest.git", :tag => "v#{s.version}" }
|
|
15
15
|
|
|
16
16
|
s.source_files = [
|
|
17
17
|
"ios/**/*.{swift}",
|
|
@@ -22,10 +22,11 @@ Pod::Spec.new do |s|
|
|
|
22
22
|
s.dependency 'React-jsi'
|
|
23
23
|
s.dependency 'React-callinvoker'
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
|
|
25
|
+
# 3.4+ is required: the log sink and diagnostics API the bridge uses
|
|
26
|
+
# (`setLogSink`, `getDiagnostics`) first shipped there. The public API used
|
|
27
|
+
# here was verified against 3.4.0; CarrotquestSDK is a closed-source vendor
|
|
28
|
+
# pod, so pin it yourself in your app's Podfile if you need a specific build.
|
|
29
|
+
s.dependency 'CarrotquestSDK', '~> 3.4'
|
|
29
30
|
|
|
30
31
|
load 'nitrogen/generated/ios/CarrotQuest+autolinking.rb'
|
|
31
32
|
add_nitrogen_files(s)
|
package/README.md
CHANGED
|
@@ -342,8 +342,8 @@ On Android, links route through the activity named by
|
|
|
342
342
|
| `wasPushShownEarlier(payload)` | `Promise<boolean>` | ✅ | — |
|
|
343
343
|
| `onUrlOpen(source, cb)` | `Subscription` | ✅ | — |
|
|
344
344
|
| `openBrowserLink(url)` / `openUniversalLink(url)` | `void` | ✅ | — |
|
|
345
|
-
| `getDiagnostics()` | `string \| undefined` |
|
|
346
|
-
| `onLog(cb)` | `Subscription` |
|
|
345
|
+
| `getDiagnostics()` | `string \| undefined` | ✅ | ✅ |
|
|
346
|
+
| `onLog(cb)` | `Subscription` | ✅ | ✅ |
|
|
347
347
|
|
|
348
348
|
Methods that cannot meaningfully fail are synchronous and return `void`. Methods
|
|
349
349
|
that can fail return a `Promise` so you get the error. A `—` means the platform's
|
|
@@ -351,8 +351,8 @@ SDK has no equivalent; those calls are inert rather than throwing.
|
|
|
351
351
|
|
|
352
352
|
### Forwarding SDK logs
|
|
353
353
|
|
|
354
|
-
|
|
355
|
-
reporter:
|
|
354
|
+
Both platforms (iOS needs `CarrotquestSDK` 3.4+). Useful for routing the SDK's
|
|
355
|
+
own diagnostics into your crash reporter:
|
|
356
356
|
|
|
357
357
|
```ts
|
|
358
358
|
import { onLog } from 'react-native-carrot-quest';
|
|
@@ -414,14 +414,18 @@ Only set it if you need to pin the chat to one language.
|
|
|
414
414
|
|
|
415
415
|
| Platform | Pinned |
|
|
416
416
|
|---|---|
|
|
417
|
-
| iOS | `CarrotquestSDK ~> 3.
|
|
418
|
-
| Android | `io.carrotquest:android-sdk:3.
|
|
417
|
+
| iOS | `CarrotquestSDK ~> 3.4` (verified against 3.4.0) |
|
|
418
|
+
| Android | `io.carrotquest:android-sdk:3.4.2-commonRelease` |
|
|
419
|
+
|
|
420
|
+
Upgrading an existing iOS app: run `pod update CarrotquestSDK` — a Podfile.lock
|
|
421
|
+
pinned to 3.1–3.3 will not move on its own, and 3.4+ is required for the log and
|
|
422
|
+
diagnostics APIs.
|
|
419
423
|
|
|
420
424
|
Carrot publishes one Android artifact per region flavour — `commonRelease` or
|
|
421
425
|
`usRelease`. Override from your app's `android/build.gradle`:
|
|
422
426
|
|
|
423
427
|
```gradle
|
|
424
|
-
ext { carrotSdkVersion = "3.
|
|
428
|
+
ext { carrotSdkVersion = "3.4.2-usRelease" }
|
|
425
429
|
```
|
|
426
430
|
|
|
427
431
|
**Android 2.x is not supported.** It exposes a callback-free `setup()` that
|
package/android/build.gradle
CHANGED
|
@@ -6,11 +6,11 @@ buildscript {
|
|
|
6
6
|
// Carrot publishes one artifact per region flavour: `commonRelease` for the
|
|
7
7
|
// default servers, `usRelease` for the US ones. Override from your app's
|
|
8
8
|
// android/build.gradle:
|
|
9
|
-
// ext { carrotSdkVersion = "3.
|
|
9
|
+
// ext { carrotSdkVersion = "3.4.2-usRelease" }
|
|
10
10
|
//
|
|
11
11
|
// Must stay on the 3.x line — 2.x has a callback-free `setup`, a `setDebug`
|
|
12
12
|
// toggle and JSON-string event params, none of which this bridge uses.
|
|
13
|
-
carrotSdkVersion: "3.
|
|
13
|
+
carrotSdkVersion: "3.4.2-commonRelease"
|
|
14
14
|
]
|
|
15
15
|
|
|
16
16
|
ext.getExtOrDefault = { prop ->
|
|
@@ -120,7 +120,7 @@ repositories {
|
|
|
120
120
|
// Carrot quest publishes its Android SDK from a GitHub-hosted Maven repo
|
|
121
121
|
// rather than Maven Central.
|
|
122
122
|
maven { url "https://raw.github.com/carrotquest/android-sdk/carrotquest" }
|
|
123
|
-
// Required for the SDK's own transitive GitHub dependencies — 3.
|
|
123
|
+
// Required for the SDK's own transitive GitHub dependencies — 3.x pulls
|
|
124
124
|
// com.github.Redman1037:TSnackBar and com.github.chrisbanes:PhotoView.
|
|
125
125
|
maven { url "https://jitpack.io" }
|
|
126
126
|
}
|
package/ios/CarrotQuest.swift
CHANGED
|
@@ -24,7 +24,9 @@ final class CarrotQuest: HybridCarrotQuestSpec {
|
|
|
24
24
|
theme: options?.theme.map { NSNumber(value: Self.nativeTheme($0).rawValue) },
|
|
25
25
|
useEuServer: options?.useEuServer ?? false,
|
|
26
26
|
appGroup: options?.appGroup,
|
|
27
|
-
isServiceMode: options?.isServiceMode ?? false
|
|
27
|
+
isServiceMode: options?.isServiceMode ?? false,
|
|
28
|
+
logLevel: options?.logLevel.map { NSNumber(value: Self.nativeLogLevel($0).rawValue) },
|
|
29
|
+
logIncludeSensitive: options?.logIncludeSensitive.map { NSNumber(value: $0) }
|
|
28
30
|
) { error in
|
|
29
31
|
if let error = error {
|
|
30
32
|
promise.reject(withError: error)
|
|
@@ -573,16 +575,85 @@ final class CarrotQuest: HybridCarrotQuestSpec {
|
|
|
573
575
|
// MARK: - Diagnostics
|
|
574
576
|
|
|
575
577
|
func getDiagnostics() throws -> String? {
|
|
576
|
-
//
|
|
577
|
-
|
|
578
|
+
// Deliberately not gated on setup: the snapshot carries `isInitialized` and
|
|
579
|
+
// `recentLogs`, which are what you want when setup fails.
|
|
580
|
+
return Carrot.shared.getDiagnostics().toFormattedString()
|
|
578
581
|
}
|
|
579
582
|
|
|
583
|
+
/// Strong reference: the SDK takes the sink as a protocol object and may not
|
|
584
|
+
/// retain it, so dropping this would silently stop log delivery.
|
|
585
|
+
private static var logSink: CarrotQuestLogSink?
|
|
586
|
+
|
|
580
587
|
func onLog(listener: @escaping (CarrotQuestLogEntry) -> Void) throws {
|
|
581
|
-
|
|
582
|
-
|
|
588
|
+
let sink = CarrotQuestLogSink(listener: listener)
|
|
589
|
+
|
|
590
|
+
Self.logSink = sink
|
|
591
|
+
Carrot.shared.setLogSink(sink)
|
|
583
592
|
}
|
|
584
593
|
|
|
585
594
|
func offLog() throws {
|
|
586
|
-
|
|
595
|
+
Carrot.shared.setLogSink(nil)
|
|
596
|
+
Self.logSink = nil
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
private static func nativeLogLevel(_ level: CarrotQuestLogLevel) -> SdkLogLevel {
|
|
600
|
+
switch level {
|
|
601
|
+
case .none: return .none
|
|
602
|
+
case .error: return .error
|
|
603
|
+
case .warn: return .warn
|
|
604
|
+
case .info: return .info
|
|
605
|
+
// Spelled `debugging` on the JS side — `DEBUG` is a C macro in RN Debug builds.
|
|
606
|
+
case .debugging: return .debug
|
|
607
|
+
case .verbose: return .verbose
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
fileprivate static func jsLogLevel(_ level: SdkLogLevel) -> CarrotQuestLogLevel {
|
|
612
|
+
switch level {
|
|
613
|
+
case .none: return .none
|
|
614
|
+
case .error: return .error
|
|
615
|
+
case .warn: return .warn
|
|
616
|
+
case .info: return .info
|
|
617
|
+
case .debug: return .debugging
|
|
618
|
+
case .verbose: return .verbose
|
|
619
|
+
// Future SDK levels: report them at the closest known verbosity.
|
|
620
|
+
@unknown default: return .verbose
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
fileprivate static func jsLogCategory(_ category: SdkLogCategory) -> CarrotQuestLogCategory {
|
|
625
|
+
switch category {
|
|
626
|
+
case .general: return .general
|
|
627
|
+
case .network: return .network
|
|
628
|
+
case .connectivity: return .connectivity
|
|
629
|
+
case .auth: return .auth
|
|
630
|
+
case .realtime: return .realtime
|
|
631
|
+
case .lifecycle: return .lifecycle
|
|
632
|
+
case .push: return .push
|
|
633
|
+
@unknown default: return .general
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
/// Adapts the SDK's `SdkLogSink` protocol to a JS listener.
|
|
639
|
+
private final class CarrotQuestLogSink: SdkLogSink {
|
|
640
|
+
private let listener: (CarrotQuestLogEntry) -> Void
|
|
641
|
+
|
|
642
|
+
init(listener: @escaping (CarrotQuestLogEntry) -> Void) {
|
|
643
|
+
self.listener = listener
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
func onLog(_ entry: SdkLogEntry) {
|
|
647
|
+
listener(
|
|
648
|
+
CarrotQuestLogEntry(
|
|
649
|
+
timestampMs: entry.timestamp.timeIntervalSince1970 * 1000,
|
|
650
|
+
level: CarrotQuest.jsLogLevel(entry.level),
|
|
651
|
+
category: CarrotQuest.jsLogCategory(entry.category),
|
|
652
|
+
tag: entry.tag,
|
|
653
|
+
message: entry.message,
|
|
654
|
+
fields: entry.fields,
|
|
655
|
+
error: entry.error.map { String(describing: $0) }
|
|
656
|
+
)
|
|
657
|
+
)
|
|
587
658
|
}
|
|
588
659
|
}
|
|
@@ -133,6 +133,9 @@ import CarrotSDK
|
|
|
133
133
|
/// - useEuServer: Route traffic to Carrot's EU servers.
|
|
134
134
|
/// - appGroup: App Group shared with your Notification Service Extension.
|
|
135
135
|
/// - isServiceMode: Run without UI, for use inside an extension process.
|
|
136
|
+
/// - logLevel: Optional `SdkLogLevel` raw value, applied before `setup` so
|
|
137
|
+
/// initialisation itself is logged at the requested level.
|
|
138
|
+
/// - logIncludeSensitive: Allow tokens and user ids into SDK logs.
|
|
136
139
|
@objc public static func configure(
|
|
137
140
|
apiKey: String,
|
|
138
141
|
locale: String? = nil,
|
|
@@ -140,6 +143,8 @@ import CarrotSDK
|
|
|
140
143
|
useEuServer: Bool = false,
|
|
141
144
|
appGroup: String? = nil,
|
|
142
145
|
isServiceMode: Bool = false,
|
|
146
|
+
logLevel: NSNumber? = nil,
|
|
147
|
+
logIncludeSensitive: NSNumber? = nil,
|
|
143
148
|
completion: ((Error?) -> Void)? = nil
|
|
144
149
|
) {
|
|
145
150
|
let identity = Identity(
|
|
@@ -158,6 +163,10 @@ import CarrotSDK
|
|
|
158
163
|
|
|
159
164
|
let conflict = self.conflict(between: existing, and: identity)
|
|
160
165
|
|
|
166
|
+
if conflict == nil {
|
|
167
|
+
applyLogging(level: logLevel, includeSensitive: logIncludeSensitive)
|
|
168
|
+
}
|
|
169
|
+
|
|
161
170
|
if conflict == nil, let theme = theme {
|
|
162
171
|
// Identity matches, so this is a re-configure rather than a second
|
|
163
172
|
// init. Apply the mutable options instead of dropping them — a native
|
|
@@ -178,6 +187,8 @@ import CarrotSDK
|
|
|
178
187
|
|
|
179
188
|
// Join the in-flight attempt rather than initialising a second time, but
|
|
180
189
|
// carry this caller's theme into it so it is not lost.
|
|
190
|
+
applyLogging(level: logLevel, includeSensitive: logIncludeSensitive)
|
|
191
|
+
|
|
181
192
|
if let theme = theme {
|
|
182
193
|
pendingTheme = theme
|
|
183
194
|
}
|
|
@@ -202,6 +213,9 @@ import CarrotSDK
|
|
|
202
213
|
applyLocale(locale)
|
|
203
214
|
}
|
|
204
215
|
|
|
216
|
+
// Logging first, so initialisation itself is covered by the level.
|
|
217
|
+
applyLogging(level: logLevel, includeSensitive: logIncludeSensitive)
|
|
218
|
+
|
|
205
219
|
DispatchQueue.global(qos: .userInitiated).async {
|
|
206
220
|
Carrot.shared.setup(
|
|
207
221
|
withApiKey: apiKey,
|
|
@@ -279,6 +293,17 @@ import CarrotSDK
|
|
|
279
293
|
}
|
|
280
294
|
}
|
|
281
295
|
|
|
296
|
+
/// Apply logging options. Plain setters, safe before or after `setup`.
|
|
297
|
+
private static func applyLogging(level: NSNumber?, includeSensitive: NSNumber?) {
|
|
298
|
+
if let level = level, let value = SdkLogLevel(rawValue: level.intValue) {
|
|
299
|
+
Carrot.shared.setLogLevel(value)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if let includeSensitive = includeSensitive {
|
|
303
|
+
Carrot.shared.setLogIncludeSensitive(includeSensitive.boolValue)
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
282
307
|
/// Refuse to re-point a live SDK at a different account or server.
|
|
283
308
|
///
|
|
284
309
|
/// Silently keeping the first configuration would let a second `setup` call
|
|
@@ -8,8 +8,8 @@ import type { HybridObject } from 'react-native-nitro-modules';
|
|
|
8
8
|
*/
|
|
9
9
|
export type CarrotQuestTheme = 'light' | 'dark' | 'fromDevice' | 'fromWeb';
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Native SDK log level, in increasing verbosity. Both platforms (iOS needs
|
|
12
|
+
* `CarrotquestSDK` 3.4+).
|
|
13
13
|
*
|
|
14
14
|
* `debugging` maps to the SDK's `DEBUG` level. It is spelled out rather than
|
|
15
15
|
* abbreviated because Nitro derives a C++ enum member from each value, and
|
|
@@ -18,11 +18,12 @@ export type CarrotQuestTheme = 'light' | 'dark' | 'fromDevice' | 'fromWeb';
|
|
|
18
18
|
*/
|
|
19
19
|
export type CarrotQuestLogLevel = 'none' | 'error' | 'warn' | 'info' | 'debugging' | 'verbose';
|
|
20
20
|
/**
|
|
21
|
-
* Which subsystem produced a log entry. Mirrors
|
|
21
|
+
* Which subsystem produced a log entry. Mirrors `SdkLogCategory`. `database` is
|
|
22
|
+
* emitted by Android only.
|
|
22
23
|
*/
|
|
23
24
|
export type CarrotQuestLogCategory = 'general' | 'network' | 'connectivity' | 'auth' | 'realtime' | 'lifecycle' | 'database' | 'push';
|
|
24
25
|
/**
|
|
25
|
-
* A single log line emitted by the native SDK.
|
|
26
|
+
* A single log line emitted by the native SDK.
|
|
26
27
|
*/
|
|
27
28
|
export interface CarrotQuestLogEntry {
|
|
28
29
|
/** Milliseconds since the Unix epoch. */
|
|
@@ -148,11 +149,11 @@ export interface CarrotQuestSetupOptions {
|
|
|
148
149
|
* Android only.
|
|
149
150
|
*/
|
|
150
151
|
notificationIconResourceName?: string;
|
|
151
|
-
/** SDK log level.
|
|
152
|
+
/** SDK log level. */
|
|
152
153
|
logLevel?: CarrotQuestLogLevel;
|
|
153
154
|
/**
|
|
154
|
-
* Allow sensitive values (tokens, user ids) into SDK logs.
|
|
155
|
-
*
|
|
155
|
+
* Allow sensitive values (tokens, user ids) into SDK logs. Leave off in
|
|
156
|
+
* production.
|
|
156
157
|
*/
|
|
157
158
|
logIncludeSensitive?: boolean;
|
|
158
159
|
}
|
|
@@ -366,14 +367,15 @@ export interface CarrotQuest extends HybridObject<{
|
|
|
366
367
|
/**
|
|
367
368
|
* A formatted dump of the SDK's internal state and recent logs.
|
|
368
369
|
*
|
|
369
|
-
*
|
|
370
|
+
* Backed by `getDiagnostics()` on both platforms. Safe to call before or
|
|
371
|
+
* after {@link setup} — including after it fails, when the dump is most
|
|
372
|
+
* useful.
|
|
370
373
|
*/
|
|
371
374
|
getDiagnostics(): string | undefined;
|
|
372
375
|
/**
|
|
373
376
|
* Receive the SDK's log entries, e.g. to forward them to a crash reporter.
|
|
374
377
|
*
|
|
375
|
-
*
|
|
376
|
-
* logging hook.
|
|
378
|
+
* Backed by `setLogSink` on both platforms.
|
|
377
379
|
*
|
|
378
380
|
* Entries are filtered by {@link CarrotQuestSetupOptions.logLevel}, so leave
|
|
379
381
|
* that at `info` or lower in production — `verbose` crosses the bridge for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CarrotQuest.nitro.d.ts","sourceRoot":"","sources":["../../../src/CarrotQuest.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;AAE3E;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,GAC7B,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAE/D
|
|
1
|
+
{"version":3,"file":"CarrotQuest.nitro.d.ts","sourceRoot":"","sources":["../../../src/CarrotQuest.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D;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IAEnC,+DAA+D;IAC/D,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAIrC;;;;;;OAMG;IACH,cAAc,IAAI,MAAM,GAAG,SAAS,CAAC;IAErC;;;;;;;;;OASG;IACH,KAAK,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,GAAG,IAAI,CAAC;IAE5D;;;;;;;OAOG;IACH,MAAM,IAAI,IAAI,CAAC;CAChB"}
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.carrotquest
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_CarrotQuestLogEntry_cxx: Func_void_CarrotQuestLogEntry {
|
|
|
59
58
|
override fun invoke(entry: CarrotQuestLogEntry): Unit
|
|
60
59
|
= invoke_cxx(entry)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(entry: CarrotQuestLogEntry): Unit
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.carrotquest
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_bool_cxx: Func_void_bool {
|
|
|
59
58
|
override fun invoke(visible: Boolean): Unit
|
|
60
59
|
= invoke_cxx(visible)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(visible: Boolean): Unit
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.carrotquest
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_double_cxx: Func_void_double {
|
|
|
59
58
|
override fun invoke(count: Double): Unit
|
|
60
59
|
= invoke_cxx(count)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(count: Double): Unit
|
|
64
62
|
}
|
|
65
63
|
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/Func_void_std__string.kt
CHANGED
|
@@ -10,7 +10,6 @@ package com.margelo.nitro.carrotquest
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
-
import dalvik.annotation.optimization.FastNative
|
|
14
13
|
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -59,7 +58,6 @@ class Func_void_std__string_cxx: Func_void_std__string {
|
|
|
59
58
|
override fun invoke(url: String): Unit
|
|
60
59
|
= invoke_cxx(url)
|
|
61
60
|
|
|
62
|
-
@FastNative
|
|
63
61
|
private external fun invoke_cxx(url: String): Unit
|
|
64
62
|
}
|
|
65
63
|
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/carrotquest/HybridCarrotQuestSpec.kt
CHANGED
|
@@ -10,6 +10,7 @@ package com.margelo.nitro.carrotquest
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
13
14
|
import com.margelo.nitro.core.Promise
|
|
14
15
|
import com.margelo.nitro.core.HybridObject
|
|
15
16
|
|
|
@@ -197,6 +198,7 @@ abstract class HybridCarrotQuestSpec: HybridObject() {
|
|
|
197
198
|
@Keep
|
|
198
199
|
protected open class CxxPart(javaPart: HybridCarrotQuestSpec): HybridObject.CxxPart(javaPart) {
|
|
199
200
|
// C++ JHybridCarrotQuestSpec::CxxPart::initHybrid(...)
|
|
201
|
+
@FastNative
|
|
200
202
|
external override fun initHybrid(): HybridData
|
|
201
203
|
}
|
|
202
204
|
override fun createCxxPart(): CxxPart {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-carrot-quest",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Unofficial React Native bindings for the Carrot quest SDK, built with Nitro Modules.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -42,7 +42,8 @@
|
|
|
42
42
|
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
43
43
|
"test": "jest",
|
|
44
44
|
"test:coverage": "jest --coverage",
|
|
45
|
-
"verify:native": "node scripts/verify-native-api.mjs"
|
|
45
|
+
"verify:native": "node scripts/verify-native-api.mjs",
|
|
46
|
+
"release": "release-it --only-version"
|
|
46
47
|
},
|
|
47
48
|
"keywords": [
|
|
48
49
|
"react-native",
|
|
@@ -64,34 +65,39 @@
|
|
|
64
65
|
"registry": "https://registry.npmjs.org/"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
68
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
67
69
|
"@eslint/compat": "^2.1.0",
|
|
68
70
|
"@eslint/eslintrc": "^3.3.5",
|
|
69
71
|
"@eslint/js": "^10.0.1",
|
|
70
72
|
"@react-native/babel-preset": "0.85.0",
|
|
71
73
|
"@react-native/eslint-config": "0.85.0",
|
|
74
|
+
"@release-it/conventional-changelog": "^12.0.0",
|
|
72
75
|
"@types/jest": "^29",
|
|
73
76
|
"@types/node": "^26.1.2",
|
|
74
77
|
"@types/react": "^19.2.0",
|
|
75
78
|
"babel-jest": "^29",
|
|
79
|
+
"commitlint": "^21.2.1",
|
|
76
80
|
"del-cli": "^7.0.0",
|
|
77
81
|
"eslint": "^9.39.4",
|
|
78
82
|
"eslint-config-prettier": "^10.1.8",
|
|
79
83
|
"eslint-plugin-ft-flow": "^3.0.11",
|
|
80
84
|
"eslint-plugin-prettier": "^5.5.6",
|
|
81
85
|
"jest": "^29",
|
|
82
|
-
"
|
|
86
|
+
"lefthook": "^2.1.10",
|
|
87
|
+
"nitrogen": "^0.37.1",
|
|
83
88
|
"prettier": "^3.8.3",
|
|
84
89
|
"react": "19.2.3",
|
|
85
90
|
"react-native": "0.85.0",
|
|
86
91
|
"react-native-builder-bob": "^0.41.0",
|
|
87
|
-
"react-native-nitro-modules": "^0.
|
|
92
|
+
"react-native-nitro-modules": "^0.37.1",
|
|
93
|
+
"release-it": "^21.0.1",
|
|
88
94
|
"turbo": "^2.9.16",
|
|
89
95
|
"typescript": "^6.0.3"
|
|
90
96
|
},
|
|
91
97
|
"peerDependencies": {
|
|
92
98
|
"react": "*",
|
|
93
99
|
"react-native": "*",
|
|
94
|
-
"react-native-nitro-modules": "^0.
|
|
100
|
+
"react-native-nitro-modules": "^0.37.1"
|
|
95
101
|
},
|
|
96
102
|
"workspaces": [
|
|
97
103
|
"example"
|
|
@@ -136,5 +142,32 @@
|
|
|
136
142
|
"eslint"
|
|
137
143
|
],
|
|
138
144
|
"version": "0.63.0"
|
|
145
|
+
},
|
|
146
|
+
"release-it": {
|
|
147
|
+
"git": {
|
|
148
|
+
"commitMessage": "chore: release ${version}",
|
|
149
|
+
"tagName": "v${version}",
|
|
150
|
+
"requireBranch": "main"
|
|
151
|
+
},
|
|
152
|
+
"npm": {
|
|
153
|
+
"publish": false
|
|
154
|
+
},
|
|
155
|
+
"github": {
|
|
156
|
+
"release": false
|
|
157
|
+
},
|
|
158
|
+
"plugins": {
|
|
159
|
+
"@release-it/conventional-changelog": {
|
|
160
|
+
"infile": "CHANGELOG.md",
|
|
161
|
+
"header": "# Changelog",
|
|
162
|
+
"preset": {
|
|
163
|
+
"name": "conventionalcommits"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"commitlint": {
|
|
169
|
+
"extends": [
|
|
170
|
+
"@commitlint/config-conventional"
|
|
171
|
+
]
|
|
139
172
|
}
|
|
140
173
|
}
|
package/src/CarrotQuest.nitro.ts
CHANGED
|
@@ -10,8 +10,8 @@ import type { HybridObject } from 'react-native-nitro-modules';
|
|
|
10
10
|
export type CarrotQuestTheme = 'light' | 'dark' | 'fromDevice' | 'fromWeb';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* Native SDK log level, in increasing verbosity. Both platforms (iOS needs
|
|
14
|
+
* `CarrotquestSDK` 3.4+).
|
|
15
15
|
*
|
|
16
16
|
* `debugging` maps to the SDK's `DEBUG` level. It is spelled out rather than
|
|
17
17
|
* abbreviated because Nitro derives a C++ enum member from each value, and
|
|
@@ -22,7 +22,8 @@ export type CarrotQuestLogLevel =
|
|
|
22
22
|
'none' | 'error' | 'warn' | 'info' | 'debugging' | 'verbose';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
-
* Which subsystem produced a log entry. Mirrors
|
|
25
|
+
* Which subsystem produced a log entry. Mirrors `SdkLogCategory`. `database` is
|
|
26
|
+
* emitted by Android only.
|
|
26
27
|
*/
|
|
27
28
|
export type CarrotQuestLogCategory =
|
|
28
29
|
| 'general'
|
|
@@ -35,7 +36,7 @@ export type CarrotQuestLogCategory =
|
|
|
35
36
|
| 'push';
|
|
36
37
|
|
|
37
38
|
/**
|
|
38
|
-
* A single log line emitted by the native SDK.
|
|
39
|
+
* A single log line emitted by the native SDK.
|
|
39
40
|
*/
|
|
40
41
|
export interface CarrotQuestLogEntry {
|
|
41
42
|
/** Milliseconds since the Unix epoch. */
|
|
@@ -189,11 +190,11 @@ export interface CarrotQuestSetupOptions {
|
|
|
189
190
|
* Android only.
|
|
190
191
|
*/
|
|
191
192
|
notificationIconResourceName?: string;
|
|
192
|
-
/** SDK log level.
|
|
193
|
+
/** SDK log level. */
|
|
193
194
|
logLevel?: CarrotQuestLogLevel;
|
|
194
195
|
/**
|
|
195
|
-
* Allow sensitive values (tokens, user ids) into SDK logs.
|
|
196
|
-
*
|
|
196
|
+
* Allow sensitive values (tokens, user ids) into SDK logs. Leave off in
|
|
197
|
+
* production.
|
|
197
198
|
*/
|
|
198
199
|
logIncludeSensitive?: boolean;
|
|
199
200
|
}
|
|
@@ -464,15 +465,16 @@ export interface CarrotQuest extends HybridObject<{
|
|
|
464
465
|
/**
|
|
465
466
|
* A formatted dump of the SDK's internal state and recent logs.
|
|
466
467
|
*
|
|
467
|
-
*
|
|
468
|
+
* Backed by `getDiagnostics()` on both platforms. Safe to call before or
|
|
469
|
+
* after {@link setup} — including after it fails, when the dump is most
|
|
470
|
+
* useful.
|
|
468
471
|
*/
|
|
469
472
|
getDiagnostics(): string | undefined;
|
|
470
473
|
|
|
471
474
|
/**
|
|
472
475
|
* Receive the SDK's log entries, e.g. to forward them to a crash reporter.
|
|
473
476
|
*
|
|
474
|
-
*
|
|
475
|
-
* logging hook.
|
|
477
|
+
* Backed by `setLogSink` on both platforms.
|
|
476
478
|
*
|
|
477
479
|
* Entries are filtered by {@link CarrotQuestSetupOptions.logLevel}, so leave
|
|
478
480
|
* that at `info` or lower in production — `verbose` crosses the bridge for
|