提交 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": {
...@@ -1802,26 +1781,4 @@ export interface Uni { ...@@ -1802,26 +1781,4 @@ export interface Uni {
* @uniVueVersion 2,3 //支持的vue版本 * @uniVueVersion 2,3 //支持的vue版本
*/ */
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'],
...@@ -24,12 +22,4 @@ export const FileSystemManagerUniErrors : Map<FileSystemManagerErrorCode, string ...@@ -24,12 +22,4 @@ export const FileSystemManagerUniErrors : Map<FileSystemManagerErrorCode, string
[1301111, 'brotli decompress fail'], [1301111, 'brotli decompress fail'],
[1302003, 'invalid flag'], [1302003, 'invalid flag'],
[1300009, 'bad file descriptor'] [1300009, 'bad file descriptor']
]); ]);
export class FileSystemManagerFailImpl extends UniError implements IFileSystemManagerFail { \ No newline at end of file
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,
/** /**
......
export type GetDeviceInfoOptions = { export type GetDeviceInfoOptions = {
/** /**
* @description 过滤字段的字符串数组,假如要获取指定字段,传入此数组。 * @description 过滤字段的字符串数组,假如要获取指定字段,传入此数组。
*/ */
filter: Array<string> filter: Array<string>
} }
export type GetDeviceInfoResult = { export type GetDeviceInfoResult = {
/** /**
* 设备品牌 * 设备品牌
* @deprecated 已废弃,仅为了向下兼容保留 */
* brand?: string
* @uniPlatform /**
* { * 设备品牌
* "app": { */
* "android": { deviceBrand?: string,
* "osVer": "5.0", /**
* "uniVer": "√", * 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变
* "unixVer": "3.9+" */
* }, deviceId?: string,
* "ios": { /**
* "osVer": "12.0", * 设备型号
* "uniVer": "√", */
* "unixVer": "4.11" model?: string,
* } /**
* }, * 设备型号
* "web": { */
* "uniVer": "x", deviceModel?: string,
* "unixVer": "x" /**
* } * 设备类型phone、pad、pc
* } */
*/ deviceType?: string,
brand?: string /**
/** * 设备方向 竖屏 portrait、横屏 landscape
* 设备品牌 */
* deviceOrientation?: string,
* @uniPlatform /**
* { * 设备像素比
* "app": { */
* "android": { devicePixelRatio?: string,
* "osVer": "5.0", /**
* "uniVer": "√", * 操作系统及版本
* "unixVer": "3.9+" */
* }, system?: string,
* "ios": { /**
* "osVer": "12.0", * 客户端平台
* "uniVer": "√", */
* "unixVer": "4.11" platform?: string,
* } /**
* }, * 是否root
* "web": { */
* "uniVer": "x", isRoot?: boolean,
* "unixVer": "x" /**
* } * 是否是模拟器
* } */
*/ isSimulator?: boolean,
deviceBrand?: string, /**
/** * adb是否开启
* 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变 *
* * @uniPlatform
* @uniPlatform * {
* { * "app": {
* "app": { * "android": {
* "android": { * "osVer": "5.0",
* "osVer": "5.0", * "uniVer": "x",
* "uniVer": "√", * "unixVer": "√"
* "unixVer": "3.9+" * },
* }, * "ios": {
* "ios": { * "osVer": "x",
* "osVer": "12.0", * "uniVer": "x",
* "uniVer": "√", * "unixVer": "x"
* "unixVer": "4.11" * }
* } * }
* }, * }
* "web": { */
* "uniVer": "√", isUSBDebugging?: boolean,
* "unixVer": "4.0" }
* }
* }
*/ /**
deviceId?: string, * @param [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
/** */
* 设备型号 export type GetDeviceInfo = (options?: GetDeviceInfoOptions | null) => GetDeviceInfoResult;
* @deprecated 已废弃,仅为了向下兼容保留
*
* @uniPlatform export interface Uni {
* { /**
* "app": { * GetDeviceInfo(Object object)
* "android": { * @description
* "osVer": "5.0", * 获取设备信息
* "uniVer": "√", * @param {GetDeviceInfoOptions} options [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
* "unixVer": "3.9+" * @return {object}
* }, * @tutorial https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html
* "ios": { * @uniPlatform
* "osVer": "12.0", * {
* "uniVer": "√", * "app": {
* "unixVer": "4.11" * "android": {
* } * "osVer": "5.0",
* }, * "uniVer": "√",
* "web": { * "unixVer": "3.9+"
* "uniVer": "√", * },
* "unixVer": "4.0" * "ios": {
* } * "osVer": "12.0",
* } * "uniVer": "√",
*/ * "unixVer": "4.11"
model?: string, * }
/** * },
* 设备型号 * "web": {
* * "uniVer": "√",
* @uniPlatform * "unixVer": "4.0"
* { * }
* "app": { * }
* "android": { * @example
* "osVer": "5.0", ```typescript
* "uniVer": "√", uni.getDeviceInfo({
* "unixVer": "3.9+" filter:[]
* }, })
* "ios": { ```
* "osVer": "12.0", */
* "uniVer": "√", getDeviceInfo(options?: GetDeviceInfoOptions | null): GetDeviceInfoResult;
* "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;
}
...@@ -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": {
......
...@@ -2,123 +2,27 @@ ...@@ -2,123 +2,27 @@
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": {
......
此差异已折叠。
...@@ -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';
......
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册