Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
AStA
Digitaler 3G-Nachweis
Commits
78afe1fe
Commit
78afe1fe
authored
Jan 20, 2022
by
Leon Tappe
🔥
Browse files
get message of the day into verification app
parent
6fbf34fa
Changes
4
Show whitespace changes
Inline
Side-by-side
verification/ios/Runner.xcodeproj/project.pbxproj
View file @
78afe1fe
...
...
@@ -157,7 +157,7 @@
97C146E61CF9000F007C117D
/* Project object */
=
{
isa
=
PBXProject
;
attributes
=
{
LastUpgradeCheck
=
10
2
0
;
LastUpgradeCheck
=
1
3
00
;
ORGANIZATIONNAME
=
""
;
TargetAttributes
=
{
97C146ED1CF9000F007C117D
=
{
...
...
verification/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
View file @
78afe1fe
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"10
2
0"
LastUpgradeVersion =
"1
3
00"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
verification/lib/home_page.dart
View file @
78afe1fe
...
...
@@ -6,6 +6,7 @@ import 'dart:typed_data';
import
'package:connectivity/connectivity.dart'
;
import
'package:digital_3g_common/backend_switcher.dart'
;
import
'package:digital_3g_common/content_dialog.dart'
;
import
'package:digital_3g_common/theme.dart'
;
import
'package:digital_3g_common/ui.dart'
;
import
'package:digital_3g_common/verification_api.dart'
;
import
'package:flutter/material.dart'
;
...
...
@@ -387,21 +388,6 @@ class _HomePageState extends State<HomePage> {
);
}
@override
void
didChangeDependencies
()
async
{
_bloc
=
BlocProvider
.
of
<
VerificationBloc
>(
context
);
final
connected
=
await
Connectivity
().
checkConnectivity
();
setState
(()
=>
_disconnected
=
connected
==
ConnectivityResult
.
none
);
if
(
_disconnected
)
{
_throwConnectivityResult
(
connected
);
}
final
prefs
=
await
SharedPreferences
.
getInstance
();
setState
(()
=>
_showHelp
=
prefs
.
getBool
(
'show_help'
)
??
true
);
super
.
didChangeDependencies
();
}
@override
void
dispose
()
{
_clockTimer
?.
cancel
();
...
...
@@ -413,6 +399,7 @@ class _HomePageState extends State<HomePage> {
@override
void
initState
()
{
super
.
initState
();
_bloc
=
BlocProvider
.
of
<
VerificationBloc
>(
context
);
_clockTimer
=
Timer
.
periodic
(
const
Duration
(
seconds:
1
),
(
timer
)
{
setState
(()
{
_currentDate
=
DateTime
.
now
();
...
...
@@ -421,7 +408,9 @@ class _HomePageState extends State<HomePage> {
_refreshTimer
=
Timer
.
periodic
(
const
Duration
(
seconds:
30
),
(
timer
)
{
_bloc
!.
onCheck
();
});
_connectionListener
=
Connectivity
().
onConnectivityChanged
.
listen
(
_throwConnectivityResult
);
_initConnectivity
();
_initPreferences
();
_loadMotd
();
}
@override
...
...
@@ -434,6 +423,40 @@ class _HomePageState extends State<HomePage> {
}
}
Future
<
void
>
_initConnectivity
()
async
{
final
connected
=
await
Connectivity
().
checkConnectivity
();
setState
(()
=>
_disconnected
=
connected
==
ConnectivityResult
.
none
);
if
(
_disconnected
)
{
_throwConnectivityResult
(
connected
);
}
_connectionListener
=
Connectivity
().
onConnectivityChanged
.
listen
(
_throwConnectivityResult
);
}
Future
<
void
>
_initPreferences
()
async
{
final
prefs
=
await
SharedPreferences
.
getInstance
();
setState
(()
=>
_showHelp
=
prefs
.
getBool
(
'show_help'
)
??
true
);
}
Future
<
void
>
_loadMotd
()
async
{
final
message
=
await
_bloc
!.
api
!.
getMotd
();
if
(
message
.
isEmpty
)
return
;
ScaffoldMessenger
.
of
(
context
).
showSnackBar
(
SnackBar
(
content:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
Text
(
'Systemnachricht'
,
style:
Theme
.
of
(
context
).
textTheme
.
headline5
!.
copyWith
(
color:
magenta
),
),
Text
(
message
)
],
),
duration:
const
Duration
(
seconds:
20
),
));
}
void
_onDeleteTicket
()
async
{
final
result
=
await
showDialog
<
bool
>(
context:
context
,
...
...
verification/lib/verification_bloc.dart
View file @
78afe1fe
...
...
@@ -31,6 +31,7 @@ class VerificationBloc extends Bloc<VerificationEvent, VerificationState> {
_initVerificationStore
().
then
((
_
)
=>
_initTicketFile
().
then
((
value
)
=>
_loadTicket
()));
}
VerificationApi
?
get
api
=>
_api
;
VerificationErrorType
?
get
error
=>
_error
;
String
?
get
ticket
=>
_ticket
;
VerificationResponse
?
get
verification
=>
_verification
;
...
...
Write
Preview
Supports
Markdown
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