uni-auth 1.1.7 → 1.1.9

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.1.7",
3
+ "version": "1.1.9",
4
4
  "main": "src/index.js",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -1,22 +1,20 @@
1
1
  <template>
2
- <!-- #ifdef APP-PLUS -->
3
- <!-- #ifndef APP-IOS -->
2
+ <!-- #ifdef APP -->
4
3
  <view class="auth-pop" :style="{ marginTop: safeH }" v-if="isPermissionAlertShow">
5
4
  <view class="title">{{ type }}权限使用说明</view>
6
5
  <view class="msg">{{ contentEnum['android'][type] }}</view>
7
6
  </view>
8
7
  <!-- #endif -->
9
- <!-- #endif -->
10
8
  </template>
11
9
 
12
10
  <script setup>
13
- // #ifdef APP-PLUS
14
- // #ifndef APP-IOS
11
+ // #ifdef APP
15
12
  import { onMounted, onUnmounted, computed, ref } from 'vue'
16
13
  import { contentEnum, safeHeight } from '../common/index.js'
17
14
  const type = ref('')
18
15
  const permissionListener = ref(null)
19
16
  const isPermissionAlertShow = ref(false)
17
+ const systemInfo = ref(uni.getSystemInfoSync())
20
18
  const props = defineProps({
21
19
  top: {
22
20
  type: String,
@@ -24,15 +22,17 @@ const props = defineProps({
24
22
  },
25
23
  })
26
24
  onMounted(() => {
27
- permissionListener.value = uni.createRequestPermissionListener()
28
- permissionListener.value.onConfirm((e) => {
29
- type.value = uni.getStorageSync('authCode') || ''
30
- uni.removeStorageSync('authCode')
31
- if (type.value) isPermissionAlertShow.value = true
32
- })
33
- permissionListener.value.onComplete((e) => {
34
- isPermissionAlertShow.value = false
35
- })
25
+ if (systemInfo.value.platform !== 'ios') {
26
+ permissionListener.value = uni.createRequestPermissionListener()
27
+ permissionListener.value.onConfirm((e) => {
28
+ type.value = uni.getStorageSync('authCode') || ''
29
+ uni.removeStorageSync('authCode')
30
+ if (type.value) isPermissionAlertShow.value = true
31
+ })
32
+ permissionListener.value.onComplete((e) => {
33
+ isPermissionAlertShow.value = false
34
+ })
35
+ }
36
36
  })
37
37
  const safeH = computed(() => {
38
38
  if (props.top) return props.top + 'px'
@@ -40,10 +40,11 @@ const safeH = computed(() => {
40
40
  return statusBarHeight + menuButtonHeight + 20 + 'px'
41
41
  })
42
42
  onUnmounted(() => {
43
- permissionListener.value.stop()
43
+ if (systemInfo.value.platform !== 'ios') {
44
+ permissionListener.value.stop()
45
+ }
44
46
  })
45
47
  // #endif
46
- // #endif
47
48
  </script>
48
49
 
49
50
  <style scoped>