Skip to content

Commit c44fa56

Browse files
committed
Release version 4.4.0
1 parent 9120b26 commit c44fa56

File tree

7 files changed

+94
-7
lines changed

7 files changed

+94
-7
lines changed

Diff for: CHANGELOG.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
## 4.4.0
2+
* Fix error when embedding Flutter app to a native iOS app (Add-to-app) (Thanks to [@nukeolay](https://github.com/nukeolay), PR [#10](https://github.com/javaherisaber/open_filex/pull/10))
3+
14
## 4.3.4
2-
* Add namespace property to make compatible with gradle 8.0 (Thanks to [kishormainali](https://github.com/kishormainali), PR [#9](https://github.com/javaherisaber/open_filex/pull/9))
5+
* Add namespace property to make compatible with gradle 8.0 (Thanks to [@kishormainali](https://github.com/kishormainali), PR [#9](https://github.com/javaherisaber/open_filex/pull/9))
36

47
## 4.3.3
58
* Update README.md
69

710
## 4.3.2
8-
* Move plugin initializations to onAttachedToEngine() in Android (Thanks to [DK070202](https://github.com/DK070202), mentioned at [#163](https://github.com/crazecoder/open_file/issues/163))
11+
* Move plugin initializations to onAttachedToEngine() in Android (Thanks to [@DK070202](https://github.com/DK070202), mentioned at [#163](https://github.com/crazecoder/open_file/issues/163))
912

1013
## 4.3.1
1114
* Update README.md

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ This package is a fork of [open_file](https://pub.dev/packages/open_file) to fix
1313
- Fix parse args not filtering commands properly
1414
- Replace JCenter with MavenCentral in Android build.gradle repositories (since JCenter becomes unreachable sometimes due to it's end of life)
1515
- Compatibility with Gradle 8+
16+
- iOS embedded flutter compatibility
1617

1718
For full list of changes see [CHANGELOG](https://pub.dev/packages/open_filex/changelog)
1819

Diff for: example/lib/main.dart

+72-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import 'package:flutter/material.dart';
21
import 'dart:async';
32

3+
import 'package:flutter/material.dart';
44
import 'package:open_filex/open_filex.dart';
5+
import 'package:permission_handler/permission_handler.dart';
56

67
void main() => runApp(const MyApp());
78

@@ -16,14 +17,82 @@ class MyAppState extends State<MyApp> {
1617
var _openResult = 'Unknown';
1718

1819
Future<void> openFile() async {
19-
const filePath = '/storage/emulated/0/Download/flutter.png';
20-
final result = await OpenFilex.open(filePath);
20+
_openAndroidExternalImage();
21+
}
2122

23+
// ignore: unused_element
24+
_openIOSFile() async {
25+
final result = await OpenFilex.open("some path in your iOS device");
2226
setState(() {
2327
_openResult = "type=${result.type} message=${result.message}";
2428
});
2529
}
2630

31+
// ignore: unused_element
32+
_openAndroidPrivateFile() async {
33+
//open an app private storage file
34+
final result = await OpenFilex.open(
35+
"/data/data/YOUR_PACKAGE_NAME/cache/IMG20230610192318.jpg");
36+
setState(() {
37+
_openResult = "type=${result.type} message=${result.message}";
38+
});
39+
}
40+
41+
// ignore: unused_element
42+
_openAndroidOtherAppFile() async {
43+
//open an external storage image file on android 13
44+
if (await Permission.manageExternalStorage.request().isGranted) {
45+
final result = await OpenFilex.open("/data/user/0/xxx/images/1.jpg");
46+
setState(() {
47+
_openResult = "type=${result.type} message=${result.message}";
48+
});
49+
}
50+
}
51+
52+
// ignore: unused_element
53+
_openAndroidExternalImage() async {
54+
//open an external storage image file on android 13
55+
if (await Permission.photos.request().isGranted) {
56+
final result = await OpenFilex.open("/sdcard/Download/flutter.png");
57+
setState(() {
58+
_openResult = "type=${result.type} message=${result.message}";
59+
});
60+
}
61+
}
62+
63+
// ignore: unused_element
64+
_openAndroidExternalVideo() async {
65+
//open an external storage video file on android 13
66+
if (await Permission.videos.request().isGranted) {
67+
final result = await OpenFilex.open("/sdcard/Download/R-C.mp4");
68+
setState(() {
69+
_openResult = "type=${result.type} message=${result.message}";
70+
});
71+
}
72+
}
73+
74+
// ignore: unused_element
75+
_openAndroidExternalAudio() async {
76+
//open an external storage audio file on android 13
77+
if (await Permission.audio.request().isGranted) {
78+
final result = await OpenFilex.open("/sdcard/Download/R-C.mp3");
79+
setState(() {
80+
_openResult = "type=${result.type} message=${result.message}";
81+
});
82+
}
83+
}
84+
85+
// ignore: unused_element
86+
_openAndroidExternalFile() async {
87+
//open an external storage file
88+
if (await Permission.manageExternalStorage.request().isGranted) {
89+
final result = await OpenFilex.open("/sdcard/Android/data/R-C.xml");
90+
setState(() {
91+
_openResult = "type=${result.type} message=${result.message}";
92+
});
93+
}
94+
}
95+
2796
@override
2897
Widget build(BuildContext context) {
2998
return MaterialApp(

Diff for: example/pubspec.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ dependencies:
1212
sdk: flutter
1313
open_filex:
1414
path: ../
15+
permission_handler: ^10.3.0
16+
file_picker: ^5.3.2
1517

1618
dev_dependencies:
1719
flutter_test:

Diff for: example/windows/flutter/generated_plugin_registrant.cc

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
#include "generated_plugin_registrant.h"
88

9+
#include <permission_handler_windows/permission_handler_windows_plugin.h>
910

1011
void RegisterPlugins(flutter::PluginRegistry* registry) {
12+
PermissionHandlerWindowsPluginRegisterWithRegistrar(
13+
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
1114
}

Diff for: example/windows/flutter/generated_plugins.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44

55
list(APPEND FLUTTER_PLUGIN_LIST
6+
permission_handler_windows
67
)
78

89
list(APPEND FLUTTER_FFI_PLUGIN_LIST

Diff for: pubspec.yaml

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: open_filex
22
description: A plug-in that can call native APP to open files with string result in flutter, support iOS(UTI) / android(intent) / PC(ffi) / web(dart:html)
3-
version: 4.3.4
3+
version: 4.4.0
44
homepage: https://github.com/javaherisaber/open_file
55

66
dependencies:
@@ -23,4 +23,12 @@ flutter:
2323
package: com.crazecoder.openfile
2424
pluginClass: OpenFilePlugin
2525
ios:
26-
pluginClass: OpenFilePlugin
26+
pluginClass: OpenFilePlugin
27+
windows:
28+
default_package: open_filex
29+
linux:
30+
default_package: open_filex
31+
macos:
32+
default_package: open_filex
33+
web:
34+
default_package: open_filex

0 commit comments

Comments
 (0)