Commit 1019befc authored by 汪林玲's avatar 汪林玲

修复intent.getData()为空

parent deffc52e
...@@ -104,21 +104,28 @@ public class FlutterSchemePlugin implements FlutterPlugin, MethodChannel.MethodC ...@@ -104,21 +104,28 @@ public class FlutterSchemePlugin implements FlutterPlugin, MethodChannel.MethodC
String action = intent.getAction(); String action = intent.getAction();
if (Intent.ACTION_VIEW.equals(action)) { if (Intent.ACTION_VIEW.equals(action)) {
Uri schemeUri = intent.getData(); Uri schemeUri = intent.getData();
Map<String,Object> dataMap = new HashMap<>(); if(schemeUri == null){
dataMap.put("scheme",schemeUri.getScheme()); return;
dataMap.put("host",schemeUri.getHost());
dataMap.put("port",schemeUri.getPort());
dataMap.put("path",schemeUri.getPath());
dataMap.put("query",schemeUri.getQuery());
dataMap.put("source","android");
dataMap.put("dataString",intent.getDataString());
if(initialIntent){
initialScheme = dataMap;
initialIntent = false;
} }
latestScheme = dataMap; try {
if(eventSink != null){ Map<String,Object> dataMap = new HashMap<>();
eventSink.success(dataMap); dataMap.put("scheme",schemeUri.getScheme());
dataMap.put("host",schemeUri.getHost());
dataMap.put("port",schemeUri.getPort());
dataMap.put("path",schemeUri.getPath());
dataMap.put("query",schemeUri.getQuery());
dataMap.put("source","android");
dataMap.put("dataString",intent.getDataString());
if(initialIntent){
initialScheme = dataMap;
initialIntent = false;
}
latestScheme = dataMap;
if(eventSink != null){
eventSink.success(dataMap);
}
}catch (Exception e){
e.printStackTrace();
} }
} }
} }
......
...@@ -7,7 +7,7 @@ packages: ...@@ -7,7 +7,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "1.0.1" version: "1.0.2"
async: async:
dependency: transitive dependency: transitive
description: description:
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'appscheme' s.name = 'appscheme'
s.version = '0.0.1' s.version = '1.0.2'
s.summary = 'A new flutter plugin project.' s.summary = 'A new flutter plugin project.'
s.description = <<-DESC s.description = <<-DESC
A new flutter plugin project. A new flutter plugin project.
......
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
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-nullsafety.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.3"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
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-nullsafety.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10-nullsafety.1"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.1"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
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-nullsafety.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
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-nullsafety.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
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-nullsafety.2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
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-nullsafety.3"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.20.0"
name: appscheme name: appscheme
description: Android、iOS自定义Scheme URL方案 description: Android、iOS自定义Scheme URL方案
version: 1.0.1 version: 1.0.2
#author: ScottWang #author: ScottWang
homepage: http://scott-cry.win/ homepage: http://scott-cry.win/
......
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