Untitled

mail@pastecode.io avatar
unknown
dart
2 years ago
958 B
1
Indexable
Never
  print("bg handler: " + message.data.toString());
  if (message != null && message.data != null) {
    String dataType = message.data['type'];
    if (dataType == 'JobRequest' && message.data["RequestData"] != null) {
      var result = jsonDecode(message.data["RequestData"]);
      if (message.data['TimeoutTime'] != null &&
          message.data['SID'] != null &&
          result["data"]["DeviceID"] != null) {
        int timeouttime =
            double.parse(message.data['TimeoutTime'].toString()).round();
        String notificationID = message.data['SID'].toString();
        String myDeviceID = result["data"]["DeviceID"];
        JobInfoModel _jobInfoModel = JobInfoModel.fromJson(result);
        await WebServices.saveBackgroundNotification(
            false,
            timeouttime,
            notificationID,
            myDeviceID,
            _jobInfoModel.data.requestInfo,
            _jobInfoModel.data.userInfo);
      }
    }
  }