Browse Source

Merge branch 'master' into dev

null_safety
w-R 3 years ago
parent
commit
0c921eeced
  1. 10
      android/app/proguard-rules.pro
  2. 9
      android/app/src/main/AndroidManifest.xml
  3. 3
      android/app/src/main/kotlin/com/zsw/huixiang/MainActivity.kt
  4. 5
      lib/address/address_map_page.dart
  5. 2
      lib/integral/integral_page.dart
  6. 6
      lib/login/login_page.dart
  7. 42
      lib/main_page.dart
  8. 9
      lib/retrofit/retrofit_api.dart
  9. 2
      lib/union/union_page.dart
  10. 28
      lib/utils/native_event_handler.dart

10
android/app/proguard-rules.pro vendored

@ -20,6 +20,16 @@
-keep class com.baidu.vi.** {*;}
-dontwarn com.baidu.**
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep class com.tencent.android.tpush.** {*;}
-keep class com.tencent.tpns.baseapi.** {*;}
-keep class com.tencent.tpns.mqttchannel.** {*;}
-keep class com.tencent.tpns.dataacquisition.** {*;}
-keep class com.tencent.bigdata.baseapi.** {*;}
-keep class com.tencent.bigdata.mqttchannel.** {*;}
#andResGuard {
# whiteList = [
# "R.layout.mob_authorize_*",

9
android/app/src/main/AndroidManifest.xml

@ -59,6 +59,15 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter >
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/>
<!-- 通过自定义 data 块内容指定您的完整 scheme,按照您的配置,将会组成形如"语义名://主机名/路径名"的 url 标识 -->
<!-- 为防止和其他应用的跳转目标页面冲突,您可以使用带有 app 名称、app 包名等可以唯一标记应用的字段进行配置-->
<data
android:scheme="huixiang"
android:host="com.zsw.huixiang"/>
</intent-filter>
</activity>
<meta-data
android:name="XG_SERVER_SUFFIX"

3
android/app/src/main/kotlin/com/zsw/huixiang/MainActivity.kt

@ -1,6 +1,7 @@
package com.zsw.huixiang
import android.os.Bundle
import android.util.Log
import io.dcloud.feature.sdk.DCUniMPSDK
import io.flutter.embedding.android.FlutterActivity
@ -11,6 +12,8 @@ class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Log.e("intentUrl:", "url: ${intent.data}" )
flutterEngine?.plugins?.add(MinPlugin())
}

5
lib/address/address_map_page.dart

@ -61,6 +61,7 @@ class _AddressMapPage extends State<AddressMapPage> {
if (aMapFlutterLocation == null) {
aMapFlutterLocation = LocationFlutterPlugin();
aMapFlutterLocation.requestPermission();
aMapFlutterLocation.onResultCallback().listen((event) {
print("event: ${jsonEncode(event)}");
if (event != null &&
@ -144,7 +145,7 @@ class _AddressMapPage extends State<AddressMapPage> {
BMFPoiNearbySearch bmfPoiNearbySearch = BMFPoiNearbySearch();
bmfPoiNearbySearch.onGetPoiNearbySearchResult(
callback: (BMFPoiSearchResult result, BMFSearchErrorCode errorCode) {
if ((DateTime.now().millisecondsSinceEpoch - time) > 2000) {
// if ((DateTime.now().millisecondsSinceEpoch - time) > 2000) {
result.poiInfoList.map((e) => print("sssssssssss:${e.toMap()}"));
poiList = result.poiInfoList
.map((e) => Address.fromJson({
@ -167,7 +168,7 @@ class _AddressMapPage extends State<AddressMapPage> {
setState(() {
time = DateTime.now().millisecondsSinceEpoch;
});
}
// }
});
bmfPoiNearbySearch.poiNearbySearch(BMFPoiNearbySearchOption(
keywords: ["all"],

2
lib/integral/integral_page.dart

@ -67,7 +67,7 @@ class _IntegralPage extends State<IntegralPage> {
.indexWhere((element) => element.id == userinfo.memberRankVo.id) +
1);
}
SmartDialog.dismiss();
SmartDialog.dismiss(closeType: 3);
if (baseData != null && baseData.isSuccess) {
signInfo = SignInfo.fromJson(baseData.data);
setState(() {});

6
lib/login/login_page.dart

@ -289,11 +289,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
xgFlutterPlugin.bindWithIdentifier(
identify: mobile, bindType: XGBindType.account);
if (widget.arguments != null) {
Navigator.of(context).pop();
} else {
Navigator.of(context).popAndPushNamed('/router/main_page');
}
Navigator.of(context).pushNamedAndRemoveUntil('/router/main_page', (route) => false);
} else {
SmartDialog.showToast("${value.msg}", alignment: Alignment.center);
}

42
lib/main_page.dart

@ -12,6 +12,7 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/union/union_page.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/native_event_handler.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -23,7 +24,6 @@ class MainPage extends StatefulWidget {
}
class _MainPage extends State<MainPage> {
List<Widget> _widgetOptions;
List<String> icons;
@ -63,14 +63,38 @@ class _MainPage extends State<MainPage> {
queryUserInfo();
/// @typed: 1 2 3 4
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);
});
}));
}
/// @typed: 1 2 3 4 5
xgFlutterPlugin.addEventHandler(xgPushClickAction: (event) async {
print("xgPushClickAction1: ${event.toString()}");
print("xgPushClickAction1: $event");
if (event["actionType"] == 2) return event;
if (event["actionType"] == 0 && event["customMessage"] != null) {
if (Platform.isAndroid
? (event["actionType"] == 0)
: (event["xg"]["msgtype"] == 1) &&
event[Platform.isAndroid ? "customMessage" : "custom"] != null) {
SharedPreferences.getInstance().then((value) {
value.setString("pushData", event["customMessage"]);
value.setString("pushData",
event[Platform.isAndroid ? "customMessage" : "custom"]);
});
print("ModalRoute isActive: ${ModalRoute.of(context).isActive}");
print("ModalRoute isCurrent: ${ModalRoute.of(context).isCurrent}");
print("ModalRoute isFirst: ${ModalRoute.of(context).isFirst}");
if (ModalRoute.of(context).isActive &&
ModalRoute.of(context).isCurrent) {
pushRoute();
} else {
Navigator.of(context).pushNamedAndRemoveUntil('/router/main_page', (route) => false);
}
}
return event;
}, onReceiveNotificationResponse: (event) async {
@ -80,7 +104,6 @@ class _MainPage extends State<MainPage> {
print("onReceiveMessage: ${event.toString()}");
return event;
});
}
pushRoute() async {
@ -108,6 +131,10 @@ class _MainPage extends State<MainPage> {
routeName = "/router/integral_store_page";
params["goodsId"] = pushMap["info"];
break;
case 5:
routeName = "/router/order_details";
params["id"] = pushMap["info"];
break;
}
sharedPreferences.setString("pushData", "");
print("xgPushClickAction: routeName: $routeName");
@ -119,7 +146,8 @@ class _MainPage extends State<MainPage> {
queryUserInfo() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (sharedPreferences.getString("token") == null || sharedPreferences.getString("token") == "") return;
if (sharedPreferences.getString("token") == null ||
sharedPreferences.getString("token") == "") return;
BaseData baseDate = await ApiService(Dio(),
context: context, token: sharedPreferences.getString('token'))
.queryInfo();

9
lib/retrofit/retrofit_api.dart

@ -14,12 +14,11 @@ import 'package:shared_preferences/shared_preferences.dart';
part 'retrofit_api.g.dart';
// const base_url = "http://platform.test.api.lotus-wallet.com/app/";///
const base_url = "https://pos.platform.lotus-wallet.com/app/";
// const baseUrl = "http://platform.test.api.lotus-wallet.com/app/";///
const baseUrl = "https://pos.platform.lotus-wallet.com/app/";
const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///
const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///
// const base_url = "http://192.168.10.236:8766/app/";
// const baseUrl = "http://192.168.10.236:8766/app/";///
// const baseUrl = "http://192.168.10.129:8766/app/"; ///
@RestApi(baseUrl: baseUrl)
abstract class ApiService {

2
lib/union/union_page.dart

@ -269,7 +269,7 @@ class _UnionPage extends State<UnionPage>
PreferredSize(
preferredSize: Size(double.infinity, 52.h),
child: Container(
padding: EdgeInsets.only(top: 26.5.h),
padding: EdgeInsets.only(top: 20.h),
color: Color(0xFFFAFAFA),
child: ItemTitle(
text: S.of(context).jingbilianmenghuiyuandian,

28
lib/utils/native_event_handler.dart

@ -0,0 +1,28 @@
import 'package:tpns_flutter_plugin/android/native_event_handler.dart';
class MyNativeEventHandler extends NativeEventHandler {
final Function(String title, String message, String customContent, int type) notifyClick;
MyNativeEventHandler(this.notifyClick);
@override
void onRegisterPushFail(String message, int code) {
}
@override
void onRegisterPushSuccess(String token) {
}
@override
void onNotifactionClickedResult(String title, String message, String customContent, int type) {
super.onNotifactionClickedResult(title, message, customContent, type);
this.notifyClick(title, message, customContent, type);
}
}
Loading…
Cancel
Save