From c93683eb197c99613d3e1f50085e93643b6af27b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=A3=8A?= <1633537611@qq.com> Date: Wed, 23 Oct 2024 19:59:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87api?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E7=B3=BB=E7=BB=9F=E5=9B=BE=E7=89=87=E9=80=89?= =?UTF-8?q?=E6=8B=A9=EF=BC=8C=E8=A7=A3=E5=86=B3=E4=B8=8A=E6=9E=B6google=20?= =?UTF-8?q?play=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../uni-chooseSystemImage/changelog.md | 0 .../uni-chooseSystemImage/package.json | 83 ++++++++++ uni_modules/uni-chooseSystemImage/readme.md | 7 + .../utssdk/app-android/config.json | 7 + .../utssdk/app-android/index.uts | 153 ++++++++++++++++++ .../app-android/libs/chooseMedia-release.aar | Bin 0 -> 10062 bytes .../utssdk/interface.uts | 20 +++ .../uni-chooseSystemImage/utssdk/unierror.uts | 25 +++ 8 files changed, 295 insertions(+) create mode 100644 uni_modules/uni-chooseSystemImage/changelog.md create mode 100644 uni_modules/uni-chooseSystemImage/package.json create mode 100644 uni_modules/uni-chooseSystemImage/readme.md create mode 100644 uni_modules/uni-chooseSystemImage/utssdk/app-android/config.json create mode 100644 uni_modules/uni-chooseSystemImage/utssdk/app-android/index.uts create mode 100644 uni_modules/uni-chooseSystemImage/utssdk/app-android/libs/chooseMedia-release.aar create mode 100644 uni_modules/uni-chooseSystemImage/utssdk/interface.uts create mode 100644 uni_modules/uni-chooseSystemImage/utssdk/unierror.uts diff --git a/uni_modules/uni-chooseSystemImage/changelog.md b/uni_modules/uni-chooseSystemImage/changelog.md new file mode 100644 index 0000000..e69de29 diff --git a/uni_modules/uni-chooseSystemImage/package.json b/uni_modules/uni-chooseSystemImage/package.json new file mode 100644 index 0000000..c71e97a --- /dev/null +++ b/uni_modules/uni-chooseSystemImage/package.json @@ -0,0 +1,83 @@ +{ + "id": "uni-chooseSystemImage", + "displayName": "uni-chooseSystemImage", + "version": "1.0.0", + "description": "uni-chooseSystemImage", + "keywords": [ + "uni-chooseSystemImage" +], + "repository": "", + "engines": { + "HBuilderX": "^3.6.8" + }, + "dcloudext": { + "type": "uts", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "", + "data": "", + "permissions": "" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "u", + "aliyun": "u", + "alipay": "u" + }, + "client": { + "Vue": { + "vue2": "u", + "vue3": "u" + }, + "App": { + "app-android": "u", + "app-ios": "u", + "app-harmony": "u" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "u", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "u", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uni-chooseSystemImage/readme.md b/uni_modules/uni-chooseSystemImage/readme.md new file mode 100644 index 0000000..50ca920 --- /dev/null +++ b/uni_modules/uni-chooseSystemImage/readme.md @@ -0,0 +1,7 @@ +# uni-chooseSystemImage +### 开发文档 +[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html) +[UTS API插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html) +[UTS uni-app兼容模式组件](https://uniapp.dcloud.net.cn/plugin/uts-component.html) +[UTS 标准模式组件](https://doc.dcloud.net.cn/uni-app-x/plugin/uts-vue-component.html) +[Hello UTS](https://gitcode.net/dcloud/hello-uts) diff --git a/uni_modules/uni-chooseSystemImage/utssdk/app-android/config.json b/uni_modules/uni-chooseSystemImage/utssdk/app-android/config.json new file mode 100644 index 0000000..a9b89eb --- /dev/null +++ b/uni_modules/uni-chooseSystemImage/utssdk/app-android/config.json @@ -0,0 +1,7 @@ +{ + "dependencies": [ + "androidx.appcompat:appcompat:1.6.1", + "androidx.activity:activity-ktx:1.9.2" + ], + "minSdkVersion": "21" +} \ No newline at end of file diff --git a/uni_modules/uni-chooseSystemImage/utssdk/app-android/index.uts b/uni_modules/uni-chooseSystemImage/utssdk/app-android/index.uts new file mode 100644 index 0000000..c3bd13d --- /dev/null +++ b/uni_modules/uni-chooseSystemImage/utssdk/app-android/index.uts @@ -0,0 +1,153 @@ +/* 引入 interface.uts 文件中定义的变量 */ +import { ChooseSystemImage, ChooseSystemImageOptions, ChooseSystemImageSuccessResult, ChooseSystemVideo, ChooseSystemVideoOptions, ChooseSystemVideoSuccessResult } from '../interface.uts'; +import AppCompatActivity from 'androidx.appcompat.app.AppCompatActivity'; +import ActivityResultCallback from 'androidx.activity.result.ActivityResultCallback'; +import List from 'kotlin.collections.List'; +import Uri from 'android.net.Uri'; +import ActivityResultContracts from 'androidx.activity.result.contract.ActivityResultContracts'; +import ActivityResultLauncher from 'androidx.activity.result.ActivityResultLauncher'; +import PickVisualMediaRequest from "androidx.activity.result.PickVisualMediaRequest"; +import Builder from "androidx.activity.result.PickVisualMediaRequest.Builder"; +import Context from 'com.alibaba.fastjson.parser.deserializer.ASMDeserializerFactory.Context'; +import MediaStore from 'android.provider.MediaStore'; +import Activity from "android.app.Activity" +import Intent from 'android.content.Intent'; +import ChooseSystemImageActivity from "uts.sdk.modules.uniChooseSystemImage.ChooseSystemImageActivity" + +/* 引入 unierror.uts 文件中定义的变量 */ +import { ImageErrorImpl } from '../unierror'; +import ChooseVideoOptions from 'uts.sdk.modules.DCloudUniMedia.ChooseVideoOptions'; +import BitmapFactory from 'android.graphics.BitmapFactory'; +import File from 'java.io.File'; +import FileInputStream from 'java.io.FileInputStream'; +import FileOutputStream from 'java.io.FileOutputStream'; +import InputStream from 'java.io.InputStream'; +import Build from 'android.os.Build'; +var resultCallback : ((requestCode : Int, resultCode : Int, data ?: Intent) => void) | null = null + +export const chooseSystemImage : ChooseSystemImage = function (option : ChooseSystemImageOptions) { + if (option.count <= 0) { + var error = new ImageErrorImpl(2101002, "uni-chooseSystemImage") + option.fail?.(error) + option.complete?.(error) + return + } + if (Build.VERSION.SDK_INT > 32) { + __chooseSystemImage(option) + } else { + UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, [android.Manifest.permission.READ_EXTERNAL_STORAGE], (a : boolean, b : string[]) => { + __chooseSystemImage(option) + }, (a : boolean, b : string[]) => { + var error = new ImageErrorImpl(2101005, "uni-chooseSystemImage") + option.fail?.(error) + option.complete?.(error) + }) + } +} + +function __chooseSystemImage(option : ChooseSystemImageOptions) { + try { + resultCallback = (requestCode : Int, resultCode : Int, data : Intent | null) => { + UTSAndroid.offAppActivityResult(resultCallback!) + if (10086 == requestCode && resultCode == -1) { + if (data != null) { + var result = data!.getStringArrayExtra("paths") + if (result != null && result!.size > 0) { + var paths : Array = [] + result.forEach((p : string) => { + if (UTSAndroid.isUniAppX()) { + paths.push("file://" + (p)) + } else { + paths.push("file://" + copyResource(p)) + } + + }) + var success : ChooseSystemImageSuccessResult = { + filePaths: paths + } + option.success?.(success) + option.complete?.(success) + } else { + var error = new ImageErrorImpl(2101001, "uni-chooseSystemImage") + option.fail?.(error) + option.complete?.(error) + } + } else { + var error = new ImageErrorImpl(2101001, "uni-chooseSystemImage") + option.fail?.(error) + option.complete?.(error) + } + } else { + var error = new ImageErrorImpl(2101001, "uni-chooseSystemImage") + option.fail?.(error) + option.complete?.(error) + } + } + UTSAndroid.onAppActivityResult(resultCallback!) + var intent = new Intent(UTSAndroid.getUniActivity()!, Class.forName("uts.sdk.modules.uniChooseSystemImage.ChooseSystemImageActivity")) + intent.putExtra("count", option.count) + intent.putExtra("type", 1) + UTSAndroid.getUniActivity()!.startActivityForResult(intent, 10086) + } catch (e) { + var error = new ImageErrorImpl(2101010, "uni-chooseSystemImage") + option.fail?.(error) + option.complete?.(error) + } +} + +var CACHEPATH = UTSAndroid.getAppCachePath() +function copyResource(url : string) : string { + var path : String = CACHEPATH! + if (CACHEPATH?.endsWith("/") == true) { + path = CACHEPATH + "/uni-getSystemImage/" + } else { + path = CACHEPATH + "/uni-getSystemImage/" + } + path = path + new File(url).getName() + console.log(path) + copyFile(url, path) + return path +} + +function copyFile(fromFilePath : string, toFilePath : string) : boolean { + var fis : InputStream | null = null + try { + let fromFile = new File(fromFilePath) + if (!fromFile.exists()) { + return false; + } + if (!fromFile.isFile()) { + return false + } + if (!fromFile.canRead()) { + return false; + } + fis = new FileInputStream(fromFile); + if (fis == null) { + return false + } + } catch (e) { + return false; + } + let toFile = new File(toFilePath) + if (!toFile.getParentFile().exists()) { + toFile.getParentFile().mkdirs() + } + if (!toFile.exists()) { + toFile.createNewFile() + } + try { + let fos = new FileOutputStream(toFile) + let byteArrays = ByteArray(1024) + var c = fis!!.read(byteArrays) + while (c > 0) { + fos.write(byteArrays, 0, c) + c = fis!!.read(byteArrays) + } + fis!!.close() + fos.close() + return true + } catch (e) { + return false; + } +} \ No newline at end of file diff --git a/uni_modules/uni-chooseSystemImage/utssdk/app-android/libs/chooseMedia-release.aar b/uni_modules/uni-chooseSystemImage/utssdk/app-android/libs/chooseMedia-release.aar new file mode 100644 index 0000000000000000000000000000000000000000..38d912b74fe598b64ae89c2bc79ab64d97d949d9 GIT binary patch literal 10062 zcmbuFWo#YImaexs=9ul6nVFfHnVp#Jn3dZuQ=g+Oy zs;-vSyQC_;U9IkZ6r{nxQ2~H2UjP7rAi#5X9f1Ei!u<@0&rqUsbafmZqgJG#D;bki zrJ$4=qn?nYk%S+X7?)LLC}!9M1t|Qt3Mmo@EHfYgfCV@JfbvgGYa@Fbb0b-OYjYE0 z2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ZkMFqdQ`>@(Uo1hF^3x4PwmEf6T zLWbsv3u1GYHWzr;o%uG~g5~H}L@ce3N+;Ufe*R8Iy!hRiFWt-xgTVzM@l@)7u3h0> z*9Mhk4AXzm?KJVFh6j_(SPIc>?;KV^8Uz#-?ElSOeNN>+TE5>ur~ja^{+9d=TK!7^ z0Ob1#eGdNz?CS3Ve`7lTE+G18%KrlG{4M+^@xR*kU&60|GePT5;^!ZO{%?wZO#E*} z{C_I`)6#zn|F-o1mFD|({CDBM4gPnDzb*3b64fOCABItohJgI16x8R@`+37Tlm2t{ Fe*hps{k;GH literal 0 HcmV?d00001 diff --git a/uni_modules/uni-chooseSystemImage/utssdk/interface.uts b/uni_modules/uni-chooseSystemImage/utssdk/interface.uts new file mode 100644 index 0000000..dad094a --- /dev/null +++ b/uni_modules/uni-chooseSystemImage/utssdk/interface.uts @@ -0,0 +1,20 @@ +export type ChooseSystemImageSuccessResult = { + filePaths : Array +} +export type ImageErrorCode = 2101001 | 2101010 | 2101002 +export interface ChooseSystemImageError extends IUniError { + errCode : ImageErrorCode +}; +export type ChooseSystemImageSuccessCallback = (result : ChooseSystemImageSuccessResult) => void +export type ChooseSystemImageFailResult = ChooseSystemImageError +export type ChooseSystemImageFailCallback = (result : ChooseSystemImageFailResult) => void +export type ChooseSystemImageCompleteCallback = (callback : any) => void + +export type ChooseSystemImageOptions = { + count : number, + success ?: ChooseSystemImageSuccessCallback | null, + fail ?: ChooseSystemImageFailCallback | null, + complete ?: ChooseSystemImageCompleteCallback | null +} + +export type ChooseSystemImage = (options : ChooseSystemImageOptions) => void \ No newline at end of file diff --git a/uni_modules/uni-chooseSystemImage/utssdk/unierror.uts b/uni_modules/uni-chooseSystemImage/utssdk/unierror.uts new file mode 100644 index 0000000..ea56c5d --- /dev/null +++ b/uni_modules/uni-chooseSystemImage/utssdk/unierror.uts @@ -0,0 +1,25 @@ +import { ImageErrorCode, ChooseSystemImageError } from "./interface.uts" +export const ImageUniErrors : Map = new Map([ + /** + * 用户取消 + */ + [2101001, 'user cancel'], + [2101002, 'fail parameter error'], + [2101005, "No Permission"], + /** + * 其他错误 + */ + [2101010, "unexpect error:"] +]); + +export class ImageErrorImpl extends UniError implements ChooseSystemImageError { + // #ifdef APP-ANDROID + override errCode : ImageErrorCode + // #endif + constructor(errCode : ImageErrorCode, uniErrorSubject : string) { + super() + this.errSubject = uniErrorSubject + this.errCode = errCode + this.errMsg = ImageUniErrors.get(errCode) ?? ""; + } +} \ No newline at end of file -- GitLab