@onekeyfe/react-native-image 6.8.0-8 → 6.8.0-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.
@@ -8,3 +8,12 @@
8
8
  *** rewind();
9
9
  }
10
10
  -dontwarn com.bumptech.glide.load.resource.bitmap.VideoDecoder
11
+
12
+ # @onekeyfe/react-native-native-overlay draws toast icons through this registry
13
+ # by reflection (Class.forName + method name and arity), so R8 must keep the
14
+ # class name, the singleton field and these members unrenamed in app builds.
15
+ -keep class com.margelo.nitro.onekeyimage.OneKeyNamedSVG {
16
+ public static final com.margelo.nitro.onekeyimage.OneKeyNamedSVG INSTANCE;
17
+ public final void request(java.lang.Object, android.content.res.AssetManager, java.lang.String, java.lang.String, int, int, float, kotlin.jvm.functions.Function1);
18
+ public final void cancel(java.lang.Object);
19
+ }
@@ -525,24 +525,34 @@ final class OneKeyIconTests: XCTestCase {
525
525
  try? FileManager.default.removeItem(at: tempFile)
526
526
  }
527
527
  OneKeyNamedSVG.shared.resetStartupForTesting(fileURL: tempFile)
528
- OneKeyMainThreadDecode.resetForTesting()
529
-
530
- // Warm one raster to disk so diskRender and prewarm can replay it.
531
- let disk = SDImageCache(namespace: "onekey-named-svg-raster-v1")
532
- _ = try XCTUnwrap(resolve("DotVerSolid", color: "rgba(0,0,0,1)", width: 48, height: 48, scale: 2))
533
- eventually("Disk raster written for DotVerSolid 48x48") {
534
- OneKeyNamedSVG.shared.clearMemoryCacheForTesting()
535
- return OneKeyNamedSVG.shared.diskRender(
528
+ let rasterPath = try XCTUnwrap(
529
+ OneKeyNamedSVG.shared.rasterDiskCachePathForTesting(
536
530
  name: "DotVerSolid",
537
531
  color: "rgba(0,0,0,1)",
538
532
  width: 48,
539
533
  height: 48,
540
534
  scale: 2
541
- ) != nil
535
+ )
536
+ )
537
+ let rasterURL = URL(fileURLWithPath: rasterPath)
538
+ let fileManager = FileManager.default
539
+ if fileManager.fileExists(atPath: rasterPath) {
540
+ try fileManager.removeItem(at: rasterURL)
541
+ }
542
+ defer { try? fileManager.removeItem(at: rasterURL) }
543
+
544
+ // Poll for the worker's atomic write independently of the frame decode budget.
545
+ OneKeyNamedSVG.shared.clearMemoryCacheForTesting()
546
+ OneKeyMainThreadDecode.resetForTesting()
547
+ _ = try XCTUnwrap(resolve("DotVerSolid", color: "rgba(0,0,0,1)", width: 48, height: 48, scale: 2))
548
+ eventually("Disk raster written for DotVerSolid 48x48") {
549
+ fileManager.fileExists(atPath: rasterPath)
542
550
  }
543
- _ = disk
551
+ let originalRasterData = try Data(contentsOf: rasterURL)
544
552
 
545
- // 1. Synchronous callback on OneKeyNamedSVGBridge.request (BottomTabs path).
553
+ // 1. Synchronous callback from a disk hit on the BottomTabs bridge path.
554
+ OneKeyNamedSVG.shared.clearMemoryCacheForTesting()
555
+ OneKeyMainThreadDecode.resetForTesting()
546
556
  var syncCallbackFired = false
547
557
  let owner = NSObject()
548
558
  OneKeyNamedSVGBridge.request(
@@ -570,22 +580,8 @@ final class OneKeyIconTests: XCTestCase {
570
580
  scale: 2
571
581
  )
572
582
  )
573
- let rasterPath = try XCTUnwrap(
574
- OneKeyNamedSVG.shared.rasterDiskCachePathForTesting(
575
- name: "DotVerSolid",
576
- color: "rgba(0,0,0,1)",
577
- width: 48,
578
- height: 48,
579
- scale: 2
580
- )
581
- )
582
- let rasterURL = URL(fileURLWithPath: rasterPath)
583
- let originalRasterData = try Data(contentsOf: rasterURL)
584
583
  try Data(repeating: 0, count: OneKeyMainThreadDecode.maximumEncodedBytes + 1024)
585
584
  .write(to: rasterURL, options: .atomic)
586
- defer {
587
- try? originalRasterData.write(to: rasterURL, options: .atomic)
588
- }
589
585
  XCTAssertNil(
590
586
  OneKeyNamedSVG.shared.diskRender(
591
587
  name: "DotVerSolid",
@@ -595,7 +591,9 @@ final class OneKeyIconTests: XCTestCase {
595
591
  scale: 2
596
592
  )
597
593
  )
594
+ XCTAssertEqual(OneKeyMainThreadDecode.metricsSnapshot().limitRejections, 1)
598
595
  try originalRasterData.write(to: rasterURL, options: .atomic)
596
+ OneKeyMainThreadDecode.resetForTesting()
599
597
  XCTAssertNotNil(
600
598
  OneKeyNamedSVG.shared.diskRender(
601
599
  name: "DotVerSolid",
@@ -605,9 +603,7 @@ final class OneKeyIconTests: XCTestCase {
605
603
  scale: 2
606
604
  )
607
605
  )
608
- let decodeMetrics = OneKeyMainThreadDecode.metricsSnapshot()
609
- XCTAssertEqual(decodeMetrics.hits, 1)
610
- XCTAssertEqual(decodeMetrics.limitRejections, 1)
606
+ XCTAssertEqual(OneKeyMainThreadDecode.metricsSnapshot().hits, 1)
611
607
 
612
608
  // 2b. Synchronous diskRender must not wait on SDImageCache.ioQueue when a concurrent
613
609
  // write or cache cleanup is occupying ioQueue, and must handle removed files cleanly.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/react-native-image",
3
- "version": "6.8.0-8",
3
+ "version": "6.8.0-9",
4
4
  "description": "High-performance native image view for OneKey",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",