1
1
package com .instabug .flutter .modules ;
2
2
3
+ import android .annotation .SuppressLint ;
4
+
3
5
import androidx .annotation .NonNull ;
4
6
import androidx .annotation .Nullable ;
5
7
@@ -40,13 +42,14 @@ public void setEnabled(@NonNull Boolean isEnabled) {
40
42
}
41
43
}
42
44
45
+ @ SuppressLint ("WrongConstant" )
43
46
@ Override
44
47
public void show (@ NonNull String reportType , @ Nullable List <String > invocationOptions ) {
45
48
int [] options = new int [invocationOptions .size ()];
46
49
for (int i = 0 ; i < invocationOptions .size (); i ++) {
47
- options [i ] = ArgsRegistry .getDeserializedValue (invocationOptions .get (i ));
50
+ options [i ] = ArgsRegistry .invocationOptions . get (invocationOptions .get (i ));
48
51
}
49
- int reportTypeInt = ArgsRegistry .getDeserializedValue (reportType );
52
+ int reportTypeInt = ArgsRegistry .reportTypes . get (reportType );
50
53
BugReporting .show (reportTypeInt , options );
51
54
}
52
55
@@ -56,49 +59,51 @@ public void setInvocationEvents(@NonNull List<String> events) {
56
59
57
60
for (int i = 0 ; i < events .size (); i ++) {
58
61
String key = events .get (i );
59
- invocationEventsArray [i ] = ArgsRegistry .getDeserializedValue (key );
62
+ invocationEventsArray [i ] = ArgsRegistry .invocationEvents . get (key );
60
63
}
61
64
62
65
BugReporting .setInvocationEvents (invocationEventsArray );
63
66
}
64
67
68
+ @ SuppressLint ("WrongConstant" )
65
69
@ Override
66
70
public void setReportTypes (@ NonNull List <String > types ) {
67
71
int [] reportTypesArray = new int [types .size ()];
68
72
69
73
for (int i = 0 ; i < types .size (); i ++) {
70
74
String key = types .get (i );
71
- reportTypesArray [i ] = ArgsRegistry .getDeserializedValue (key );
75
+ reportTypesArray [i ] = ArgsRegistry .reportTypes . get (key );
72
76
}
73
77
74
78
BugReporting .setReportTypes (reportTypesArray );
75
79
}
76
80
77
81
@ Override
78
82
public void setExtendedBugReportMode (@ NonNull String mode ) {
79
- final ExtendedBugReport .State resolvedMode = ArgsRegistry .getDeserializedValue (mode );
83
+ final ExtendedBugReport .State resolvedMode = ArgsRegistry .extendedBugReportStates . get (mode );
80
84
BugReporting .setExtendedBugReportState (resolvedMode );
81
85
}
82
86
87
+ @ SuppressLint ("WrongConstant" )
83
88
@ Override
84
89
public void setInvocationOptions (@ NonNull List <String > options ) {
85
90
int [] resolvedOptions = new int [options .size ()];
86
91
for (int i = 0 ; i < options .size (); i ++) {
87
- resolvedOptions [i ] = ArgsRegistry .getDeserializedValue (options .get (i ));
92
+ resolvedOptions [i ] = ArgsRegistry .invocationOptions . get (options .get (i ));
88
93
}
89
94
BugReporting .setOptions (resolvedOptions );
90
95
}
91
96
92
97
@ Override
93
98
public void setFloatingButtonEdge (@ NonNull String edge , @ NonNull Long offset ) {
94
- final InstabugFloatingButtonEdge resolvedEdge = ArgsRegistry .getDeserializedValue (edge );
99
+ final InstabugFloatingButtonEdge resolvedEdge = ArgsRegistry .floatingButtonEdges . get (edge );
95
100
BugReporting .setFloatingButtonEdge (resolvedEdge );
96
101
BugReporting .setFloatingButtonOffset (offset .intValue ());
97
102
}
98
103
99
104
@ Override
100
105
public void setVideoRecordingFloatingButtonPosition (@ NonNull String position ) {
101
- final InstabugVideoRecordingButtonPosition resolvedPosition = ArgsRegistry .getDeserializedValue (position );
106
+ final InstabugVideoRecordingButtonPosition resolvedPosition = ArgsRegistry .recordButtonPositions . get (position );
102
107
BugReporting .setVideoRecordingFloatingButtonPosition (resolvedPosition );
103
108
}
104
109
@@ -155,13 +160,14 @@ public void setDisclaimerText(@NonNull String text) {
155
160
BugReporting .setDisclaimerText (text );
156
161
}
157
162
163
+ @ SuppressLint ("WrongConstant" )
158
164
@ Override
159
165
public void setCommentMinimumCharacterCount (@ NonNull Long limit , @ Nullable List <String > reportTypes ) {
160
166
int [] reportTypesArray = reportTypes == null ? new int [0 ] : new int [reportTypes .size ()];
161
167
if (reportTypes != null ){
162
168
for (int i = 0 ; i < reportTypes .size (); i ++) {
163
169
String key = reportTypes .get (i );
164
- reportTypesArray [i ] = ArgsRegistry .getDeserializedValue (key );
170
+ reportTypesArray [i ] = ArgsRegistry .reportTypes . get (key );
165
171
}
166
172
}
167
173
BugReporting .setCommentMinimumCharacterCount (limit .intValue (), reportTypesArray );
0 commit comments