Skip to content

Commit f6aa49f

Browse files
committed
🔨 Migrating Sample App to new SDK structure
1 parent 67135e7 commit f6aa49f

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

InstabugSample/App.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
ScrollView
1717
} from 'react-native';
1818

19-
import Instabug from'instabug-reactnative';
19+
import Instabug, {BugReporting, FeatureRequests, Surveys} from'instabug-reactnative';
2020

2121

2222
const instructions = Platform.select({
@@ -139,30 +139,43 @@ export default class App extends Component<{}> {
139139
}
140140

141141
invoke() {
142-
Instabug.invoke();
142+
BugReporting.invoke();
143+
}
144+
143145
}
144146

145147
sendBugReport() {
146-
Instabug.invokeWithInvocationMode(Instabug.invocationMode.newBug);
148+
BugReporting.invokeWithInvocationModeAndOptions(BugReporting.invocationMode.newBug, []);
149+
}
150+
151+
sendCrashReport() {
152+
try {
153+
throw new Error('Text Handled Exception From Instabug Test App');
154+
} catch (Exception) {
155+
Instabug.reportJSException(Exception);
156+
alert('Crash report Sent!');
157+
}
147158
}
148159

149160
sendFeedback() {
150-
Instabug.invokeWithInvocationMode(Instabug.invocationMode.newFeedback);
161+
BugReporting.invokeWithInvocationModeAndOptions(BugReporting.invocationMode.newFeedback, []);
151162
}
152163

153164
changeInvocationEvent(invocationEvent) {
154165
if(invocationEvent === 'Shake')
155-
Instabug.setInvocationEvent(Instabug.invocationEvent.shake);
166+
BugReporting.setInvocationEvents([BugReporting.invocationEvent.shake]);
156167
if(invocationEvent === 'Button')
157-
Instabug.setInvocationEvent(Instabug.invocationEvent.floatingButton);
168+
Instabug.setInvocationEvent(BugReporting.invocationEvent.floatingButton);
158169
if(invocationEvent === 'Screenshot')
159-
Instabug.setInvocationEvent(Instabug.invocationEvent.screenshot);
170+
BugReporting.setInvocationEvents([BugReporting.invocationEvent.screenshot]);
171+
if(invocationEvent === 'twoFingersSwipe')
172+
BugReporting.setInvocationEvents([BugReporting.invocationEvent.twoFingersSwipe]);
160173
if(invocationEvent === 'None')
161-
Instabug.setInvocationEvent(Instabug.invocationEvent.none);
174+
BugReporting.setInvocationEvents([BugReporting.invocationEvent.none]);
162175
}
163176

164177
startNewConversation() {
165-
Instabug.invokeWithInvocationMode(Instabug.invocationMode.newChat);
178+
BugReporting.invokeWithInvocationModeAndOptions(BugReporting.invocationMode.newChat, []);
166179
}
167180

168181
showUnreadMessagesCount() {

0 commit comments

Comments
 (0)