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
51ea07b6
Commit
51ea07b6
authored
2 years ago
by
Maximilian Betz
Browse files
Options
Downloads
Patches
Plain Diff
included git commit hash in version information
parent
9d484a4c
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/datamodel.dart
+13
-0
13 additions, 0 deletions
lib/datamodel.dart
lib/main.dart
+1
-14
1 addition, 14 deletions
lib/main.dart
lib/overview.dart
+11
-8
11 additions, 8 deletions
lib/overview.dart
pubspec.yaml
+1
-1
1 addition, 1 deletion
pubspec.yaml
with
26 additions
and
23 deletions
lib/datamodel.dart
+
13
−
0
View file @
51ea07b6
import
'dart:convert'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/services.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
class
Collection
{
...
...
@@ -457,3 +458,15 @@ class EventStoreInstance extends EventStoreBase {
);
}
}
String
gitVersionHash
=
''
;
Future
<
void
>
loadGitInfo
()
async
{
final
commitHash
=
await
rootBundle
.
loadString
(
'.git/refs/heads/main'
);
gitVersionHash
=
commitHash
.
substring
(
0
,
8
);
//Use the short version
debugPrint
(
"Commit ID:
$gitVersionHash
"
);
}
String
getGitHash
(){
return
gitVersionHash
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/main.dart
+
1
−
14
View file @
51ea07b6
...
...
@@ -8,31 +8,18 @@ import 'overview.dart';
import
'configuration.dart'
;
import
'databaseconnector.dart'
;
Future
<
String
>
getGitInfo
()
async
{
final
_head
=
await
rootBundle
.
loadString
(
'.git/HEAD'
);
final
commitId
=
await
rootBundle
.
loadString
(
'.git/ORIG_HEAD'
);
final
branch
=
_head
.
split
(
'/'
)
.
last
;
print
(
"Branch:
$branch
"
);
print
(
"Commit ID:
$commitId
"
);
return
"Branch:
$branch
, Commit ID:
$commitId
"
;
}
Future
<
void
>
loadConfiguration
()
async
{
final
ConfigurationStoreInstance
configuration
=
ConfigurationStoreInstance
();
final
EventStoreInstance
event
=
EventStoreInstance
();
WidgetsFlutterBinding
.
ensureInitialized
();
get
GitInfo
();
load
GitInfo
();
//In oder to display the git commit version.
// Load conf and last event fields from shared preferences to prefill UI
await
configuration
.
loadFromSharedPrefs
();
await
event
.
loadFromSharedPrefs
();
//const storage = FlutterSecureStorage(); //TODO: move login information to secure storage
//Map<String, String> allValues = await storage.readAll();
//print('Secure Storage: ' + allValues.toString());
...
...
This diff is collapsed.
Click to expand it.
lib/overview.dart
+
11
−
8
View file @
51ea07b6
import
'package:flutter/material.dart'
;
import
'package:mobileeventlog/datamodel.dart'
;
class
Overview
extends
StatelessWidget
{
const
Overview
({
Key
?
key
})
:
super
(
key:
key
);
...
...
@@ -11,14 +12,16 @@ class Overview extends StatelessWidget {
content:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
const
<
Widget
>[
Icon
(
Icons
.
copyright_outlined
),
Text
(
'Alfred Wegener Institute'
),
Text
(
'Data-Logistics-Support'
),
SizedBox
(
height:
10
),
Text
(
'Maximilian Betz'
),
SizedBox
(
height:
30
),
Text
(
'o2a-support@awi.de'
),
children:
<
Widget
>[
const
Icon
(
Icons
.
copyright_outlined
),
const
Text
(
'Alfred Wegener Institute'
),
const
Text
(
'Data-Logistics-Support'
),
const
SizedBox
(
height:
10
),
const
Text
(
'Maximilian Betz'
),
const
SizedBox
(
height:
30
),
const
Text
(
'o2a-support@awi.de'
),
const
SizedBox
(
height:
30
),
Text
(
'Git-Commit-Hash: '
+
getGitHash
()),
],
),
actions:
<
Widget
>[
...
...
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
1
−
1
View file @
51ea07b6
...
...
@@ -71,7 +71,7 @@ flutter:
-
assets/awi_logo.png
-
.git/HEAD
# This file points out the current branch of the project.
-
.git/ORIG_HEAD
# This file points to the commit id at origin (last commit id of the remote repository).
-
.git/refs/heads/
-
.git/refs/heads/
main
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
...
...
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