Skip to content

Commit a025867

Browse files
hamdikahlounEgor
authored andcommitted
[share] MethodCallHandler.java uses unchecked or unsafe operations (flutter#3004)
1 parent b323e5a commit a025867

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

packages/share/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.6.5+1
2+
3+
* Avoiding uses unchecked or unsafe Object Type Casting
4+
15
## 0.6.5
26

37
* Added support for sharing files

packages/share/android/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
group 'io.flutter.plugins.share'
22
version '1.0-SNAPSHOT'
3+
def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"]
34

45
buildscript {
56
repositories {
@@ -19,6 +20,10 @@ rootProject.allprojects {
1920
}
2021
}
2122

23+
project.getTasks().withType(JavaCompile){
24+
options.compilerArgs.addAll(args)
25+
}
26+
2227
apply plugin: 'com.android.library'
2328

2429
android {

packages/share/android/src/main/java/io/flutter/plugins/share/MethodCallHandler.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ public void onMethodCall(MethodCall call, MethodChannel.Result result) {
2525
case "share":
2626
expectMapArguments(call);
2727
// Android does not support showing the share sheet at a particular point on screen.
28-
share.share((String) call.argument("text"), (String) call.argument("subject"));
28+
String text = call.argument("text");
29+
String subject = call.argument("subject");
30+
share.share(text, subject);
2931
result.success(null);
3032
break;
3133
case "shareFiles":
3234
expectMapArguments(call);
3335

36+
List<String> paths = call.argument("paths");
37+
List<String> mimeTypes = call.argument("mimeTypes");
38+
text = call.argument("text");
39+
subject = call.argument("subject");
3440
// Android does not support showing the share sheet at a particular point on screen.
3541
try {
36-
share.shareFiles(
37-
(List<String>) call.argument("paths"),
38-
(List<String>) call.argument("mimeTypes"),
39-
(String) call.argument("text"),
40-
(String) call.argument("subject"));
42+
share.shareFiles(paths, mimeTypes, text, subject);
4143
result.success(null);
4244
} catch (IOException e) {
4345
result.error(e.getMessage(), null, null);

packages/share/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ homepage: https://github.com/flutter/plugins/tree/master/packages/share
55
# 0.6.y+z is compatible with 1.0.0, if you land a breaking change bump
66
# the version to 2.0.0.
77
# See more details: https://github.com/flutter/flutter/wiki/Package-migration-to-1.0.0
8-
version: 0.6.5
8+
version: 0.6.5+1
99

1010
flutter:
1111
plugin:

0 commit comments

Comments
 (0)