Skip to content

Commit

Permalink
version update to flutter: 2.6.0 - 6.0.pre.200
Browse files Browse the repository at this point in the history
  • Loading branch information
Tushar1805 committed Sep 24, 2021
1 parent 312b45c commit 1d65b27
Show file tree
Hide file tree
Showing 5,000 changed files with 841,029 additions and 1,666 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
98 changes: 60 additions & 38 deletions functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ const fcm = admin.messaging();

exports.sendMessageToTherapist = functions.firestore
.document('assessments/{id}')
.onCreate(async (snapshot, context) => {
.onUpdate(async (snapshot, context) => {
if (snapshot.empty) {
console.log("No Assessments");
}
const message = snapshot.data();
console.log(message);
// const message = snapshot.data();
// console.log(message);


const querySnapshot = await db
Expand All @@ -91,11 +91,23 @@ const fcm = admin.messaging();
const token = querySnapshot.data()["token"];
console.log(token);

// if (message.data()["currentStatus"] == "Assessment Scheduled") {
var currentStatus = snapshot.after.data()["currentStatus"];
var body;

if (currentStatus == "Assessment Scheduled" && snapshot.data()["assessor"] == snapshot.data()["therapist"]){
body = 'Hello, You have been allocated as a therapist for the assessment. Please complete the assessment and provide the necessary recommedations!\n\n Thank You!!';
}else if (currentStatus == "Assessment Scheduled"){
body = 'Hello, You have been allocated as a therapist for the assessment. Assessor will soon began the assessment wait untill then.\n\n Thank You!!';
}else if(currentStatus == "Assessment Scheduled"){
body = 'Hello, Assessment completely filled by the assessor. Now, please provide the recommendations to the assessment!\n\n Thank You!!';
}else{
body = 'Thank You!!\n\n You have completed the assessment.'
}

var payload = {
notification: {
title: `BHBS | ${querySnapshot.data()["firstName"]} ${querySnapshot.data()["lastName"]}`,
body: 'Hello, You have been allocated as a therapist for the assessment',
title: `BHBS | ${querySnapshot.data()["firstName"]} ${querySnapshot.data()["lastName"]} `,
body: body,
click_action : 'FLUTTER_NOTIFICATION_CLICK',
}
};
Expand All @@ -113,18 +125,18 @@ const fcm = admin.messaging();

exports.sendMessageToPatient = functions.firestore
.document('assessments/{id}')
.onCreate(async (snapshot, context) => {
.onUpdate(async (snapshot, context) => {
if (snapshot.empty) {
console.log("No Assessments");
}
const message = snapshot.data();
console.log(message);
// const message = snapshot.data();
// console.log(message);


const querySnapshot = await db
.collection('users')
.doc(snapshot.data()["therapist"])
.get();
.get();flutter build apk --split-per-abi

const querySnapshotPatient = await db
.collection('users')
Expand All @@ -133,36 +145,42 @@ const fcm = admin.messaging();

const token = querySnapshot.data()["token"];
console.log(token);

// if (message.data()["currentStatus"] == "Assessment Scheduled") {
var payload = {
notification: {
title: `BHBS | Assessment of ${querySnapshotPatient.data()["firstName"]} ${querySnapshotPatient.data()["lastName"]} with therapist ${querySnapshot.data()["firstName"]} ${querySnapshot.data()["lastName"]}`,
body: 'Hello, Your assessment has been scheduled with our hospital',
click_action : 'FLUTTER_NOTIFICATION_CLICK',
}
};
try {
var currentStatus = snapshot.after.data()["currentStatus"];
var body;

if (currentStatus == "Assessment Finished") {
body = 'Hello, Your assessment has been finished by the assessor. Therapist will soon began to give recommendations to your assessment. \n\n Thank you for choosing us!';
}else if(currentStatus == "Report Generated"){
body = 'Hello, Your assessment has been finished by the therapist. View your report so that you can make the changes according the therapist recommendations. \n\n Thank you for choosing us!';
}else{
body = "Hello, Assessor will soon informed with your assessment.\n\n Thank you for choosing us!";
}

var payload = {
notification: {
title: `Welcome to BHBS | Assessment of ${querySnapshotPatient.data()["firstName"]} ${querySnapshotPatient.data()["lastName"]} with therapist ${querySnapshot.data()["firstName"]} ${querySnapshot.data()["lastName"]} has been scheduled`,
body: body,
click_action : 'FLUTTER_NOTIFICATION_CLICK',
}
};
try {
const response = await admin.messaging().sendToDevice(token, payload);
console.log("Notification sent successfully");
return response;
} catch (error) {
console.log();
}
// return fcm.sendToDevice(token, payload);
// }
} catch (error) {
console.log();
}

});

exports.sendMessageToAssessor = functions.firestore
.document('assessments/{id}')
.onCreate(async (snapshot, context) => {
.onUpdate(async (snapshot, context) => {
if (snapshot.empty) {
console.log("No Assessments");
}
const message = snapshot.data();
console.log(message);

// const message = snapshot.data();
// console.log(message);

const querySnapshot = await db
.collection('users')
Expand All @@ -176,12 +194,19 @@ const fcm = admin.messaging();

const token = querySnapshot.data()["token"];
console.log(token);
var currentStatus = snapshot.after.data()["currentStatus"];
var body;

if (currentStatus == "Assessment Scheduled" && snapshot.data()["therapist"] != snapshot.data()["assessor"] ) {
body = 'Hello, You have been allocated as an assessor for the assessment. So, complete the assessment as soon as posible\n\n Thank You!!';
}else{
body = 'Thank You! to complete the assessment in time.';
}

// if (message.data()["currentStatus"] == "Assessment Scheduled") {
var payload = {
notification: {
title: `BHBS | ${querySnapshot.data()["firstName"]} ${querySnapshot.data()["lastName"]}`,
body: 'Hello, You have been allocated as a therapist for the assessment',
body: body,
click_action : 'FLUTTER_NOTIFICATION_CLICK',
}
};
Expand All @@ -192,9 +217,6 @@ const fcm = admin.messaging();
} catch (error) {
console.log();
}
// return fcm.sendToDevice(token, payload);
// }

});

// exports.onStatusUpdate = functions.document("assessments/{id}").onUpdate(async (snapshot, context) => {
Expand Down Expand Up @@ -222,8 +244,8 @@ const fcm = admin.messaging();
// }
// });

exports.onUserCreate = functions.firestore.document("users/{userid}").onCreate(async (snap, context) => {
const values = snap.data();
// exports.onUserCreate = functions.firestore.document("users/{userid}").onCreate(async (snap, context) => {
// const values = snap.data();

await db.collection("logging").add({description: "Email was sent to user with username: ${values.username}"});
});
// await db.collection("logging").add({description: "Email was sent to user with username: ${values.username}"});
// });
14 changes: 7 additions & 7 deletions functions/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"main": "index.js",
"dependencies": {
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.14.1"
"firebase-functions": "^3.15.5"
},
"devDependencies": {
"firebase-functions-test": "^0.2.0"
Expand Down
4 changes: 3 additions & 1 deletion lib/Assesment/Forms/Pathway/pathwaypro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ class PathwayPro extends ChangeNotifier {
if (wholelist[0][accessname]['question']["7"]['stepCount']
.containsKey('count')) {}
} else {
wholelist[0][accessname]['question']["7"]['stepCount'] = {};
wholelist[0][accessname]['question']["7"]['stepCount'] = {
"count": 0,
};
}
print(wholelist[0][accessname]['question']["7"]['stepCount']);
}
Expand Down
Loading

0 comments on commit 1d65b27

Please sign in to comment.