Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MobileEventLog
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
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
Data-Logistics-Support
MobileEventLog
Commits
749b1d62
Commit
749b1d62
authored
3 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
expanded urn field to two lines
parent
c0a9ff21
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/addevent.dart
+8
-4
8 additions, 4 deletions
lib/addevent.dart
lib/configuration.dart
+9
-2
9 additions, 2 deletions
lib/configuration.dart
lib/datamodel.dart
+24
-1
24 additions, 1 deletion
lib/datamodel.dart
lib/viewevents.dart
+9
-1
9 additions, 1 deletion
lib/viewevents.dart
with
50 additions
and
8 deletions
lib/addevent.dart
+
8
−
4
View file @
749b1d62
...
...
@@ -270,6 +270,7 @@ class _AddEventPageState extends State<AddEvent> {
const
SizedBox
(
height:
15.0
),
DropdownButtonFormField
(
value:
eventStore
.
currentEvent
.
urn
,
isDense:
false
,
isExpanded:
true
,
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
(),
...
...
@@ -512,10 +513,13 @@ class _AddEventPageState extends State<AddEvent> {
body:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
crossAxisAlignment:
CrossAxisAlignment
.
end
,
children:
const
<
Widget
>[
Text
(
' Visit Configuration first'
,
style:
TextStyle
(
fontSize:
20
)
children:
<
Widget
>[
Container
(
margin:
const
EdgeInsets
.
all
(
10.0
),
child:
const
Text
(
'Check Configuration Page for initial setup!'
,
style:
TextStyle
(
fontSize:
20
)
),
),
],
),
...
...
This diff is collapsed.
Click to expand it.
lib/configuration.dart
+
9
−
2
View file @
749b1d62
...
...
@@ -66,6 +66,9 @@ class _MyHomePageState extends State<Configuration> {
configuration
.
devices
=
await
connector
.
fetchCollectionDevices
(
configuration
.
currentCollection
.
id
);
//await futureDevices; //already fetched just use the data.
configuration
.
eventTypes
=
await
connector
.
fetchEventTypes
();
if
(
configuration
.
devices
.
isEmpty
){
throw
Exception
(
'Collection with 0 devices.'
);
}
event
.
currentEvent
.
id
=
0
;
event
.
currentEvent
.
urnId
=
configuration
.
devices
[
0
]
.
id
;
//TODO: fix if devices are an empty list.
event
.
currentEvent
.
urn
=
configuration
.
devices
[
0
]
.
urn
;
...
...
@@ -139,7 +142,7 @@ class _MyHomePageState extends State<Configuration> {
children:
<
Widget
>[
const
SizedBox
(
height:
50
),
const
Text
(
'
You must be online to do something here
!'
,
'
Online access required for initial configuration
!'
,
style:
TextStyle
(
fontSize:
14
)
),
const
SizedBox
(
height:
50
),
...
...
@@ -244,6 +247,11 @@ class _MyHomePageState extends State<Configuration> {
label:
const
Text
(
'Dump Events'
),
onPressed:
()
{
dumpToFile
();
//Reset for debug testing only. //Remove in RELEASE Version:
database
.
delete
();
events
.
reset
();
configuration
.
reset
();
},
),
FloatingActionButton
.
extended
(
...
...
@@ -253,7 +261,6 @@ class _MyHomePageState extends State<Configuration> {
label:
const
Text
(
'Set'
),
onPressed:
()
{
updateConfiguration
();
//TODO: display failed as user feedback somehow
},
),
],
...
...
This diff is collapsed.
Click to expand it.
lib/datamodel.dart
+
24
−
1
View file @
749b1d62
...
...
@@ -333,7 +333,7 @@ abstract class ConfigurationStoreBase {
devices
=
[];
eventTypes
=
[];
currentCollection
=
Collection
(
id:
-
1
,
description:
''
,
collectionName:
''
);
loginInformation
=
SensorLogin
(
'
admin'
,
'adminadmin
'
);
loginInformation
=
SensorLogin
(
'
'
,
'
'
);
initialized
=
false
;
}
}
...
...
@@ -343,6 +343,12 @@ class ConfigurationStoreInstance extends ConfigurationStoreBase {
static
final
ConfigurationStoreInstance
_instance
=
ConfigurationStoreInstance
.
_internal
();
@override
void
reset
(){
super
.
reset
();
deleteSharedPrefs
();
}
Future
<
void
>
storeToSharedPrefs
()
async
{
const
secureStorage
=
FlutterSecureStorage
();
...
...
@@ -377,6 +383,15 @@ class ConfigurationStoreInstance extends ConfigurationStoreBase {
}
}
Future
<
void
>
deleteSharedPrefs
()
async
{
final
prefs
=
await
SharedPreferences
.
getInstance
();
prefs
.
clear
();
await
prefs
.
remove
(
'configuration'
);
const
secureStorage
=
FlutterSecureStorage
();
secureStorage
.
delete
(
key:
'login'
);
}
factory
ConfigurationStoreInstance
()
{
return
_instance
;
}
...
...
@@ -445,6 +460,11 @@ class EventStoreInstance extends EventStoreBase {
}
}
Future
<
void
>
deleteSharedPrefs
()
async
{
final
prefs
=
await
SharedPreferences
.
getInstance
();
await
prefs
.
remove
(
'currentEvent'
);
}
factory
EventStoreInstance
()
{
return
_instance
;
}
...
...
@@ -468,6 +488,8 @@ class EventStoreInstance extends EventStoreBase {
}
void
reset
(){
gnssSync
=
true
;
showAllEvents
=
false
;
currentEvent
=
Event
(
id:
0
,
urnId:
-
1
,
...
...
@@ -483,6 +505,7 @@ class EventStoreInstance extends EventStoreBase {
longitude:
''
,
elevation:
''
);
deleteSharedPrefs
();
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/viewevents.dart
+
9
−
1
View file @
749b1d62
...
...
@@ -19,7 +19,6 @@ class _ViewEvents extends State<ViewEvents> {
var
database
=
DatabaseInstance
();
List
<
Event
>
_localEvents
=
[];
Future
<
void
>
fetchEventsFromDb
()
async
{
final
EventStoreInstance
event
=
EventStoreInstance
();
int
pendingEvents
=
0
;
...
...
@@ -47,6 +46,15 @@ class _ViewEvents extends State<ViewEvents> {
fetchEventsFromDb
();
}
@override
void
dispose
()
async
{
/*Async update current configuration to shared preferences*/
final
EventStoreInstance
event
=
EventStoreInstance
();
event
.
storeToSharedPrefs
();
super
.
dispose
();
}
Future
<
void
>
syncEvents
()
async
{
final
ConfigurationStoreInstance
configuration
=
ConfigurationStoreInstance
();
SensorConnector
connection
=
SensorConnector
();
...
...
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