Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-035-CoviDefender
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-035
2021-035-CoviDefender
Commits
7aaf5cbc
Commit
7aaf5cbc
authored
Aug 18, 2021
by
Indika NK
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Awareness level related changes
parent
4d634207
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
lib/pages/notificator/model/Notification_plugin.dart
lib/pages/notificator/model/Notification_plugin.dart
+51
-0
No files found.
lib/pages/notificator/model/Notification_plugin.dart
View file @
7aaf5cbc
import
'dart:ffi'
;
import
'dart:ffi'
;
import
'package:cloud_firestore/cloud_firestore.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_local_notifications/flutter_local_notifications.dart'
;
import
'package:flutter_local_notifications/flutter_local_notifications.dart'
;
import
'package:oktoast/oktoast.dart'
;
import
'package:oktoast/oktoast.dart'
;
...
@@ -19,6 +20,52 @@ class NotificationPlugin {
...
@@ -19,6 +20,52 @@ class NotificationPlugin {
int
awarenessLevel
=
0
;
int
awarenessLevel
=
0
;
//getting awareness from Users Collection
getAwareness
()
async
{
print
(
"Executing get data"
);
final
CollectionReference
userlist
=
FirebaseFirestore
.
instance
.
collection
(
"users"
);
userlist
.
get
().
then
((
dataSnapshot
){
print
(
"(2)Executing Get Data "
);
FirebaseFirestore
.
instance
.
collection
(
"users"
).
get
().
then
((
QuerySnapshot
snapshot
){
if
(
snapshot
.
size
==
0
)
{
awarenessLevel
=
1
;
print
(
"Snapshot Data error"
);
}
else
{
snapshot
.
docs
.
forEach
((
doc
)
async
{
print
(
doc
[
"awarenessLevel"
]);
print
(
doc
[
"email"
]);
print
(
doc
[
"Name"
]);
print
(
doc
[
"Address"
]);
print
(
doc
[
"NIC"
]);
print
(
doc
[
"mobile"
]);
print
(
doc
[
"Home phone"
]);
Map
<
String
,
String
>
UserDetails
=
{
"awarenessLevel"
:
doc
[
"awarenessLevel"
],
"email"
:
doc
[
"email"
],
"Name"
:
doc
[
"Name"
],
"Address"
:
doc
[
"Address"
],
"NIC"
:
doc
[
"NIC"
],
"mobile"
:
doc
[
"mobile"
],
"Home phone"
:
doc
[
"Home phone"
],
};
print
(
"Getting Final awareness level ... "
);
awarenessLevel
=
UserDetails
.
containsKey
(
awarenessLevel
)
as
int
;
print
(
"Final Awareness"
+
awarenessLevel
.
toString
());
});
}
});
});
}
NotificationPlugin
.
_
()
{
NotificationPlugin
.
_
()
{
init
();
init
();
}
}
...
@@ -29,8 +76,11 @@ class NotificationPlugin {
...
@@ -29,8 +76,11 @@ class NotificationPlugin {
_requestIOSPermission
();
_requestIOSPermission
();
}
}
initializePlatformSpecifics
();
initializePlatformSpecifics
();
getAwareness
();
print
(
"Awareness Level After init"
+
awarenessLevel
.
toString
());
}
}
initializePlatformSpecifics
()
{
initializePlatformSpecifics
()
{
var
initializationSettingsAndroid
=
var
initializationSettingsAndroid
=
AndroidInitializationSettings
(
'app_notf_icon'
);
AndroidInitializationSettings
(
'app_notf_icon'
);
...
@@ -75,6 +125,7 @@ class NotificationPlugin {
...
@@ -75,6 +125,7 @@ class NotificationPlugin {
}
}
Future
<
void
>
showNotification
()
async
{
Future
<
void
>
showNotification
()
async
{
var
androidChannelSpecifics
=
AndroidNotificationDetails
(
var
androidChannelSpecifics
=
AndroidNotificationDetails
(
'CHANNEL_ID'
,
'CHANNEL_ID'
,
'CHANNEL_NAME'
,
'CHANNEL_NAME'
,
...
...
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