uni-auth 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-auth",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -19,7 +19,7 @@ export function hintOpenAuth(params = {}) {
19
19
  const { code, platform = 'android', content = '', isOpenAuth = false } = params || {}
20
20
  return new Promise((resolve, reject) => {
21
21
  uni.showModal({
22
- content: content,
22
+ content,
23
23
  showCancel: platform !== 'ios',
24
24
  cancelText: '拒绝',
25
25
  confirmText: platform === 'ios' ? '下一步' : '同意',
@@ -12,12 +12,11 @@ const type = ref('')
12
12
  const permissionListener = ref(null)
13
13
  const isPermissionAlertShow = ref(false)
14
14
  onMounted(() => {
15
- type.value = uni.getStorageSync('authCode') || ''
16
- uni.removeStorageSync('authCode')
17
- if (!type.value) return
18
15
  permissionListener.value = uni.createRequestPermissionListener()
19
16
  permissionListener.value.onConfirm((e) => {
20
- isPermissionAlertShow.value = true
17
+ type.value = uni.getStorageSync('authCode') || ''
18
+ uni.removeStorageSync('authCode')
19
+ if (type.value) isPermissionAlertShow.value = true
21
20
  })
22
21
  permissionListener.value.onComplete((e) => {
23
22
  isPermissionAlertShow.value = false
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { appAuth } from './util/app.js'
2
- import { wxAuth } from './util/wx.js'
2
+ // import { wxAuth } from './util/wx.js'
3
3
  export { default as AuthPop } from './components/AuthPop.vue'
4
4
 
5
5
  export async function ifUserAuth(code) {
package/src/util/app.js CHANGED
@@ -1,5 +1,18 @@
1
1
  import { hintOpenAuth, contentEnum } from '../common/index.js'
2
-
2
+ const APP = {
3
+ ios: {
4
+ 相册: 'albumAuthorized',
5
+ 相机: 'cameraAuthorized',
6
+ 麦克风: 'microphoneAuthorized',
7
+ },
8
+ android: {
9
+ 相册: 'android.permission.WRITE_EXTERNAL_STORAGE',
10
+ 相机: 'android.permission.WRITE_EXTERNAL_STORAGE',
11
+ 麦克风: 'android.permission.RECORD_AUDIO',
12
+ 设备信息: 'android.permission.READ_PHONE_STATE',
13
+ 电话: 'android.permission.CALL_PHONE',
14
+ },
15
+ }
3
16
  export function appAuth(code = '相册') {
4
17
  return new Promise((resolve, reject) => {
5
18
  const platform = uni.getSystemInfoSync().platform // ios/android