Skip to content

Commit

Permalink
Merge pull request #22 from negativetwelve/ios/restart-session
Browse files Browse the repository at this point in the history
[iOS] Add restartSession method and stub for android
  • Loading branch information
negativetwelve authored Nov 4, 2016
2 parents 06dd738 + 234b5a2 commit 80b0a30
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
12 changes: 12 additions & 0 deletions android/src/main/java/com/rnuxcam/rnuxcam/UXCamModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ public void stopApplicationAndUploadData() {
UXCam.stopApplicationAndUploadData();
}

@SuppressWarnings("unused")
@ReactMethod
public void restartSession() {
// TODO(mark): Not available on Android.
}

@SuppressWarnings("unused")
@ReactMethod
public void setAutomaticScreenNameTagging(boolean automaticScreenNameTagging) {
// TODO(mark): Not available on Android.
}

@SuppressWarnings("unused")
@ReactMethod
public void occludeSensitiveScreen(boolean occlude) {
Expand Down
4 changes: 4 additions & 0 deletions ios/RNUXCam.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ - (dispatch_queue_t)methodQueue {
[UXCam stopApplicationAndUploadData];
}

RCT_EXPORT_METHOD(restartSession) {
[UXCam restartSession];
}

RCT_EXPORT_METHOD(setAutomaticScreenNameTagging:(BOOL)automaticScreenNameTagging) {
[UXCam SetAutomaticScreenNameTagging:automaticScreenNameTagging];
}
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ UXCam.occludeSensitiveScreen(false);

// Stop recording and upload data manually.
UXCam.stopApplicationAndUploadData();

// To start a new recording:
UXCam.restartSession();
```

If a method is missing from the official SDK, please send a PR!
15 changes: 6 additions & 9 deletions src/UXCam.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Libraries
import {NativeModules, Platform} from 'react-native';
import {NativeModules} from 'react-native';

// Native Modules
const {RNUXCam} = NativeModules;
Expand All @@ -18,15 +18,12 @@ class UXCam {
return RNUXCam.stopApplicationAndUploadData();
}

restartSession() {
return RNUXCam.restartSession();
}

setAutomaticScreenNameTagging(enableScreenNameTagging) {
if (Platform.OS === 'android') {
// eslint-disable-next-line
console.warn(
'UXCam#setAutomaticScreenNameTagging not available on Android',
);
} else {
return RNUXCam.setAutomaticScreenNameTagging(enableScreenNameTagging);
}
return RNUXCam.setAutomaticScreenNameTagging(enableScreenNameTagging);
}

// --------------------------------------------------
Expand Down

0 comments on commit 80b0a30

Please sign in to comment.