|
|
|
@ -105,13 +105,15 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
|
|
|
|
|
|
|
|
|
|
if (Platform.isAndroid) { |
|
|
|
|
xgFlutterPlugin.getXgAndroidApi().addNativeEventHandler( |
|
|
|
|
MyNativeEventHandler( |
|
|
|
|
(String title, String message, String customContent, int type) { |
|
|
|
|
print("xgPushClickAction2: $customContent"); |
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
value.setString("pushData", customContent); |
|
|
|
|
}); |
|
|
|
|
})); |
|
|
|
|
MyNativeEventHandler( |
|
|
|
|
(String title, String message, String customContent, int type) { |
|
|
|
|
print("xgPushClickAction2: $customContent"); |
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
value.setString("pushData", customContent); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// @typed: 1文章 2活动 3店铺 4积分商品 5订单 |
|
|
|
@ -147,8 +149,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
|
|
|
|
|
}, xgPushDidBindWithIdentifier: (event) async { |
|
|
|
|
print("xgPushDidBindWithIdentifier: ${event.toString()}"); |
|
|
|
|
return event; |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
pushRoute() async { |
|
|
|
@ -203,9 +204,11 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
|
|
|
|
|
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); |
|
|
|
|
if (sharedPreferences.getString("token") == null || |
|
|
|
|
sharedPreferences.getString("token") == "") return; |
|
|
|
|
BaseData<UserInfo> baseDate = await ApiService(Dio(), |
|
|
|
|
context: context, token: sharedPreferences.getString('token')) |
|
|
|
|
.queryInfo(); |
|
|
|
|
BaseData<UserInfo> baseDate = await ApiService( |
|
|
|
|
Dio(), |
|
|
|
|
context: context, |
|
|
|
|
token: sharedPreferences.getString('token'), |
|
|
|
|
).queryInfo().catchError((onError) {}); |
|
|
|
|
sharedPreferences.setString('user', jsonEncode(baseDate.data)); |
|
|
|
|
|
|
|
|
|
String mobile = baseDate.data.phone; |
|
|
|
|