Skip to content

Commit

Permalink
checked all spelling mistakes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tushar1805 committed Oct 7, 2021
1 parent 714ec75 commit 6f33e96
Show file tree
Hide file tree
Showing 31 changed files with 438 additions and 310 deletions.
Binary file added assets/bhbs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
{}
{
"functions": {
"source": "functions"
}
}
40 changes: 39 additions & 1 deletion functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,44 @@ const fcm = admin.messaging();

// });

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

const querySnapshot = await db
.collection('users')
.doc(snapshot["therapist"])
.get();

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

var body;

if ( snapshot["assessor"].toString() == snapshot["therapist"].toString()){
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!!';
}

var payload = {
notification: {
title: `BHBS | ${querySnapshot.data()["firstName"]} ${querySnapshot.data()["lastName"]} `,
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();
}

});

exports.sendMessageToTherapist = functions.firestore
.document('assessments/{id}')
.onUpdate(async (snapshot, context) => {
Expand Down Expand Up @@ -136,7 +174,7 @@ const fcm = admin.messaging();
const querySnapshot = await db
.collection('users')
.doc(snapshot.data()["therapist"])
.get();flutter build apk --split-per-abi
.get();

const querySnapshotPatient = await db
.collection('users')
Expand Down
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.15.5"
"firebase-functions": "^3.14.1"
},
"devDependencies": {
"firebase-functions-test": "^0.2.0"
Expand Down
83 changes: 45 additions & 38 deletions lib/Assesment/Forms/Bathroom/bathroomUI.dart

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/Assesment/Forms/Bathroom/bathroompro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ class BathroomPro extends ChangeNotifier {
),
labelStyle:
TextStyle(color: (isColor) ? Colors.green : Colors.red),
labelText: 'Recomendation'),
labelText: 'Recommendation'),
onChanged: (value) {
// print(accessname);
assesmentprovider.setrecothera(index, value);
Expand Down
44 changes: 22 additions & 22 deletions lib/Assesment/Forms/Bedroom/bedroomUI.dart
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,7 @@ class _BedroomUIState extends State<BedroomUI> {
children: [
Container(
width: MediaQuery.of(context).size.width * .4,
child: Text('Lighting Types',
child: Text('Lighting Type',
style: TextStyle(
color: Color.fromRGBO(10, 80, 106, 1),
fontSize: 20,
Expand Down Expand Up @@ -948,13 +948,13 @@ class _BedroomUIState extends State<BedroomUI> {
new TextEditingController().clear();
// print(widget.accessname);
assesmentprovider.setdata(
4, value, 'Lighting');
4, value, 'Lighting Type');
} else if (role != "therapist") {
FocusScope.of(context).requestFocus();
new TextEditingController().clear();
// print(widget.accessname);
assesmentprovider.setdata(
4, value, 'Lighting');
4, value, 'Lighting Type');
} else {
_showSnackBar(
"You can't change the other fields",
Expand Down Expand Up @@ -987,7 +987,7 @@ class _BedroomUIState extends State<BedroomUI> {
children: [
Container(
width: MediaQuery.of(context).size.width * .6,
child: Text('Switches Able to Operate',
child: Text('Able to Operate Switches?',
style: TextStyle(
color: Color.fromRGBO(10, 80, 106, 1),
fontSize: 20,
Expand Down Expand Up @@ -1016,13 +1016,13 @@ class _BedroomUIState extends State<BedroomUI> {
new TextEditingController().clear();
// print(widget.accessname);
assesmentprovider.setdata(
5, value, 'Switches Able to Operate');
5, value, 'Able to Operate Switches?');
} else if (role != "therapist") {
FocusScope.of(context).requestFocus();
new TextEditingController().clear();
// print(widget.accessname);
assesmentprovider.setdata(
5, value, 'Switches Able to Operate');
5, value, 'Able to Operate Switches?');
} else {
_showSnackBar(
"You can't change the other fields",
Expand Down Expand Up @@ -1053,7 +1053,7 @@ class _BedroomUIState extends State<BedroomUI> {
children: [
Container(
width: MediaQuery.of(context).size.width * .4,
child: Text('Switch Types',
child: Text('Switch Type',
style: TextStyle(
color: Color.fromRGBO(10, 80, 106, 1),
fontSize: 20,
Expand All @@ -1079,8 +1079,8 @@ class _BedroomUIState extends State<BedroomUI> {
value: '4 Way',
),
DropdownMenuItem(
child: Text('Mutlti Location'),
value: 'Mutlti Location',
child: Text('Multi Location'),
value: 'Multi Location',
),
DropdownMenuItem(
child: Text('Double Switch'),
Expand All @@ -1102,13 +1102,13 @@ class _BedroomUIState extends State<BedroomUI> {
new TextEditingController().clear();
// print(widget.accessname);
assesmentprovider.setdata(
6, value, 'Switch Types');
6, value, 'Switch Type');
} else if (role != "therapist") {
FocusScope.of(context).requestFocus();
new TextEditingController().clear();
// print(widget.accessname);
assesmentprovider.setdata(
6, value, 'Switch Types');
6, value, 'Switch Type');
} else {
_showSnackBar(
"You can't change the other fields",
Expand Down Expand Up @@ -1351,7 +1351,7 @@ class _BedroomUIState extends State<BedroomUI> {
width:
MediaQuery.of(context).size.width *
.6,
child: Text('Telephone Type?',
child: Text('Type of Telephone',
style: TextStyle(
color: Color.fromRGBO(
10, 80, 106, 1),
Expand Down Expand Up @@ -1420,8 +1420,8 @@ class _BedroomUIState extends State<BedroomUI> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: MediaQuery.of(context).size.width * .4,
child: Text('Smoke Detector?',
width: MediaQuery.of(context).size.width * .6,
child: Text('Smoke Detector Present?',
style: TextStyle(
color: Color.fromRGBO(10, 80, 106, 1),
fontSize: 20,
Expand Down Expand Up @@ -1450,14 +1450,14 @@ class _BedroomUIState extends State<BedroomUI> {
// print(widget.accessname);

assesmentprovider.setdata(
10, value, 'Smoke Detector?');
10, value, 'Smoke Detector Present?');
} else if (role != "therapist") {
FocusScope.of(context).requestFocus();
new TextEditingController().clear();
// print(widget.accessname);

assesmentprovider.setdata(
10, value, 'Smoke Detector?');
10, value, 'Smoke Detector Present?');
} else {
_showSnackBar(
"You can't change the other fields",
Expand Down Expand Up @@ -1509,7 +1509,7 @@ class _BedroomUIState extends State<BedroomUI> {
),
DropdownMenuItem(
child: Text('Adjustable'),
value: 'Ajustable',
value: 'Adjustable',
),
],
onChanged: (value) {
Expand Down Expand Up @@ -1578,8 +1578,8 @@ class _BedroomUIState extends State<BedroomUI> {
value: 'Two Twins Joined',
),
DropdownMenuItem(
child: Text('Two Twins Seperated'),
value: 'Two Twins Seperated',
child: Text('Two Twins Separated'),
value: 'Two Twins Separated',
),
],
onChanged: (value) {
Expand Down Expand Up @@ -1801,7 +1801,7 @@ class _BedroomUIState extends State<BedroomUI> {
children: [
Container(
width: MediaQuery.of(context).size.width * .7,
child: Text('Able to access closet/clothes',
child: Text('Able to access closet/clothes?',
style: TextStyle(
color: Color.fromRGBO(10, 80, 106, 1),
fontSize: 20,
Expand Down Expand Up @@ -1830,14 +1830,14 @@ class _BedroomUIState extends State<BedroomUI> {
// print(widget.accessname);

assesmentprovider.setdata(16, value,
'Able to Access Closet/Clothes');
'Able to Access Closet/Clothes?');
} else if (role != "therapist") {
FocusScope.of(context).requestFocus();
new TextEditingController().clear();
// print(widget.accessname);

assesmentprovider.setdata(16, value,
'Able to Access Closet/Clothes');
'Able to Access Closet/Clothes?');
} else {
_showSnackBar(
"You can't change the other fields",
Expand Down
2 changes: 1 addition & 1 deletion lib/Assesment/Forms/Bedroom/bedroompro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ class BedroomPro extends ChangeNotifier {
),
labelStyle:
TextStyle(color: (isColor) ? Colors.green : Colors.red),
labelText: 'Recomendation'),
labelText: 'Recommendation'),
onChanged: (value) {
// print(accessname);
assesmentprovider.setrecothera(index, value);
Expand Down
Loading

0 comments on commit 6f33e96

Please sign in to comment.