|
|
|
@ -2,6 +2,8 @@ import 'dart:convert';
|
|
|
|
|
import 'dart:io'; |
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
|
|
|
|
import 'package:flutter_bmflocation/bdmap_location_flutter_plugin.dart'; |
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart'; |
|
|
|
|
import 'package:huixiang/community/community_page.dart'; |
|
|
|
@ -20,6 +22,9 @@ import 'package:huixiang/utils/font_weight.dart';
|
|
|
|
|
import 'package:huixiang/utils/native_event_handler.dart'; |
|
|
|
|
import 'package:permission_handler/permission_handler.dart'; |
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
import 'package:sharesdk_plugin/sharesdk_interface.dart'; |
|
|
|
|
import 'package:sharesdk_plugin/sharesdk_register.dart'; |
|
|
|
|
import 'package:tpns_flutter_plugin/android/xg_android_api.dart'; |
|
|
|
|
import 'package:tpns_flutter_plugin/tpns_flutter_plugin.dart'; |
|
|
|
|
|
|
|
|
|
import 'community/order_page.dart'; |
|
|
|
@ -81,6 +86,9 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
|
|
|
|
|
..userInteractions = false |
|
|
|
|
..dismissOnTap = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initSdk(); |
|
|
|
|
|
|
|
|
|
pushRoute(); |
|
|
|
|
|
|
|
|
|
String invite = ""; |
|
|
|
@ -130,11 +138,53 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
queryUserInfo(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
initSdk() async { |
|
|
|
|
///ios 调用startXg前需要调用此方法 |
|
|
|
|
xgFlutterPlugin.configureClusterDomainName("tpns.sh.tencent.com"); |
|
|
|
|
xgFlutterPlugin.setEnableDebug(true); |
|
|
|
|
|
|
|
|
|
///此处配置为iOS的appID信息,Android信息在build.gradle文件中 |
|
|
|
|
xgFlutterPlugin.startXg("1680005688", "IYIB3R2XRE22"); |
|
|
|
|
|
|
|
|
|
if (Platform.isAndroid) { |
|
|
|
|
XgAndroidApi androidApi = xgFlutterPlugin.getXgAndroidApi(); |
|
|
|
|
//小米 |
|
|
|
|
androidApi.setMiPushAppId(appId: "2882303761520050452"); |
|
|
|
|
androidApi.setMiPushAppKey(appKey: "5582005091452"); |
|
|
|
|
|
|
|
|
|
androidApi.enableOtherPush(); |
|
|
|
|
androidApi.regPush(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ShareSDKRegister shareSDKRegister = ShareSDKRegister(); |
|
|
|
|
shareSDKRegister.setupWechat( |
|
|
|
|
"wx3b269e795ed23e5f", |
|
|
|
|
"64020361b8ec4c99936c0e3999a9f249", |
|
|
|
|
"https://hx.lotus-wallet.com/app/", |
|
|
|
|
); |
|
|
|
|
shareSDKRegister.setupFacebook( |
|
|
|
|
"523308712059457", |
|
|
|
|
"d3a1b6377100871799d8973fbe84794a", |
|
|
|
|
"一心回乡", |
|
|
|
|
); |
|
|
|
|
SharesdkPlugin.regist(shareSDKRegister); |
|
|
|
|
|
|
|
|
|
if (Platform.isIOS) { |
|
|
|
|
LocationFlutterPlugin.setApiKey("ylW2QPlsbERkho7jOgU4GQSeawmdUIoR"); |
|
|
|
|
BMFMapSDK.setApiKeyAndCoordType( |
|
|
|
|
'ylW2QPlsbERkho7jOgU4GQSeawmdUIoR', |
|
|
|
|
BMF_COORD_TYPE.COMMON, |
|
|
|
|
); |
|
|
|
|
} else if (Platform.isAndroid) { |
|
|
|
|
BMFMapSDK.setCoordType(BMF_COORD_TYPE.COMMON); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (Platform.isAndroid) { |
|
|
|
|
xgFlutterPlugin.getXgAndroidApi().addNativeEventHandler( |
|
|
|
|
MyNativeEventHandler( |
|
|
|
|
(String title, String message, String customContent, int type) { |
|
|
|
|
(String title, String message, String customContent, int type) { |
|
|
|
|
print("xgPushClickAction2: $customContent"); |
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
value.setString("pushData", customContent); |
|
|
|
@ -151,7 +201,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
|
|
|
|
|
if (Platform.isAndroid |
|
|
|
|
? (event["actionType"] == 0) |
|
|
|
|
: (event["xg"]["msgtype"] == 1) && |
|
|
|
|
event[Platform.isAndroid ? "customMessage" : "custom"] != null) { |
|
|
|
|
event[Platform.isAndroid ? "customMessage" : "custom"] != null) { |
|
|
|
|
SharedPreferences.getInstance().then((value) { |
|
|
|
|
value.setString("pushData", |
|
|
|
|
event[Platform.isAndroid ? "customMessage" : "custom"]); |
|
|
|
|