@ayden-fc2/riffle-bridge-web 1.0.6 → 1.0.7

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/index.d.mts CHANGED
@@ -412,8 +412,8 @@ declare class FileStorageController {
412
412
  private resolveUri;
413
413
  /**
414
414
  * 保存图片/视频到系统相册
415
- * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL
416
- * @param uri 文件 URI(支持 file://、local:// 或 http(s):// 路径)
415
+ * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL、data: base64 dataUrl
416
+ * @param uri 文件 URI(支持 file://、local://、http(s):// 或 data: base64)
417
417
  * @param albumName 相册名称(默认 'Riffle')
418
418
  */
419
419
  saveToGallery(uri: string, albumName?: string): Promise<{
package/dist/index.d.ts CHANGED
@@ -412,8 +412,8 @@ declare class FileStorageController {
412
412
  private resolveUri;
413
413
  /**
414
414
  * 保存图片/视频到系统相册
415
- * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL
416
- * @param uri 文件 URI(支持 file://、local:// 或 http(s):// 路径)
415
+ * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL、data: base64 dataUrl
416
+ * @param uri 文件 URI(支持 file://、local://、http(s):// 或 data: base64)
417
417
  * @param albumName 相册名称(默认 'Riffle')
418
418
  */
419
419
  saveToGallery(uri: string, albumName?: string): Promise<{
package/dist/index.js CHANGED
@@ -446,12 +446,15 @@ var FileStorageController = class {
446
446
  }
447
447
  /**
448
448
  * 保存图片/视频到系统相册
449
- * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL
450
- * @param uri 文件 URI(支持 file://、local:// 或 http(s):// 路径)
449
+ * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL、data: base64 dataUrl
450
+ * @param uri 文件 URI(支持 file://、local://、http(s):// 或 data: base64)
451
451
  * @param albumName 相册名称(默认 'Riffle')
452
452
  */
453
453
  async saveToGallery(uri, albumName = "Riffle") {
454
- const resolvedUri = await this.resolveUri(uri);
454
+ let resolvedUri = uri;
455
+ if (!uri.startsWith("data:")) {
456
+ resolvedUri = await this.resolveUri(uri);
457
+ }
455
458
  return this.core.send("fileStorage", "saveToGallery", {
456
459
  saveUri: resolvedUri,
457
460
  albumName
package/dist/index.mjs CHANGED
@@ -404,12 +404,15 @@ var FileStorageController = class {
404
404
  }
405
405
  /**
406
406
  * 保存图片/视频到系统相册
407
- * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL
408
- * @param uri 文件 URI(支持 file://、local:// 或 http(s):// 路径)
407
+ * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL、data: base64 dataUrl
408
+ * @param uri 文件 URI(支持 file://、local://、http(s):// 或 data: base64)
409
409
  * @param albumName 相册名称(默认 'Riffle')
410
410
  */
411
411
  async saveToGallery(uri, albumName = "Riffle") {
412
- const resolvedUri = await this.resolveUri(uri);
412
+ let resolvedUri = uri;
413
+ if (!uri.startsWith("data:")) {
414
+ resolvedUri = await this.resolveUri(uri);
415
+ }
413
416
  return this.core.send("fileStorage", "saveToGallery", {
414
417
  saveUri: resolvedUri,
415
418
  albumName
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ayden-fc2/riffle-bridge-web",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Riffle Bridge Web SDK - WebView 与 Native 通信桥接库",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -338,8 +338,8 @@ export class FileStorageController {
338
338
 
339
339
  /**
340
340
  * 保存图片/视频到系统相册
341
- * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL
342
- * @param uri 文件 URI(支持 file://、local:// 或 http(s):// 路径)
341
+ * 自动解析 URI:支持 file:// 真实路径、local:// 虚拟映射键、http(s):// 缓存 URL、data: base64 dataUrl
342
+ * @param uri 文件 URI(支持 file://、local://、http(s):// 或 data: base64)
343
343
  * @param albumName 相册名称(默认 'Riffle')
344
344
  */
345
345
  async saveToGallery(uri: string, albumName = 'Riffle'): Promise<{
@@ -352,8 +352,12 @@ export class FileStorageController {
352
352
  height?: number;
353
353
  duration?: number;
354
354
  }> {
355
- // 先解析为实际的 file:// 路径
356
- const resolvedUri = await this.resolveUri(uri);
355
+ // base64 dataUrl 直接透传给 native 处理
356
+ let resolvedUri = uri;
357
+ if (!uri.startsWith('data:')) {
358
+ // 非 base64 才需要解析为实际的 file:// 路径
359
+ resolvedUri = await this.resolveUri(uri);
360
+ }
357
361
 
358
362
  return this.core.send('fileStorage', 'saveToGallery', {
359
363
  saveUri: resolvedUri,