diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index c548f123..9b9d5e51 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -40,7 +40,7 @@
android:icon="@mipmap/ic_launcher">
+ android:resource="@drawable/launch_background"/>
diff --git a/android/app/src/main/kotlin/com/zsw/huixiang/BridgePlugin.kt b/android/app/src/main/kotlin/com/zsw/huixiang/BridgePlugin.kt
new file mode 100644
index 00000000..279e101e
--- /dev/null
+++ b/android/app/src/main/kotlin/com/zsw/huixiang/BridgePlugin.kt
@@ -0,0 +1,43 @@
+package com.zsw.huixiang
+
+import android.content.Context
+import android.net.Uri
+import android.text.TextUtils
+import android.util.Log
+import io.flutter.embedding.engine.plugins.FlutterPlugin
+import io.flutter.plugin.common.MethodCall
+import io.flutter.plugin.common.MethodChannel
+
+class BridgePlugin : FlutterPlugin, MethodChannel.MethodCallHandler {
+
+ var intentAction : Uri? = null
+
+ private lateinit var channel : MethodChannel
+ private lateinit var context : Context;
+
+ override fun onAttachedToEngine(binding: FlutterPlugin.FlutterPluginBinding) {
+ context = binding.applicationContext;
+ channel = MethodChannel(binding.binaryMessenger, "bridge")
+ channel.setMethodCallHandler(this)
+ }
+
+ override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
+ channel.setMethodCallHandler(null)
+ }
+
+ override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
+ if (call.method == "action") {
+ if (intentAction != null) {
+ val custom = intentAction?.getQueryParameter("custom")
+ Log.e("bridge", "bridge:$custom")
+ if (!TextUtils.isEmpty(custom)) {
+ result.success(custom)
+ intentAction = null
+ return
+ }
+ }
+ result.success("")
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/android/app/src/main/kotlin/com/zsw/huixiang/MainActivity.kt b/android/app/src/main/kotlin/com/zsw/huixiang/MainActivity.kt
index 1667e29d..c249d05c 100644
--- a/android/app/src/main/kotlin/com/zsw/huixiang/MainActivity.kt
+++ b/android/app/src/main/kotlin/com/zsw/huixiang/MainActivity.kt
@@ -1,5 +1,6 @@
package com.zsw.huixiang
+import android.content.Intent
import android.os.Bundle
import android.util.Log
import io.dcloud.feature.sdk.DCUniMPSDK
@@ -15,8 +16,15 @@ class MainActivity: FlutterActivity() {
Log.e("intentUrl:", "url: ${intent.data}" )
flutterEngine?.plugins?.add(MinPlugin())
+ flutterEngine?.plugins?.add(BridgePlugin().apply {
+ intentAction = intent.data
+ })
}
+ override fun onNewIntent(intent: Intent) {
+ super.onNewIntent(intent)
+ Log.e("intentUrl:", "onNewIntent: ${intent.data}" )
+ }
override fun onDestroy() {
super.onDestroy()
diff --git a/ios/Runner/AppDelegate.mm b/ios/Runner/AppDelegate.mm
index 6b75bbb1..11b6cc96 100644
--- a/ios/Runner/AppDelegate.mm
+++ b/ios/Runner/AppDelegate.mm
@@ -4,6 +4,7 @@
#import "UniappPlugin.h"
#import "WXApi.h"
+
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
@@ -11,6 +12,7 @@
[GeneratedPluginRegistrant registerWithRegistry:self];
// Override point for customization after application launch.
+
// 配置参数
NSMutableDictionary *options = [NSMutableDictionary dictionaryWithDictionary:launchOptions];
@@ -69,7 +71,18 @@
//result(FlutterMethodNotImplemented);
}];
+ // 消息内容获取
+ NSDictionary *remoteNotification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
+ NSLog(@"notification dic: %@", remoteNotification);
+ FlutterMethodChannel* bridgeAppChannel = [FlutterMethodChannel methodChannelWithName:@"bridge" binaryMessenger:(NSObject *)controller];
+ [bridgeAppChannel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) {
+ NSString * method = call.method;
+ if ([method isEqual:@"action"]) {
+ result([NSNumber numberWithBool:YES]);
+ }
+ //result(FlutterMethodNotImplemented);
+ }];
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
diff --git a/ios/Runner/Bridge.swift b/ios/Runner/Bridge.swift
new file mode 100644
index 00000000..dbad8889
--- /dev/null
+++ b/ios/Runner/Bridge.swift
@@ -0,0 +1,13 @@
+//
+// Bridge.swift
+// Runner
+//
+// Created by 冯美坎 on 2021/8/9.
+//
+import Flutter
+import UIKit
+
+class Bridge: NSObject, FlutterPlugin {
+
+
+}
diff --git a/lib/main.dart b/lib/main.dart
index ebed8b0e..c18695fe 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -52,6 +52,7 @@ import 'package:huixiang/union/store_details_page.dart';
import 'package:huixiang/union/union_details_page.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:huixiang/utils/bridge.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:sharesdk_plugin/sharesdk_interface.dart';
diff --git a/lib/main_page.dart b/lib/main_page.dart
index 7805564b..0ea03477 100644
--- a/lib/main_page.dart
+++ b/lib/main_page.dart
@@ -11,6 +11,7 @@ import 'package:huixiang/retrofit/data/base_data.dart';
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/bridge.dart';
import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/native_event_handler.dart';
import 'package:permission_handler/permission_handler.dart';
@@ -107,8 +108,17 @@ class _MainPage extends State {
}
pushRoute() async {
+
+ String startIntent = await Bridge.getStartIntent();
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
- String pushData = sharedPreferences.getString("pushData");
+ print("intent:$startIntent");
+ String pushData = "";
+ if (startIntent != null && startIntent != "") {
+ pushData = startIntent;
+ // pushData = """{"typed":1,"info":"1420304936817655808"}""";
+ } else {
+ pushData = sharedPreferences.getString("pushData");
+ }
if (pushData == null || pushData == "") return;
Map pushMap = jsonDecode(pushData);
if (pushMap != null) {
diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart
index 700e9905..3f560aa5 100644
--- a/lib/retrofit/retrofit_api.dart
+++ b/lib/retrofit/retrofit_api.dart
@@ -14,11 +14,11 @@ import 'package:shared_preferences/shared_preferences.dart';
part 'retrofit_api.g.dart';
-const base_url = "https://pos.platform.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 base_url = "http://192.168.10.236:8766/app/";
+const baseUrl = "http://192.168.10.236:8766/app/";/// 本地
@RestApi(baseUrl: baseUrl)
abstract class ApiService {
diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart
deleted file mode 100644
index 5b770fec..00000000
--- a/lib/retrofit/retrofit_api.g.dart
+++ /dev/null
@@ -1,820 +0,0 @@
-// GENERATED CODE - DO NOT MODIFY BY HAND
-
-part of 'retrofit_api.dart';
-
-// **************************************************************************
-// RetrofitGenerator
-// **************************************************************************
-
-class _ApiService implements ApiService {
- _ApiService(this._dio, {this.baseUrl}) {
- ArgumentError.checkNotNull(_dio, '_dio');
- baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/';
- }
-
- final Dio _dio;
-
- String baseUrl;
-
- @override
- Future upload(data, folderId) async {
- ArgumentError.checkNotNull(data, 'data');
- ArgumentError.checkNotNull(folderId, 'folderId');
- const _extra = {};
- final queryParameters = {};
- final _data = FormData();
- _data.files.add(MapEntry(
- 'file',
- MultipartFile.fromFileSync(data.path,
- filename: data.path.split(Platform.pathSeparator).last)));
- if (folderId != null) {
- _data.fields.add(MapEntry('folderId', folderId.toString()));
- }
- final _result = await _dio.request