|
|
|
@ -281,120 +281,103 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
//
|
|
|
|
|
// //_firebase Background message handler
|
|
|
|
|
_firebaseMessaging.configure(
|
|
|
|
|
onMessage: (Map<String, dynamic> message) async {
|
|
|
|
|
// showDialog("onMessage: $message");
|
|
|
|
|
print("onMessage: $message");
|
|
|
|
|
print(message);
|
|
|
|
|
print(message['name']);
|
|
|
|
|
print(message['appointmentdate']);
|
|
|
|
|
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
if (message['is_call'] == "true") {
|
|
|
|
|
var route = ModalRoute.of(context);
|
|
|
|
|
|
|
|
|
|
if (route != null) {
|
|
|
|
|
print(route.settings.name);
|
|
|
|
|
}
|
|
|
|
|
onMessage: (Map<String, dynamic> message) async {
|
|
|
|
|
// showDialog("onMessage: $message");
|
|
|
|
|
print("onMessage: $message");
|
|
|
|
|
print(message);
|
|
|
|
|
print(message['name']);
|
|
|
|
|
print(message['appointmentdate']);
|
|
|
|
|
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
if (message['is_call'] == "true") {
|
|
|
|
|
var route = ModalRoute.of(context);
|
|
|
|
|
|
|
|
|
|
if (route != null) {
|
|
|
|
|
print(route.settings.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
|
|
|
|
|
print(myMap);
|
|
|
|
|
LandingPage.isOpenCallPage = true;
|
|
|
|
|
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
if (!isPageNavigated) {
|
|
|
|
|
isPageNavigated = true;
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => IncomingCall(
|
|
|
|
|
incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found iOS");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found iOS");
|
|
|
|
|
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
|
|
|
|
|
print(myMap);
|
|
|
|
|
LandingPage.isOpenCallPage = true;
|
|
|
|
|
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
if (!isPageNavigated) {
|
|
|
|
|
isPageNavigated = true;
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found iOS");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found iOS");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
if (message['data'].containsKey("is_call")) {
|
|
|
|
|
var route = ModalRoute.of(context);
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
if (message['data'].containsKey("is_call")) {
|
|
|
|
|
var route = ModalRoute.of(context);
|
|
|
|
|
|
|
|
|
|
if (route != null) {
|
|
|
|
|
print(route.settings.name);
|
|
|
|
|
}
|
|
|
|
|
if (route != null) {
|
|
|
|
|
print(route.settings.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> myMap =
|
|
|
|
|
new Map<String, dynamic>.from(message['data']);
|
|
|
|
|
print(myMap);
|
|
|
|
|
LandingPage.isOpenCallPage = true;
|
|
|
|
|
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
if (!isPageNavigated) {
|
|
|
|
|
isPageNavigated = true;
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => IncomingCall(
|
|
|
|
|
incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found Android");
|
|
|
|
|
LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found Android");
|
|
|
|
|
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message['data']);
|
|
|
|
|
print(myMap);
|
|
|
|
|
LandingPage.isOpenCallPage = true;
|
|
|
|
|
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
if (!isPageNavigated) {
|
|
|
|
|
isPageNavigated = true;
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found Android");
|
|
|
|
|
LocalNotification.getInstance().showNow(title: message['notification']['title'], subtitle: message['notification']['body']);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found Android");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
|
|
|
|
|
onLaunch: (Map<String, dynamic> message) async {
|
|
|
|
|
print("onLaunch: $message");
|
|
|
|
|
// showDialog("onLaunch: $message");
|
|
|
|
|
},
|
|
|
|
|
onResume: (Map<String, dynamic> message) async {
|
|
|
|
|
print("onResume: $message");
|
|
|
|
|
print(message);
|
|
|
|
|
print(message['name']);
|
|
|
|
|
print(message['appointmentdate']);
|
|
|
|
|
|
|
|
|
|
// showDialog("onResume: $message");
|
|
|
|
|
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
if (message['is_call'] == "true") {
|
|
|
|
|
var route = ModalRoute.of(context);
|
|
|
|
|
|
|
|
|
|
if (route != null) {
|
|
|
|
|
print(route.settings.name);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onBackgroundMessage: Platform.isIOS ? null : myBackgroundMessageHandler,
|
|
|
|
|
onLaunch: (Map<String, dynamic> message) async {
|
|
|
|
|
print("onLaunch: $message");
|
|
|
|
|
// showDialog("onLaunch: $message");
|
|
|
|
|
},
|
|
|
|
|
onResume: (Map<String, dynamic> message) async {
|
|
|
|
|
print("onResume: $message");
|
|
|
|
|
print(message);
|
|
|
|
|
print(message['name']);
|
|
|
|
|
print(message['appointmentdate']);
|
|
|
|
|
|
|
|
|
|
// showDialog("onResume: $message");
|
|
|
|
|
|
|
|
|
|
if (Platform.isIOS) {
|
|
|
|
|
if (message['is_call'] == "true") {
|
|
|
|
|
var route = ModalRoute.of(context);
|
|
|
|
|
|
|
|
|
|
if (route != null) {
|
|
|
|
|
print(route.settings.name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, dynamic> myMap =
|
|
|
|
|
new Map<String, dynamic>.from(message);
|
|
|
|
|
print(myMap);
|
|
|
|
|
LandingPage.isOpenCallPage = true;
|
|
|
|
|
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
if (!isPageNavigated) {
|
|
|
|
|
isPageNavigated = true;
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) => IncomingCall(
|
|
|
|
|
incomingCallData: LandingPage.incomingCallData)))
|
|
|
|
|
.then((value) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found iOS");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found iOS");
|
|
|
|
|
Map<String, dynamic> myMap = new Map<String, dynamic>.from(message);
|
|
|
|
|
print(myMap);
|
|
|
|
|
LandingPage.isOpenCallPage = true;
|
|
|
|
|
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
|
|
|
|
|
if (!isPageNavigated) {
|
|
|
|
|
isPageNavigated = true;
|
|
|
|
|
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
|
|
|
|
|
isPageNavigated = false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found iOS");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
print("Is Call Not Found iOS");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
showDialogs(String message) {
|
|
|
|
@ -558,7 +541,7 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
|
|
|
|
|
pageController.jumpToPage(0);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
projectViewModel.isLogin && model.notificationsCount != null
|
|
|
|
|
projectViewModel.isLogin && model.notificationsCount != null && !projectViewModel.isLoginChild
|
|
|
|
|
? new Positioned(
|
|
|
|
|
right: projectViewModel.isArabic ? 35 : 0,
|
|
|
|
|
top: 5,
|
|
|
|
|