index.uts 2.1 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 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
import { GetAppAuthorizeSetting, GetAppAuthorizeSettingResult } from "../interface.uts";
import { UTSiOS } from "DCloudUTSFoundation";
export const getAppAuthorizeSetting : GetAppAuthorizeSetting = function () : GetAppAuthorizeSettingResult {
	let setting : Map<string, any> = UTSiOS.getAppAuthorizeSetting();

	let result : GetAppAuthorizeSettingResult = {
		cameraAuthorized: "",
		locationAuthorized: "",
		locationAccuracy: null,
		microphoneAuthorized: "",
		notificationAuthorized: "",
		albumAuthorized: "",
		bluetoothAuthorized: "",
		locationReducedAccuracy: false,
		notificationAlertAuthorized: null,
		notificationBadgeAuthorized: null,
		notificationSoundAuthorized: null,
		phoneCalendarAuthorized: null
	}
	if (setting.has("cameraAuthorized")) {
		result.cameraAuthorized = setting.get("cameraAuthorized") as string;
	}
	if (setting.has("locationAuthorized")) {
		result.locationAuthorized = setting.get("locationAuthorized") as string;
	}
	if (setting.has("locationAccuracy")) {
		result.locationAccuracy = setting.get("locationAccuracy") as string;
	}
	if (setting.has("microphoneAuthorized")) {
		result.microphoneAuthorized = setting.get("microphoneAuthorized") as string;
	}
	if (setting.has("notificationAuthorized")) {
		result.notificationAuthorized = setting.get("notificationAuthorized") as string;
	}
	if (setting.has("albumAuthorized")) {
		result.albumAuthorized = setting.get("albumAuthorized") as string;
	}
	if (setting.has("bluetoothAuthorized")) {
		result.bluetoothAuthorized = setting.get("bluetoothAuthorized") as string;
	}
	if (setting.has("locationReducedAccuracy")) {
		result.locationReducedAccuracy = setting.get("locationReducedAccuracy") as boolean;
	}
	if (setting.has("notificationAlertAuthorized")) {
		result.notificationAlertAuthorized = setting.get("notificationAlertAuthorized") as string;
	}
	if (setting.has("notificationBadgeAuthorized")) {
		result.notificationBadgeAuthorized = setting.get("notificationBadgeAuthorized") as string;
	}
	if (setting.has("notificationSoundAuthorized")) {
		result.notificationSoundAuthorized = setting.get("notificationSoundAuthorized") as string;
	}

	return result
}