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
2b55b2d5
Commit
2b55b2d5
authored
2 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
loading from shared preferences not yet working
parent
12c9686f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Devices also Contact Based
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sw/lib/configuration.dart
+4
-7
4 additions, 7 deletions
sw/lib/configuration.dart
sw/lib/datamodel.dart
+10
-2
10 additions, 2 deletions
sw/lib/datamodel.dart
sw/lib/sensorconnector.dart
+1
-1
1 addition, 1 deletion
sw/lib/sensorconnector.dart
with
15 additions
and
10 deletions
sw/lib/configuration.dart
+
4
−
7
View file @
2b55b2d5
...
...
@@ -186,6 +186,9 @@ class _MyHomePageState extends State<Configuration> {
}
else
{
await
configuration
.
storeToSharedPrefs
();
// collection has not been changed but store the other parameters
statusPopUpMessageText
=
'Stored changed configuration.'
;
popUpError
=
false
;
...
...
@@ -198,12 +201,6 @@ class _MyHomePageState extends State<Configuration> {
statusPopUpMessageText
=
errorText
.
substring
(
10
,
errorText
.
length
);
//Remove 'Exception' from string.
popUpError
=
true
;
//_showResultPopup(context,
// errorText,
// true
//);
//setState(() {});
}
setState
(()
{
_showResultPopup
(
context
,
statusPopUpMessageText
,
popUpError
);});
}
...
...
@@ -355,7 +352,7 @@ class _MyHomePageState extends State<Configuration> {
const
SizedBox
(
height:
15.0
),
TextFormField
(
keyboardType:
TextInputType
.
text
,
keyboardType:
TextInputType
.
url
,
autofocus:
false
,
initialValue:
configuration
.
restRequestUrl
,
decoration:
const
InputDecoration
(
...
...
This diff is collapsed.
Click to expand it.
sw/lib/datamodel.dart
+
10
−
2
View file @
2b55b2d5
...
...
@@ -340,7 +340,14 @@ abstract class ConfigurationStoreBase {
eventTypes
.
add
(
EventType
.
fromJson
(
element
));
}
//TODO: fix this here! What is the problem.
print
(
map
[
'labelConfiguration'
]);
labelConfig
=
LabelConfiguration
.
fromJson
(
map
[
'labelConfiguration'
]);
print
(
map
[
'labelConfiguration'
]);
print
(
map
[
'restRequestUrl'
]);
restRequestUrl
=
map
[
'restRequestUrl'
];
initialized
=
map
[
'initialized'
];
...
...
@@ -405,8 +412,9 @@ class ConfigurationStoreInstance extends ConfigurationStoreBase {
final
prefs
=
await
SharedPreferences
.
getInstance
();
prefs
.
setString
(
'configuration'
,
jsonEncode
(
toMap
()));
debugPrint
(
'Stored current configuration to shared prefs'
);
debugPrint
(
'
${toMap()['labelConfiguration']}
'
);
debugPrint
(
'
${toMap()['restRequestUrl']}
'
);
}
Future
<
void
>
loadFromSharedPrefs
()
async
{
...
...
@@ -423,7 +431,7 @@ class ConfigurationStoreInstance extends ConfigurationStoreBase {
final
prefs
=
await
SharedPreferences
.
getInstance
();
final
String
?
configuration
=
prefs
.
getString
(
'configuration'
);
if
(
configuration
!=
null
){
debugPrint
(
'Configuration String:
'
+
configuration
);
debugPrint
(
'Configuration String:
$
configuration
'
);
fromMap
(
jsonDecode
(
configuration
));
debugPrint
(
'Configuration loaded from shared preferences'
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
sw/lib/sensorconnector.dart
+
1
−
1
View file @
2b55b2d5
...
...
@@ -56,7 +56,7 @@ class SensorConnector {
List
<
Collection
>
collectionList
=
[];
try
{
final
response
=
await
http
.
get
(
Uri
.
parse
(
url
))
.
timeout
(
Duration
(
seconds:
3
));
//TODO: check if this timeout works
final
response
=
await
http
.
get
(
Uri
.
parse
(
url
))
.
timeout
(
const
Duration
(
seconds:
3
));
//TODO: check if this timeout works
if
(
response
.
statusCode
==
200
)
{
collectionList
=
(
json
.
decode
(
response
.
body
)
as
List
)
.
map
((
i
)
=
>
Collection
.
fromJson
(
i
))
...
...
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