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

同步代码@HBuilderX4.15-补充

上级 a737b84f
......@@ -61,14 +61,12 @@ export interface Uni {
* "android": {
* "osVer": "5.0",
* "uniVer": "3.8.15",
* "unixVer": "3.9.0",
* "utsPlugin": "3.9.0"
* "unixVer": "3.9.0"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x",
* "utsPlugin": "x"
* "unixVer": "x"
* }
* },
* "web": {
......
......@@ -37,7 +37,7 @@
"getFileSystemManager": {
"name": "getFileSystemManager",
"app": {
"js": true,
"js": false,
"kotlin": true,
"swift": false
}
......
import File from 'java.io.File'
import ParcelFileDescriptor from 'android.os.ParcelFileDescriptor'
import { OpenFileOptions, OpenFileSuccessResult, OpenFileSyncOptions } from '../interface';
import { UniErrorSubject,FileSystemManagerFailImpl,FileSystemManagerUniErrors } from '../unierror';
import { UniErrorSubject, UniErrors } from '../unierror';
export class FileDescriptorUtil {
public openMap : Map<string, File> = new Map()
......@@ -28,12 +28,12 @@ export class FileDescriptorUtil {
case 'ax': //类似于 'a',但如果路径存在,则失败
{
if (file.exists()) {
let err = new FileSystemManagerFailImpl(1301005);
let err = new UniError(UniErrorSubject, 1301005, UniErrors.get(1301005)!);
options.fail?.(err)
options.complete?.(err)
} else {
if (file.parentFile?.exists() == false) {
let err = new FileSystemManagerFailImpl(1300002);
let err = new UniError(UniErrorSubject, 1300002, UniErrors.get(1300002)!);
options.fail?.(err)
options.complete?.(err)
return
......@@ -66,7 +66,7 @@ export class FileDescriptorUtil {
case 'ax+': //类似于 'a+',但如果路径存在,则失败
{
if (file.exists()) {
let err = new FileSystemManagerFailImpl(1301005);
let err = new UniError(UniErrorSubject, 1301005, UniErrors.get(1301005)!);
options.fail?.(err)
options.complete?.(err)
} else {
......@@ -84,7 +84,7 @@ export class FileDescriptorUtil {
case 'r': //打开文件用于读取。 如果文件不存在,则会发生异常
{
if (!file.exists()) {
let err = new FileSystemManagerFailImpl(1300002);
let err = new UniError(UniErrorSubject, 1300002, UniErrors.get(1300002)!);
options.fail?.(err)
options.complete?.(err)
} else {
......@@ -104,7 +104,7 @@ export class FileDescriptorUtil {
case 'r+': //打开文件用于读取和写入。 如果文件不存在,则会发生异常
{
if (!file.exists()) {
let err = new FileSystemManagerFailImpl(1300002);
let err = new UniError(UniErrorSubject, 1300002, UniErrors.get(1300002)!);
options.fail?.(err)
options.complete?.(err)
} else {
......@@ -136,7 +136,7 @@ export class FileDescriptorUtil {
case 'wx'://类似于 'w',但如果路径存在,则失败
{
if (file.exists()) {
let err = new FileSystemManagerFailImpl(1301005);
let err = new UniError(UniErrorSubject, 1301005, UniErrors.get(1301005)!);
options.fail?.(err)
options.complete?.(err)
} else {
......@@ -168,7 +168,7 @@ export class FileDescriptorUtil {
case 'wx+': // 类似于 'w+',但如果路径存在,则失败
{
if (file.exists()) {
let err = new FileSystemManagerFailImpl(1301005);
let err = new UniError(UniErrorSubject, 1301005, UniErrors.get(1301005)!);
options.fail?.(err)
options.complete?.(err)
} else {
......@@ -187,7 +187,7 @@ export class FileDescriptorUtil {
}
}
} catch (e) {
let err = new FileSystemManagerFailImpl(1300201);
let err = new UniError(UniErrorSubject, 1300201, UniErrors.get(1300201)! + ":" + e + " " + options.filePath);
options.fail?.(err)
options.complete?.(err)
}
......@@ -206,10 +206,10 @@ export class FileDescriptorUtil {
case 'ax': //类似于 'a',但如果路径存在,则失败
{
if (file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1301005]}`)
throw new Error(`${msgPrefix}${UniErrors[1301005]}`)
} else {
if (file.parentFile?.exists() == false) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1300002]}`)
throw new Error(`${msgPrefix}${UniErrors[1300002]}`)
} else {
file.createNewFile()
let fd = this.open_a(file)
......@@ -228,7 +228,7 @@ export class FileDescriptorUtil {
case 'ax+': //类似于 'a+',但如果路径存在,则失败
{
if (file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1301005]}`)
throw new Error(`${msgPrefix}${UniErrors[1301005]}`)
} else {
let fd = this.open_ax(file)
this.openMap.set(fd, file)
......@@ -238,7 +238,7 @@ export class FileDescriptorUtil {
case 'r': //打开文件用于读取。 如果文件不存在,则会发生异常
{
if (!file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1300002]}`)
throw new Error(`${msgPrefix}${UniErrors[1300002]}`)
} else {
let mode = ParcelFileDescriptor.MODE_READ_ONLY
let pfd = ParcelFileDescriptor.open(file, mode);
......@@ -251,7 +251,7 @@ export class FileDescriptorUtil {
case 'r+': //打开文件用于读取和写入。 如果文件不存在,则会发生异常
{
if (!file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1300002]}`)
throw new Error(`${msgPrefix}${UniErrors[1300002]}`)
} else {
let mode = ParcelFileDescriptor.MODE_READ_WRITE
let pfd = ParcelFileDescriptor.open(file, mode);
......@@ -270,7 +270,7 @@ export class FileDescriptorUtil {
case 'wx'://类似于 'w',但如果路径存在,则失败
{
if (file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1301005]}`)
throw new Error(`${msgPrefix}${UniErrors[1301005]}`)
} else {
let fd = this.open_w(file)
this.openMap.set(fd, file)
......@@ -289,7 +289,7 @@ export class FileDescriptorUtil {
case 'wx+': // 类似于 'w+',但如果路径存在,则失败
{
if (file.exists()) {
throw new Error(`${msgPrefix}${FileSystemManagerUniErrors[1301005]}`)
throw new Error(`${msgPrefix}${UniErrors[1301005]}`)
} else {
let mode = ParcelFileDescriptor.MODE_CREATE | ParcelFileDescriptor.MODE_READ_WRITE | ParcelFileDescriptor.MODE_TRUNCATE
let pfd = ParcelFileDescriptor.open(file, mode);
......
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 { 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 {
/**
......@@ -92,7 +93,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code)
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.path);
options.fail?.(err)
options.complete?.(err)
})
......@@ -102,7 +103,7 @@ class JsFileSystemManager implements FileSystemManager {
if(options.digestAlgorithm == null || options.digestAlgorithm == undefined){
options.digestAlgorithm = "md5"
} 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.complete?.(err)
return
......@@ -116,7 +117,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.filePath);
options.fail?.(err)
options.complete?.(err)
})
......@@ -135,7 +136,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)!);
options.fail?.(err)
options.complete?.(err)
})
......@@ -154,7 +155,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)!);
options.fail?.(err)
options.complete?.(err)
})
......@@ -172,7 +173,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.path);
options.fail?.(err)
options.complete?.(err)
})
......@@ -190,7 +191,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.dirPath);
options.fail?.(err)
options.complete?.(err)
})
......@@ -213,7 +214,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.dirPath);
options.fail?.(err)
options.complete?.(err)
})
......@@ -228,7 +229,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.dirPath);
options.fail?.(err)
options.complete?.(err)
})
......@@ -247,7 +248,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.filePath);
options.fail?.(err)
options.complete?.(err)
})
......@@ -265,7 +266,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.filePath);
options.fail?.(err)
options.complete?.(err)
})
......@@ -285,7 +286,7 @@ class JsFileSystemManager implements FileSystemManager {
options.complete?.(ret)
},
function (code) {
let err = new FileSystemManagerFailImpl(code);
let err = new UniError(UniErrorSubject, code, UniErrors.get(code)! + ":" + options.filePath);
options.fail?.(err)
options.complete?.(err)
})
......
......@@ -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 = {
*/
encoding : "base64" | "utf-8",
/**
* 文件路径,支持相对地址和绝对地址,app-android平台支持代码包文件目录
* 文件路径,支持相对地址和绝对地址
*/
filePath : string.URIString,
/**
......@@ -553,7 +553,7 @@ export type ReadCompressedFileResult = {
export type ReadCompressedFileCallback = (res : ReadCompressedFileResult) => void
export type ReadCompressedFileOptions = {
/**
* 要读取的文件的路径 (本地用户文件或代码包文件),app-android平台支持代码包文件目录
* 要读取的文件的路径 (本地用户文件或代码包文件)
*/
filePath : string.URIString,
/**
......@@ -779,7 +779,7 @@ export type ZipFileItem = {
export type ReadZipEntryCallback = (res : EntriesResult) => void
export type ReadZipEntryOptions = {
/**
* 要读取的压缩包的路径 (本地路径),app-android平台支持代码包文件目录
* 要读取的压缩包的路径 (本地路径)
*/
filePath : string.URIString,
/**
......@@ -829,8 +829,6 @@ export interface FileSystemManager {
readFile(options : ReadFileOptions) : void;
/**
* FileSystemManager.readFile 的同步版本参数
* @param 文件路径,支持相对地址和绝对地址,app-android平台支持代码包文件目录
* @param base64 / utf-8
* @uniPlatform {
* "app": {
* "android": {
......@@ -875,9 +873,6 @@ export interface FileSystemManager {
writeFile(options : WriteFileOptions) : void;
/**
* FileSystemManager.writeFile 的同步版本
* @param 文件路径,只支持绝对地址
* @param 写入的文本内容
* @param 指定写入文件的字符编码,支持:ascii base64 utf-8
* @uniPlatform {
* "app": {
* "android": {
......@@ -922,7 +917,6 @@ export interface FileSystemManager {
unlink(options : UnLinkOptions) : void;
/**
* FileSystemManager.unlink 的同步版本
* @param 文件路径,只支持绝对地址
* @uniPlatform {
* "app": {
* "android": {
......@@ -967,8 +961,6 @@ export interface FileSystemManager {
mkdir(options : MkDirOptions) : void;
/**
* FileSystemManager.mkdir 的同步版本
* @param 创建的目录路径 (本地路径)
* @param 是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
* @uniPlatform {
* "app": {
* "android": {
......@@ -1013,8 +1005,6 @@ export interface FileSystemManager {
rmdir(options : RmDirOptions) : void;
/**
* FileSystemManager.rmdir 的同步版本
* @param 要删除的目录路径 (本地路径)
* @param 是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
* @uniPlatform {
* "app": {
* "android": {
......@@ -1059,7 +1049,6 @@ export interface FileSystemManager {
readdir(options : ReadDirOptions) : void;
/**
* FileSystemManager.readdir 的同步版本
* @param 要读取的目录路径 (本地路径)
* @uniPlatform {
* "app": {
* "android": {
......@@ -1104,7 +1093,6 @@ export interface FileSystemManager {
access(options : AccessOptions) : void;
/**
* FileSystemManager.access 的同步版本
* @param 要删除的目录路径 (本地路径)
* @uniPlatform {
* "app": {
* "android": {
......@@ -1149,8 +1137,6 @@ export interface FileSystemManager {
rename(options : RenameOptions) : void;
/**
* FileSystemManager.rename 的同步版本
* @param 源文件路径,支持本地路径
* @param 新文件路径,支持本地路径
* @uniPlatform {
* "app": {
* "android": {
......@@ -1195,8 +1181,6 @@ export interface FileSystemManager {
copyFile(options : CopyFileOptions) : void;
/**
* FileSystemManager.copyFile 的同步版本
* @param 源文件路径,支持本地路径
* @param 新文件路径,支持本地路径
* @uniPlatform {
* "app": {
* "android": {
......@@ -1263,8 +1247,6 @@ export interface FileSystemManager {
stat(options : StatOptions) : void;
/**
* FileSystemManager.stat 的同步版本
* @param 文件/目录路径 (本地路径)
* @param 是否递归获取目录下的每个文件的 Stats 信息
* @uniPlatform {
* "app": {
* "android": {
......@@ -1309,9 +1291,6 @@ export interface FileSystemManager {
appendFile(options : AppendFileOptions) : void;
/**
* FileSystemManager.appendFile 的同步版本
* @param 要追加内容的文件路径 (本地路径)
* @param 要追加的文本
* @param 指定写入文件的字符编码支持:ascii base64 utf-8
* @uniPlatform {
* "app": {
* "android": {
......@@ -1802,26 +1781,4 @@ export interface Uni {
* @uniVueVersion 2,3 //支持的vue版本
*/
getFileSystemManager() : FileSystemManager
}
/**
* 错误码
* - 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
};
}
\ No newline at end of file
import { FileSystemManagerErrorCode,IFileSystemManagerFail } from "./interface.uts"
/**
* 错误主题
*/
export const FileSystemManagerUniErrorSubject = 'uni-fileSystemManager';
export const UniErrorSubject = 'uni-fileSystemManager';
/**
* 错误码
* @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'],
[1300002, 'no such file or directory'],
......@@ -24,12 +22,4 @@ export const FileSystemManagerUniErrors : Map<FileSystemManagerErrorCode, string
[1301111, 'brotli decompress fail'],
[1302003, 'invalid flag'],
[1300009, 'bad file descriptor']
]);
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
]);
\ No newline at end of file
......@@ -90,21 +90,6 @@ export type GetAppAuthorizeSettingResult = {
* - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 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'
* @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',
/**
......@@ -114,21 +99,6 @@ export type GetAppAuthorizeSettingResult = {
* - 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(定位)` 模块
* @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',
/**
......@@ -137,21 +107,6 @@ export type GetAppAuthorizeSettingResult = {
* - full: 精准定位
* - unsupported: 不支持(包括用户拒绝定位权限和没有在 `manifest.json -> App模块配置` 中配置 `Geolocation(定位)` 模块)
* @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,
/**
......@@ -181,21 +136,6 @@ export type GetAppAuthorizeSettingResult = {
* - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 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'
* @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',
/**
......@@ -205,21 +145,6 @@ export type GetAppAuthorizeSettingResult = {
* - not determined: 尚未请求授权,会在App下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
* - config error: Android平台没有该值;iOS平台:表示没有在 `manifest.json -> App模块配置` 中配置 `Push(推送)` 模块
* @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',
/**
......
......@@ -8,143 +8,31 @@ export type GetAppBaseInfoOptions = {
export type GetAppBaseInfoResult = {
/**
* 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,
/**
* `manifest.json` 中应用名称。
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/
appName?: string,
/**
* `manifest.json` 中应用版本名称。
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/
appVersion?: string,
/**
* `manifest.json` 中应用版本名号。
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/
appVersionCode?: string,
/**
* 应用设置的语言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,
/**
* 应用设置的语言
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/
language?: string,
/**
* 引擎版本号。已废弃,仅为了向下兼容保留
* @deprecated 已废弃,仅为了向下兼容保留
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/
version?: string,
/**
......@@ -317,48 +205,12 @@ export type GetAppBaseInfoResult = {
hostTheme?: string,
/**
* 是否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,
/**
* uni 编译器版本
* @deprecated 已废弃,仅为了向下兼容保留
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
*/
uniCompileVersion ?: string,
/**
......@@ -379,79 +231,23 @@ export type GetAppBaseInfoResult = {
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* "uniVer": "",
* "unixVer": "4.0"
* }
* }
*/
uniCompilerVersion ?: string,
/**
* 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',
/**
* 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,
/**
* uni 编译器版本号
* @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,
/**
......@@ -472,34 +268,14 @@ export type GetAppBaseInfoResult = {
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* "uniVer": "",
* "unixVer": "4.0"
* }
* }
*/
uniCompilerVersionCode?: number,
/**
* 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,
/**
......
export type GetDeviceInfoOptions = {
/**
* @description 过滤字段的字符串数组,假如要获取指定字段,传入此数组。
*/
filter: Array<string>
}
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
/**
* 设备品牌
*
* @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,
/**
* 设备 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,
/**
* 设备型号
* @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,
/**
* 设备型号
*
* @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,
/**
* 设备类型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,
/**
* 设备方向 竖屏 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,
/**
* 设备像素比
*
* @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,
/**
* 操作系统及版本
*
* @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,
/**
* 客户端平台
*
* @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,
/**
* 是否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,
/**
* 是否是模拟器
*
* @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,
/**
* adb是否开启
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "x",
* "unixVer": "√"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "x",
* "unixVer": "x"
* }
* }
*/
isUSBDebugging?: boolean,
}
/**
* @param [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
*/
export type GetDeviceInfo = (options?: GetDeviceInfoOptions | null) => GetDeviceInfoResult;
export interface Uni {
/**
* GetDeviceInfo(Object object)
* @description
* 获取设备信息
* @param {GetDeviceInfoOptions} options [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
* @return {object}
* @tutorial https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
* @example
```typescript
uni.getDeviceInfo({
filter:[]
})
```
*/
getDeviceInfo(options?: GetDeviceInfoOptions | null): GetDeviceInfoResult;
}
export type GetDeviceInfoOptions = {
/**
* @description 过滤字段的字符串数组,假如要获取指定字段,传入此数组。
*/
filter: Array<string>
}
export type GetDeviceInfoResult = {
/**
* 设备品牌
*/
brand?: string
/**
* 设备品牌
*/
deviceBrand?: string,
/**
* 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变
*/
deviceId?: string,
/**
* 设备型号
*/
model?: string,
/**
* 设备型号
*/
deviceModel?: string,
/**
* 设备类型phone、pad、pc
*/
deviceType?: string,
/**
* 设备方向 竖屏 portrait、横屏 landscape
*/
deviceOrientation?: string,
/**
* 设备像素比
*/
devicePixelRatio?: string,
/**
* 操作系统及版本
*/
system?: string,
/**
* 客户端平台
*/
platform?: string,
/**
* 是否root
*/
isRoot?: boolean,
/**
* 是否是模拟器
*/
isSimulator?: boolean,
/**
* adb是否开启
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "x",
* "unixVer": "√"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
*/
isUSBDebugging?: boolean,
}
/**
* @param [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
*/
export type GetDeviceInfo = (options?: GetDeviceInfoOptions | null) => GetDeviceInfoResult;
export interface Uni {
/**
* GetDeviceInfo(Object object)
* @description
* 获取设备信息
* @param {GetDeviceInfoOptions} options [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
* @return {object}
* @tutorial https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
* @example
```typescript
uni.getDeviceInfo({
filter:[]
})
```
*/
getDeviceInfo(options?: GetDeviceInfoOptions | null): GetDeviceInfoResult;
}
......@@ -22,16 +22,16 @@ export interface Uni {
* "unixVer": "3.9.0"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "",
* "unixVer": "4.11"
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* },
* "web": {
* "uniVer": "√",
* "unixVer": "4.0"
* }
* }
* }9999
*
*/
getLocation(options: GetLocationOptions):void;
......
......@@ -15,9 +15,9 @@ export interface Uni {
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "osVer": "9.0",
* "uniVer": "√",
* "unixVer": "4.11"
* "unixVer": "4.06"
* }
* },
* "web": {
......
......@@ -2,123 +2,27 @@
export type GetSystemSettingResult = {
/**
* 蓝牙是否开启
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
* 蓝牙是否开启
*/
bluetoothEnabled?: boolean,
/**
* 蓝牙的报错信息
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
* 蓝牙的报错信息
*/
bluetoothError?: string,
/**
* 位置是否开启
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
* 位置是否开启
*/
locationEnabled : boolean,
/**
* wifi是否开启
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
* wifi是否开启
*/
wifiEnabled?: boolean,
/**
* wifi的报错信息
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "x",
* "uniVer": "x",
* "unixVer": "x"
* }
* }
* }
* wifi的报错信息
*/
wifiError?: string,
/**
* 设备方向
*
* @uniPlatform
* {
* "app": {
* "android": {
* "osVer": "5.0",
* "uniVer": "√",
* "unixVer": "3.9+"
* },
* "ios": {
* "osVer": "12.0",
* "uniVer": "√",
* "unixVer": "4.11"
* }
* }
* }
* 设备方向
*/
deviceOrientation : 'portrait' | 'landscape',
}
......
......@@ -86,7 +86,7 @@
"app": {
"js": false,
"kotlin": true,
"swift": true
"swift": false
}
},
"saveVideoToPhotosAlbum": {
......@@ -94,7 +94,7 @@
"app": {
"js": false,
"kotlin": true,
"swift": true
"swift": false
}
},
"getVideoInfo": {
......
此差异已折叠。
......@@ -8,7 +8,7 @@ import {
MediaErrorImpl
} from "../../unierror.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 Intent from 'android.content.Intent';
import File from 'java.io.File';
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册