confirmPushRead method
Implementation
Future<void> confirmPushRead(String payload) async {
final Map<String, dynamic> decoded = json.decode(payload);
String reportUrl = '';
if (Platform.isAndroid) {
// final String ntiuspNotiStr = decoded['message']['android']['data']['ntiuspNoti'];
// final Map<String, dynamic> ntiuspNoti = json.decode(ntiuspNotiStr);
// reportUrl = ntiuspNoti['reportUrl'];
// final Map<String, dynamic> decoded = json.decode(payload);
reportUrl = decoded['reportUrl'];
} else if (Platform.isIOS) {
// final Map<String, dynamic> decoded = json.decode(payload);
reportUrl = decoded['ntiuspNoti']['reportUrl'];
}
Uri uri = Uri.parse(reportUrl);
String? senderMsgId = uri.queryParameters['SenderMsgId'];
String? nrid;
if (senderMsgId != null) {
List<String> parts = senderMsgId.split(',');
if (parts.length >= 3) {
nrid = parts[2];
_sendLog("NRID : $nrid");
} else {
_sendLog("SenderMsgId에 세 번째 값이 없습니다.");
}
} else {
_sendLog("SenderMsgId 파라미터가 없습니다.");
}
if (nrid == null) {
_sendLog("nrid 값이 없습니다.");
return ;
}
//nrid를 base64 decodeing
// Base64 디코딩
List<int> decodedBytes = base64Decode(nrid);
// UTF-8로 디코딩해서 문자열로 변환
String decodedString = utf8.decode(decodedBytes);
await _sendReadPush(decodedString);
}