getSemiTitle function

String? getSemiTitle(
  1. LocationNotificationModel locationNotificationModel,
  2. bool haveResponded
)

Returns the semi-title for a location notification model

Implementation

String? getSemiTitle(
    LocationNotificationModel locationNotificationModel, bool haveResponded) {
  if (locationNotificationModel.key!.contains(MixedConstants.SHARE_LOCATION)) {
    return locationNotificationModel.atsignCreator !=
            AtLocationNotificationListener().currentAtSign
        ? (locationNotificationModel.isAccepted
            ? null
            : locationNotificationModel.isExited
                ? 'Received Share location rejected'
                : (haveResponded ? 'Pending request' : 'Action required'))
        : (locationNotificationModel.isAccepted
            ? null
            : locationNotificationModel.isExited
                ? 'Sent Share location rejected'
                : 'Awaiting response');
  } else {
    var _memberInfo = getCreatorDetails(locationNotificationModel);

    if (_memberInfo == null) {
      return (locationNotificationModel.atsignCreator ==
              AtLocationNotificationListener().currentAtSign)
          ? 'Action required'
          : 'Awaiting response';
    }

    return locationNotificationModel.atsignCreator ==
            AtLocationNotificationListener().currentAtSign
        ? (!_memberInfo.isExited
            ? (_memberInfo.isAccepted
                ? null
                : (haveResponded ? 'Pending request' : 'Action required'))
            : 'Request rejected')
        : (!_memberInfo.isExited
            ? (_memberInfo.isAccepted ? null : 'Awaiting response')
            : 'Request rejected');
  }
}