@@ -35,54 +35,6 @@ class _MyAppState extends State<MyApp> {
35
35
if (Platform .isIOS) {
36
36
Instabug .start ('068ba9a8c3615035e163dc5f829c73be' , < InvocationEvent > [InvocationEvent .shake]);
37
37
}
38
- //Instabug.showWelcomeMessageWithMode(WelcomeMessageMode.beta);
39
- //Instabug.setWelcomeMessageMode(WelcomeMessageMode.beta);
40
- Instabug .
identifyUser (
'[email protected] ' ,
'Aly Ezz' );
41
- InstabugLog .logInfo ('Test Log Info Message from Flutter!' );
42
- InstabugLog .logDebug ('Test Debug Message from Flutter!' );
43
- InstabugLog .logVerbose ('Test Verbose Message from Flutter!' );
44
- InstabugLog .clearAllLogs ();
45
- InstabugLog .logError ('Test Error Message from Flutter!' );
46
- InstabugLog .logWarn ('Test Warn Message from Flutter!' );
47
- Instabug .logOut ();
48
- //Instabug.setLocale(Locale.German);
49
- Instabug .setColorTheme (ColorTheme .dark);
50
- Instabug .appendTags (< String > ['tag1' , 'tag2' ]);
51
- Instabug .setUserAttribute ('19' , 'Age' );
52
- Instabug .setUserAttribute ('female' , 'gender' );
53
- Instabug .removeUserAttribute ('gender' );
54
- final String value = await Instabug .getUserAttributeForKey ('Age' );
55
- print ('User Attribute ' + value);
56
- final Map <String , String > userAttributes = await Instabug .getUserAttributes ();
57
- print (userAttributes.toString ());
58
- Instabug .logUserEvent ('Aly Event' );
59
- Instabug .setValueForStringWithKey ('What\' s the problem' , IBGCustomTextPlaceHolderKey .reportBug);
60
- Instabug .setValueForStringWithKey ('Send some ideas' , IBGCustomTextPlaceHolderKey .reportFeedback);
61
- Instabug .setSessionProfilerEnabled (false );
62
- Color c = const Color .fromRGBO (255 , 0 , 255 , 1.0 );
63
- Instabug .setPrimaryColor (c);
64
- Instabug .setUserData ("This is some useful data" );
65
- var list = Uint8List (10 );
66
- Instabug .addFileAttachmentWithData (list, "My File" );
67
- Instabug .clearFileAttachments ();
68
- //Instabug.clearFileAttachments();
69
- //BugReporting.setEnabled(false);
70
- BugReporting .setOnInvokeCallback (sdkInvoked);
71
- BugReporting .setOnDismissCallback (sdkDismissed);
72
- BugReporting .setInvocationEvents (< InvocationEvent > [InvocationEvent .floatingButton]);
73
- Surveys .setEnabled (true );
74
- Surveys .setAutoShowingEnabled (false );
75
- Surveys .setOnShowCallback (surveyShown);
76
- Surveys .setOnDismissCallback (surveyDismiss);
77
- //Replies.setInAppNotificationsEnabled(false);
78
- Replies .setEnabled (true );
79
- Replies .show ();
80
- Replies .setOnNewReplyReceivedCallback (replies);
81
- //BugReporting.setEnabledAttachmentTypes(false, false, false, false);
82
- //BugReporting.setReportTypes(<ReportType>[ReportType.FEEDBACK,ReportType.BUG]);
83
- //BugReporting.setExtendedBugReportMode(ExtendedBugReportMode.ENABLED_WITH_REQUIRED_FIELDS);
84
- //BugReporting.setInvocationOptions(<InvocationOption>[InvocationOption.EMAIL_FIELD_HIDDEN]);
85
-
86
38
} on PlatformException {
87
39
platformVersion = 'Failed to get platform version.' ;
88
40
}
@@ -96,92 +48,250 @@ class _MyAppState extends State<MyApp> {
96
48
});
97
49
}
98
50
99
- void resetTags () {
100
- Instabug .resetTags ();
51
+ void show () {
52
+ Instabug .show ();
101
53
}
102
54
103
- void getSurveys (List <String > surveys) {
104
- int x = surveys.length;
105
- debugPrint (x.toString ());
55
+ void sendBugReport () {
56
+ BugReporting .invoke (InvocationMode .bug, [InvocationOption .emailFieldOptional]);
106
57
}
107
58
108
- void sdkInvoked () {
109
- debugPrint ( "I am called before invocation" );
59
+ void sendFeedback () {
60
+ BugReporting . invoke ( InvocationMode .feedback, [ InvocationOption .emailFieldOptional] );
110
61
}
111
62
112
- void surveyShown () {
113
- debugPrint ( "The user will se a survey nwoww" );
63
+ void startNewConversation () {
64
+ Chats . show ( );
114
65
}
115
66
116
- void surveyDismiss () {
117
- debugPrint ( "The survey is Dismissed" );
67
+ void showNpsSurvey () {
68
+ Surveys . showSurvey ( 'pcV_mE2ttqHxT1iqvBxL0w' );
118
69
}
119
70
120
- void sdkDismissed (DismissType dismissType, ReportType reportType) {
121
- debugPrint ('SDK Dismissed DismissType: ' + dismissType.toString ());
122
- debugPrint ('SDK Dismissed ReportType: ' + reportType.toString ());
71
+ void showMultipleQuestionSurvey () {
72
+ Surveys .showSurvey ('ZAKSlVz98QdPyOx1wIt8BA' );
123
73
}
124
74
125
- void hasResponded ( bool hasResponded ) {
126
- debugPrint (hasResponded. toString () );
75
+ void showFeatureRequests ( ) {
76
+ FeatureRequests . show ( );
127
77
}
128
78
129
- void replies () {
130
- debugPrint ("new Replyyy" );
131
- }
132
- void show () {
133
- //Instabug.show();
134
- // Surveys.getAvailableSurveys(getSurveys);
135
- // Surveys.showSurveyIfAvailable();
136
- // Surveys.setShouldShowWelcomeScreen(true);
137
- //Surveys.showSurvey("BHJI1iaKYhr4CYHHcUAaTg");
138
- //BugReporting.showWithOptions(ReportType.bug, <InvocationOption>[InvocationOption.emailFieldHidden]);
139
- // FeatureRequests.setEmailFieldRequired(false, [ActionType.allActions]);
140
- // FeatureRequests.show();
141
- // Replies.setEnabled(true);
142
- // Replies.show();
143
- //Replies.setInAppNotificationsEnabled(false);
144
- //Replies.getUnreadRepliesCount(replies);
79
+ void setInvocationEvent (InvocationEvent invocationEvent) {
80
+ BugReporting .setInvocationEvents ([invocationEvent]);
145
81
}
146
82
147
- void invokeWithMode () {
148
- Surveys .hasRespondedToSurvey ("BHJI1iaKYhr4CYHHcUAaTg" , hasResponded);
149
- // BugReporting.invokeWithMode(InvocationMode.bug, [InvocationOption.emailFieldHidden]);
83
+ void setPrimaryColor (Color c) {
84
+ Instabug .setPrimaryColor (c);
150
85
}
151
86
152
- void getTags () async {
153
- final List <String > tags = await Instabug .getTags ();
154
- print (tags.toString ());
87
+ void setColorTheme (ColorTheme colorTheme) {
88
+ Instabug .setColorTheme (colorTheme);
155
89
}
156
90
157
91
@override
158
92
Widget build (BuildContext context) {
159
93
return MaterialApp (
160
94
home: Scaffold (
161
- appBar: AppBar (
162
- title: const Text ('Plugin example app' ),
163
- ),
164
- body: Center (
95
+ body: SingleChildScrollView (
96
+ padding: EdgeInsets .only (top: 60.0 ),
165
97
child: Column (
166
98
mainAxisAlignment: MainAxisAlignment .center,
167
99
children: < Widget > [
168
- Text ('Running on: $_platformVersion \n ' ),
169
- RaisedButton (
100
+ Container (
101
+ margin: const EdgeInsets .only (left: 20.0 , right: 20.0 , bottom: 20.0 ),
102
+ child : Text (
103
+ 'Hello Instabug\' s awesome user! The purpose of this application is to show you the different options for customizing the SDK and how easy it is to integrate it to your existing app' ,
104
+ textAlign: TextAlign .center,
105
+ ),
106
+ ),
107
+ Container (
108
+ width: double .infinity,
109
+ margin: const EdgeInsets .only (left: 20.0 , right: 20.0 ),
110
+ // height: double.infinity,
111
+ child: RaisedButton (
170
112
onPressed: show,
171
- child: Text ('show' ),
113
+ textColor: Colors .white,
114
+ child: Text ('Invoke' ),
115
+ color: Colors .lightBlue),
116
+ ),
117
+ Container (
118
+ width: double .infinity,
119
+ margin: const EdgeInsets .only (left: 20.0 , right: 20.0 ),
120
+ // height: double.infinity,
121
+ child: RaisedButton (
122
+ onPressed: sendBugReport,
123
+ textColor: Colors .white,
124
+ child: Text ('Send Bug Report' ),
125
+ color: Colors .lightBlue),
126
+ ),
127
+ Container (
128
+ width: double .infinity,
129
+ margin: const EdgeInsets .only (left: 20.0 , right: 20.0 ),
130
+ // height: double.infinity,
131
+ child: RaisedButton (
132
+ onPressed: sendFeedback,
133
+ textColor: Colors .white,
134
+ child: Text ('Send Feedback' ),
135
+ color: Colors .lightBlue),
136
+ ),
137
+ Container (
138
+ width: double .infinity,
139
+ margin: const EdgeInsets .only (left: 20.0 , right: 20.0 ),
140
+ // height: double.infinity,
141
+ child: RaisedButton (
142
+ onPressed: startNewConversation,
143
+ textColor: Colors .white,
144
+ child: Text ('Start a New Conversation' ),
145
+ color: Colors .lightBlue),
146
+ ),
147
+ Container (
148
+ width: double .infinity,
149
+ margin: const EdgeInsets .only (left: 20.0 , right: 20.0 ),
150
+ // height: double.infinity,
151
+ child: RaisedButton (
152
+ onPressed: showNpsSurvey,
153
+ textColor: Colors .white,
154
+ child: Text ('Show NPS Survey' ),
172
155
color: Colors .lightBlue),
173
- RaisedButton (
174
- onPressed: invokeWithMode,
175
- child: Text ('invokeWithMode' ),
156
+ ),
157
+ Container (
158
+ width: double .infinity,
159
+ margin: const EdgeInsets .only (left: 20.0 , right: 20.0 ),
160
+ // height: double.infinity,
161
+ child: RaisedButton (
162
+ onPressed: showMultipleQuestionSurvey,
163
+ textColor: Colors .white,
164
+ child: Text ('Show Multiple Questions Survey' ),
176
165
color: Colors .lightBlue),
177
- RaisedButton (
178
- onPressed: resetTags,
179
- child: Text ('reset tags' ),
166
+ ),
167
+ Container (
168
+ width: double .infinity,
169
+ margin: const EdgeInsets .only (left: 20.0 , right: 20.0 ),
170
+ // height: double.infinity,
171
+ child: RaisedButton (
172
+ onPressed: showFeatureRequests,
173
+ textColor: Colors .white,
174
+ child: Text ('Show Feature Requests' ),
180
175
color: Colors .lightBlue),
181
- RaisedButton (
182
- onPressed: getTags,
183
- child: Text ('get tags' ),
184
- color: Colors .lightBlue)
176
+ ),
177
+ Container (
178
+ alignment: Alignment .centerLeft,
179
+ margin: const EdgeInsets .only (top: 20.0 , left: 20.0 ),
180
+ child : Text (
181
+ 'Change Invocation Event' ,
182
+ textAlign: TextAlign .left,
183
+ style: TextStyle (fontSize: 16 , fontWeight: FontWeight .bold),
184
+ ),
185
+ ),
186
+ ButtonBar (
187
+ mainAxisSize: MainAxisSize .min,
188
+ alignment: MainAxisAlignment .start,
189
+ children: < Widget > [
190
+ RaisedButton (
191
+ onPressed: ()=> setInvocationEvent (InvocationEvent .none),
192
+ textColor: Colors .white,
193
+ child: Text ('none' ),
194
+ color: Colors .lightBlue),
195
+ RaisedButton (
196
+ onPressed: ()=> setInvocationEvent (InvocationEvent .shake),
197
+ textColor: Colors .white,
198
+ child: Text ('Shake' ),
199
+ color: Colors .lightBlue),
200
+ RaisedButton (
201
+ onPressed: ()=> setInvocationEvent (InvocationEvent .screenshot),
202
+ textColor: Colors .white,
203
+ child: Text ('Screenshot' ),
204
+ color: Colors .lightBlue),
205
+ ],
206
+ ),
207
+ ButtonBar (
208
+ mainAxisSize: MainAxisSize .min,
209
+ alignment: MainAxisAlignment .start,
210
+ children: < Widget > [
211
+ RaisedButton (
212
+ onPressed: ()=> setInvocationEvent (InvocationEvent .floatingButton),
213
+ textColor: Colors .white,
214
+ child: Text ('Floating Button' ),
215
+ color: Colors .lightBlue),
216
+ RaisedButton (
217
+ onPressed: ()=> setInvocationEvent (InvocationEvent .twoFingersSwipeLeft),
218
+ textColor: Colors .white,
219
+ child: Text ('Two Fingers Swipe Left' ),
220
+ color: Colors .lightBlue),
221
+ ],
222
+ ),
223
+ Container (
224
+ alignment: Alignment .centerLeft,
225
+ margin: const EdgeInsets .only ( left: 20.0 ),
226
+ child : Text (
227
+ 'Set Primary Color' ,
228
+ textAlign: TextAlign .left,
229
+ style: TextStyle (fontSize: 16 , fontWeight: FontWeight .bold),
230
+ ),
231
+ ),
232
+ ButtonBar (
233
+ mainAxisSize: MainAxisSize .min,
234
+ alignment: MainAxisAlignment .center,
235
+ children: < Widget > [
236
+ ButtonTheme (
237
+ minWidth: 50.0 ,
238
+ height: 30.0 ,
239
+ child: RaisedButton (
240
+ onPressed: ()=> setPrimaryColor (Colors .red),
241
+ textColor: Colors .white,
242
+ color: Colors .red),
243
+ ),
244
+ ButtonTheme (
245
+ minWidth: 50.0 ,
246
+ height: 30.0 ,
247
+ child: RaisedButton (
248
+ onPressed: ()=> setPrimaryColor (Colors .green),
249
+ textColor: Colors .white,
250
+ color: Colors .green),
251
+ ),
252
+ ButtonTheme (
253
+ minWidth: 50.0 ,
254
+ height: 30.0 ,
255
+ child: RaisedButton (
256
+ onPressed: ()=> setPrimaryColor (Colors .blue),
257
+ textColor: Colors .white,
258
+ color: Colors .blue),
259
+ ),
260
+ ButtonTheme (
261
+ minWidth: 50.0 ,
262
+ height: 30.0 ,
263
+ child: RaisedButton (
264
+ onPressed: ()=> setPrimaryColor (Colors .yellow),
265
+ textColor: Colors .white,
266
+ color: Colors .yellow),
267
+ ),
268
+ ],
269
+ ),
270
+ Container (
271
+ alignment: Alignment .centerLeft,
272
+ margin: const EdgeInsets .only ( left: 20.0 ),
273
+ child : Text (
274
+ 'Color Theme' ,
275
+ textAlign: TextAlign .left,
276
+ style: TextStyle (fontSize: 16 , fontWeight: FontWeight .bold),
277
+ ),
278
+ ),
279
+ ButtonBar (
280
+ mainAxisSize: MainAxisSize .max,
281
+ alignment: MainAxisAlignment .center,
282
+ children: < Widget > [
283
+ RaisedButton (
284
+ onPressed: ()=> setColorTheme (ColorTheme .light),
285
+ textColor: Colors .lightBlue,
286
+ child: Text ('Light' ),
287
+ color: Colors .white),
288
+ RaisedButton (
289
+ onPressed: ()=> setColorTheme (ColorTheme .dark),
290
+ textColor: Colors .white,
291
+ child: Text ('Dark' ),
292
+ color: Colors .black),
293
+ ],
294
+ ),
185
295
],
186
296
)),
187
297
),
0 commit comments