Commit 3e7a8316 authored by 汪林玲's avatar 汪林玲

Scheme返回参数格式更新

parent a180f453
......@@ -48,6 +48,7 @@ appScheme.registerSchemeListener().listen((event) {
```
<scheme>://<host>:<port>/<path>?<query>
```
xiaoxiongapp://xapi.xiaomanxiong.com/home?redirect_type=1&ios_redirect_url=aaaaaaa.com&android_redirect_url=aaaaaaa.com
如下就是一个自定义的URL
openapp://hhong:80/product?productId=10000007
openapp: 即Scheme 该Scheme协议名称(必填)
......
......@@ -18,7 +18,7 @@
</head>
<body>
<div>
<a href="app://hong.com/product?productId=10000007">Android、iOS</a>
<a href="app://hong.com/product?productId=10000007&">Android、iOS</a>
</div>
<div>
......
......@@ -10,7 +10,7 @@
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:launchMode="singleTask"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<meta-data android:name="flutterEmbedding" android:value="2"/>
......
......@@ -347,7 +347,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = Q74HRRECHL;
DEVELOPMENT_TEAM = 4R6KK56452;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
......@@ -471,7 +471,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = Q74HRRECHL;
DEVELOPMENT_TEAM = 4R6KK56452;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
......@@ -490,7 +490,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = Q74HRRECHL;
DEVELOPMENT_TEAM = 4R6KK56452;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
......
......@@ -18,26 +18,26 @@ class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
appScheme.getInitScheme().then((value){
if(value != null){
appScheme.getInitScheme().then((value) {
if (value != null) {
setState(() {
_platformVersion = "Init ${value.dataString}";
_platformVersion = "Init ${value.dataString} map:${value.query}";
});
}
});
appScheme.getLatestScheme().then((value){
if(value != null){
appScheme.getLatestScheme().then((value) {
if (value != null) {
setState(() {
_platformVersion = "Latest ${value.dataString}";
_platformVersion = "Latest ${value.dataString} map:${value.query}";
});
}
});
appScheme.registerSchemeListener().listen((event) {
if(event != null){
if (event != null) {
setState(() {
_platformVersion = "listen ${event.dataString}";
_platformVersion = "listen ${event.dataString} map:${event.query}";
});
}
});
......
......@@ -14,49 +14,49 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.0"
version: "2.5.0-nullsafety.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
version: "2.1.0-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.2.0-nullsafety.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.15.0"
version: "1.15.0-nullsafety.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.2.0-nullsafety.1"
flutter:
dependency: "direct main"
description: flutter
......@@ -73,21 +73,21 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10"
version: "0.12.10-nullsafety.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.3.0-nullsafety.3"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.8.0-nullsafety.1"
sky_engine:
dependency: transitive
description: flutter
......@@ -99,56 +99,56 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.8.0-nullsafety.2"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0"
version: "1.10.0-nullsafety.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
version: "2.1.0-nullsafety.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.2.0-nullsafety.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.19"
version: "0.2.19-nullsafety.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.3.0-nullsafety.3"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
version: "2.1.0-nullsafety.3"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.20.0"
......@@ -3,8 +3,16 @@ class SchemeEntity {
String host;
int port;
String path;
String query;
Map<String, String> query;
String source;
String dataString;
SchemeEntity({this.scheme,this.host,this.port,this.path,this.query,this.source,this.dataString});
SchemeEntity({
this.scheme,
this.host,
this.port,
this.path,
this.query,
this.source,
this.dataString,
});
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'entity/scheme_entity.dart';
abstract class SchemeController {
Future<SchemeEntity> getInitScheme();
Future<SchemeEntity> getLatestScheme();
Stream<SchemeEntity> registerSchemeListener();
}
class PluginController implements SchemeController{
class PluginController implements SchemeController {
final MethodChannel _schemeChannel;
final EventChannel _eventChannel;
PluginController({
@required MethodChannel schemeChannel,
@required EventChannel eventChannel
}):_schemeChannel=schemeChannel,_eventChannel=eventChannel;
PluginController(
{@required MethodChannel schemeChannel,
@required EventChannel eventChannel})
: _schemeChannel = schemeChannel,
_eventChannel = eventChannel;
@override
Future<SchemeEntity> getInitScheme() async{
Future<SchemeEntity> getInitScheme() async {
dynamic data = await _schemeChannel.invokeMethod('getInitScheme');
if(data != null && data is Map && data.isNotEmpty){
if (data != null && data is Map && data.isNotEmpty) {
return SchemeEntity(
scheme:data['scheme'] as String,
host:data['host'] as String,
port:data['port'] as int,
path:data['path'] as String,
query:data['query'] as String,
source:data['source'] as String,
dataString:data['dataString'] as String,
scheme: data['scheme'] as String,
host: data['host'] as String,
port: data['port'] as int,
path: data['path'] as String,
query: Uri.parse(data['dataString'] as String).queryParameters,
source: data['source'] as String,
dataString: data['dataString'] as String,
);
}
return null;
}
@override
Future<SchemeEntity> getLatestScheme() async{
Future<SchemeEntity> getLatestScheme() async {
dynamic data = await _schemeChannel.invokeMethod('getLatestScheme');
if(data != null && data is Map && data.isNotEmpty){
if (data != null && data is Map && data.isNotEmpty) {
Map<String, String> queryParameters =
Uri.parse(data['dataString'] as String).queryParameters;
return SchemeEntity(
scheme:data['scheme'] as String,
host:data['host'] as String,
port:data['port'] as int,
path:data['path'] as String,
query:data['query'] as String,
source:data['source'] as String,
dataString:data['dataString'] as String,
scheme: data['scheme'] as String,
host: data['host'] as String,
port: data['port'] as int,
path: data['path'] as String,
query: queryParameters,
source: data['source'] as String,
dataString: data['dataString'] as String,
);
}
return null;
......@@ -60,25 +60,30 @@ class PluginController implements SchemeController{
return _eventChannel
.receiveBroadcastStream()
.map((event) => event)
.asBroadcastStream().map((event) => (event != null && event is Map && event.isNotEmpty)?SchemeEntity(
scheme:event['scheme'] as String,
host:event['host'] as String,
port:event['port'] as int,
path:event['path'] as String,
query:event['query'] as String,
source:event['source'] as String,
dataString:event['dataString'] as String,
):null);
.asBroadcastStream()
.map((event) => (event != null && event is Map && event.isNotEmpty)
? SchemeEntity(
scheme: event['scheme'] as String,
host: event['host'] as String,
port: event['port'] as int,
path: event['path'] as String,
query: Uri.parse(event['dataString'] as String).queryParameters,
source: event['source'] as String,
dataString: event['dataString'] as String,
)
: null);
}
}
class PluginControllerFactory {
const PluginControllerFactory();
PluginController create() {
const MethodChannel _channelMethod = const MethodChannel('scheme/flutter.app.method');
const EventChannel _eventChannel = const EventChannel('scheme/flutter.app.event');
PluginController _controller = PluginController(schemeChannel:_channelMethod,eventChannel:_eventChannel);
const MethodChannel _channelMethod =
const MethodChannel('scheme/flutter.app.method');
const EventChannel _eventChannel =
const EventChannel('scheme/flutter.app.event');
PluginController _controller = PluginController(
schemeChannel: _channelMethod, eventChannel: _eventChannel);
return _controller;
}
}
......@@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.0"
version: "2.5.0-nullsafety.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
version: "2.1.0-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.2.0-nullsafety.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.15.0"
version: "1.15.0-nullsafety.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.2.0-nullsafety.1"
flutter:
dependency: "direct main"
description: flutter
......@@ -66,21 +66,21 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10"
version: "0.12.10-nullsafety.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.3.0-nullsafety.3"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.8.0-nullsafety.1"
sky_engine:
dependency: transitive
description: flutter
......@@ -92,56 +92,56 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0"
version: "1.8.0-nullsafety.2"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0"
version: "1.10.0-nullsafety.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
version: "2.1.0-nullsafety.1"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
version: "1.2.0-nullsafety.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.19"
version: "0.2.19-nullsafety.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0"
version: "1.3.0-nullsafety.3"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
version: "2.1.0-nullsafety.3"
sdks:
dart: ">=2.12.0-0.0 <3.0.0"
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.20.0"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment