Skip to content

Commit 631fb3b

Browse files
committed
some error handling if start recording goes bad and startRecording and stopRecording now return the array of recordings
1 parent ed21504 commit 631fb3b

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

ios/RNReactNativeReplaykit.m

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,18 @@ - (dispatch_queue_t)methodQueue
3030
[self.screenRecordCoordinator
3131
startRecordingWithFileName:randomString
3232
recordingHandler:^(NSError *error) {
33-
3433
if(error)
3534
{
36-
35+
callback(@[[NSNull null], error.localizedDescription]);
3736
}
3837
}
3938
onCompletion:^(NSError *error) {
40-
4139
if(error)
4240
{
41+
callback(@[[NSNull null], error.localizedDescription]);
42+
} else {
43+
NSArray *recordings = [self.screenRecordCoordinator listAllReplays];
44+
callback(@[recordings, [NSNull null]]);
4345
}
4446
}];
4547
}
@@ -75,9 +77,12 @@ - (dispatch_queue_t)methodQueue
7577
callback(@[recordings]);
7678
}
7779

78-
RCT_EXPORT_METHOD(stopRecording)
80+
RCT_EXPORT_METHOD(stopRecording:(RCTResponseSenderBlock)callback)
7981
{
8082
[self.screenRecordCoordinator stopRecording];
83+
NSArray *recordings = [self.screenRecordCoordinator listAllReplays];
84+
callback(@[recordings]);
85+
8186
}
8287

8388
RCT_EXPORT_METHOD(previewRecording:(NSString *)path)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "1.0.1",
44
"description": "",
55
"main": "index.js",
6+
"license" : "MIT",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1"
89
},

0 commit comments

Comments
 (0)