Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ginkgo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vjrj
ginkgo
Commits
ed10d587
Commit
ed10d587
authored
1 year ago
by
vjrj
Browse files
Options
Downloads
Patches
Plain Diff
Feedback callback
parent
910a58a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
assets/translations/en.json
+6
-1
6 additions, 1 deletion
assets/translations/en.json
assets/translations/es.json
+6
-1
6 additions, 1 deletion
assets/translations/es.json
lib/ui/widgets/card_drawer.dart
+113
-3
113 additions, 3 deletions
lib/ui/widgets/card_drawer.dart
with
125 additions
and
5 deletions
assets/translations/en.json
+
6
−
1
View file @
ed10d587
...
@@ -227,5 +227,10 @@
...
@@ -227,5 +227,10 @@
"cesium_secret_phrase"
:
"Secret phrase"
,
"cesium_secret_phrase"
:
"Secret phrase"
,
"cesium_password"
:
"Password"
,
"cesium_password"
:
"Password"
,
"accept"
:
"ACCEPT"
,
"accept"
:
"ACCEPT"
,
"incorrect_passwords"
:
"Incorrect passwords"
"incorrect_passwords"
:
"Incorrect passwords"
,
"issueCreatedTitle"
:
"Issue Created"
,
"issueCreatedSuccessfully"
:
"The issue has been successfully created."
,
"viewIssue"
:
"View Issue"
,
"issueCreationErrorTitle"
:
"Error Creating Issue"
,
"issueCreationErrorMessage"
:
"There was an error trying to create the issue."
}
}
This diff is collapsed.
Click to expand it.
assets/translations/es.json
+
6
−
1
View file @
ed10d587
...
@@ -233,5 +233,10 @@
...
@@ -233,5 +233,10 @@
"cesium_password"
:
"Contraseña"
,
"cesium_password"
:
"Contraseña"
,
"accept"
:
"ACEPTAR"
,
"accept"
:
"ACEPTAR"
,
"incorrect_passwords"
:
"Contraseñas incorrectas"
,
"incorrect_passwords"
:
"Contraseñas incorrectas"
,
"card_name_changed"
:
"El nombre de tu tarjeta ha sido actualizado. Recuerda que este nombre es público y permite a otr@s encontrarte"
"card_name_changed"
:
"El nombre de tu tarjeta ha sido actualizado. Recuerda que este nombre es público y permite a otr@s encontrarte"
,
"issueCreatedTitle"
:
"Issue Creada"
,
"issueCreatedSuccessfully"
:
"La issue ha sido creada exitosamente."
,
"viewIssue"
:
"Ver Issue"
,
"issueCreationErrorTitle"
:
"Error al Crear Issue"
,
"issueCreationErrorMessage"
:
"Ocurrió un error al intentar crear la issue."
}
}
This diff is collapsed.
Click to expand it.
lib/ui/widgets/card_drawer.dart
+
113
−
3
View file @
ed10d587
import
'dart:convert'
;
import
'package:easy_localization/easy_localization.dart'
;
import
'package:easy_localization/easy_localization.dart'
;
import
'package:feedback_gitlab/feedback_gitlab.dart'
;
import
'package:feedback_gitlab/feedback_gitlab.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
import
'package:flutter_dotenv/flutter_dotenv.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:package_info_plus/package_info_plus.dart'
;
import
'package:package_info_plus/package_info_plus.dart'
;
import
'package:sentry_flutter/sentry_flutter.dart'
;
import
'package:sentry_flutter/sentry_flutter.dart'
;
import
'../../data/models/cesium_card.dart'
;
import
'../../data/models/cesium_card.dart'
;
import
'../../main.dart'
;
import
'../../shared_prefs_helper.dart'
;
import
'../../shared_prefs_helper.dart'
;
import
'../screens/sandbox.dart'
;
import
'../screens/sandbox.dart'
;
import
'../ui_helpers.dart'
;
import
'../ui_helpers.dart'
;
import
'first_screen/card_stack.dart'
;
import
'first_screen/card_stack.dart'
;
typedef
IssueCreatedCallback
=
void
Function
(
String
?
issueUrl
,
Map
<
String
,
dynamic
>
issueData
,
bool
isSuccess
);
class
CardDrawer
extends
StatelessWidget
{
class
CardDrawer
extends
StatelessWidget
{
const
CardDrawer
({
super
.
key
});
const
CardDrawer
({
super
.
key
});
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
final
List
<
CesiumCard
>
cards
=
SharedPreferencesHelper
()
.
cesiumCards
;
final
List
<
CesiumCard
>
cards
=
SharedPreferencesHelper
()
.
cesiumCards
;
return
FutureBuilder
<
PackageInfo
>(
return
FutureBuilder
<
PackageInfo
>(
future:
PackageInfo
.
fromPlatform
(),
future:
PackageInfo
.
fromPlatform
(),
builder:
(
BuildContext
context
,
AsyncSnapshot
<
PackageInfo
>
snapshot
)
{
builder:
(
BuildContext
context
,
AsyncSnapshot
<
PackageInfo
>
snapshot
)
{
...
@@ -94,11 +100,80 @@ class CardDrawer extends StatelessWidget {
...
@@ -94,11 +100,80 @@ class CardDrawer extends StatelessWidget {
onTap:
()
{
onTap:
()
{
Navigator
.
pop
(
context
);
Navigator
.
pop
(
context
);
final
String
gitLabToken
=
dotenv
.
get
(
'GITLAB_TOKEN'
,
final
String
gitLabToken
=
dotenv
.
get
(
'GITLAB_TOKEN'
,
fallback:
'FKb9GMueV4-hyDEWjfAf'
);
fallback:
'xjxXTv3ZRzKsc4SPTN4s'
);
final
FeedbackController
betterFeedback
=
BetterFeedback
.
of
(
context
);
final
MyCustomHttpClient
httpClient
=
MyCustomHttpClient
(
http
.
Client
());
void
listener
()
{
if
(
!
betterFeedback
.
isVisible
&&
httpClient
.
responseDataNotifier
.
value
!=
null
)
{
final
Map
<
String
,
dynamic
>
?
issueData
=
httpClient
.
responseDataNotifier
.
value
;
final
String
?
issueUrl
=
issueData
?
[
'web_url'
]
as
String
?
;
if
(
issueUrl
!=
null
)
{
showDialog
(
context:
GinkgoApp
.
navigatorKey
.
currentContext
!
,
builder:
(
BuildContext
dialogContext
)
{
return
AlertDialog
(
title:
Text
(
tr
(
'issueCreatedTitle'
)),
content:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
Text
(
tr
(
'issueCreatedSuccessfully'
)),
if
(
issueUrl
!=
null
)
TextButton
(
onPressed:
()
{
openUrl
(
issueUrl
);
},
child:
Text
(
tr
(
'viewIssue'
)),
),
],
),
actions:
<
Widget
>[
TextButton
(
onPressed:
()
{
Navigator
.
of
(
dialogContext
)
.
pop
();
},
child:
Text
(
tr
(
'close'
)),
),
],
);
},
);
}
else
{
showDialog
(
context:
GinkgoApp
.
navigatorKey
.
currentContext
!
,
builder:
(
BuildContext
dialogContext
)
{
return
AlertDialog
(
title:
Text
(
tr
(
'issueCreationErrorTitle'
)),
content:
Text
(
tr
(
'issueCreationErrorMessage'
)),
actions:
<
Widget
>[
TextButton
(
onPressed:
()
{
Navigator
.
of
(
dialogContext
)
.
pop
();
},
child:
Text
(
tr
(
'close'
)),
),
],
);
},
);
}
}
}
betterFeedback
.
addListener
(
listener
);
// TODO remove this
BetterFeedback
.
of
(
context
)
.
showAndUploadToGitLab
(
BetterFeedback
.
of
(
context
)
.
showAndUploadToGitLab
(
projectId:
'663'
,
projectId:
'663'
,
apiToken:
gitLabToken
,
apiToken:
gitLabToken
,
gitlabUrl:
'git.duniter.org'
);
gitlabUrl:
'git.duniter.org'
,
client:
httpClient
);
/* BetterFeedback.of(context).showAndUploadToSentry(
/* BetterFeedback.of(context).showAndUploadToSentry(
// name: 'Foo Bar',
// name: 'Foo Bar',
// email: 'foo_bar@example.com',
// email: 'foo_bar@example.com',
...
@@ -133,3 +208,38 @@ Future<void> tryCatch() async {
...
@@ -133,3 +208,38 @@ Future<void> tryCatch() async {
await Sentry.captureException(error, stackTrace: stackTrace);
await Sentry.captureException(error, stackTrace: stackTrace);
}
}
}
}
class MyCustomHttpClient extends http.BaseClient {
MyCustomHttpClient(this._inner);
final http.Client _inner;
final ValueNotifier<Map<String, dynamic>?> responseDataNotifier =
ValueNotifier<Map<String, dynamic>?>(null);
@override
Future<http.StreamedResponse> send(http.BaseRequest request) async {
final http.StreamedResponse response = await _inner.send(request);
if (request.url.path.contains('
/
api
/
v4
/
projects
/
') &&
request.url.path.contains('
/
issues
')) {
final String responseBody = await response.stream.bytesToString();
final Map<String, dynamic> issueData =
json.decode(responseBody) as Map<String, dynamic>;
responseDataNotifier.value = issueData;
final Stream<List<int>> newStream =
Stream<List<int>>.value(utf8.encode(responseBody));
return http.StreamedResponse(newStream, response.statusCode,
contentLength: response.contentLength,
request: response.request,
headers: response.headers,
isRedirect: response.isRedirect,
persistentConnection: response.persistentConnection,
reasonPhrase: response.reasonPhrase);
}
return response;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment