添加火警推送,修复巡更问题

hmxc
张萌 3 years ago
parent 9084987b2b
commit a0df048fc4

@ -1,6 +1,6 @@
class API {
///HOST
static const String host = 'http://test.akuhotel.com:8804';
static const String host = 'http://39.103.177.88:8804';
///
static const String baseURL = '$host/IntelligentCommunity/butlerApp';
@ -185,7 +185,6 @@ class _Manage {
///n
String get uploadLocation => '/user/inspection/uploadLocation';
}
class _Upload {

@ -11,6 +11,7 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:power_logger/power_logger.dart';
import 'package:provider/provider.dart';
// Project imports:
@ -31,6 +32,7 @@ void main() async {
//
onReceiveNotification: (Map<String, dynamic> message) async {
print("flutter onReceiveNotification: $message");
LoggerData.addData(message);
},
//
onOpenNotification: (Map<String, dynamic> message) async {
@ -47,6 +49,7 @@ void main() async {
production: false,
debug: true, // debug
);
print(jpush.getRegistrationID());
runApp(MyApp());
}

@ -289,7 +289,8 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
),
padding:
EdgeInsets.symmetric(vertical: 16.w, horizontal: 24.w),
child: model.remakes.text
child: (model?.remakes ?? '')
.text
.color(kTextPrimaryColor)
.size(28.sp)
.make(),

@ -0,0 +1,59 @@
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
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 fireAlert(subTitle);
break;
default:
}
}
}
Future fireAlert(String subTitle) async {
await Get.dialog(
CupertinoAlertDialog(
title: Text('发现火灾!请立刻组织疏散人群!'),
content: Column(
children: [
Text(subTitle),
10.w.heightBox,
Icon(
CupertinoIcons.bell_fill,
color: Colors.red,
size: 48.w,
),
],
),
actions: [
CupertinoDialogAction(
child: Text('确认'),
onPressed: () => Get.back(),
),
],
),
barrierDismissible: false,
);
}
}
Loading…
Cancel
Save