Skip to content

Commit

Permalink
Merge branch 'ohos-flutter-3.22.0' of github.com:yeliulee/fluwx into …
Browse files Browse the repository at this point in the history
…ohos-flutter-3.22.0
  • Loading branch information
yeliulee committed Nov 11, 2024
2 parents 3d0cb37 + 157e996 commit 9b82db4
Show file tree
Hide file tree
Showing 16 changed files with 658 additions and 702 deletions.
41 changes: 41 additions & 0 deletions .github/actions/publish_flutter_package/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Publish Flutter package to pub.dev
description: Publish your Flutter package to pub.dev

inputs:
working-directory:
description: directory with-in the repository where the package is located (if not in the repository root)
required: false

runs:
using: "composite"
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2

- name: 🪪 Get Id Token
uses: actions/github-script@v6
with:
script: |
let pub_token = await core.getIDToken('https://pub.dev')
core.exportVariable('PUB_TOKEN', pub_token)
- name: 📢 Authenticate
shell: ${{ inputs.shell }}
run: flutter pub pub token add https://pub.dev --env-var PUB_TOKEN

- name: 📦 Install dependencies
shell: ${{ inputs.shell }}
run: flutter pub get
working-directory: ${{ inputs.working-directory }}

# - name: 🌵 Dry Run
# shell: ${{ inputs.shell }}
# run: flutter pub publish --dry-run
# working-directory: ${{ inputs.working-directory }}

- name: 📢 Publish
shell: ${{ inputs.shell }}
run: flutter pub publish -f
working-directory: ${{ inputs.working-directory }}
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish to pub.dev

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

jobs:
publish:
environment: 'pub.dev'
permissions:
id-token: write # Required for authentication using OIDC
runs-on: ubuntu-latest
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- uses: ./.github/actions/publish_flutter_package
25 changes: 1 addition & 24 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
example/android/gradle/wrapper/gradle-wrapper.jar
example/
.DS_Store
.dart_tool/

Expand All @@ -13,28 +13,5 @@ build/
.flutter-plugins-dependencies
flutter_export_environment.sh

android/.classpath
android/.project
android/.settings/org.eclipse.buildship.core.prefs
example/android/.project
example/android/.settings/org.eclipse.buildship.core.prefs
example/android/app/.classpath
example/android/app/.project
example/android/app/.settings/org.eclipse.buildship.core.prefs
example/ios/.symlinks
example/Podfile.lock
.last_build_id

example/

example/build
example/.dart_tool

example/.flutter-plugins
example/.flutter-plugins-dependencies
example/.packages
example/.pub-cache/
example/.pub/
example/build/
example
example/android/app/debug.keystore
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
# 5.2.6
* iOS脚本优化

# 5.2.5
* 测试自动发布脚本

# 5.2.4
* Fix #663

# 5.2.3
* Fix #661

# 5.2.2
* Fix #659,优化iOS脚本,使其更加友好

# 5.2.1
* Merge #658

# 5.2.0
* 为iOS分享小程序增加hdImageData选项
* 优化Android图片分享逻辑,优先把LocalImagePath以最大限度保证图片质量

# 5.1.0
* 试验性支持harmonyOS,目前受限于native sdk,只支持部分功能

# 5.0.3
* 优化localImagePath处理,减轻非Android开发者的上手难度:localImagePath如果是以content://开头,则默认你已经挂载了相关路径的权限,
否则请务必保证该路径是文件实际保存路径,即Android层可以直接读取到该文件,以方便fluwx将文件拷贝到指定可用目录。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,44 +106,47 @@ internal interface FluwxShareHandler : CoroutineScope {
val map: Map<String, Any> = call.argument("source") ?: mapOf()

val imgHash = call.argument<String?>("imgDataHash")
val uint8List = map["uint8List"] as? ByteArray
val imageObject = uint8List?.let {
val localImagePath = map["localImagePath"] as? String
val imageObject = localImagePath?.let {
WXImageObject().apply {
imageData = it
imgDataHash = imgHash
}
} ?: run {
WXImageObject().apply {
val localImagePath = map["localImagePath"] as? String
localImagePath?.also {
if (supportFileProvider && targetHigherThanN) {
if (localImagePath.startsWith("content://")) {
imagePath = localImagePath
} else {
val tempFile = File(localImagePath)
val ecd = context.externalCacheDir ?: return@also
val desPath =
ecd.absolutePath + File.separator + cachePathName
if (tempFile.exists()) {
val target = if (isFileInDirectory(
file = tempFile,
directory = File(desPath)
)
) {
tempFile
} else {
withContext(Dispatchers.IO) {
copyFile(tempFile.absolutePath, desPath)
}
if (supportFileProvider && targetHigherThanN) {
if (localImagePath.startsWith("content://")) {
imagePath = localImagePath
} else {
val tempFile = File(localImagePath)
val ecd = context.externalCacheDir ?: return@apply
val desPath =
ecd.absolutePath + File.separator + cachePathName
if (tempFile.exists()) {
val target = if (isFileInDirectory(
file = tempFile,
directory = File(desPath)
)
) {
tempFile
} else {
withContext(Dispatchers.IO) {
copyFile(tempFile.absolutePath, desPath)
}

imagePath = getFileContentUri(target)
}

imagePath = getFileContentUri(target)
}
}
} else {
imagePath = localImagePath
}

imgDataHash = imgHash
}
} ?: run {
WXImageObject().apply {
val uint8List = map["uint8List"] as? ByteArray
uint8List?.let {
imageData = it
imgDataHash = imgHash
}
}
}


Expand Down
5 changes: 3 additions & 2 deletions android/src/main/res/xml/fluwx_file_provider_paths.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="fluwxSharedData" path="fluwxSharedData/"/>
</paths>
<cache-path name="fluwxSharedData" path="fluwxSharedData/" />
<external-cache-path name="externalFluwxSharedData" path="fluwxSharedData/" />
</paths>
3 changes: 1 addition & 2 deletions ios/Classes/FluwxDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ + (instancetype)defaultManager {
return instance;
}

- (void) registerWxAPI:(NSString *)appId universalLink:(NSString *)universalLink {
- (void)registerWxAPI:(NSString *)appId universalLink:(NSString *)universalLink {
[WXApi registerApp:appId universalLink:universalLink];
}


@end
Loading

0 comments on commit 9b82db4

Please sign in to comment.