getStatus static method
getStatus return call status
Implementation
static String getStatus(
BuildContext? context, CallLog? callLog, User? loggedInUser) {
String callMessageText = "";
if (callLog == null || loggedInUser == null) {
return "";
}
if (context == null) {
return "";
}
//check if the call is initiated
if (callLog.status == CallStatusConstants.initiated) {
//check if the logged in user is the initiator
if (!callLogLoggedInUser(callLog, loggedInUser)) {
callMessageText = Translations.of(context).incomingCall;
} else {
callMessageText = Translations.of(context).outgoingCall;
}
} else if (callLog.status == CallStatusConstants.ongoing) {
if (callLogLoggedInUser(callLog, loggedInUser)) {
callMessageText = Translations.of(context).ongoingCall;
} else {
callMessageText = Translations.of(context).ongoingCall;
}
} else if (callLog.status == CallStatusConstants.ended) {
if (callLogLoggedInUser(callLog, loggedInUser)) {
callMessageText = Translations.of(context).outgoingCall;
} else {
callMessageText = Translations.of(context).incomingCall;
}
} else if (callLog.status == CallStatusConstants.unanswered) {
if (callLogLoggedInUser(callLog, loggedInUser)) {
callMessageText = Translations.of(context).unansweredCall;
} else {
callMessageText = Translations.of(context).missedCall;
}
} else if (callLog.status == CallStatusConstants.cancelled) {
if (callLogLoggedInUser(callLog, loggedInUser)) {
callMessageText = Translations.of(context).cancelledCall;
} else {
callMessageText = Translations.of(context).missedCall;
}
} else if (callLog.status == CallStatusConstants.rejected) {
if (callLogLoggedInUser(callLog, loggedInUser)) {
callMessageText = Translations.of(context).rejectedCall;
} else {
callMessageText = Translations.of(context).missedCall;
}
} else if (callLog.status == CallStatusConstants.busy) {
if (callLogLoggedInUser(callLog, loggedInUser)) {
callMessageText = Translations.of(context).unansweredCall;
} else {
callMessageText = Translations.of(context).missedCall;
}
}
return " $callMessageText";
}