Skip to content

Commit 8e5e6b4

Browse files
Add local image_gallery_saver plugin and update config
Replaces the image_gallery_saver dependency in chewie with a local path reference and adds the full plugin source under third-party/tool/image_gallery_saver. Downgrades Android Gradle plugin and wrapper versions for compatibility. Removes Gradle cache from release workflow.
1 parent f6b5285 commit 8e5e6b4

File tree

22 files changed

+1076
-4
lines changed

22 files changed

+1076
-4
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ jobs:
8989
with:
9090
distribution: 'temurin'
9191
java-version: '17'
92-
cache: gradle
9392

9493
# Flutter Pub Get
9594
- name: Flutter Pub Get

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip

android/settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "8.6.1" apply false
21+
id "com.android.application" version "7.3.1" apply false
2222
id "org.jetbrains.kotlin.android" version "2.1.0" apply false
2323
}
2424

third-party/chewie/pubspec.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ dependencies:
5757
url_launcher: ^6.3.0
5858
app_links: ^6.4.0
5959
flutter_displaymode: ^0.6.0
60-
image_gallery_saver: ^2.0.3
60+
image_gallery_saver:
61+
path: ../tool/image_gallery_saver
6162
permission_handler: ^11.3.1
6263
hotkey_manager: ^0.2.3
6364
flutter_inappwebview: 6.0.0
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
## 2.0.3
2+
- 1.Upgrade flutter version to 3.10.5
3+
- 2.Android build tools are upgraded to 7.3.0
4+
- 3.Optimize the Android plugin library code
5+
6+
## 2.0.2
7+
- 1.Optimization android plugin
8+
9+
## 2.0.1
10+
- 1.Upgrade flutter version to 3.10.2
11+
- 2.Upgrade Android/ios plug-in related
12+
- 3.Support Android 13
13+
- 4.Support ios16
14+
15+
## 1.7.1
16+
- optimization
17+
18+
## 1.7.0
19+
- optimization
20+
21+
## 1.6.9
22+
- optimization
23+
24+
## 1.6.8
25+
- Support android 11 save
26+
27+
## 1.6.7
28+
- fix ios bug
29+
30+
## 1.6.6
31+
* fix ios bug
32+
33+
## 1.6.5
34+
* fix android bug
35+
36+
## 1.6.4
37+
* formatted code
38+
39+
## 1.6.3
40+
* Save result return more message
41+
42+
## 1.6.2
43+
* fix crash on iOS when granting permission
44+
45+
## 1.6.1
46+
* fix iOS Swift5.1 error
47+
48+
## 1.6.0
49+
* Support iOS return save path
50+
51+
## 1.5.0
52+
* Save image with JPG and Support special quality(ios & Android)
53+
* Support special Image name for Android
54+
* Upgrade libraries and dependence
55+
* fix docs
56+
* Add more example
57+
58+
## 1.3.0
59+
60+
* Define clang module for static ios builds
61+
* Cleanup example project
62+
63+
## 1.2.2
64+
65+
* Migrate to AndroidX
66+
* optimize git ignore
67+
68+
## 1.2.1
69+
70+
* Support return path for Android.
71+
* Fix bug(save video fail for Android).
72+
73+
## 1.2.0
74+
75+
* Support video save and file path to gallery
76+
* Add example for save video and net image
77+
78+
## 1.1.0
79+
80+
* Upgrade kotlin(1.3.20) and gradle build plugin version(3.3.0).
81+
82+
## 1.0.0
83+
84+
* Updated Kotlin Gradle plugin version
85+
86+
## 0.1.2
87+
88+
* Remove hard coded path - image_gallery_saver in Android
89+
90+
## 0.1.1
91+
92+
* Updated README and Description
93+
94+
## 0.1.0
95+
96+
* Updated README and CHANGELOG
97+
* Add LICENSE
98+
* Add Test
99+
100+
## 0.0.2
101+
102+
* Updated README and CHANGELOG
103+
104+
## 0.0.1
105+
106+
* Initial Open Source release.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2023] [zaihui]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# image_gallery_saver
2+
3+
[![Build Status](https://travis-ci.org/hui-z/image_gallery_saver.svg?branch=master)](https://travis-ci.org/hui-z/image_gallery_saver#)
4+
[![pub package](https://img.shields.io/pub/v/image_gallery_saver.svg)](https://pub.dartlang.org/packages/image_gallery_saver)
5+
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://choosealicense.com/licenses/mit/)
6+
7+
We use the `image_picker` plugin to select images from the Android and iOS image library, but it can't save images to the gallery. This plugin can provide this feature.
8+
9+
## Usage
10+
11+
To use this plugin, add `image_gallery_saver` as a dependency in your pubspec.yaml file. For example:
12+
```yaml
13+
dependencies:
14+
image_gallery_saver: '^2.0.3'
15+
```
16+
17+
## iOS
18+
Your project need create with swift.
19+
Add the following keys to your Info.plist file, located in <project root>/ios/Runner/Info.plist:
20+
* NSPhotoLibraryAddUsageDescription - describe why your app needs permission for the photo library. This is called Privacy - Photo Library Additions Usage Description in the visual editor
21+
22+
## Android
23+
You need to ask for storage permission to save an image to the gallery. You can handle the storage permission using [flutter_permission_handler](https://github.com/BaseflowIT/flutter-permission-handler).
24+
In Android version 10, Open the manifest file and add this line to your application tag
25+
```
26+
<application android:requestLegacyExternalStorage="true" .....>
27+
```
28+
29+
## Example
30+
Saving an image from the internet, quality and name is option
31+
``` dart
32+
_saveLocalImage() async {
33+
RenderRepaintBoundary boundary =
34+
_globalKey.currentContext!.findRenderObject() as RenderRepaintBoundary;
35+
ui.Image image = await boundary.toImage();
36+
ByteData? byteData =
37+
await (image.toByteData(format: ui.ImageByteFormat.png));
38+
if (byteData != null) {
39+
final result =
40+
await ImageGallerySaver.saveImage(byteData.buffer.asUint8List());
41+
print(result);
42+
}
43+
}
44+
45+
_saveNetworkImage() async {
46+
var response = await Dio().get(
47+
"https://ss0.baidu.com/94o3dSag_xI4khGko9WTAnF6hhy/image/h%3D300/sign=a62e824376d98d1069d40a31113eb807/838ba61ea8d3fd1fc9c7b6853a4e251f94ca5f46.jpg",
48+
options: Options(responseType: ResponseType.bytes));
49+
final result = await ImageGallerySaver.saveImage(
50+
Uint8List.fromList(response.data),
51+
quality: 60,
52+
name: "hello");
53+
print(result);
54+
}
55+
```
56+
57+
Saving file(ig: video/gif/others) from the internet
58+
``` dart
59+
_saveNetworkGifFile() async {
60+
var appDocDir = await getTemporaryDirectory();
61+
String savePath = appDocDir.path + "/temp.gif";
62+
String fileUrl =
63+
"https://hyjdoc.oss-cn-beijing.aliyuncs.com/hyj-doc-flutter-demo-run.gif";
64+
await Dio().download(fileUrl, savePath);
65+
final result =
66+
await ImageGallerySaver.saveFile(savePath, isReturnPathOfIOS: true);
67+
print(result);
68+
}
69+
70+
_saveNetworkVideoFile() async {
71+
var appDocDir = await getTemporaryDirectory();
72+
String savePath = appDocDir.path + "/temp.mp4";
73+
String fileUrl =
74+
"https://s3.cn-north-1.amazonaws.com.cn/mtab.kezaihui.com/video/ForBiggerBlazes.mp4";
75+
await Dio().download(fileUrl, savePath, onReceiveProgress: (count, total) {
76+
print((count / total * 100).toStringAsFixed(0) + "%");
77+
});
78+
final result = await ImageGallerySaver.saveFile(savePath);
79+
print(result);
80+
}
81+
```
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
group 'com.example.imagegallerysaver'
2+
version '1.0-SNAPSHOT'
3+
4+
buildscript {
5+
ext.kotlin_version = '1.7.10'
6+
repositories {
7+
google()
8+
mavenCentral()
9+
}
10+
11+
dependencies {
12+
classpath 'com.android.tools.build:gradle:7.3.0'
13+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14+
}
15+
}
16+
17+
rootProject.allprojects {
18+
repositories {
19+
google()
20+
mavenCentral()
21+
}
22+
}
23+
24+
apply plugin: 'com.android.library'
25+
apply plugin: 'kotlin-android'
26+
27+
android {
28+
namespace "com.example.imagegallerysaver"
29+
compileSdkVersion 30
30+
31+
sourceSets {
32+
main.java.srcDirs += 'src/main/kotlin'
33+
}
34+
defaultConfig {
35+
minSdkVersion 16
36+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
37+
}
38+
lintOptions {
39+
disable 'InvalidPackage'
40+
}
41+
}
42+
43+
dependencies {
44+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
45+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
android.enableJetifier=true
2+
android.useAndroidX=true
3+
org.gradle.jvmargs=-Xmx1536M
Binary file not shown.

0 commit comments

Comments
 (0)