interface.uts 3.3 KB
Newer Older
DCloud-yyl's avatar
DCloud-yyl 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
export type GetDeviceInfoOptions = {
  /**
   * @description 过滤字段的字符串数组,假如要获取指定字段,传入此数组。
   */
  filter: Array<string>
}

export type GetDeviceInfoResult = {
  /**
   * 设备品牌
   */
  brand?: string
  /**
   * 设备品牌
   */
  deviceBrand?: string,
  /**
   * 设备 id 。由 uni-app 框架生成并存储,清空 Storage 会导致改变
   */
  deviceId?: string,
  /**
lizhongyi_'s avatar
lizhongyi_ 已提交
22
   * 设备型号
DCloud-yyl's avatar
DCloud-yyl 已提交
23 24 25
   */
  model?: string,
  /**
lizhongyi_'s avatar
lizhongyi_ 已提交
26
   * 设备型号
DCloud-yyl's avatar
DCloud-yyl 已提交
27 28 29
   */
  deviceModel?: string,
  /**
lizhongyi_'s avatar
lizhongyi_ 已提交
30
   * 设备类型phone、pad、pc
DCloud-yyl's avatar
DCloud-yyl 已提交
31 32 33
   */
  deviceType?: string,
  /**
lizhongyi_'s avatar
lizhongyi_ 已提交
34
   * 设备方向 竖屏 portrait、横屏 landscape
DCloud-yyl's avatar
DCloud-yyl 已提交
35 36 37
   */
  deviceOrientation?: string,
  /**
lizhongyi_'s avatar
lizhongyi_ 已提交
38
   * 设备像素比
DCloud-yyl's avatar
DCloud-yyl 已提交
39 40 41
   */
  devicePixelRatio?: string,
  /**
lizhongyi_'s avatar
lizhongyi_ 已提交
42
   * 操作系统及版本
DCloud-yyl's avatar
DCloud-yyl 已提交
43 44 45
   */
  system?: string,
  /**
lizhongyi_'s avatar
lizhongyi_ 已提交
46
   * 客户端平台
DCloud-yyl's avatar
DCloud-yyl 已提交
47 48 49 50
   */
  platform?: string,
  /**
   * oaid标识 Android专有
lizhongyi_'s avatar
lizhongyi_ 已提交
51
   *
DCloud-yyl's avatar
DCloud-yyl 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
   * @uniPlatform {
   *    "app": {
   *        "android": {
   *            "osVer": "5.0",
   *  		  	 "uniVer": "√",
   * 			 "unixVer": "√"
   *        },
   *        "ios": {
   *            "osVer": "9.0",
   *  		  	 "uniVer": "x",
   * 			 "unixVer": "x"
   *        }
   *    }
   * }
   */
  oaid?: string,
  /**
   * 是否root
   */
  isRoot?: boolean,
  /**
   * 是否是模拟器
   */
  isSimulator?: boolean,
  /**
   * adb是否开启
lizhongyi_'s avatar
lizhongyi_ 已提交
78
   *
DCloud-yyl's avatar
DCloud-yyl 已提交
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
   * @uniPlatform {
   *    "app": {
   *        "android": {
   *            "osVer": "5.0",
   *  		  	 "uniVer": "√",
   * 			 "unixVer": "√"
   *        },
   *        "ios": {
   *            "osVer": "9.0",
   *  		  	 "uniVer": "x",
   * 			 "unixVer": "x"
   *        }
   *    }
   * }
   */
  isUSBDebugging?: boolean,
  /**
   * idfa标识 iOS专有
lizhongyi_'s avatar
lizhongyi_ 已提交
97
   *
DCloud-yyl's avatar
DCloud-yyl 已提交
98 99 100 101 102 103 104 105 106 107
   * @uniPlatform {
   *    "app": {
   *        "android": {
   *            "osVer": "5.0",
   *  		  	 "uniVer": "x",
   * 			 "unixVer": "x"
   *        },
   *        "ios": {
   *            "osVer": "9.0",
   *  		  	 "uniVer": "√",
lizhongyi_'s avatar
lizhongyi_ 已提交
108
   * 			 "unixVer": "x"
DCloud-yyl's avatar
DCloud-yyl 已提交
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
   *        }
   *    }
   * }
   */
  idfa?: string,
  /**
   * 应用平台
   */
}


/**
 * @param [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
 */
export type GetDeviceInfo = (options?: GetDeviceInfoOptions | null) => GetDeviceInfoResult;


export interface Uni {
  /**
    * GetDeviceInfo(Object object)
lizhongyi_'s avatar
lizhongyi_ 已提交
129
    * @description
DCloud-yyl's avatar
DCloud-yyl 已提交
130 131 132 133 134 135 136 137 138 139 140 141 142 143
    * 获取设备信息
    * @param {GetDeviceInfoOptions} options [options=包含所有字段的过滤对象] 过滤的字段对象, 不传参数默认为获取全部字段。
    * @return {object}
    * @tutorial https://uniapp.dcloud.net.cn/api/system/getDeviceInfo.html
    * @uniPlatform {
    *    "app": {
    *        "android": {
    *            "osVer": "4.4",
    *  		  	 "uniVer": "√",
    * 			 "unixVer": "3.9+"
    *        },
    *        "ios": {
    *            "osVer": "9.0",
    *  		  	 "uniVer": "√",
lizhongyi_'s avatar
lizhongyi_ 已提交
144
    * 			 "unixVer": "x"
DCloud-yyl's avatar
DCloud-yyl 已提交
145 146 147 148 149 150 151 152 153 154 155 156
    *        }
    *    }
    * }
    * @example
     ```typescript
      uni.getDeviceInfo({
        filter:[]
      })
     ```
    */
  getDeviceInfo(options?: GetDeviceInfoOptions | null): GetDeviceInfoResult;
}