Skip to content

Commit

Permalink
Merge pull request #292 from fluttercandies/ohos
Browse files Browse the repository at this point in the history
feat: OpenHarmony Support
  • Loading branch information
CaiJingLong authored Mar 14, 2024
2 parents ec99d00 + 70eecfb commit 3018544
Show file tree
Hide file tree
Showing 87 changed files with 2,542 additions and 118 deletions.
48 changes: 48 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,54 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 2024-03-13

### Changes

---

Packages with breaking changes:

- There are no breaking changes in this release.

Packages with other changes:

- [`flutter_image_compress` - `v2.2.0`](#flutter_image_compress---v220)
- [`flutter_image_compress_common` - `v1.0.5`](#flutter_image_compress_common---v105)
- [`flutter_image_compress_macos` - `v1.0.2`](#flutter_image_compress_macos---v102)
- [`flutter_image_compress_ohos` - `v0.0.2`](#flutter_image_compress_ohos---v002)
- [`flutter_image_compress_platform_interface` - `v1.0.5`](#flutter_image_compress_platform_interface---v105)
- [`flutter_image_compress_web` - `v0.1.4+1`](#flutter_image_compress_web---v0141)

---

#### `flutter_image_compress` - `v2.2.0`

- **FEAT**: support openharmony ([#290](https://github.com/fluttercandies/flutter_image_compress/issues/290)). ([e9f10b28](https://github.com/fluttercandies/flutter_image_compress/commit/e9f10b28e089539fe7319d7bc1779b9a2c209fc4))
- **DOCS**: The first version for OpenHarmony. ([5fcab8da](https://github.com/fluttercandies/flutter_image_compress/commit/5fcab8dac6277b36b7169962474e5af3cf88724b))

#### `flutter_image_compress_common` - `v1.0.5`

- **DOCS**: The first version for OpenHarmony. ([5fcab8da](https://github.com/fluttercandies/flutter_image_compress/commit/5fcab8dac6277b36b7169962474e5af3cf88724b))

#### `flutter_image_compress_macos` - `v1.0.2`

- **DOCS**: The first version for OpenHarmony. ([5fcab8da](https://github.com/fluttercandies/flutter_image_compress/commit/5fcab8dac6277b36b7169962474e5af3cf88724b))

#### `flutter_image_compress_ohos` - `v0.0.2`

- **FEAT**: support openharmony ([#290](https://github.com/fluttercandies/flutter_image_compress/issues/290)). ([e9f10b28](https://github.com/fluttercandies/flutter_image_compress/commit/e9f10b28e089539fe7319d7bc1779b9a2c209fc4))
- **FEAT**: support openharmony ([#290](https://github.com/fluttercandies/flutter_image_compress/issues/290)). ([d8c3fb95](https://github.com/fluttercandies/flutter_image_compress/commit/d8c3fb95f31e9199161dbf4306b2c98c80037c13))

#### `flutter_image_compress_platform_interface` - `v1.0.5`

- **DOCS**: The first version for OpenHarmony. ([5fcab8da](https://github.com/fluttercandies/flutter_image_compress/commit/5fcab8dac6277b36b7169962474e5af3cf88724b))

#### `flutter_image_compress_web` - `v0.1.4+1`

- **DOCS**: The first version for OpenHarmony. ([5fcab8da](https://github.com/fluttercandies/flutter_image_compress/commit/5fcab8dac6277b36b7169962474e5af3cf88724b))


## 2024-03-08

### Changes
Expand Down
43 changes: 26 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
[![Awesome Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](https://stackoverflow.com/questions/tagged/flutter?sort=votes)
[![FlutterCandies](https://pub.idqqimg.com/wpa/images/group.png)](https://jq.qq.com/?_wv=1027&k=5bcc0gy)

Compresses image as native plugin (Obj-C/Kotlin). This library works on Android and iOS.
Compresses image as native plugin (Obj-C/Kotlin). This library works on Android, iOS, macOS, Web, OpenHarmony.

- [flutter\_image\_compress](#flutter_image_compress)
- [Why don't you use dart to do it](#why-dont-you-use-dart-to-do-it)
- [Platform Features](#platform-features)
- [Usage](#usage)
- [About common params](#about-common-params)
- [minWidth and minHeight](#minwidth-and-minheight)
Expand All @@ -33,7 +34,7 @@ Compresses image as native plugin (Obj-C/Kotlin). This library works on Android
- [About EXIF information](#about-exif-information)
- [Web](#web)
- [About macOS](#about-macos)
- [Platform Features](#platform-features)
- [OpenHarmony](#openharmony)

## Why don't you use dart to do it

Expand All @@ -42,6 +43,25 @@ Q:Dart already has image compression libraries. Why use native?
A:For unknown reasons, image compression in Dart language is not efficient,
even in release version. Using isolate does not solve the problem.

## Platform Features

| Feature | Android | iOS | Web | macOS | OpenHarmony |
| :------------------------- | :-----: | :---: | :---------------------: | :---: | :-------: |
| method: compressWithList ||||||
| method: compressAssetImage ||||||
| method: compressWithFile ||||||
| method: compressAndGetFile ||||||
| format: jpeg ||||||
| format: png ||||||
| format: webp ||| [🌐][webp-compatibility] |||
| format: heic ||||||
| param: quality ||| [🌐][webp-compatibility] |||
| param: rotate ||||||
| param: keepExif ||||||

[webp-compatibility]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#browser_compatibility "Browser support"


## Usage

See the [![pub](https://img.shields.io/pub/v/flutter_image_compress.svg)](https://pub.dev/packages/flutter_image_compress/versions) version.
Expand Down Expand Up @@ -368,20 +388,9 @@ Open xcode project, select Runner target, and change the value of `macOS Deploym
And, change the `Podfile`:
Change `platform` to `platform :osx, '10.15'`.

## Platform Features

| Feature | Android | iOS | Web | macOS |
| :------------------------- | :-----: | :---: | :---------------------: | :---: |
| method: compressWithList |||||
| method: compressAssetImage |||||
| method: compressWithFile |||||
| method: compressAndGetFile |||||
| format: jpeg |||||
| format: png |||||
| format: webp ||| [🌐][webp-compatibility] ||
| format: heic |||||
| param: quality ||| [🌐][webp-compatibility] ||
| param: rotate |||||
| param: keepExif |||||
## OpenHarmony

[webp-compatibility]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#browser_compatibility "Browser support"
The currently supported image formats for parsing include JPEG, PNG, GIF, RAW, WebP, BMP, and SVG. However, the encoding output image formats are currently limited to JPEG, PNG, and WebP only.

当前支持的解析图片格式包括 JPEG、PNG、GIF、RAW、WebP、BMP、SVG . 编码输出图片格式当前仅支持 JPEG、PNG 和 WebP.
5 changes: 5 additions & 0 deletions packages/flutter_image_compress/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.2.0

- **FEAT**: support openharmony ([#290](https://github.com/fluttercandies/flutter_image_compress/issues/290)). ([e9f10b28](https://github.com/fluttercandies/flutter_image_compress/commit/e9f10b28e089539fe7319d7bc1779b9a2c209fc4))
- **DOCS**: The first version for OpenHarmony. ([5fcab8da](https://github.com/fluttercandies/flutter_image_compress/commit/5fcab8dac6277b36b7169962474e5af3cf88724b))

## 2.1.0

- **FEAT**: support macOS ([#264](https://github.com/fluttercandies/flutter_image_compress/issues/264)). ([06ab91ed](https://github.com/fluttercandies/flutter_image_compress/commit/06ab91ed470ea2c838daeb6c654ad06dadc99f1d))
Expand Down
45 changes: 28 additions & 17 deletions packages/flutter_image_compress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
[![Awesome Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](https://stackoverflow.com/questions/tagged/flutter?sort=votes)
[![FlutterCandies](https://pub.idqqimg.com/wpa/images/group.png)](https://jq.qq.com/?_wv=1027&k=5bcc0gy)

Compresses image as native plugin (Obj-C/Kotlin). This library works on Android and iOS.
Compresses image as native plugin (Obj-C/Kotlin). This library works on Android, iOS, macOS, Web, OpenHarmony.

- [flutter\_image\_compress](#flutter_image_compress)
- [Why don't you use dart to do it](#why-dont-you-use-dart-to-do-it)
- [Platform Features](#platform-features)
- [Usage](#usage)
- [About common params](#about-common-params)
- [minWidth and minHeight](#minwidth-and-minheight)
Expand All @@ -33,7 +34,7 @@ Compresses image as native plugin (Obj-C/Kotlin). This library works on Android
- [About EXIF information](#about-exif-information)
- [Web](#web)
- [About macOS](#about-macos)
- [Platform Features](#platform-features)
- [OpenHarmony](#openharmony)

## Why don't you use dart to do it

Expand All @@ -42,6 +43,25 @@ Q:Dart already has image compression libraries. Why use native?
A:For unknown reasons, image compression in Dart language is not efficient,
even in release version. Using isolate does not solve the problem.

## Platform Features

| Feature | Android | iOS | Web | macOS | OpenHarmony |
| :------------------------- | :-----: | :---: | :---------------------: | :---: | :-------: |
| method: compressWithList ||||||
| method: compressAssetImage ||||||
| method: compressWithFile ||||||
| method: compressAndGetFile ||||||
| format: jpeg ||||||
| format: png ||||||
| format: webp ||| [🌐][webp-compatibility] |||
| format: heic ||||||
| param: quality ||| [🌐][webp-compatibility] |||
| param: rotate ||||||
| param: keepExif ||||||

[webp-compatibility]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#browser_compatibility "Browser support"


## Usage

See the [![pub](https://img.shields.io/pub/v/flutter_image_compress.svg)](https://pub.dev/packages/flutter_image_compress/versions) version.
Expand Down Expand Up @@ -368,20 +388,11 @@ Open xcode project, select Runner target, and change the value of `macOS Deploym
And, change the `Podfile`:
Change `platform` to `platform :osx, '10.15'`.

## Platform Features

| Feature | Android | iOS | Web | macOS |
| :------------------------- | :-----: | :---: | :---------------------: | :---: |
| method: compressWithList |||||
| method: compressAssetImage |||||
| method: compressWithFile |||||
| method: compressAndGetFile |||||
| format: jpeg |||||
| format: png |||||
| format: webp ||| [🌐][webp-compatibility] ||
| format: heic |||||
| param: quality ||| [🌐][webp-compatibility] ||
| param: rotate |||||
| param: keepExif |||||
## OpenHarmony

The currently supported image formats for parsing include JPEG, PNG, GIF, RAW, WebP, BMP, and SVG. However, the encoding output image formats are currently limited to JPEG, PNG, and WebP only.

当前支持的解析图片格式包括 JPEG、PNG、GIF、RAW、WebP、BMP、SVG . 编码输出图片格式当前仅支持 JPEG、PNG 和 WebP.


[webp-compatibility]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob#browser_compatibility "Browser support"
18 changes: 18 additions & 0 deletions packages/flutter_image_compress/example/ohos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/node_modules
/oh_modules
/local.properties
/.idea
**/build
/.hvigor
.cxx
/.clangd
/.clang-format
/.clang-tidy
**/.test
entry/libs/arm64-v8a/libapp.so
entry/libs/arm64-v8a/libflutter.so
entry/libs/arm64-v8a/libvmservice_snapshot.so
entry/src/main/resources/rawfile/flutter_assets/
har/flutter.har
oh-package-lock.json5
dta
10 changes: 10 additions & 0 deletions packages/flutter_image_compress/example/ohos/AppScope/app.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"app": {
"bundleName": "com.fluttercandies.example",
"vendor": "example",
"versionCode": 1000000,
"versionName": "1.0.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"string": [
{
"name": "app_name",
"value": "example"
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions packages/flutter_image_compress/example/ohos/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

{
"app": {
"signingConfigs": [],
"products": [
{
"name": "default",
"signingConfig": "default",
"compileSdkVersion": "4.1.0(11)",
"compatibleSdkVersion": "4.1.0(11)",
"runtimeOS": "HarmonyOS",
}
]
},
"modules": [
{
"name": "entry",
"srcPath": "./entry",
"targets": [
{
"name": "default",
"applyToProducts": [
"default"
]
}
]
}
]
}
9 changes: 9 additions & 0 deletions packages/flutter_image_compress/example/ohos/entry/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
/har
/libs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

{
"apiType": 'stageMode',
"buildOption": {
},
"targets": [
{
"name": "default",
"runtimeOS": "HarmonyOS"
},
{
"name": "ohosTest",
}
]
}
17 changes: 17 additions & 0 deletions packages/flutter_image_compress/example/ohos/entry/hvigorfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2023 Hunan OpenValley Digital Industry Development Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Script for compiling build behavior. It is built in the build plug-in and cannot be modified currently.
export { hapTasks } from '@ohos/hvigor-ohos-plugin';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
name: 'entry',
version: '1.0.0',
description: 'Please describe the basic information.',
main: '',
author: '',
license: '',
dependencies: {
'@ohos/path_provider_ohos': 'file:./har/path_provider_ohos.har',
'@ohos/flutter_image_compress_ohos': 'file:./har/flutter_image_compress_ohos.har',
},
}
Loading

0 comments on commit 3018544

Please sign in to comment.