提交 10c651e8 编写于 作者: DCloud-yyl's avatar DCloud-yyl

同步代码@HBuilderX4.15-补充

上级 a737b84f
...@@ -61,14 +61,12 @@ export interface Uni { ...@@ -61,14 +61,12 @@ export interface Uni {
* "android": { * "android": {
* "osVer": "5.0", * "osVer": "5.0",
* "uniVer": "3.8.15", * "uniVer": "3.8.15",
* "unixVer": "3.9.0", * "unixVer": "3.9.0"
* "utsPlugin": "3.9.0"
* }, * },
* "ios": { * "ios": {
* "osVer": "x", * "osVer": "x",
* "uniVer": "x", * "uniVer": "x",
* "unixVer": "x", * "unixVer": "x"
* "utsPlugin": "x"
* } * }
* }, * },
* "web": { * "web": {
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
"getFileSystemManager": { "getFileSystemManager": {
"name": "getFileSystemManager", "name": "getFileSystemManager",
"app": { "app": {
"js": true, "js": false,
"kotlin": true, "kotlin": true,
"swift": false "swift": false
} }
......
import File from 'java.io.File' import File from 'java.io.File'
import ParcelFileDescriptor from 'android.os.ParcelFileDescriptor' import ParcelFileDescriptor from 'android.os.ParcelFileDescriptor'
import { OpenFileOptions, OpenFileSuccessResult, OpenFileSyncOptions } from '../interface'; import { OpenFileOptions, OpenFileSuccessResult, OpenFileSyncOptions } from '../interface';
import { UniErrorSubject,FileSystemManagerFailImpl,FileSystemManagerUniErrors } from '../unierror'; import { UniErrorSubject, UniErrors } from '../unierror';
export class FileDescriptorUtil { export class FileDescriptorUtil {
public openMap : Map<string, File> = new Map() public openMap : Map<string, File> = new Map()
...@@ -28,12 +28,12 @@ export class FileDescriptorUtil { ...@@ -28,12 +28,12 @@ export class FileDescriptorUtil {
case 'ax': //类似于 'a',但如果路径存在,则失败 case 'ax': //类似于 'a',但如果路径存在,则失败
{ {
if (file.exists()) { if (file.exists()) {
let err = new FileSystemManagerFailImpl(1301005); let err = new UniError(UniErrorSubject, 1301005, UniErrors.get(1301005)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
} else { } else {
if (file.parentFile?.exists() == false) { if (file.parentFile?.exists() == false) {
let err = new FileSystemManagerFailImpl(1300002); let err = new UniError(UniErrorSubject, 1300002, UniErrors.get(1300002)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
return return
...@@ -66,7 +66,7 @@ export class FileDescriptorUtil { ...@@ -66,7 +66,7 @@ export class FileDescriptorUtil {
case 'ax+': //类似于 'a+',但如果路径存在,则失败 case 'ax+': //类似于 'a+',但如果路径存在,则失败
{ {
if (file.exists()) { if (file.exists()) {
let err = new FileSystemManagerFailImpl(1301005); let err = new UniError(UniErrorSubject, 1301005, UniErrors.get(1301005)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
} else { } else {
...@@ -84,7 +84,7 @@ export class FileDescriptorUtil { ...@@ -84,7 +84,7 @@ export class FileDescriptorUtil {
case 'r': //打开文件用于读取。 如果文件不存在,则会发生异常 case 'r': //打开文件用于读取。 如果文件不存在,则会发生异常
{ {
if (!file.exists()) { if (!file.exists()) {
let err = new FileSystemManagerFailImpl(1300002); let err = new UniError(UniErrorSubject, 1300002, UniErrors.get(1300002)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
} else { } else {
...@@ -104,7 +104,7 @@ export class FileDescriptorUtil { ...@@ -104,7 +104,7 @@ export class FileDescriptorUtil {
case 'r+': //打开文件用于读取和写入。 如果文件不存在,则会发生异常 case 'r+': //打开文件用于读取和写入。 如果文件不存在,则会发生异常
{ {
if (!file.exists()) { if (!file.exists()) {
let err = new FileSystemManagerFailImpl(1300002); let err = new UniError(UniErrorSubject, 1300002, UniErrors.get(1300002)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
} else { } else {
...@@ -136,7 +136,7 @@ export class FileDescriptorUtil { ...@@ -136,7 +136,7 @@ export class FileDescriptorUtil {
case 'wx'://类似于 'w',但如果路径存在,则失败 case 'wx'://类似于 'w',但如果路径存在,则失败
{ {
if (file.exists()) { if (file.exists()) {
let err = new FileSystemManagerFailImpl(1301005); let err = new UniError(UniErrorSubject, 1301005, UniErrors.get(1301005)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
} else { } else {
...@@ -168,7 +168,7 @@ export class FileDescriptorUtil { ...@@ -168,7 +168,7 @@ export class FileDescriptorUtil {
case 'wx+': // 类似于 'w+',但如果路径存在,则失败 case 'wx+': // 类似于 'w+',但如果路径存在,则失败
{ {
if (file.exists()) { if (file.exists()) {
let err = new FileSystemManagerFailImpl(1301005); let err = new UniError(UniErrorSubject, 1301005, UniErrors.get(1301005)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
} else { } else {
...@@ -187,7 +187,7 @@ export class FileDescriptorUtil { ...@@ -187,7 +187,7 @@ export class FileDescriptorUtil {
} }
} }
} catch (e) { } catch (e) {
let err = new FileSystemManagerFailImpl(1300201); let err = new UniError(UniErrorSubject, 1300201, UniErrors.get(1300201)! + ":" + e + " " + options.filePath);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
} }
...@@ -206,10 +206,10 @@ export class FileDescriptorUtil { ...@@ -206,10 +206,10 @@ export class FileDescriptorUtil {
case 'ax': //类似于 'a',但如果路径存在,则失败 case 'ax': //类似于 'a',但如果路径存在,则失败
{ {
if (file.exists()) { if (file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1301005]}`) throw new Error(`${msgPrefix}${UniErrors[1301005]}`)
} else { } else {
if (file.parentFile?.exists() == false) { if (file.parentFile?.exists() == false) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1300002]}`) throw new Error(`${msgPrefix}${UniErrors[1300002]}`)
} else { } else {
file.createNewFile() file.createNewFile()
let fd = this.open_a(file) let fd = this.open_a(file)
...@@ -228,7 +228,7 @@ export class FileDescriptorUtil { ...@@ -228,7 +228,7 @@ export class FileDescriptorUtil {
case 'ax+': //类似于 'a+',但如果路径存在,则失败 case 'ax+': //类似于 'a+',但如果路径存在,则失败
{ {
if (file.exists()) { if (file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1301005]}`) throw new Error(`${msgPrefix}${UniErrors[1301005]}`)
} else { } else {
let fd = this.open_ax(file) let fd = this.open_ax(file)
this.openMap.set(fd, file) this.openMap.set(fd, file)
...@@ -238,7 +238,7 @@ export class FileDescriptorUtil { ...@@ -238,7 +238,7 @@ export class FileDescriptorUtil {
case 'r': //打开文件用于读取。 如果文件不存在,则会发生异常 case 'r': //打开文件用于读取。 如果文件不存在,则会发生异常
{ {
if (!file.exists()) { if (!file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1300002]}`) throw new Error(`${msgPrefix}${UniErrors[1300002]}`)
} else { } else {
let mode = ParcelFileDescriptor.MODE_READ_ONLY let mode = ParcelFileDescriptor.MODE_READ_ONLY
let pfd = ParcelFileDescriptor.open(file, mode); let pfd = ParcelFileDescriptor.open(file, mode);
...@@ -251,7 +251,7 @@ export class FileDescriptorUtil { ...@@ -251,7 +251,7 @@ export class FileDescriptorUtil {
case 'r+': //打开文件用于读取和写入。 如果文件不存在,则会发生异常 case 'r+': //打开文件用于读取和写入。 如果文件不存在,则会发生异常
{ {
if (!file.exists()) { if (!file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1300002]}`) throw new Error(`${msgPrefix}${UniErrors[1300002]}`)
} else { } else {
let mode = ParcelFileDescriptor.MODE_READ_WRITE let mode = ParcelFileDescriptor.MODE_READ_WRITE
let pfd = ParcelFileDescriptor.open(file, mode); let pfd = ParcelFileDescriptor.open(file, mode);
...@@ -270,7 +270,7 @@ export class FileDescriptorUtil { ...@@ -270,7 +270,7 @@ export class FileDescriptorUtil {
case 'wx'://类似于 'w',但如果路径存在,则失败 case 'wx'://类似于 'w',但如果路径存在,则失败
{ {
if (file.exists()) { if (file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1301005]}`) throw new Error(`${msgPrefix}${UniErrors[1301005]}`)
} else { } else {
let fd = this.open_w(file) let fd = this.open_w(file)
this.openMap.set(fd, file) this.openMap.set(fd, file)
...@@ -289,7 +289,7 @@ export class FileDescriptorUtil { ...@@ -289,7 +289,7 @@ export class FileDescriptorUtil {
case 'wx+': // 类似于 'w+',但如果路径存在,则失败 case 'wx+': // 类似于 'w+',但如果路径存在,则失败
{ {
if (file.exists()) { if (file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1301005]}`) throw new Error(`${msgPrefix}${UniErrors[1301005]}`)
} else { } else {
let mode = ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_READ_WRITE | ParcelFileDescriptor.MODE_TRUNCATE let mode = ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_READ_WRITE | ParcelFileDescriptor.MODE_TRUNCATE
let pfd = ParcelFileDescriptor.open(file, mode); let pfd = ParcelFileDescriptor.open(file, mode);
......
import { WriteFileOptions, ReadFileOptions, MkDirOptions, RmDirOptions, UnLinkOptions, ReadDirOptions, AccessOptions, RenameOptions, GetFileInfoOptions, CopyFileOptions, StatOptions } from "../interface.uts" import { WriteFileOptions, ReadFileOptions, MkDirOptions, RmDirOptions, UnLinkOptions, ReadDirOptions, AccessOptions, RenameOptions, GetFileInfoOptions, CopyFileOptions, StatOptions } from "../interface.uts"
import { ReadFileSuccessResult, FileManagerSuccessResult, ReadDirSuccessResult, GetFileInfoSuccessResult, StatSuccessResult, FileStats, Stats } from "../interface.uts" import { ReadFileSuccessResult, FileManagerSuccessResult, ReadDirSuccessResult, GetFileInfoSuccessResult, StatSuccessResult, FileStats, Stats } from "../interface.uts"
import { GetFileSystemManager, FileSystemManager } from "../interface.uts" import { GetFileSystemManager, FileSystemManager } from "../interface.uts"
import { FileSystemManagerFailImpl, FileSystemManagerUniErrorSubject, FileSystemManagerUniErrors } from "../unierror.uts" import { UniErrorSubject, UniErrors } from "../unierror.uts"
export { Stats,FileStats } from '../interface.uts'
class InnerStats implements Stats { class InnerStats implements Stats {
/** /**
...@@ -92,7 +93,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -92,7 +93,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code) let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.path);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -102,7 +103,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -102,7 +103,7 @@ class JsFileSystemManager implements FileSystemManager {
if(options.digestAlgorithm == null || options.digestAlgorithm == undefined){ if(options.digestAlgorithm == null || options.digestAlgorithm == undefined){
options.digestAlgorithm = "md5" options.digestAlgorithm = "md5"
} else if (options.digestAlgorithm!.toLowerCase() != 'md5' && options.digestAlgorithm!.toLowerCase() != 'sha1') { } else if (options.digestAlgorithm!.toLowerCase() != 'md5' && options.digestAlgorithm!.toLowerCase() != 'sha1') {
let err = new FileSystemManagerFailImpl(1300022); let err = new UniError(UniErrorSubject, 1300022, UniErrors.get(1300022)! + ":invalid digestAlgorithm " + options.digestAlgorithm);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
return return
...@@ -116,7 +117,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -116,7 +117,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.filePath);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -135,7 +136,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -135,7 +136,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -154,7 +155,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -154,7 +155,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)!);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -172,7 +173,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -172,7 +173,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.path);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -190,7 +191,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -190,7 +191,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.dirPath);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -213,7 +214,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -213,7 +214,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.dirPath);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -228,7 +229,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -228,7 +229,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.dirPath);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -247,7 +248,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -247,7 +248,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.filePath);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -265,7 +266,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -265,7 +266,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.filePath);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
...@@ -285,7 +286,7 @@ class JsFileSystemManager implements FileSystemManager { ...@@ -285,7 +286,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret) options.complete?.(ret)
}, },
function (code) { function (code) {
let err = new FileSystemManagerFailImpl(code); let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.filePath);
options.fail?.(err) options.fail?.(err)
options.complete?.(err) options.complete?.(err)
}) })
......
...@@ -21,7 +21,7 @@ export type FileManagerSuccessCallback = (res : FileManagerSuccessResult) => voi ...@@ -21,7 +21,7 @@ export type FileManagerSuccessCallback = (res : FileManagerSuccessResult) => voi
/** /**
* 通用的错误返回结果回调 * 通用的错误返回结果回调
*/ */
export type FileManagerFailCallback = (res : FileSystemManagerFail) => void export type FileManagerFailCallback = (res : UniError) => void
/** /**
* 通用的结束返回结果回调 * 通用的结束返回结果回调
*/ */
...@@ -39,7 +39,7 @@ export type ReadFileOptions = { ...@@ -39,7 +39,7 @@ export type ReadFileOptions = {
*/ */
encoding : "base64" | "utf-8", encoding : "base64" | "utf-8",
/** /**
* 文件路径,支持相对地址和绝对地址,app-android平台支持代码包文件目录 * 文件路径,支持相对地址和绝对地址
*/ */
filePath : string.URIString, filePath : string.URIString,
/** /**
...@@ -553,7 +553,7 @@ export type ReadCompressedFileResult = { ...@@ -553,7 +553,7 @@ export type ReadCompressedFileResult = {
export type ReadCompressedFileCallback = (res : ReadCompressedFileResult) => void export type ReadCompressedFileCallback = (res : ReadCompressedFileResult) => void
export type ReadCompressedFileOptions = { export type ReadCompressedFileOptions = {
/** /**
* 要读取的文件的路径 (本地用户文件或代码包文件),app-android平台支持代码包文件目录 * 要读取的文件的路径 (本地用户文件或代码包文件)
*/ */
filePath : string.URIString, filePath : string.URIString,
/** /**
...@@ -779,7 +779,7 @@ export type ZipFileItem = { ...@@ -779,7 +779,7 @@ export type ZipFileItem = {
export type ReadZipEntryCallback = (res : EntriesResult) => void export type ReadZipEntryCallback = (res : EntriesResult) => void
export type ReadZipEntryOptions = { export type ReadZipEntryOptions = {
/** /**
* 要读取的压缩包的路径 (本地路径),app-android平台支持代码包文件目录 * 要读取的压缩包的路径 (本地路径)
*/ */
filePath : string.URIString, filePath : string.URIString,
/** /**
...@@ -829,8 +829,6 @@ export interface FileSystemManager { ...@@ -829,8 +829,6 @@ export interface FileSystemManager {
readFile(options : ReadFileOptions) : void; readFile(options : ReadFileOptions) : void;
/** /**
* FileSystemManager.readFile 的同步版本参数 * FileSystemManager.readFile 的同步版本参数
* @param 文件路径,支持相对地址和绝对地址,app-android平台支持代码包文件目录
* @param base64 / utf-8
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -875,9 +873,6 @@ export interface FileSystemManager { ...@@ -875,9 +873,6 @@ export interface FileSystemManager {
writeFile(options : WriteFileOptions) : void; writeFile(options : WriteFileOptions) : void;
/** /**
* FileSystemManager.writeFile 的同步版本 * FileSystemManager.writeFile 的同步版本
* @param 文件路径,只支持绝对地址
* @param 写入的文本内容
* @param 指定写入文件的字符编码,支持:ascii base64 utf-8
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -922,7 +917,6 @@ export interface FileSystemManager { ...@@ -922,7 +917,6 @@ export interface FileSystemManager {
unlink(options : UnLinkOptions) : void; unlink(options : UnLinkOptions) : void;
/** /**
* FileSystemManager.unlink 的同步版本 * FileSystemManager.unlink 的同步版本
* @param 文件路径,只支持绝对地址
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -967,8 +961,6 @@ export interface FileSystemManager { ...@@ -967,8 +961,6 @@ export interface FileSystemManager {
mkdir(options : MkDirOptions) : void; mkdir(options : MkDirOptions) : void;
/** /**
* FileSystemManager.mkdir 的同步版本 * FileSystemManager.mkdir 的同步版本
* @param 创建的目录路径 (本地路径)
* @param 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -1013,8 +1005,6 @@ export interface FileSystemManager { ...@@ -1013,8 +1005,6 @@ export interface FileSystemManager {
rmdir(options : RmDirOptions) : void; rmdir(options : RmDirOptions) : void;
/** /**
* FileSystemManager.rmdir 的同步版本 * FileSystemManager.rmdir 的同步版本
* @param 要删除的目录路径 (本地路径)
* @param 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -1059,7 +1049,6 @@ export interface FileSystemManager { ...@@ -1059,7 +1049,6 @@ export interface FileSystemManager {
readdir(options : ReadDirOptions) : void; readdir(options : ReadDirOptions) : void;
/** /**
* FileSystemManager.readdir 的同步版本 * FileSystemManager.readdir 的同步版本
* @param 要读取的目录路径 (本地路径)
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -1104,7 +1093,6 @@ export interface FileSystemManager { ...@@ -1104,7 +1093,6 @@ export interface FileSystemManager {
access(options : AccessOptions) : void; access(options : AccessOptions) : void;
/** /**
* FileSystemManager.access 的同步版本 * FileSystemManager.access 的同步版本
* @param 要删除的目录路径 (本地路径)
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -1149,8 +1137,6 @@ export interface FileSystemManager { ...@@ -1149,8 +1137,6 @@ export interface FileSystemManager {
rename(options : RenameOptions) : void; rename(options : RenameOptions) : void;
/** /**
* FileSystemManager.rename 的同步版本 * FileSystemManager.rename 的同步版本
* @param 源文件路径,支持本地路径
* @param 新文件路径,支持本地路径
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -1195,8 +1181,6 @@ export interface FileSystemManager { ...@@ -1195,8 +1181,6 @@ export interface FileSystemManager {
copyFile(options : CopyFileOptions) : void; copyFile(options : CopyFileOptions) : void;
/** /**
* FileSystemManager.copyFile 的同步版本 * FileSystemManager.copyFile 的同步版本
* @param 源文件路径,支持本地路径
* @param 新文件路径,支持本地路径
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -1263,8 +1247,6 @@ export interface FileSystemManager { ...@@ -1263,8 +1247,6 @@ export interface FileSystemManager {
stat(options : StatOptions) : void; stat(options : StatOptions) : void;
/** /**
* FileSystemManager.stat 的同步版本 * FileSystemManager.stat 的同步版本
* @param 文件/目录路径 (本地路径)
* @param 是否递归获取目录下的每个文件的 Stats 信息
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -1309,9 +1291,6 @@ export interface FileSystemManager { ...@@ -1309,9 +1291,6 @@ export interface FileSystemManager {
appendFile(options : AppendFileOptions) : void; appendFile(options : AppendFileOptions) : void;
/** /**
* FileSystemManager.appendFile 的同步版本 * FileSystemManager.appendFile 的同步版本
* @param 要追加内容的文件路径 (本地路径)
* @param 要追加的文本
* @param 指定写入文件的字符编码支持:ascii base64 utf-8
* @uniPlatform { * @uniPlatform {
* "app": { * "app": {
* "android": { * "android": {
...@@ -1803,25 +1782,3 @@ export interface Uni { ...@@ -1803,25 +1782,3 @@ export interface Uni {
*/ */
getFileSystemManager() : FileSystemManager getFileSystemManager() : FileSystemManager
} }
\ No newline at end of file
/**
* 错误码
* - 1200002 类型错误。仅支持 base64 / utf-8
* - 1300002 未找到文件
* - 1300013 无权限
* - 1300021 是目录
* - 1300022 参数无效
* - 1300066 目录非空
* - 1301003 对目录的非法操作
* - 1301005 文件已存在
* - 1300201 系统错误
* - 1300202 超出文件存储限制的最大尺寸
* - 1301111 brotli解压失败
* - 1302003 标志无效
* - 1300009 文件描述符错误
*/
export type FileSystemManagerErrorCode = 1200002 | 1300002 | 1300013 | 1300021 | 1300022 | 1300066 | 1301003 | 1301005 | 1300201 | 1300202 | 1301111 | 1302003 | 1300009;
export type FileSystemManagerFail = IFileSystemManagerFail;
export interface IFileSystemManagerFail extends IUniError {
errCode : FileSystemManagerErrorCode
};
import { FileSystemManagerErrorCode,IFileSystemManagerFail } from "./interface.uts"
/** /**
* 错误主题 * 错误主题
*/ */
export const FileSystemManagerUniErrorSubject = 'uni-fileSystemManager'; export const UniErrorSubject = 'uni-fileSystemManager';
/** /**
* 错误码 * 错误码
* @UniError * @UniError
*/ */
export const FileSystemManagerUniErrors : Map<FileSystemManagerErrorCode, string> = new Map([ export const UniErrors : Map<number, string> = new Map([
[1200002, 'type error. only support base64 / utf-8'], [1200002, 'type error. only support base64 / utf-8'],
[1300002, 'no such file or directory'], [1300002, 'no such file or directory'],
...@@ -25,11 +23,3 @@ export const FileSystemManagerUniErrors : Map<FileSystemManagerErrorCode, string ...@@ -25,11 +23,3 @@ export const FileSystemManagerUniErrors : Map<FileSystemManagerErrorCode, string
[1302003, 'invalid flag'], [1302003, 'invalid flag'],
[1300009, 'bad file descriptor'] [1300009, 'bad file descriptor']
]); ]);
\ No newline at end of file
export class FileSystemManagerFailImpl extends UniError implements IFileSystemManagerFail {
constructor(errCode : FileSystemManagerErrorCode) {
super();
this.errSubject = FileSystemManagerUniErrorSubject;
this.errCode = errCode;
this.errMsg = FileSystemManagerUniErrors.get(errCode) ?? "";
}
}
\ No newline at end of file
...@@ -90,21 +90,6 @@ export type GetAppAuthorizeSettingResult = { ...@@ -90,21 +90,6 @@ export type GetAppAuthorizeSettingResult = {
* - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
* - config error: Android平台:表示没有配置 `android.permission.CAMERA` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台没有该值 * - config error: Android平台:表示没有配置 `android.permission.CAMERA` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台没有该值
* @type 'authorized' | 'denied' | 'not determined' | 'config error' * @type 'authorized' | 'denied' | 'not determined' | 'config error'
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "√",
* "unixVer": "3.9"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
cameraAuthorized: 'authorized' | 'denied' | 'not determined' | 'config error', cameraAuthorized: 'authorized' | 'denied' | 'not determined' | 'config error',
/** /**
...@@ -114,21 +99,6 @@ export type GetAppAuthorizeSettingResult = { ...@@ -114,21 +99,6 @@ export type GetAppAuthorizeSettingResult = {
* - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
* - config error: Android平台:表示没有配置 `android.permission.ACCESS_COARSE_LOCATION` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块 * - config error: Android平台:表示没有配置 `android.permission.ACCESS_COARSE_LOCATION` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块
* @type 'authorized' | 'denied' | 'not determined' | 'config error' * @type 'authorized' | 'denied' | 'not determined' | 'config error'
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "√",
* "unixVer": "3.9"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
locationAuthorized: 'authorized' | 'denied' | 'not determined' | 'config error', locationAuthorized: 'authorized' | 'denied' | 'not determined' | 'config error',
/** /**
...@@ -137,21 +107,6 @@ export type GetAppAuthorizeSettingResult = { ...@@ -137,21 +107,6 @@ export type GetAppAuthorizeSettingResult = {
* - full: 精准定位 * - full: 精准定位
* - unsupported: 不支持(包括用户拒绝定位权限和没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块) * - unsupported: 不支持(包括用户拒绝定位权限和没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块)
* @type 'reduced' | 'full' | 'unsupported' * @type 'reduced' | 'full' | 'unsupported'
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "√",
* "unixVer": "3.9"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
locationAccuracy?: 'reduced' | 'full' | 'unsupported' | null, locationAccuracy?: 'reduced' | 'full' | 'unsupported' | null,
/** /**
...@@ -181,21 +136,6 @@ export type GetAppAuthorizeSettingResult = { ...@@ -181,21 +136,6 @@ export type GetAppAuthorizeSettingResult = {
* - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
* - config error: Android平台:表示没有配置 `android.permission.RECORD_AUDIO` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台没有该值 * - config error: Android平台:表示没有配置 `android.permission.RECORD_AUDIO` 权限,[权限配置详情](https://uniapp.dcloud.net.cn/tutorial/app-nativeresource-android.html#permissions);iOS平台没有该值
* @type 'authorized' | 'denied' | 'not determined' | 'config error' * @type 'authorized' | 'denied' | 'not determined' | 'config error'
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "√",
* "unixVer": "3.9"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
microphoneAuthorized: 'authorized' | 'denied' | 'not determined' | 'config error', microphoneAuthorized: 'authorized' | 'denied' | 'not determined' | 'config error',
/** /**
...@@ -205,21 +145,6 @@ export type GetAppAuthorizeSettingResult = { ...@@ -205,21 +145,6 @@ export type GetAppAuthorizeSettingResult = {
* - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关) * - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
* - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块 * - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块
* @type 'authorized' | 'denied' | 'not determined' | 'config error' * @type 'authorized' | 'denied' | 'not determined' | 'config error'
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "4.4",
* "uniVer": "√",
* "unixVer": "3.9"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
notificationAuthorized: 'authorized' | 'denied' | 'not determined' | 'config error', notificationAuthorized: 'authorized' | 'denied' | 'not determined' | 'config error',
/** /**
......
...@@ -8,143 +8,31 @@ export type GetAppBaseInfoOptions = { ...@@ -8,143 +8,31 @@ export type GetAppBaseInfoOptions = {
export type GetAppBaseInfoResult = { export type GetAppBaseInfoResult = {
/** /**
* manifest.json 中应用appid,即DCloud appid。 * manifest.json 中应用appid,即DCloud appid。
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
appId?: string, appId?: string,
/** /**
* `manifest.json` 中应用名称。 * `manifest.json` 中应用名称。
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
appName?: string, appName?: string,
/** /**
* `manifest.json` 中应用版本名称。 * `manifest.json` 中应用版本名称。
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
appVersion?: string, appVersion?: string,
/** /**
* `manifest.json` 中应用版本名号。 * `manifest.json` 中应用版本名号。
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
appVersionCode?: string, appVersionCode?: string,
/** /**
* 应用设置的语言en、zh-Hans、zh-Hant、fr、es * 应用设置的语言en、zh-Hans、zh-Hant、fr、es
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
appLanguage?: string, appLanguage?: string,
/** /**
* 应用设置的语言 * 应用设置的语言
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
language?: string, language?: string,
/** /**
* 引擎版本号。已废弃,仅为了向下兼容保留 * 引擎版本号。已废弃,仅为了向下兼容保留
* @deprecated 已废弃,仅为了向下兼容保留 * @deprecated 已废弃,仅为了向下兼容保留
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
version?: string, version?: string,
/** /**
...@@ -317,48 +205,12 @@ export type GetAppBaseInfoResult = { ...@@ -317,48 +205,12 @@ export type GetAppBaseInfoResult = {
hostTheme?: string, hostTheme?: string,
/** /**
* 是否uni-app x * 是否uni-app x
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/ */
isUniAppX ?: boolean, isUniAppX ?: boolean,
/** /**
* uni 编译器版本 * uni 编译器版本
* @deprecated 已废弃,仅为了向下兼容保留 * @deprecated 已废弃,仅为了向下兼容保留
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
uniCompileVersion ?: string, uniCompileVersion ?: string,
/** /**
...@@ -379,79 +231,23 @@ export type GetAppBaseInfoResult = { ...@@ -379,79 +231,23 @@ export type GetAppBaseInfoResult = {
* } * }
* }, * },
* "web": { * "web": {
* "uniVer": "x", * "uniVer": "",
* "unixVer": "x" * "unixVer": "4.0"
* } * }
* } * }
*/ */
uniCompilerVersion ?: string, uniCompilerVersion ?: string,
/** /**
* uni-app 运行平台。 * uni-app 运行平台。
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
uniPlatform ?: 'app' | 'web' | 'mp-weixin' | 'mp-alipay' | 'mp-baidu' | 'mp-toutiao' | 'mp-lark' | 'mp-qq' | 'mp-kuaishou' | 'mp-jd' | 'mp-360' | 'quickapp-webview' | 'quickapp-webview-union' | 'quickapp-webview-huawei', uniPlatform ?: 'app' | 'web' | 'mp-weixin' | 'mp-alipay' | 'mp-baidu' | 'mp-toutiao' | 'mp-lark' | 'mp-qq' | 'mp-kuaishou' | 'mp-jd' | 'mp-360' | 'quickapp-webview' | 'quickapp-webview-union' | 'quickapp-webview-huawei',
/** /**
* uni 运行时版本 * uni 运行时版本
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/ */
uniRuntimeVersion ?: string, uniRuntimeVersion ?: string,
/** /**
* uni 编译器版本号 * uni 编译器版本号
* @deprecated 已废弃,仅为了向下兼容保留 * @deprecated 已废弃,仅为了向下兼容保留
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
uniCompileVersionCode?: number, uniCompileVersionCode?: number,
/** /**
...@@ -472,34 +268,14 @@ export type GetAppBaseInfoResult = { ...@@ -472,34 +268,14 @@ export type GetAppBaseInfoResult = {
* } * }
* }, * },
* "web": { * "web": {
* "uniVer": "x", * "uniVer": "",
* "unixVer": "x" * "unixVer": "4.0"
* } * }
* } * }
*/ */
uniCompilerVersionCode?: number, uniCompilerVersionCode?: number,
/** /**
* uni 运行时版本号 * uni 运行时版本号
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/ */
uniRuntimeVersionCode?: number, uniRuntimeVersionCode?: number,
/** /**
......
...@@ -8,292 +8,50 @@ export type GetDeviceInfoOptions = { ...@@ -8,292 +8,50 @@ export type GetDeviceInfoOptions = {
export type GetDeviceInfoResult = { export type GetDeviceInfoResult = {
/** /**
* 设备品牌 * 设备品牌
* @deprecated 已废弃,仅为了向下兼容保留
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/ */
brand?: string brand?: string
/** /**
* 设备品牌 * 设备品牌
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/ */
deviceBrand?: string, deviceBrand?: string,
/** /**
* 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变 * 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
deviceId?: string, deviceId?: string,
/** /**
* 设备型号 * 设备型号
* @deprecated 已废弃,仅为了向下兼容保留
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
model?: string, model?: string,
/** /**
* 设备型号 * 设备型号
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
deviceModel?: string, deviceModel?: string,
/** /**
* 设备类型phone、pad、pc * 设备类型phone、pad、pc
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
deviceType?: string, deviceType?: string,
/** /**
* 设备方向 竖屏 portrait、横屏 landscape * 设备方向 竖屏 portrait、横屏 landscape
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
deviceOrientation?: string, deviceOrientation?: string,
/** /**
* 设备像素比 * 设备像素比
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
devicePixelRatio?: string, devicePixelRatio?: string,
/** /**
* 操作系统及版本 * 操作系统及版本
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
system?: string, system?: string,
/** /**
* 客户端平台 * 客户端平台
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
*/ */
platform?: string, platform?: string,
/** /**
* 是否root * 是否root
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "x",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "x",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/ */
isRoot?: boolean, isRoot?: boolean,
/** /**
* 是否是模拟器 * 是否是模拟器
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "x",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "x",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/ */
isSimulator?: boolean, isSimulator?: boolean,
/** /**
...@@ -312,10 +70,6 @@ export type GetDeviceInfoResult = { ...@@ -312,10 +70,6 @@ export type GetDeviceInfoResult = {
* "uniVer": "x", * "uniVer": "x",
* "unixVer": "x" * "unixVer": "x"
* } * }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* } * }
* } * }
*/ */
......
...@@ -22,16 +22,16 @@ export interface Uni { ...@@ -22,16 +22,16 @@ export interface Uni {
* "unixVer": "3.9.0" * "unixVer": "3.9.0"
* }, * },
* "ios": { * "ios": {
* "osVer": "12.0", * "osVer": "x",
* "uniVer": "", * "uniVer": "x",
* "unixVer": "4.11" * "unixVer": "x"
* } * }
* }, * },
* "web": { * "web": {
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.0" * "unixVer": "4.0"
* } * }
* } * }9999
* *
*/ */
getLocation(options: GetLocationOptions):void; getLocation(options: GetLocationOptions):void;
......
...@@ -15,9 +15,9 @@ export interface Uni { ...@@ -15,9 +15,9 @@ export interface Uni {
* "unixVer": "3.9+" * "unixVer": "3.9+"
* }, * },
* "ios": { * "ios": {
* "osVer": "12.0", * "osVer": "9.0",
* "uniVer": "√", * "uniVer": "√",
* "unixVer": "4.11" * "unixVer": "4.06"
* } * }
* }, * },
* "web": { * "web": {
......
...@@ -3,122 +3,26 @@ ...@@ -3,122 +3,26 @@
export type GetSystemSettingResult = { export type GetSystemSettingResult = {
/** /**
* 蓝牙是否开启 * 蓝牙是否开启
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
bluetoothEnabled?: boolean, bluetoothEnabled?: boolean,
/** /**
* 蓝牙的报错信息 * 蓝牙的报错信息
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
bluetoothError?: string, bluetoothError?: string,
/** /**
* 位置是否开启 * 位置是否开启
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
locationEnabled : boolean, locationEnabled : boolean,
/** /**
* wifi是否开启 * wifi是否开启
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
wifiEnabled?: boolean, wifiEnabled?: boolean,
/** /**
* wifi的报错信息 * wifi的报错信息
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
*/ */
wifiError?: string, wifiError?: string,
/** /**
* 设备方向 * 设备方向
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/ */
deviceOrientation : 'portrait' | 'landscape', deviceOrientation : 'portrait' | 'landscape',
} }
......
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
"app": { "app": {
"js": false, "js": false,
"kotlin": true, "kotlin": true,
"swift": true "swift": false
} }
}, },
"saveVideoToPhotosAlbum": { "saveVideoToPhotosAlbum": {
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
"app": { "app": {
"js": false, "js": false,
"kotlin": true, "kotlin": true,
"swift": true "swift": false
} }
}, },
"getVideoInfo": { "getVideoInfo": {
......
import { ChooseImageOptions, ChooseVideoOptions } from "./interface.uts"
import {
UniError_ChooseImage, UniError_ChooseVideo, MediaErrorImpl
} from "./unierror.uts"
export const CODE_CAMERA_ERROR = 11;
export const CODE_GALLERY_ERROR = 12;
export const CODE_GET_IMAGE_INFO_CODE = 13
export function uniChooseImage(options : ChooseImageOptions, onSourceTypeSelect : (count : number, compressed : boolean, index : number) => void) {
let count = options.count != null ? (options.count! <= 0 ? 9 : options.count) : 9
// 默认为 false
let compressed = false;
if ((options.sizeType) != null) {
compressed = options.sizeType!.indexOf("original") < 0
}
/* source type 乱传如何处理 */
let sourceType : Array<string> = (options.sourceType != null && options.sourceType!.length > 0) ? options.sourceType! : ["album", "camera"];
let itemList = ["拍摄", "从相册选择"]
if (sourceType.length == 1) {
if (sourceType.indexOf("album") >= 0) {
onSourceTypeSelect(count!, compressed, 1)
} else if (sourceType.indexOf("camera") >= 0) {
onSourceTypeSelect(count!, compressed, 0)
}
return
}
if (sourceType.length == 2) {
uni.showActionSheet({
itemList: itemList,
success: (e) => {
onSourceTypeSelect(count!, compressed, e.tapIndex!)
},
fail: (e) => {
let error = new MediaErrorImpl(1101001, UniError_ChooseImage);
options.fail?.(error)
options.complete?.(error)
}
})
}
}
export function uniChooseVideo(options : ChooseVideoOptions, onSourceTypeSelect : (count : number, compressed : boolean, index : number) => void) {
let count = 1
// 默认为 false
let compressed = options.compressed != null ? options.compressed! : true;
/* source type 乱传如何处理 */
let sourceType : Array<string> = (options.sourceType != null && options.sourceType!.length > 0) ? options.sourceType! : ["album", "camera"];
let itemList = ["拍摄", "从相册选择"]
if (sourceType.length == 1) {
if (sourceType.indexOf("album") >= 0) {
onSourceTypeSelect(count!, compressed, 1)
} else if (sourceType.indexOf("camera") >= 0) {
onSourceTypeSelect(count!, compressed, 0)
}
return
}
if (sourceType.length == 2) {
uni.showActionSheet({
itemList: itemList,
success: (e) => {
onSourceTypeSelect(count!, compressed, e.tapIndex!)
},
fail: (e) => {
let error = new MediaErrorImpl(1101001, UniError_ChooseVideo);
options.fail?.(error)
options.complete?.(error)
}
})
}
}
\ No newline at end of file
...@@ -343,7 +343,6 @@ function copyFile(fromFilePath : string, toFilePath : string) : boolean { ...@@ -343,7 +343,6 @@ function copyFile(fromFilePath : string, toFilePath : string) : boolean {
if (!fromFile.canRead()) { if (!fromFile.canRead()) {
return false; return false;
} }
fis = new FileInputStream(fromFile);
} }
if (fis == null) { if (fis == null) {
return false return false
...@@ -359,6 +358,7 @@ function copyFile(fromFilePath : string, toFilePath : string) : boolean { ...@@ -359,6 +358,7 @@ function copyFile(fromFilePath : string, toFilePath : string) : boolean {
toFile.createNewFile() toFile.createNewFile()
} }
try { try {
// let fis = new FileInputStream(fromFile)
let fos = new FileOutputStream(toFile) let fos = new FileOutputStream(toFile)
let byteArrays = ByteArray(1024) let byteArrays = ByteArray(1024)
var c = fis!!.read(byteArrays) var c = fis!!.read(byteArrays)
...@@ -592,21 +592,6 @@ export const getVideoInfo : GetVideoInfo = function (options : GetVideoInfoOptio ...@@ -592,21 +592,6 @@ export const getVideoInfo : GetVideoInfo = function (options : GetVideoInfoOptio
export const saveVideoToPhotosAlbum : SaveVideoToPhotosAlbum = function (options : SaveVideoToPhotosAlbumOptions) { export const saveVideoToPhotosAlbum : SaveVideoToPhotosAlbum = function (options : SaveVideoToPhotosAlbumOptions) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
let requestPermissionList : Array<string> = [Manifest.permission.WRITE_EXTERNAL_STORAGE];
UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, requestPermissionList, (a : boolean, b : string[]) => {
loadFile(options);
}, (a : boolean, b : string[]) => {
let error = new MediaErrorImpl(1101005, UniError_SaveVideoToPhotosAlbum);
options.fail?.(error);
options.complete?.(error);
})
} else {
loadFile(options);
}
}
function loadFile(options : SaveVideoToPhotosAlbumOptions) {
if (TextUtils.isEmpty(options.filePath)) { if (TextUtils.isEmpty(options.filePath)) {
let error = new MediaErrorImpl(1101003, UniError_SaveVideoToPhotosAlbum); let error = new MediaErrorImpl(1101003, UniError_SaveVideoToPhotosAlbum);
options.fail?.(error) options.fail?.(error)
......
...@@ -8,7 +8,7 @@ import { ...@@ -8,7 +8,7 @@ import {
MediaErrorImpl MediaErrorImpl
} from "../../unierror.uts" } from "../../unierror.uts"
import { getVideoMetadata } from "./MediaUtils.uts" import { getVideoMetadata } from "./MediaUtils.uts"
import { uniChooseImage, uniChooseVideo } from "./ChooseImageUtils.uts" import { uniChooseImage, uniChooseVideo } from "../../ChooseImageUtils.uts"
import { getUniActivity } from "io.dcloud.uts.android"; import { getUniActivity } from "io.dcloud.uts.android";
import Intent from 'android.content.Intent'; import Intent from 'android.content.Intent';
import File from 'java.io.File'; import File from 'java.io.File';
......
...@@ -46,16 +46,18 @@ export function transcodeImage(options : CompressImageOptions) { ...@@ -46,16 +46,18 @@ export function transcodeImage(options : CompressImageOptions) {
var widthStr = "" var widthStr = ""
var heightStr = "" var heightStr = ""
if (options.compressedWidth != null) { if (options.compressedWidth != null) {
widthStr = options.compressedWidth.toString(); compressOption.width = options.compressedWidth!
} else { } else {
widthStr = TextUtils.isEmpty(options.width) ? "auto" : options.width! widthStr = TextUtils.isEmpty(options.width) ? "auto" : options.width!
} }
if (options.compressedHeight != null) { if (options.compressedHeight != null) {
heightStr = options.compressedHeight.toString(); compressOption.height = options.compressedHeight!
} else { } else {
heightStr = TextUtils.isEmpty(options.height) ? "auto" : options.height! heightStr = TextUtils.isEmpty(options.height) ? "auto" : options.height!
} }
getHeightAndWidth(compressOption, widthStr, heightStr); if (compressOption.width <= 0 || compressOption.height <= 0) {
getHeightAndWidth(compressOption, widthStr, heightStr)
}
let bitmapOptions = new BitmapFactory.Options() let bitmapOptions = new BitmapFactory.Options()
bitmapOptions.inJustDecodeBounds = false; bitmapOptions.inJustDecodeBounds = false;
if (srcFile.length() > 1500000) { if (srcFile.length() > 1500000) {
...@@ -173,7 +175,7 @@ function str2Float(valuestr : string, realValue : number, defValue : number) : n ...@@ -173,7 +175,7 @@ function str2Float(valuestr : string, realValue : number, defValue : number) : n
} }
valuestr = valuestr.toLowerCase() valuestr = valuestr.toLowerCase()
if (valuestr.endsWith("px")) { if (valuestr.endsWith("px")) {
valuestr = valuestr.substring(0, valuestr.length - 2); valuestr == valuestr.substring(0, valuestr.length - 2);
} }
try { try {
return Integer.parseInt(valuestr) return Integer.parseInt(valuestr)
...@@ -229,7 +231,8 @@ export function transcodeVideo(options : CompressVideoOptions) { ...@@ -229,7 +231,8 @@ export function transcodeVideo(options : CompressVideoOptions) {
} else if (resolution! > 1 || resolution! <= 0) { } else if (resolution! > 1 || resolution! <= 0) {
resolution = 1.0 resolution = 1.0
} }
let outPath = mediaCachePath + "compress_video_" + System.currentTimeMillis() + ".mp4"; let fileName = getFileName(inPath);
let outPath = mediaCachePath + (fileName == "" ? (System.currentTimeMillis() + ".mp4") : fileName)
let outFile = new File(outPath) let outFile = new File(outPath)
if (!outFile.getParentFile().exists()) { if (!outFile.getParentFile().exists()) {
outFile.getParentFile().mkdirs() outFile.getParentFile().mkdirs()
...@@ -238,6 +241,14 @@ export function transcodeVideo(options : CompressVideoOptions) { ...@@ -238,6 +241,14 @@ export function transcodeVideo(options : CompressVideoOptions) {
MediaTranscoder.getInstance().transcodeVideo(inPath, outPath, MediaFormatStrategyPresets.createAndroid720pStrategy(compressLevel, resolution!), new MediaTranscoderListener(inPath, outPath, options)) MediaTranscoder.getInstance().transcodeVideo(inPath, outPath, MediaFormatStrategyPresets.createAndroid720pStrategy(compressLevel, resolution!), new MediaTranscoderListener(inPath, outPath, options))
} }
function getFileName(path : string) : string {
const array = path.split("/")
if (array.length > 0) {
return array[array.length - 1]
}
return ""
}
class MediaTranscoderListener implements Listener { class MediaTranscoderListener implements Listener {
inPath : string inPath : string
outPath : string outPath : string
......
...@@ -28,10 +28,6 @@ ...@@ -28,10 +28,6 @@
<data> <data>
nghJYGVbKFhvAi/+2XYvdy408is= nghJYGVbKFhvAi/+2XYvdy408is=
</data> </data>
<key>PrivacyInfo.xcprivacy</key>
<data>
L50owgIQfV6zTzg7T11NlSDYSZU=
</data>
</dict> </dict>
<key>files2</key> <key>files2</key>
<dict> <dict>
...@@ -90,17 +86,6 @@ ...@@ -90,17 +86,6 @@
M9nMA2y1DqhJFLOymGCa66mNVw5qDN8J1QzcxQD3H/w= M9nMA2y1DqhJFLOymGCa66mNVw5qDN8J1QzcxQD3H/w=
</data> </data>
</dict> </dict>
<key>PrivacyInfo.xcprivacy</key>
<dict>
<key>hash</key>
<data>
L50owgIQfV6zTzg7T11NlSDYSZU=
</data>
<key>hash2</key>
<data>
NOpzMYrYXZEAI4Xdo9XJX+tflymAvdW2UHdZwen1+iU=
</data>
</dict>
</dict> </dict>
<key>rules</key> <key>rules</key>
<dict> <dict>
......
...@@ -3,14 +3,12 @@ import { ...@@ -3,14 +3,12 @@ import {
PreviewImageOptions, PreviewImage, PreviewImageSuccess, PreviewImageOptions, PreviewImage, PreviewImageSuccess,
ClosePreviewImage, ClosePreviewImageSuccess, ClosePreviewImageOptions, ClosePreviewImage, ClosePreviewImageSuccess, ClosePreviewImageOptions,
SaveImageToPhotosAlbum, SaveImageToPhotosAlbumOptions, SaveImageToPhotosAlbumSuccess, SaveImageToPhotosAlbum, SaveImageToPhotosAlbumOptions, SaveImageToPhotosAlbumSuccess,
ChooseVideo, ChooseVideoOptions,
SaveVideoToPhotosAlbum, SaveVideoToPhotosAlbumOptions, SaveVideoToPhotosAlbumSuccess, ChooseVideoSuccess,
} from "../interface.uts"; } from "../interface.uts";
import { import {
UniError_ChooseImage, UniError_SaveImageToPhotosAlbum, UniError_ChooseImage, UniError_SaveImageToPhotosAlbum,
MediaErrorImpl,UniError_PreviewImage, UniError_ChooseVideo, UniError_SaveVideoToPhotosAlbum MediaErrorImpl,UniError_PreviewImage
} from "../unierror.uts" } from "../unierror.uts"
import { uniChooseImage, uniChooseVideo } from "./ChooseImageUtils.uts"; import { uniChooseImage, uniChooseVideo } from "../ChooseImageUtils.uts";
import { UTSiOS } from "DCloudUTSFoundation"; import { UTSiOS } from "DCloudUTSFoundation";
import { NSFileManager } from "Foundation"; import { NSFileManager } from "Foundation";
...@@ -25,7 +23,7 @@ export const chooseImage : ChooseImage = function (option : ChooseImageOptions) ...@@ -25,7 +23,7 @@ export const chooseImage : ChooseImage = function (option : ChooseImageOptions)
if (index == 0) { if (index == 0) {
requestCameraPermission(function (status : number) { requestCameraPermission(function (status : number) {
if (status == 1) { if (status == 1) {
mediaPicker.openCameraForImage(option) mediaPicker.openCameraForImage(option, compressed)
} else { } else {
let error = new MediaErrorImpl(1101005, UniError_ChooseImage); let error = new MediaErrorImpl(1101005, UniError_ChooseImage);
option.fail?.(error) option.fail?.(error)
...@@ -36,7 +34,7 @@ export const chooseImage : ChooseImage = function (option : ChooseImageOptions) ...@@ -36,7 +34,7 @@ export const chooseImage : ChooseImage = function (option : ChooseImageOptions)
} else if (index == 1) { } else if (index == 1) {
requestAlbumPermission("readWrite", function (status : number) { requestAlbumPermission("readWrite", function (status : number) {
if (status == 1) { if (status == 1) {
mediaPicker.openAlbumForImage(option, count) mediaPicker.openAlbumForImage(option, count, 101)
} else { } else {
let error = new MediaErrorImpl(1101005, UniError_ChooseImage); let error = new MediaErrorImpl(1101005, UniError_ChooseImage);
option.fail?.(error) option.fail?.(error)
...@@ -47,56 +45,14 @@ export const chooseImage : ChooseImage = function (option : ChooseImageOptions) ...@@ -47,56 +45,14 @@ export const chooseImage : ChooseImage = function (option : ChooseImageOptions)
}); });
} }
export const chooseVideo : ChooseVideo = function (option : ChooseVideoOptions) {
uniChooseVideo(option, (count : number, compressed : boolean, index : number) => {
if (index == 0) {
requestCameraPermission(function (status : number) {
if (status == 1) {
requestMicrophonePermission(function (status : number){
if (status == 1) {
mediaPicker.openCameraForVideo(option)
}else{
let error = new MediaErrorImpl(1101005, UniError_ChooseVideo);
option.fail?.(error)
option.complete?.(error)
}
})
} else {
let error = new MediaErrorImpl(1101005, UniError_ChooseVideo);
option.fail?.(error)
option.complete?.(error)
}
})
} else if (index == 1) {
requestAlbumPermission("readWrite", function (status : number) {
if (status == 1) {
mediaPicker.openAlbumForVideo(option)
} else {
let error = new MediaErrorImpl(1101005, UniError_ChooseVideo);
option.fail?.(error)
option.complete?.(error)
}
})
}
})
}
class DCUniMediaPicker { class DCUniMediaPicker {
private mediaAlbum : DCloudMediaAlbum = new DCloudMediaAlbum(); private mediaAlbum : DCloudMediaAlbum = new DCloudMediaAlbum();
private mediaCamera : DCloudMediaCamera = new DCloudMediaCamera(); private mediaCamera : DCloudMediaCamera = new DCloudMediaCamera();
openAlbumForImage(option : ChooseImageOptions, count : number){ openAlbumForImage(option : ChooseImageOptions, count : number, type : number){
this.chooseImageWithAlbum(option,count); this.chooseImageWithAlbum(option,count,type);
}
openAlbumForVideo(option : ChooseVideoOptions){
this.chooseVideoWithAlbum(option);
}
openCameraForVideo(option : ChooseVideoOptions){
this.chooseVideoWithCamera(option);
} }
openCameraForImage(option : ChooseImageOptions){ openCameraForImage(option : ChooseImageOptions, compressed : boolean){
this.chooseImageWithCamera(option); this.chooseImageWithCamera(option,compressed);
} }
preview(options : PreviewImageOptions){ preview(options : PreviewImageOptions){
this.previewImageWithOptions(options); this.previewImageWithOptions(options);
...@@ -104,44 +60,7 @@ class DCUniMediaPicker { ...@@ -104,44 +60,7 @@ class DCUniMediaPicker {
close(){ close(){
this.closePreview(); this.closePreview();
} }
private chooseImageWithAlbum(option : ChooseImageOptions, count : number, type : number){
private chooseVideoWithAlbum(option : ChooseVideoOptions){
const mediaCachePath = UTSiOS.getMediaCacheDir() + "/"
let fileManager = FileManager.default
if (fileManager.fileExists(atPath = mediaCachePath) == false) {
try {
UTSiOS.try(fileManager.createDirectory(atPath = mediaCachePath, withIntermediateDirectories = true, attributes = null))
} catch (e) {
console.log(e)
}
}
let options : Map<string, any> = new Map();
options.set('resolution', "high");
options.set('videoCompress', option.compressed);
options.set('filePath', mediaCachePath);
options.set('maximum', 1);
options.set('filter', "video");
DispatchQueue.main.async(execute = () : void => {
this.mediaAlbum.start(options, success = (response : Map<AnyHashable, any>) : void => {
const filePath : string = response.get('tempFilePath') as string
let success : ChooseVideoSuccess = {
tempFilePath: "file://" + filePath,
width: response.get('width'),
height: response.get('height'),
size: response.get('size'),
duration: response.get('duration'),
}
option.success?.(success)
option.complete?.(success)
}, fail = (code : number) : void => {
let mediaError = new MediaErrorImpl(code, UniError_ChooseVideo);
option.fail?.(mediaError)
option.complete?.(mediaError)
})
})
}
private chooseImageWithAlbum(option : ChooseImageOptions, count : number){
const mediaCachePath = UTSiOS.getMediaCacheDir() + "/" const mediaCachePath = UTSiOS.getMediaCacheDir() + "/"
let fileManager = FileManager.default let fileManager = FileManager.default
if (fileManager.fileExists(atPath = mediaCachePath) == false) { if (fileManager.fileExists(atPath = mediaCachePath) == false) {
...@@ -192,47 +111,7 @@ class DCUniMediaPicker { ...@@ -192,47 +111,7 @@ class DCUniMediaPicker {
}) })
} }
private chooseVideoWithCamera(option : ChooseVideoOptions){ private chooseImageWithCamera(option : ChooseImageOptions, compressed : boolean){
const mediaCachePath = UTSiOS.getMediaCacheDir() + "/"
const fileManager = FileManager.default
if (fileManager.fileExists(atPath = mediaCachePath) == false) {
try {
UTSiOS.try(fileManager.createDirectory(atPath = mediaCachePath, withIntermediateDirectories = true, attributes = null))
} catch (e) {
console.log(e)
}
}
const currentTime = Int(Date().timeIntervalSince1970)
const cameraPath = (mediaCachePath + currentTime.toString() + ".mp4")
let options : Map<string, any> = new Map();
options.set('resolution', "high");
options.set('videoCompress', option.compressed);
options.set('filePath', cameraPath);
options.set('type', "video");
options.set('videoMaximumDuration', 60);
DispatchQueue.main.async(execute = () : void => {
this.mediaCamera.start(options, success = (response : Map<AnyHashable, any>) : void => {
let success : ChooseVideoSuccess = {
tempFilePath: "file://" + cameraPath,
width: response.get('width'),
height: response.get('height'),
size: response.get('size'),
duration: response.get('duration'),
}
option.success?.(success)
option.complete?.(success)
}, fail = (code : number) : void => {
let mediaError = new MediaErrorImpl(code, UniError_ChooseVideo);
option.fail?.(mediaError)
option.complete?.(mediaError)
})
})
}
private chooseImageWithCamera(option : ChooseImageOptions){
const mediaCachePath = UTSiOS.getMediaCacheDir() + "/" const mediaCachePath = UTSiOS.getMediaCacheDir() + "/"
const fileManager = FileManager.default const fileManager = FileManager.default
if (fileManager.fileExists(atPath = mediaCachePath) == false) { if (fileManager.fileExists(atPath = mediaCachePath) == false) {
...@@ -250,7 +129,6 @@ class DCUniMediaPicker { ...@@ -250,7 +129,6 @@ class DCUniMediaPicker {
options.set('resolution', "high"); options.set('resolution', "high");
options.set('sizeType', option.sizeType); options.set('sizeType', option.sizeType);
options.set('filePath', cameraPath); options.set('filePath', cameraPath);
options.set('type', "image");
if (option.crop != null) { if (option.crop != null) {
let crop : Map<string, any> = new Map(); let crop : Map<string, any> = new Map();
if (option.crop!.width != nil) { if (option.crop!.width != nil) {
...@@ -318,23 +196,6 @@ class DCUniMediaPicker { ...@@ -318,23 +196,6 @@ class DCUniMediaPicker {
} }
} }
function requestMicrophonePermission(completion : (status : number) => void) {
let authorized = AVCaptureDevice.authorizationStatus(for= AVMediaType.audio)
if (authorized == AVAuthorizationStatus.authorized) {
completion(1)
} else if (authorized == AVAuthorizationStatus.notDetermined) {
AVCaptureDevice.requestAccess(for=AVMediaType.audio, completionHandler = (result : Bool) : void => {
if (result) {
completion(1)
} else {
completion(0)
}
})
} else {
completion(0)
}
}
function requestCameraPermission(completion : (status : number) => void) { function requestCameraPermission(completion : (status : number) => void) {
let cameraAuthorized = AVCaptureDevice.authorizationStatus(for=AVMediaType.video) let cameraAuthorized = AVCaptureDevice.authorizationStatus(for=AVMediaType.video)
...@@ -474,34 +335,3 @@ export const saveImageToPhotosAlbum : SaveImageToPhotosAlbum = function (options ...@@ -474,34 +335,3 @@ export const saveImageToPhotosAlbum : SaveImageToPhotosAlbum = function (options
} }
}) })
} }
\ No newline at end of file
export const saveVideoToPhotosAlbum : SaveVideoToPhotosAlbum = function (options : SaveVideoToPhotosAlbumOptions) {
const path = UTSiOS.getResourceAbsolutePath(options.filePath,null)
let url = new URL(string = path)
if (url == null) {
let error = new MediaErrorImpl(1101003, UniError_SaveVideoToPhotosAlbum);
options.fail?.(error)
options.complete?.(error)
return
}
requestAlbumPermission("addOnly", function (status : number) {
if (status == 1) {
try {
UTSiOS.try(PHPhotoLibrary.shared().performChangesAndWait(() : void => {
PHAssetCreationRequest.creationRequestForAssetFromVideo(atFileURL = url!)
}))
let success : SaveVideoToPhotosAlbumSuccess = {}
options.success?.(success)
options.complete?.(success)
} catch (e) {
let error = new MediaErrorImpl(1101006, UniError_SaveVideoToPhotosAlbum);
options.fail?.(error)
options.complete?.(error)
}
} else {
let error = new MediaErrorImpl(1101005, UniError_SaveVideoToPhotosAlbum);
options.fail?.(error)
options.complete?.(error)
}
})
}
\ No newline at end of file
...@@ -5,10 +5,8 @@ ...@@ -5,10 +5,8 @@
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>APP需要您的同意,才能使用摄像头,以便于相机拍摄</string> <string>APP需要您的同意,才能使用摄像头,以便于相机拍摄</string>
<key>NSPhotoLibraryAddUsageDescription</key> <key>NSPhotoLibraryAddUsageDescription</key>
<string>APP需要您的同意,才能访问相册,以便于保存图</string> <string>APP需要您的同意,才能访问相册,以便于保存图</string>
<key>NSPhotoLibraryUsageDescription</key> <key>NSPhotoLibraryUsageDescription</key>
<string>APP需要您的同意,才能访问相册,以便于图像选取</string> <string>APP需要您的同意,才能访问相册,以便于图片选取</string>
<key>NSMicrophoneUsageDescription</key>
<string>APP需要您的同意,才能使用麦克风,以便于录制音频</string>
</dict> </dict>
</plist> </plist>
\ No newline at end of file
...@@ -429,7 +429,6 @@ export type ChooseVideoOptions = { ...@@ -429,7 +429,6 @@ export type ChooseVideoOptions = {
/** /**
* 是否压缩所选的视频源文件,默认值为true,需要压缩 * 是否压缩所选的视频源文件,默认值为true,需要压缩
* @type boolean * @type boolean
* @default true
*/ */
compressed ?: boolean | null, compressed ?: boolean | null,
/** /**
......
import { Request, RequestOptions, RequestSuccess, RequestFail, RequestTask, UploadFileOptions, UploadFile, UploadTask, OnProgressUpdateResult, UploadFileSuccess, UploadFileProgressUpdateCallback, DownloadFileProgressUpdateCallback, DownloadFileOptions, OnProgressDownloadResult, DownloadFile, DownloadFileSuccess } from './interface'; import { Request, RequestOptions, RequestSuccess, RequestFail, RequestTask, UploadFileOptions, UploadFile, UploadTask, OnProgressUpdateResult, UploadFileSuccess, UploadFileProgressUpdateCallback, DownloadFileProgressUpdateCallback, DownloadFileOptions, OnProgressDownloadResult, DownloadFile ,DownloadFileSuccess} from './interface';
import { NetworkManager, NetworkRequestListener, NetworkUploadFileListener, NetworkDownloadFileListener } from './network/NetworkManager.uts' import { NetworkManager, NetworkRequestListener, NetworkUploadFileListener, NetworkDownloadFileListener } from './network/NetworkManager.uts'
import { Data, HTTPURLResponse, NSError, NSNumber, ComparisonResult, RunLoop, Thread } from 'Foundation'; import { Data, HTTPURLResponse, NSError, NSNumber, ComparisonResult, RunLoop, Thread } from 'Foundation';
import { StatusCode } from './network/StatusCode.uts'; import { StatusCode } from './network/StatusCode.uts';
import { RequestFailImpl, UploadFileFailImpl, DownloadFileFailImpl, getErrcode } from '../unierror'; import { RequestFailImpl, UploadFileFailImpl, DownloadFileFailImpl, getErrcode } from '../unierror';
class SimpleNetworkListener<T> extends NetworkRequestListener { class SimpleNetworkListener extends NetworkRequestListener {
private param : RequestOptions<T> | null = null; private param : RequestOptions | null = null;
private headers : Map<string, any> | null = null; private headers : Map<string, any> | null = null;
private received : number = 0; private received : number = 0;
private data : Data = new Data(); private data : Data = new Data();
constructor(param : RequestOptions<T>) { constructor(param : RequestOptions) {
this.param = param; this.param = param;
super(); super();
} }
...@@ -53,21 +53,12 @@ class SimpleNetworkListener<T> extends NetworkRequestListener { ...@@ -53,21 +53,12 @@ class SimpleNetworkListener<T> extends NetworkRequestListener {
result['data'] = this.parseData(this.data, strData, type); result['data'] = this.parseData(this.data, strData, type);
if (result['data'] == null) { let tmp : RequestSuccess = {
let failResult = new RequestFailImpl(getErrcode(100001)); data: result['data']!,
let fail = kParam?.fail;
let complete = kParam?.complete;
fail?.(failResult);
complete?.(failResult);
return
}
let tmp = new RequestSuccess<T>({
data: result['data']! as T,
statusCode: (new NSNumber(value = response.statusCode)), statusCode: (new NSNumber(value = response.statusCode)),
header: result['header'] ?? "", header: result['header'] ?? "",
cookies: this.parseCookie(this.headers) cookies: this.parseCookie(this.headers)
}) };
let success = kParam?.success; let success = kParam?.success;
let complete = kParam?.complete; let complete = kParam?.complete;
success?.(tmp); success?.(tmp);
...@@ -117,15 +108,13 @@ class SimpleNetworkListener<T> extends NetworkRequestListener { ...@@ -117,15 +108,13 @@ class SimpleNetworkListener<T> extends NetworkRequestListener {
return result; return result;
} }
private parseData(data : Data | null, dataStr : string | null, parseType : string | null) : any | null { private parseData(data : Data | null, dataStr : string | null, type : string | null) : any | null {
if (`${type(of = T.self)}` == "Any.Protocol" || `${type(of = T.self)}` == "Optional<Any>.Type") { if (type != null && type!.contains("json")) {
if (parseType != null && parseType!.contains("json")) {
if (dataStr == null || dataStr!.length == 0) { if (dataStr == null || dataStr!.length == 0) {
return {}; return {};
} }
return this.parseJson(dataStr!);
return JSON.parse(dataStr!); } else if (type == 'jsonp') {
} else if (parseType == 'jsonp') {
if (dataStr == null || dataStr!.length == 0) { if (dataStr == null || dataStr!.length == 0) {
return {}; return {};
} }
...@@ -136,7 +125,7 @@ class SimpleNetworkListener<T> extends NetworkRequestListener { ...@@ -136,7 +125,7 @@ class SimpleNetworkListener<T> extends NetworkRequestListener {
} }
start += 1; start += 1;
let tmp = dataStr!.slice(start, end); let tmp = dataStr!.slice(start, end);
return JSON.parse(tmp); return this.parseJson(tmp);
} else { } else {
//dataStr如果解码失败是空的时候,还需要继续尝试解码。极端情况,服务器不是utf8的,所以字符解码会出现乱码,所以特殊处理一下非utf8的字符。 //dataStr如果解码失败是空的时候,还需要继续尝试解码。极端情况,服务器不是utf8的,所以字符解码会出现乱码,所以特殊处理一下非utf8的字符。
if (data == null) { if (data == null) {
...@@ -152,22 +141,17 @@ class SimpleNetworkListener<T> extends NetworkRequestListener { ...@@ -152,22 +141,17 @@ class SimpleNetworkListener<T> extends NetworkRequestListener {
// } // }
// } // }
if (currentStr == null) {
currentStr = new String(data = data!, encoding = String.Encoding.utf8);
}
// utf8 如果失败了,就用ascii,虽然几率很小。
if (currentStr == null) { if (currentStr == null) {
currentStr = new String(data = data!, encoding = String.Encoding.ascii); currentStr = new String(data = data!, encoding = String.Encoding.ascii);
} }
return currentStr; return currentStr;
} }
} else {
if (dataStr == null || dataStr!.length == 0) {
return null;
}
return JSON.parse<T>(dataStr!)
} }
private parseJson(str : string) : any | null {
return JSON.parse(str);
} }
private parseCookie(header : Map<string, any> | null) : string[] { private parseCookie(header : Map<string, any> | null) : string[] {
...@@ -309,11 +293,11 @@ class DownloadNetworkListener implements NetworkDownloadFileListener { ...@@ -309,11 +293,11 @@ class DownloadNetworkListener implements NetworkDownloadFileListener {
} }
} }
onFinished(response : HTTPURLResponse, filePath : string) : void { onFinished(response : HTTPURLResponse, filePath: string) : void {
try { try {
let kParam = this.options; let kParam = this.options;
let tmp : DownloadFileSuccess = { let tmp : DownloadFileSuccess = {
tempFilePath: filePath, tempFilePath:filePath,
statusCode: response.statusCode statusCode: response.statusCode
}; };
let success = kParam?.success; let success = kParam?.success;
...@@ -351,15 +335,10 @@ class DownloadNetworkListener implements NetworkDownloadFileListener { ...@@ -351,15 +335,10 @@ class DownloadNetworkListener implements NetworkDownloadFileListener {
} }
// export const request : Request = (options : RequestOptions) : RequestTask => { export const request : Request = (options : RequestOptions) : RequestTask => {
// return NetworkManager.getInstance().request(options, new SimpleNetworkListener(options)); return NetworkManager.getInstance().request(options, new SimpleNetworkListener(options));
// }
export function request<T>(options : RequestOptions<T>, _t : T.Type) : RequestTask {
return NetworkManager.getInstance().request(options, new SimpleNetworkListener<T>(options));
} }
export const uploadFile : UploadFile = (options : UploadFileOptions) : UploadTask => { export const uploadFile : UploadFile = (options : UploadFileOptions) : UploadTask => {
return NetworkManager.getInstance().uploadFile(options, new UploadNetworkListener(options)); return NetworkManager.getInstance().uploadFile(options, new UploadNetworkListener(options));
} }
......
export type Request<T> = (param: RequestOptions<T>) => RequestTask; export type Request = (param: RequestOptions) => RequestTask;
/** /**
* 网络请求参数 * 网络请求参数
*/ */
export type RequestOptions<T> = { export type RequestOptions = {
/** /**
* 开发者服务器接口地址 * 开发者服务器接口地址
*/ */
...@@ -80,7 +80,7 @@ export type RequestOptions<T> = { ...@@ -80,7 +80,7 @@ export type RequestOptions<T> = {
* 网络请求成功回调。 * 网络请求成功回调。
* @defaultValue null * @defaultValue null
*/ */
success?: RequestSuccessCallback<T> | null, success?: RequestSuccessCallback | null,
/** /**
* 网络请求失败回调。 * 网络请求失败回调。
* @defaultValue null * @defaultValue null
...@@ -93,12 +93,12 @@ export type RequestOptions<T> = { ...@@ -93,12 +93,12 @@ export type RequestOptions<T> = {
complete?: RequestCompleteCallback | null complete?: RequestCompleteCallback | null
} }
export type RequestSuccess<T> = { export type RequestSuccess = {
/** /**
* 开发者服务器返回的数据 * 开发者服务器返回的数据
* @type {RequestDataOptions} * @type {RequestDataOptions}
*/ */
data: T | null, data: any | null,
/** /**
* 开发者服务器返回的 HTTP 状态码 * 开发者服务器返回的 HTTP 状态码
*/ */
...@@ -138,7 +138,7 @@ export type RequestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" ...@@ -138,7 +138,7 @@ export type RequestMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD"
export type RequestErrorCode = 5 | 1000 | 100001 | 100002 | 600003 | 600009 | 602001; export type RequestErrorCode = 5 | 1000 | 100001 | 100002 | 600003 | 600009 | 602001;
// export type RequestFail = UniError; export type RequestFail = UniError;
// /** // /**
// * 网络请求失败的错误回调参数 // * 网络请求失败的错误回调参数
// */ // */
...@@ -146,7 +146,8 @@ export type RequestErrorCode = 5 | 1000 | 100001 | 100002 | 600003 | 600009 | 60 ...@@ -146,7 +146,8 @@ export type RequestErrorCode = 5 | 1000 | 100001 | 100002 | 600003 | 600009 | 60
// errCode: RequestErrorCode // errCode: RequestErrorCode
// }; // };
export type RequestSuccessCallback<T> = (option: RequestSuccess<T>) => void;
export type RequestSuccessCallback = (option: RequestSuccess) => void;
export type RequestFailCallback = (option: RequestFail) => void; export type RequestFailCallback = (option: RequestFail) => void;
export type RequestCompleteCallback = (option: any) => void; export type RequestCompleteCallback = (option: any) => void;
...@@ -230,7 +231,7 @@ export type UploadFileSuccess = { ...@@ -230,7 +231,7 @@ export type UploadFileSuccess = {
statusCode: number statusCode: number
}; };
export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void; export type UploadFileSuccessCallback = (result: UploadFileSuccess) => void;
// export type UploadFileFail = UniError; export type UploadFileFail = UniError;
// /** // /**
// * 上传文件失败的错误回调参数 // * 上传文件失败的错误回调参数
// */ // */
...@@ -386,7 +387,7 @@ export type DownloadFileSuccess = { ...@@ -386,7 +387,7 @@ export type DownloadFileSuccess = {
statusCode: number statusCode: number
}; };
export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void; export type DownloadFileSuccessCallback = (result: DownloadFileSuccess) => void;
// export type DownloadFileFail = UniError; export type DownloadFileFail = UniError;
// /** // /**
// * 下载文件失败的错误回调参数 // * 下载文件失败的错误回调参数
// */ // */
...@@ -569,7 +570,7 @@ export interface Uni { ...@@ -569,7 +570,7 @@ export interface Uni {
}); });
``` ```
*/ */
request<T>(param: RequestOptions<T>): RequestTask; request: Request,
/** /**
* UploadFile() * UploadFile()
* @description * @description
...@@ -606,7 +607,7 @@ export interface Uni { ...@@ -606,7 +607,7 @@ export interface Uni {
}); });
``` ```
*/ */
uploadFile: UploadFile; uploadFile: UploadFile,
/** /**
* DownloadFile() * DownloadFile()
* @description * @description
...@@ -638,5 +639,5 @@ export interface Uni { ...@@ -638,5 +639,5 @@ export interface Uni {
}); });
``` ```
*/ */
downloadFile: DownloadFile; downloadFile: DownloadFile
} }
...@@ -60,7 +60,7 @@ class NetworkManager implements URLSessionDataDelegate { ...@@ -60,7 +60,7 @@ class NetworkManager implements URLSessionDataDelegate {
} }
public request<T>(param : RequestOptions<T>, listener : NetworkRequestListener) : RequestTask { public request(param : RequestOptions, listener : NetworkRequestListener) : RequestTask {
let request = this.createRequest(param); let request = this.createRequest(param);
if (request == null) { if (request == null) {
let error = new NSError(domain = "invalid URL", code = 600009); let error = new NSError(domain = "invalid URL", code = 600009);
...@@ -91,7 +91,7 @@ class NetworkManager implements URLSessionDataDelegate { ...@@ -91,7 +91,7 @@ class NetworkManager implements URLSessionDataDelegate {
} }
public createRequest<T>(param : RequestOptions<T>) : URLRequest | null { public createRequest(param : RequestOptions) : URLRequest | null {
let url = new URL(string = param.url); let url = new URL(string = param.url);
if (url == null) { if (url == null) {
return null return null
......
import PayTask from 'com.alipay.sdk.app.PayTask'; import PayTask from 'com.alipay.sdk.app.PayTask';
import string from 'android.R.string'; import string from 'android.R.string';
const defaultErrorCode : number = 700000 const defaultErrorCode : number = 700716
const errorCodeMap : Map<number, number> = new Map([ const errorCodeMap : Map<number, number> = new Map([
[8000, 700600], [8000, 700710],
[4000, 701100], [4000, 700711],
[5000, 701110], [5000, 700712],
[6001, 700601], [6001, 700713],
[6002, 700602], [6002, 700714],
[6004, 700603] [6004, 700715]
]) ])
export class Alipay { export class Alipay {
public requestPayment(options : RequestPaymentOptions) { public requestPayment(options : RequestPaymentOptions) {
......
import { UTSiOSHookProxy } from "DCloudUniappRuntime";
import { UIApplication } from "UIKit"
import { AlipaySDK } from "AlipaySDK"
import { URL, NSUserActivity, NSUserActivityTypeBrowsingWeb } from "Foundation"
const defaultErrorCode : number = 700716;
const errorCodeMap : Map<string, number> = new Map([
['8000', 700710],
['4000', 700711],
['5000', 700712],
['6001', 700713],
['6002', 700714],
['6004', 700715]
]);
export class Alipay implements UTSiOSHookProxy {
options ?: RequestPaymentOptions
// 通过 url scheme 方式唤起 app 时的回调函数。
applicationOpenURLOptions(app : UIApplication | null, url : URL, options : Map<UIApplication.OpenURLOptionsKey, any> | null = null) : boolean {
if (url.host == 'safepay') {
AlipaySDK.defaultService().processOrder(withPaymentResult = url, standbyCallback = (resultDic ?: Map<AnyHashable, any>) : void => {
this.handlePaymentResult(resultDic)
})
}
return true
}
// 当应用程序接收到与用户活动相关的数据时调用此方法,例如,当用户使用 Universal Link 唤起应用时。
applicationContinueUserActivityRestorationHandler(application : UIApplication | null, userActivity : NSUserActivity | null, restorationHandler : ((res : [any] | null) => void) | null = null) : boolean {
if (userActivity?.activityType == NSUserActivityTypeBrowsingWeb) {
AlipaySDK.defaultService().handleOpenUniversalLink(userActivity, standbyCallback = (resultDic ?: Map<AnyHashable, any>) : void => {
this.handlePaymentResult(resultDic)
})
}
return true
}
requestPayment(options : RequestPaymentOptions) {
this.options = options
AlipaySDK.defaultService().payOrder(options.orderInfo, fromScheme = "uniAlipay", fromUniversalLink = "", callback = (resultDic ?: Map<AnyHashable, any>) : void => {
this.handlePaymentResult(resultDic)
})
}
handlePaymentResult(resultDic ?: Map<AnyHashable, any>) {
let resultStatus : string = ''
if (resultDic == null) {
resultStatus = defaultErrorCode.toString()
} else {
resultStatus = resultDic!.get("resultStatus") as string
if (resultStatus == null) {
resultStatus = defaultErrorCode.toString()
}
}
if (resultStatus == "9000") {
let res : RequestPaymentSuccess = {
data: resultDic
}
this.options?.success?.(res)
this.options?.complete?.(res)
} else {
let code = errorCodeMap[resultStatus];
if (code == null) {
code = defaultErrorCode
}
let err = new RequestPaymentFailImpl(code!);
this.options?.fail?.(err)
this.options?.complete?.(err)
}
}
}
\ No newline at end of file
...@@ -7,10 +7,10 @@ import Bundle from 'android.os.Bundle' ...@@ -7,10 +7,10 @@ import Bundle from 'android.os.Bundle'
import WXAPIFactory from 'com.tencent.mm.opensdk.openapi.WXAPIFactory'; import WXAPIFactory from 'com.tencent.mm.opensdk.openapi.WXAPIFactory';
import {Wxpay} from './Wxpay'; import {Wxpay} from './Wxpay';
import R from 'uts.sdk.modules.uniPaymentWxpay.R'; import R from 'uts.sdk.modules.uniPaymentWxpay.R';
const defaultErrorCode : number = 700000 const defaultErrorCode : number = 700716
const errorCodeMap : Map<number, number> = new Map([ const errorCodeMap : Map<number, number> = new Map([
[-1, 701100], [-1, 700711],
[-2, 700601] [-2, 700713]
]) ])
export class WXPayEntryActivity extends Activity implements IWXAPIEventHandler { export class WXPayEntryActivity extends Activity implements IWXAPIEventHandler {
constructor() { constructor() {
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册