@ray-js/t-agent-ui-ray 0.2.7-beta.7 → 0.2.7-beta.8
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/dist/hooks/useAttachmentInput.js +36 -15
- package/package.json +2 -2
|
@@ -8,6 +8,7 @@ import { chooseImage, chooseVideo, uploadImage, uploadVideo } from '../utils/fil
|
|
|
8
8
|
import { generateId } from '@ray-js/t-agent';
|
|
9
9
|
import { useRenderOptions } from './context';
|
|
10
10
|
import { useTranslate } from './useTranslate';
|
|
11
|
+
import { authorize } from '../utils/ttt';
|
|
11
12
|
export function useAttachmentInput() {
|
|
12
13
|
let {
|
|
13
14
|
local
|
|
@@ -150,6 +151,15 @@ export function useAttachmentInput() {
|
|
|
150
151
|
if (!sourceType) {
|
|
151
152
|
return;
|
|
152
153
|
}
|
|
154
|
+
const result = await authorize({
|
|
155
|
+
scope: 'scope.writePhotosAlbum'
|
|
156
|
+
});
|
|
157
|
+
if (!result) {
|
|
158
|
+
ty.showToast({
|
|
159
|
+
title: t('t-agent.input.upload.source-type.album.require-permission')
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
153
163
|
file = await chooseImage(count, sourceType);
|
|
154
164
|
} catch (err) {
|
|
155
165
|
return;
|
|
@@ -157,30 +167,41 @@ export function useAttachmentInput() {
|
|
|
157
167
|
}
|
|
158
168
|
if (type === 'camera') {
|
|
159
169
|
try {
|
|
160
|
-
const allowUseCamera =
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
ty.showToast({
|
|
168
|
-
title: t('t-agent.input.upload.source-type.camera.require-permission'),
|
|
169
|
-
icon: 'none'
|
|
170
|
-
});
|
|
171
|
-
resolve(false);
|
|
172
|
-
}
|
|
170
|
+
const allowUseCamera = authorize({
|
|
171
|
+
scope: 'scope.camera'
|
|
172
|
+
});
|
|
173
|
+
if (!allowUseCamera) {
|
|
174
|
+
ty.showToast({
|
|
175
|
+
title: t('t-agent.input.upload.source-type.camera.require-permission'),
|
|
176
|
+
icon: 'none'
|
|
173
177
|
});
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const result = await authorize({
|
|
181
|
+
scope: 'scope.writePhotosAlbum'
|
|
174
182
|
});
|
|
175
|
-
if (
|
|
176
|
-
|
|
183
|
+
if (!result) {
|
|
184
|
+
ty.showToast({
|
|
185
|
+
title: t('t-agent.input.upload.source-type.album.require-permission')
|
|
186
|
+
});
|
|
187
|
+
return;
|
|
177
188
|
}
|
|
189
|
+
file = await chooseImage(count, 'camera');
|
|
178
190
|
} catch (err) {
|
|
179
191
|
return;
|
|
180
192
|
}
|
|
181
193
|
}
|
|
182
194
|
if (type === 'album') {
|
|
183
195
|
try {
|
|
196
|
+
const result = await authorize({
|
|
197
|
+
scope: 'scope.writePhotosAlbum'
|
|
198
|
+
});
|
|
199
|
+
if (!result) {
|
|
200
|
+
ty.showToast({
|
|
201
|
+
title: t('t-agent.input.upload.source-type.album.require-permission')
|
|
202
|
+
});
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
184
205
|
file = await chooseImage(count, 'album');
|
|
185
206
|
} catch (err) {
|
|
186
207
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/t-agent-ui-ray",
|
|
3
|
-
"version": "0.2.7-beta.
|
|
3
|
+
"version": "0.2.7-beta.8",
|
|
4
4
|
"author": "Tuya.inc",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"private": false,
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"@types/echarts": "^4.9.22",
|
|
41
41
|
"@types/markdown-it": "^14.1.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "31a0d88f88eddae8bfd802e4861c76cd02c07692"
|
|
44
44
|
}
|