@rejourneyco/react-native 1.0.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/android/build.gradle.kts +135 -0
- package/android/consumer-rules.pro +10 -0
- package/android/proguard-rules.pro +1 -0
- package/android/src/main/AndroidManifest.xml +15 -0
- package/android/src/main/java/com/rejourney/RejourneyModuleImpl.kt +2981 -0
- package/android/src/main/java/com/rejourney/capture/ANRHandler.kt +206 -0
- package/android/src/main/java/com/rejourney/capture/ActivityTracker.kt +98 -0
- package/android/src/main/java/com/rejourney/capture/CaptureEngine.kt +1553 -0
- package/android/src/main/java/com/rejourney/capture/CaptureHeuristics.kt +375 -0
- package/android/src/main/java/com/rejourney/capture/CrashHandler.kt +153 -0
- package/android/src/main/java/com/rejourney/capture/MotionEvent.kt +215 -0
- package/android/src/main/java/com/rejourney/capture/SegmentUploader.kt +512 -0
- package/android/src/main/java/com/rejourney/capture/VideoEncoder.kt +773 -0
- package/android/src/main/java/com/rejourney/capture/ViewHierarchyScanner.kt +633 -0
- package/android/src/main/java/com/rejourney/capture/ViewSerializer.kt +286 -0
- package/android/src/main/java/com/rejourney/core/Constants.kt +117 -0
- package/android/src/main/java/com/rejourney/core/Logger.kt +93 -0
- package/android/src/main/java/com/rejourney/core/Types.kt +124 -0
- package/android/src/main/java/com/rejourney/lifecycle/SessionLifecycleService.kt +162 -0
- package/android/src/main/java/com/rejourney/network/DeviceAuthManager.kt +747 -0
- package/android/src/main/java/com/rejourney/network/HttpClientProvider.kt +16 -0
- package/android/src/main/java/com/rejourney/network/NetworkMonitor.kt +272 -0
- package/android/src/main/java/com/rejourney/network/UploadManager.kt +1363 -0
- package/android/src/main/java/com/rejourney/network/UploadWorker.kt +492 -0
- package/android/src/main/java/com/rejourney/privacy/PrivacyMask.kt +645 -0
- package/android/src/main/java/com/rejourney/touch/GestureClassifier.kt +233 -0
- package/android/src/main/java/com/rejourney/touch/KeyboardTracker.kt +158 -0
- package/android/src/main/java/com/rejourney/touch/TextInputTracker.kt +181 -0
- package/android/src/main/java/com/rejourney/touch/TouchInterceptor.kt +591 -0
- package/android/src/main/java/com/rejourney/utils/EventBuffer.kt +284 -0
- package/android/src/main/java/com/rejourney/utils/OEMDetector.kt +154 -0
- package/android/src/main/java/com/rejourney/utils/PerfTiming.kt +235 -0
- package/android/src/main/java/com/rejourney/utils/Telemetry.kt +297 -0
- package/android/src/main/java/com/rejourney/utils/WindowUtils.kt +84 -0
- package/android/src/newarch/java/com/rejourney/RejourneyModule.kt +187 -0
- package/android/src/newarch/java/com/rejourney/RejourneyPackage.kt +40 -0
- package/android/src/oldarch/java/com/rejourney/RejourneyModule.kt +218 -0
- package/android/src/oldarch/java/com/rejourney/RejourneyPackage.kt +23 -0
- package/ios/Capture/RJANRHandler.h +42 -0
- package/ios/Capture/RJANRHandler.m +328 -0
- package/ios/Capture/RJCaptureEngine.h +275 -0
- package/ios/Capture/RJCaptureEngine.m +2062 -0
- package/ios/Capture/RJCaptureHeuristics.h +80 -0
- package/ios/Capture/RJCaptureHeuristics.m +903 -0
- package/ios/Capture/RJCrashHandler.h +46 -0
- package/ios/Capture/RJCrashHandler.m +313 -0
- package/ios/Capture/RJMotionEvent.h +183 -0
- package/ios/Capture/RJMotionEvent.m +183 -0
- package/ios/Capture/RJPerformanceManager.h +100 -0
- package/ios/Capture/RJPerformanceManager.m +373 -0
- package/ios/Capture/RJPixelBufferDownscaler.h +42 -0
- package/ios/Capture/RJPixelBufferDownscaler.m +85 -0
- package/ios/Capture/RJSegmentUploader.h +146 -0
- package/ios/Capture/RJSegmentUploader.m +778 -0
- package/ios/Capture/RJVideoEncoder.h +247 -0
- package/ios/Capture/RJVideoEncoder.m +1036 -0
- package/ios/Capture/RJViewControllerTracker.h +73 -0
- package/ios/Capture/RJViewControllerTracker.m +508 -0
- package/ios/Capture/RJViewHierarchyScanner.h +215 -0
- package/ios/Capture/RJViewHierarchyScanner.m +1464 -0
- package/ios/Capture/RJViewSerializer.h +119 -0
- package/ios/Capture/RJViewSerializer.m +498 -0
- package/ios/Core/RJConstants.h +124 -0
- package/ios/Core/RJConstants.m +88 -0
- package/ios/Core/RJLifecycleManager.h +85 -0
- package/ios/Core/RJLifecycleManager.m +308 -0
- package/ios/Core/RJLogger.h +61 -0
- package/ios/Core/RJLogger.m +211 -0
- package/ios/Core/RJTypes.h +176 -0
- package/ios/Core/RJTypes.m +66 -0
- package/ios/Core/Rejourney.h +64 -0
- package/ios/Core/Rejourney.mm +2495 -0
- package/ios/Network/RJDeviceAuthManager.h +94 -0
- package/ios/Network/RJDeviceAuthManager.m +967 -0
- package/ios/Network/RJNetworkMonitor.h +68 -0
- package/ios/Network/RJNetworkMonitor.m +267 -0
- package/ios/Network/RJRetryManager.h +73 -0
- package/ios/Network/RJRetryManager.m +325 -0
- package/ios/Network/RJUploadManager.h +267 -0
- package/ios/Network/RJUploadManager.m +2296 -0
- package/ios/Privacy/RJPrivacyMask.h +163 -0
- package/ios/Privacy/RJPrivacyMask.m +922 -0
- package/ios/Rejourney.h +63 -0
- package/ios/Touch/RJGestureClassifier.h +130 -0
- package/ios/Touch/RJGestureClassifier.m +333 -0
- package/ios/Touch/RJTouchInterceptor.h +169 -0
- package/ios/Touch/RJTouchInterceptor.m +772 -0
- package/ios/Utils/RJEventBuffer.h +112 -0
- package/ios/Utils/RJEventBuffer.m +358 -0
- package/ios/Utils/RJGzipUtils.h +33 -0
- package/ios/Utils/RJGzipUtils.m +89 -0
- package/ios/Utils/RJKeychainManager.h +48 -0
- package/ios/Utils/RJKeychainManager.m +111 -0
- package/ios/Utils/RJPerfTiming.h +209 -0
- package/ios/Utils/RJPerfTiming.m +264 -0
- package/ios/Utils/RJTelemetry.h +92 -0
- package/ios/Utils/RJTelemetry.m +320 -0
- package/ios/Utils/RJWindowUtils.h +66 -0
- package/ios/Utils/RJWindowUtils.m +133 -0
- package/lib/commonjs/NativeRejourney.js +40 -0
- package/lib/commonjs/components/Mask.js +79 -0
- package/lib/commonjs/index.js +1381 -0
- package/lib/commonjs/sdk/autoTracking.js +1259 -0
- package/lib/commonjs/sdk/constants.js +151 -0
- package/lib/commonjs/sdk/errorTracking.js +199 -0
- package/lib/commonjs/sdk/index.js +50 -0
- package/lib/commonjs/sdk/metricsTracking.js +204 -0
- package/lib/commonjs/sdk/navigation.js +151 -0
- package/lib/commonjs/sdk/networkInterceptor.js +412 -0
- package/lib/commonjs/sdk/utils.js +363 -0
- package/lib/commonjs/types/expo-router.d.js +2 -0
- package/lib/commonjs/types/index.js +2 -0
- package/lib/module/NativeRejourney.js +38 -0
- package/lib/module/components/Mask.js +72 -0
- package/lib/module/index.js +1284 -0
- package/lib/module/sdk/autoTracking.js +1233 -0
- package/lib/module/sdk/constants.js +145 -0
- package/lib/module/sdk/errorTracking.js +189 -0
- package/lib/module/sdk/index.js +12 -0
- package/lib/module/sdk/metricsTracking.js +187 -0
- package/lib/module/sdk/navigation.js +143 -0
- package/lib/module/sdk/networkInterceptor.js +401 -0
- package/lib/module/sdk/utils.js +342 -0
- package/lib/module/types/expo-router.d.js +2 -0
- package/lib/module/types/index.js +2 -0
- package/lib/typescript/NativeRejourney.d.ts +147 -0
- package/lib/typescript/components/Mask.d.ts +39 -0
- package/lib/typescript/index.d.ts +117 -0
- package/lib/typescript/sdk/autoTracking.d.ts +204 -0
- package/lib/typescript/sdk/constants.d.ts +120 -0
- package/lib/typescript/sdk/errorTracking.d.ts +32 -0
- package/lib/typescript/sdk/index.d.ts +9 -0
- package/lib/typescript/sdk/metricsTracking.d.ts +58 -0
- package/lib/typescript/sdk/navigation.d.ts +33 -0
- package/lib/typescript/sdk/networkInterceptor.d.ts +47 -0
- package/lib/typescript/sdk/utils.d.ts +148 -0
- package/lib/typescript/types/index.d.ts +624 -0
- package/package.json +102 -0
- package/rejourney.podspec +21 -0
- package/src/NativeRejourney.ts +165 -0
- package/src/components/Mask.tsx +80 -0
- package/src/index.ts +1459 -0
- package/src/sdk/autoTracking.ts +1373 -0
- package/src/sdk/constants.ts +134 -0
- package/src/sdk/errorTracking.ts +231 -0
- package/src/sdk/index.ts +11 -0
- package/src/sdk/metricsTracking.ts +232 -0
- package/src/sdk/navigation.ts +157 -0
- package/src/sdk/networkInterceptor.ts +440 -0
- package/src/sdk/utils.ts +369 -0
- package/src/types/expo-router.d.ts +7 -0
- package/src/types/index.ts +739 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
|
|
2
|
+
#import "RJPixelBufferDownscaler.h"
|
|
3
|
+
#import <Accelerate/Accelerate.h>
|
|
4
|
+
|
|
5
|
+
@implementation RJPixelBufferDownscaler
|
|
6
|
+
|
|
7
|
+
+ (CVPixelBufferRef)downscale:(CVPixelBufferRef)src
|
|
8
|
+
toW:(size_t)dstW
|
|
9
|
+
toH:(size_t)dstH
|
|
10
|
+
usingPool:(CVPixelBufferPoolRef)pool {
|
|
11
|
+
return [self downscale:src
|
|
12
|
+
toW:dstW
|
|
13
|
+
toH:dstH
|
|
14
|
+
usingPool:pool
|
|
15
|
+
quality:RJDownscaleQualityBalanced];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
+ (CVPixelBufferRef)downscale:(CVPixelBufferRef)src
|
|
19
|
+
toW:(size_t)dstW
|
|
20
|
+
toH:(size_t)dstH
|
|
21
|
+
usingPool:(CVPixelBufferPoolRef)pool
|
|
22
|
+
quality:(RJDownscaleQuality)quality {
|
|
23
|
+
|
|
24
|
+
if (!src)
|
|
25
|
+
return NULL;
|
|
26
|
+
|
|
27
|
+
CVPixelBufferRef dst = NULL;
|
|
28
|
+
CVReturn status = kCVReturnError;
|
|
29
|
+
|
|
30
|
+
if (pool) {
|
|
31
|
+
status = CVPixelBufferPoolCreatePixelBuffer(NULL, pool, &dst);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (status != kCVReturnSuccess || !dst) {
|
|
35
|
+
NSDictionary *options = @{
|
|
36
|
+
(id)kCVPixelBufferCGImageCompatibilityKey : @YES,
|
|
37
|
+
(id)kCVPixelBufferCGBitmapContextCompatibilityKey : @YES,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
status = CVPixelBufferCreate(
|
|
41
|
+
kCFAllocatorDefault, dstW, dstH,
|
|
42
|
+
CVPixelBufferGetPixelFormatType(src),
|
|
43
|
+
(__bridge CFDictionaryRef)options, &dst);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (status != kCVReturnSuccess || !dst) {
|
|
47
|
+
return NULL;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
CVPixelBufferLockBaseAddress(src, kCVPixelBufferLock_ReadOnly);
|
|
51
|
+
CVPixelBufferLockBaseAddress(dst, 0);
|
|
52
|
+
|
|
53
|
+
vImage_Buffer srcBuf = {
|
|
54
|
+
.data = CVPixelBufferGetBaseAddress(src),
|
|
55
|
+
.height = CVPixelBufferGetHeight(src),
|
|
56
|
+
.width = CVPixelBufferGetWidth(src),
|
|
57
|
+
.rowBytes = CVPixelBufferGetBytesPerRow(src),
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
vImage_Buffer dstBuf = {
|
|
61
|
+
.data = CVPixelBufferGetBaseAddress(dst),
|
|
62
|
+
.height = dstH,
|
|
63
|
+
.width = dstW,
|
|
64
|
+
.rowBytes = CVPixelBufferGetBytesPerRow(dst),
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
vImage_Flags flags = kvImageDoNotTile;
|
|
68
|
+
if (quality == RJDownscaleQualityHigh) {
|
|
69
|
+
flags |= kvImageHighQualityResampling;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
vImage_Error error = vImageScale_ARGB8888(&srcBuf, &dstBuf, NULL, flags);
|
|
73
|
+
|
|
74
|
+
CVPixelBufferUnlockBaseAddress(dst, 0);
|
|
75
|
+
CVPixelBufferUnlockBaseAddress(src, kCVPixelBufferLock_ReadOnly);
|
|
76
|
+
|
|
77
|
+
if (error != kvImageNoError) {
|
|
78
|
+
CVPixelBufferRelease(dst);
|
|
79
|
+
return NULL;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return dst;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@end
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RJSegmentUploader.h
|
|
3
|
+
// Rejourney
|
|
4
|
+
//
|
|
5
|
+
// Uploads finished video segments to S3/R2 storage.
|
|
6
|
+
// Handles presigned URL requests and direct uploads.
|
|
7
|
+
//
|
|
8
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
// you may not use this file except in compliance with the License.
|
|
10
|
+
// You may obtain a copy of the License at
|
|
11
|
+
//
|
|
12
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
//
|
|
14
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
// See the License for the specific language governing permissions and
|
|
18
|
+
// limitations under the License.
|
|
19
|
+
//
|
|
20
|
+
// Copyright (c) 2026 Rejourney
|
|
21
|
+
//
|
|
22
|
+
|
|
23
|
+
#import <Foundation/Foundation.h>
|
|
24
|
+
|
|
25
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Completion handler for segment uploads.
|
|
29
|
+
*
|
|
30
|
+
* @param success Whether the upload succeeded.
|
|
31
|
+
* @param error Error if upload failed.
|
|
32
|
+
*/
|
|
33
|
+
typedef void (^RJSegmentUploadCompletion)(BOOL success, NSError *_Nullable error);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Uploads video segments and hierarchy snapshots to cloud storage.
|
|
37
|
+
*
|
|
38
|
+
* Uses the presigned URL flow:
|
|
39
|
+
* 1. Request presigned URL from backend
|
|
40
|
+
* 2. Upload directly to S3/R2
|
|
41
|
+
* 3. Notify backend of completion
|
|
42
|
+
*
|
|
43
|
+
* ## Features
|
|
44
|
+
* - Background upload support
|
|
45
|
+
* - Retry with exponential backoff
|
|
46
|
+
* - Queue management for multiple segments
|
|
47
|
+
* - Automatic cleanup of uploaded files
|
|
48
|
+
*
|
|
49
|
+
* ## Usage
|
|
50
|
+
* ```objc
|
|
51
|
+
* RJSegmentUploader *uploader = [[RJSegmentUploader alloc] initWithBaseURL:@"https://api.rejourney.co"];
|
|
52
|
+
* uploader.apiKey = @"rj_...";
|
|
53
|
+
* uploader.projectId = projectId;
|
|
54
|
+
*
|
|
55
|
+
* [uploader uploadVideoSegment:fileURL
|
|
56
|
+
* sessionId:sessionId
|
|
57
|
+
* startTime:startTime
|
|
58
|
+
* endTime:endTime
|
|
59
|
+
* frameCount:frameCount
|
|
60
|
+
* completion:^(BOOL success, NSError *error) {
|
|
61
|
+
* if (success) {
|
|
62
|
+
* // Clean up local file
|
|
63
|
+
* }
|
|
64
|
+
* }];
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
@interface RJSegmentUploader : NSObject
|
|
68
|
+
|
|
69
|
+
#pragma mark - Configuration
|
|
70
|
+
|
|
71
|
+
/// Base URL for the Rejourney API.
|
|
72
|
+
@property (nonatomic, copy) NSString *baseURL;
|
|
73
|
+
|
|
74
|
+
/// API key (public key rj_...) for authentication.
|
|
75
|
+
@property (nonatomic, copy, nullable) NSString *apiKey;
|
|
76
|
+
|
|
77
|
+
/// Project ID for the current recording session.
|
|
78
|
+
@property (nonatomic, copy, nullable) NSString *projectId;
|
|
79
|
+
|
|
80
|
+
/// Upload token from device auth for authenticated uploads.
|
|
81
|
+
@property (nonatomic, copy, nullable) NSString *uploadToken;
|
|
82
|
+
|
|
83
|
+
/// Maximum number of retry attempts. Default: 3.
|
|
84
|
+
@property (nonatomic, assign) NSInteger maxRetries;
|
|
85
|
+
|
|
86
|
+
/// Whether to delete local files after successful upload. Default: YES.
|
|
87
|
+
@property (nonatomic, assign) BOOL deleteAfterUpload;
|
|
88
|
+
|
|
89
|
+
/// Number of uploads currently in progress.
|
|
90
|
+
@property (nonatomic, readonly) NSInteger pendingUploads;
|
|
91
|
+
|
|
92
|
+
#pragma mark - Initialization
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Creates a new segment uploader with the specified base URL.
|
|
96
|
+
*
|
|
97
|
+
* @param baseURL The Rejourney API base URL.
|
|
98
|
+
* @return A new uploader instance.
|
|
99
|
+
*/
|
|
100
|
+
- (instancetype)initWithBaseURL:(NSString *)baseURL;
|
|
101
|
+
|
|
102
|
+
#pragma mark - Upload Methods
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Uploads a video segment to cloud storage.
|
|
106
|
+
*
|
|
107
|
+
* @param segmentURL Local file URL of the .mp4 segment.
|
|
108
|
+
* @param sessionId Session identifier.
|
|
109
|
+
* @param startTime Segment start time in epoch milliseconds.
|
|
110
|
+
* @param endTime Segment end time in epoch milliseconds.
|
|
111
|
+
* @param frameCount Number of frames in the segment.
|
|
112
|
+
* @param completion Callback when upload completes or fails.
|
|
113
|
+
*/
|
|
114
|
+
- (void)uploadVideoSegment:(NSURL *)segmentURL
|
|
115
|
+
sessionId:(NSString *)sessionId
|
|
116
|
+
startTime:(NSTimeInterval)startTime
|
|
117
|
+
endTime:(NSTimeInterval)endTime
|
|
118
|
+
frameCount:(NSInteger)frameCount
|
|
119
|
+
completion:(nullable RJSegmentUploadCompletion)completion;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Uploads a view hierarchy snapshot to cloud storage.
|
|
123
|
+
*
|
|
124
|
+
* @param hierarchyData JSON data of the hierarchy snapshot.
|
|
125
|
+
* @param sessionId Session identifier.
|
|
126
|
+
* @param timestamp Snapshot timestamp in epoch milliseconds.
|
|
127
|
+
* @param completion Callback when upload completes or fails.
|
|
128
|
+
*/
|
|
129
|
+
- (void)uploadHierarchy:(NSData *)hierarchyData
|
|
130
|
+
sessionId:(NSString *)sessionId
|
|
131
|
+
timestamp:(NSTimeInterval)timestamp
|
|
132
|
+
completion:(nullable RJSegmentUploadCompletion)completion;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Cancels all pending uploads.
|
|
136
|
+
*/
|
|
137
|
+
- (void)cancelAllUploads;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Cleans up any leftover segment files from previous sessions.
|
|
141
|
+
*/
|
|
142
|
+
- (void)cleanupOrphanedSegments;
|
|
143
|
+
|
|
144
|
+
@end
|
|
145
|
+
|
|
146
|
+
NS_ASSUME_NONNULL_END
|