1
1
import 'dart:async' ;
2
2
import 'dart:io' show Platform;
3
+
3
4
import 'package:flutter/services.dart' ;
4
5
import 'package:instabug_flutter/Instabug.dart' ;
5
6
@@ -74,7 +75,7 @@ class BugReporting {
74
75
75
76
///Enables and disables manual invocation and prompt options for bug and feedback.
76
77
/// [boolean] isEnabled
77
- static void setEnabled (bool isEnabled) async {
78
+ static Future < void > setEnabled (bool isEnabled) async {
78
79
final List <dynamic > params = < dynamic > [isEnabled];
79
80
await _channel.invokeMethod <Object >('setBugReportingEnabled:' , params);
80
81
}
@@ -83,7 +84,7 @@ class BugReporting {
83
84
/// This block is executed on the UI thread. Could be used for performing any
84
85
/// UI changes before the SDK's UI is shown.
85
86
/// [function] A callback that gets executed before invoking the SDK
86
- static void setOnInvokeCallback (Function function) async {
87
+ static Future < void > setOnInvokeCallback (Function function) async {
87
88
_channel.setMethodCallHandler (_handleMethod);
88
89
_onInvokeCallback = function;
89
90
await _channel.invokeMethod <Object >('setOnInvokeCallback' );
@@ -93,7 +94,7 @@ class BugReporting {
93
94
/// This block is executed on the UI thread. Could be used for performing any
94
95
/// UI changes before the SDK's UI is shown.
95
96
/// [function] A callback that gets executed before invoking the SDK
96
- static void setOnDismissCallback (Function function) async {
97
+ static Future < void > setOnDismissCallback (Function function) async {
97
98
_channel.setMethodCallHandler (_handleMethod);
98
99
_onDismissCallback = function;
99
100
await _channel.invokeMethod <Object >('setOnDismissCallback' );
@@ -102,7 +103,7 @@ class BugReporting {
102
103
/// Sets the events that invoke the feedback form.
103
104
/// Default is set by `Instabug.startWithToken` .
104
105
/// [invocationEvents] invocationEvent List of events that invokes the
105
- static void setInvocationEvents (
106
+ static Future < void > setInvocationEvents (
106
107
List <InvocationEvent > invocationEvents) async {
107
108
final List <String > invocationEventsStrings = < String > [];
108
109
if (invocationEvents != null ) {
@@ -121,8 +122,8 @@ class BugReporting {
121
122
/// attachments. In iOS 10+,NSPhotoLibraryUsageDescription should be set in
122
123
/// info.plist to enable gallery image attachments.
123
124
/// [screenRecording] A boolean to enable or disable screen recording attachments.
124
- static void setEnabledAttachmentTypes (bool screenshot, bool extraScreenshot ,
125
- bool galleryImage, bool screenRecording) async {
125
+ static Future < void > setEnabledAttachmentTypes (bool screenshot,
126
+ bool extraScreenshot, bool galleryImage, bool screenRecording) async {
126
127
final List <dynamic > params = < dynamic > [
127
128
screenshot,
128
129
extraScreenshot,
@@ -136,7 +137,7 @@ class BugReporting {
136
137
137
138
///Sets what type of reports, bug or feedback, should be invoked.
138
139
/// [reportTypes] - List of reportTypes
139
- static void setReportTypes (List <ReportType > reportTypes) async {
140
+ static Future < void > setReportTypes (List <ReportType > reportTypes) async {
140
141
final List <String > reportTypesStrings = < String > [];
141
142
if (reportTypes != null ) {
142
143
reportTypes.forEach ((e) {
@@ -150,7 +151,7 @@ class BugReporting {
150
151
/// Sets whether the extended bug report mode should be disabled, enabled with
151
152
/// required fields or enabled with optional fields.
152
153
/// [extendedBugReportMode] ExtendedBugReportMode enum
153
- static void setExtendedBugReportMode (
154
+ static Future < void > setExtendedBugReportMode (
154
155
ExtendedBugReportMode extendedBugReportMode) async {
155
156
final List <dynamic > params = < dynamic > [extendedBugReportMode.toString ()];
156
157
await _channel.invokeMethod <Object >('setExtendedBugReportMode:' , params);
@@ -159,7 +160,7 @@ class BugReporting {
159
160
/// Sets the invocation options.
160
161
/// Default is set by `Instabug.startWithToken` .
161
162
/// [invocationOptions] List of invocation options
162
- static void setInvocationOptions (
163
+ static Future < void > setInvocationOptions (
163
164
List <InvocationOption > invocationOptions) async {
164
165
final List <String > invocationOptionsStrings = < String > [];
165
166
if (invocationOptions != null ) {
@@ -174,7 +175,7 @@ class BugReporting {
174
175
/// Invoke bug reporting with report type and options.
175
176
/// [reportType] type
176
177
/// [invocationOptions] List of invocation options
177
- static void show (
178
+ static Future < void > show (
178
179
ReportType reportType, List <InvocationOption > invocationOptions) async {
179
180
final List <String > invocationOptionsStrings = < String > [];
180
181
if (invocationOptions != null ) {
@@ -193,7 +194,7 @@ class BugReporting {
193
194
/// Sets the threshold value of the shake gesture for iPhone/iPod Touch
194
195
/// Default for iPhone is 2.5.
195
196
/// [iPhoneShakingThreshold] iPhoneShakingThreshold double
196
- static void setShakingThresholdForiPhone (
197
+ static Future < void > setShakingThresholdForiPhone (
197
198
double iPhoneShakingThreshold) async {
198
199
if (Platform .isIOS) {
199
200
final List <dynamic > params = < dynamic > [iPhoneShakingThreshold];
@@ -205,7 +206,8 @@ class BugReporting {
205
206
/// Sets the threshold value of the shake gesture for iPad
206
207
/// Default for iPhone is 0.6.
207
208
/// [iPadShakingThreshold] iPhoneShakingThreshold double
208
- static void setShakingThresholdForiPad (double iPadShakingThreshold) async {
209
+ static Future <void > setShakingThresholdForiPad (
210
+ double iPadShakingThreshold) async {
209
211
if (Platform .isIOS) {
210
212
final List <dynamic > params = < dynamic > [iPadShakingThreshold];
211
213
await _channel.invokeMethod <Object >(
@@ -218,7 +220,8 @@ class BugReporting {
218
220
/// you could increase the shaking difficulty level by
219
221
/// increasing the `350` value and vice versa
220
222
/// [androidThreshold] iPhoneShakingThreshold int
221
- static void setShakingThresholdForAndroid (int androidThreshold) async {
223
+ static Future <void > setShakingThresholdForAndroid (
224
+ int androidThreshold) async {
222
225
if (Platform .isAndroid) {
223
226
final List <dynamic > params = < dynamic > [androidThreshold];
224
227
await _channel.invokeMethod <Object >(
0 commit comments