You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// Dart imports:
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
import 'package:aku_new_community_manager/utils/websocket/fier_dialog.dart';
|
|
|
|
|
|
|
|
// Flutter imports:
|
|
|
|
|
|
|
|
// Package imports:
|
|
|
|
|
|
|
|
class JpushMessageParse {
|
|
|
|
final Map<String, dynamic> message;
|
|
|
|
String? subTitle;
|
|
|
|
String type = '0';
|
|
|
|
JpushMessageParse(Map<String, dynamic> rawMessage)
|
|
|
|
: message = Map<String, dynamic>.from(rawMessage);
|
|
|
|
|
|
|
|
Future shot() async {
|
|
|
|
subTitle = message['alert'];
|
|
|
|
Map<dynamic, dynamic> rawExtras = message['extras'];
|
|
|
|
String? androidExtra = rawExtras['cn.jpush.android.EXTRA'];
|
|
|
|
if (androidExtra == null) {
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
Map<String, dynamic> _innerMap = jsonDecode(androidExtra);
|
|
|
|
type = _innerMap['type'] ?? '0';
|
|
|
|
switch (type) {
|
|
|
|
case '1':
|
|
|
|
await FireDialog.fireAlarm(subTitle!);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|