Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Pattle
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
72
Issues
72
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pattle
Pattle
Commits
07c0c93d
Verified
Commit
07c0c93d
authored
Jul 25, 2019
by
Wilko Manger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show 504 error in a more simple way to the user
parent
11cb66b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
lib/src/ui/main/widgets/error.dart
lib/src/ui/main/widgets/error.dart
+15
-9
lib/src/ui/resources/localizations.dart
lib/src/ui/resources/localizations.dart
+5
-0
No files found.
lib/src/ui/main/widgets/error.dart
View file @
07c0c93d
...
...
@@ -19,6 +19,7 @@ import 'package:flutter/material.dart';
import
'package:matrix_sdk/matrix_sdk.dart'
;
import
'package:pattle/src/ui/resources/localizations.dart'
;
import
'package:http/http.dart'
as
http
;
import
'package:chopper/chopper.dart'
;
import
'dart:io'
;
import
'../sync_bloc.dart'
;
...
...
@@ -67,10 +68,15 @@ class ErrorBannerState extends State<ErrorBanner>
_controller
.
animateBack
(
0
);
}
Widget
icon
=
Icon
(
Icons
.
cloud_off
);
Widget
text
=
Text
(
l
(
context
).
connectionLost
);
Widget
icon
,
text
;
if
(
error
is
!
SocketException
&&
error
is
!
http
.
ClientException
)
{
if
(
error
is
SocketException
||
error
is
http
.
ClientException
)
{
icon
=
Icon
(
Icons
.
cloud_off
);
text
=
Text
(
l
(
context
).
connectionLost
);
}
else
if
(
error
is
Response
&&
error
.
statusCode
==
504
)
{
icon
=
Icon
(
Icons
.
cloud_off
);
text
=
Text
(
l
(
context
).
connectionFailedServerOverloaded
);
}
else
{
// TODO: Make error messages less complex for end users,
// but keep it like this for now (before 1.0).
icon
=
Icon
(
Icons
.
bug_report
);
...
...
@@ -79,18 +85,18 @@ class ErrorBannerState extends State<ErrorBanner>
style:
DefaultTextStyle
.
of
(
context
).
style
,
children:
[
TextSpan
(
text:
'
${l(context).anErrorHasOccurred}
\n
'
text:
'
${l(context).anErrorHasOccurred}
\n
'
,
),
TextSpan
(
text:
error
.
toString
(),
style:
TextStyle
(
fontFamily:
'monospace'
,
fontWeight:
FontWeight
.
bold
)
fontWeight:
FontWeight
.
bold
,
)
,
),
TextSpan
(
text:
'
\n
${l(context).thisErrorHasBeenReported}
'
)
]
)
TextSpan
(
text:
'
\n
${l(context).thisErrorHasBeenReported}
'
)
,
]
,
)
,
);
}
...
...
lib/src/ui/resources/localizations.dart
View file @
07c0c93d
...
...
@@ -55,11 +55,16 @@ class Strings {
'Connection failed. '
'Check your internet connection'
;
final
connectionFailedServerOverloaded
=
'Connection failed. '
'The server is probably overloaded.'
;
final
anErrorHasOccurred
=
'An error has occurred:'
;
final
thisErrorHasBeenReported
=
'This error has been reported. Please restart Pattle.'
;
final
youDeletedThisMessage
=
'You deleted this message'
;
List
<
TextSpan
>
hasDeletedThisMessage
(
TextSpan
name
)
=>
[
name
,
TextSpan
(
text:
' deleted this message'
)];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment