import{a3 as e}from"./index-2PZN6pGH.js";var t;const o={get isIOS(){return"boolean"==typeof t?t:t="ios"===e().platform},requestIOS:function(e){return new Promise(((t,o)=>{switch(e){case"push":t(function(){var e=0,t=plus.ios.import("UIApplication"),o=t.sharedApplication();if(o.currentUserNotificationSettings){var s=o.currentUserNotificationSettings();0==s.plusGetAttribute("types")?(e=0,console.log("推送权限没有开启")):(e=1,console.log("已经开启推送功能!")),plus.ios.deleteObject(s)}else 0==o.enabledRemoteNotificationTypes()?(e=3,console.log("推送权限没有开启!")):(e=4,console.log("已经开启推送功能!"));return plus.ios.deleteObject(o),plus.ios.deleteObject(t),e}());break;case"location":t((s=0,i=plus.ios.import("CLLocationManager"),n=i.locationServicesEnabled(),r=i.authorizationStatus(),s=n?0===r?null:3===r||4===r?1:0:2,plus.ios.deleteObject(i),s));break;case"record":t(function(){var e=null,t=plus.ios.import("AVAudioSession"),o=t.sharedInstance().recordPermission();return console.log("permissionStatus:"+o),e=1970168948===o?null:1735552628===o?1:0,plus.ios.deleteObject(t),e}());break;case"camera":t(function(){var e=0,t=plus.ios.import("AVCaptureDevice"),o=t.authorizationStatusForMediaType("vide");return e=0===o?null:3==o?1:0,plus.ios.deleteObject(t),e}());break;case"album":t(function(){var e=0,t=plus.ios.import("PHPhotoLibrary"),o=t.authorizationStatus();return e=0===o?null:3==o?1:0,plus.ios.deleteObject(t),e}());break;case"contact":t(function(){var e=0,t=plus.ios.import("CNContactStore"),o=t.authorizationStatusForEntityType(0);return e=0===o?null:3==o?1:0,plus.ios.deleteObject(t),e}());break;case"calendar":t(function(){var e=null,t=plus.ios.import("EKEventStore");return 3==t.authorizationStatusForEntityType(0)?(e=1,console.log("日历权限已经开启")):console.log("日历权限没有开启"),plus.ios.deleteObject(t),e}());break;case"memo":t(function(){var e=null,t=plus.ios.import("EKEventStore");return 3==t.authorizationStatusForEntityType(1)?(e=1,console.log("备忘录权限已经开启")):console.log("备忘录权限没有开启"),plus.ios.deleteObject(t),e}());break;default:t(0)}var s,i,n,r}))},requestAndroid:function(e){return new Promise(((t,o)=>{plus.android.requestPermissions([e],(function(e){for(var o=0,s=0;s<e.granted.length;s++){var i=e.granted[s];console.log("已获取的权限："+i),o=1}for(s=0;s<e.deniedPresent.length;s++){var n=e.deniedPresent[s];console.log("拒绝本次申请的权限："+n),o=0}for(s=0;s<e.deniedAlways.length;s++){var r=e.deniedAlways[s];console.log("永久拒绝申请的权限："+r),o=-1}t(o)}),(function(e){console.log("result error: "+e.message),t({code:e.code,message:e.message})}))}))},gotoAppSetting:function(){if(o.isIOS){var e=plus.ios.import("UIApplication").sharedApplication(),t=plus.ios.import("NSURL"),s=t.URLWithString("app-settings:");e.openURL(s),plus.ios.deleteObject(s),plus.ios.deleteObject(t),plus.ios.deleteObject(e)}else{var i=plus.android.importClass("android.content.Intent"),n=plus.android.importClass("android.provider.Settings"),r=plus.android.importClass("android.net.Uri"),a=plus.android.runtimeMainActivity(),l=new i;l.setAction(n.ACTION_APPLICATION_DETAILS_SETTINGS);var u=r.fromParts("package",a.getPackageName(),null);l.setData(u),a.startActivity(l)}}},s=o;export{s as p};
