Commit e05501a6cc665da688fac936167dae4910d29a08

Authored by “gaiyaguang”
1 parent c2e14607

红点

... ... @@ -404,9 +404,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 136;
CURRENT_PROJECT_VERSION = 141;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -419,7 +420,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.3.6;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -546,9 +547,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 136;
CURRENT_PROJECT_VERSION = 141;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -561,7 +562,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.3.6;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -579,9 +580,9 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 136;
CURRENT_PROJECT_VERSION = 141;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -594,7 +595,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.3.6;
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ...
... ... @@ -33,6 +33,7 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart';
import 'package:flutter_app_badger/flutter_app_badger.dart';
class HomePage extends StatefulWidget {
final int initialIndex; //初始tab
... ... @@ -51,6 +52,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
int _currIndex = 1;
Color _activeColor = MyColours.color_199095;
Color _defaultColor = MyColours.color_999999;
int numPush = 0; //推送消息个数
Timer timer;
... ... @@ -103,6 +105,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
//获取点击通知栏的自定义参数
_getIntent() async {
_clearBadge();
Map param = await Tools().getIntent();
Map notifyParam = param;
if (Platform.isIOS && param != null) {
... ... @@ -152,7 +155,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
LogUtil.v("注册成功:$token");
// Utils.showToast("注册成功:$token");
userTokenInit(token);
XgFlutterPlugin().setAppBadge(0);
// XgFlutterPlugin().setAppBadge(0);
}
},
unRegistered: (String msg) async {
... ... @@ -160,6 +163,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
},
onReceiveNotificationResponse: (Map<String, dynamic> msg) async {
LogUtil.v("flutter onReceiveNotificationResponse $msg");
numPush++;
_addBadge();
},
onReceiveMessage: (Map<String, dynamic> msg) async {
print("flutter onReceiveMessage $msg");
... ... @@ -167,8 +172,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
xgPushDidSetBadge: (String msg) async {
print("flutter xgPushDidSetBadge: $msg");
/// 在此可设置应用角标
XgFlutterPlugin().setAppBadge(0);
// /// 在此可设置应用角标
// XgFlutterPlugin().setAppBadge(0);
},
xgPushDidBindWithIdentifier: (String msg) async {
print("flutter xgPushDidBindWithIdentifier: $msg");
... ... @@ -183,6 +188,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
print("flutter xgPushDidClearAllIdentifiers: $msg");
},
xgPushClickAction: (Map<String, dynamic> msg) async {
_clearBadge();
if (Platform.isIOS && msg != null && msg['custom'] != null) {
Map custom = json.decode(msg['custom'].toString());
switch (custom["messageType"].toString()) {
... ... @@ -233,6 +239,19 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
xgCount++;
}
void _addBadge() {
XgFlutterPlugin().setBadge(numPush);
XgFlutterPlugin().setAppBadge(numPush);
FlutterAppBadger.updateBadgeCount(numPush);
}
void _clearBadge() async {
numPush = 0;
XgFlutterPlugin().setBadge(0);
XgFlutterPlugin().setAppBadge(0);
FlutterAppBadger.removeBadge();
}
//初始化推送token
userTokenInit(String token) {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
... ...
... ... @@ -300,6 +300,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_app_badger:
dependency: "direct main"
description:
name: flutter_app_badger
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.2"
flutter_blurhash:
dependency: transitive
description:
... ...
... ... @@ -87,6 +87,7 @@ dependencies:
contacts_service: ^0.4.6
common_utils: ^1.1.3
easy_contact_picker: ^0.0.2
flutter_app_badger: ^1.1.2
dev_dependencies:
... ...