@granite-js/image 1.0.10 → 1.0.12
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/CHANGELOG.md
CHANGED
|
@@ -198,7 +198,11 @@ __attribute__((used)) static void _forceIncludeGraniteImageComponentView(void) {
|
|
|
198
198
|
|
|
199
199
|
if (shouldReload) {
|
|
200
200
|
if (_currentUri.length > 0) {
|
|
201
|
-
|
|
201
|
+
// 다음 runloop으로 지연하여 _eventEmitter 세팅 후 실행
|
|
202
|
+
__weak GraniteImageComponentView *weakSelf = self;
|
|
203
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
204
|
+
[weakSelf loadImageWithProvider];
|
|
205
|
+
});
|
|
202
206
|
} else {
|
|
203
207
|
// URI가 비어있거나 nil인 경우 에러 발생
|
|
204
208
|
[self showErrorViewWithMessage:@"No URI provided"];
|
|
@@ -264,12 +268,14 @@ __attribute__((used)) static void _forceIncludeGraniteImageComponentView(void) {
|
|
|
264
268
|
if (!provider) {
|
|
265
269
|
[self showErrorViewWithMessage:@"No GraniteImageProvidable registered"];
|
|
266
270
|
[self emitOnError:@"No GraniteImageProvidable registered"];
|
|
271
|
+
[self emitOnLoadEnd];
|
|
267
272
|
return;
|
|
268
273
|
}
|
|
269
274
|
|
|
270
275
|
if (!_currentUri || _currentUri.length == 0) {
|
|
271
276
|
[self showErrorViewWithMessage:@"No URI provided"];
|
|
272
277
|
[self emitOnError:@"No URI provided"];
|
|
278
|
+
[self emitOnLoadEnd];
|
|
273
279
|
return;
|
|
274
280
|
}
|
|
275
281
|
|
|
@@ -94,14 +94,24 @@ class GraniteImageModule: NSObject {
|
|
|
94
94
|
@objc func clearMemoryCache(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
95
95
|
reject: @escaping RCTPromiseRejectBlock) {
|
|
96
96
|
NSLog("[GraniteImageModule] clearMemoryCache called")
|
|
97
|
-
|
|
97
|
+
if let provider = GraniteImageRegistry.shared.provider,
|
|
98
|
+
let clearMemory = provider.clearMemoryCache {
|
|
99
|
+
clearMemory()
|
|
100
|
+
} else {
|
|
101
|
+
URLCache.shared.removeAllCachedResponses()
|
|
102
|
+
}
|
|
98
103
|
resolve(nil)
|
|
99
104
|
}
|
|
100
105
|
|
|
101
106
|
@objc func clearDiskCache(_ resolve: @escaping RCTPromiseResolveBlock,
|
|
102
107
|
reject: @escaping RCTPromiseRejectBlock) {
|
|
103
108
|
NSLog("[GraniteImageModule] clearDiskCache called")
|
|
104
|
-
|
|
109
|
+
if let provider = GraniteImageRegistry.shared.provider,
|
|
110
|
+
let clearDisk = provider.clearDiskCache {
|
|
111
|
+
clearDisk()
|
|
112
|
+
} else {
|
|
113
|
+
URLCache.shared.removeAllCachedResponses()
|
|
114
|
+
}
|
|
105
115
|
resolve(nil)
|
|
106
116
|
}
|
|
107
117
|
}
|
|
@@ -67,4 +67,10 @@ public typealias GraniteImageCompletionBlock = (_ image: UIImage?, _ error: Erro
|
|
|
67
67
|
/// - tintColor: The color to apply
|
|
68
68
|
/// - view: The view to tint
|
|
69
69
|
@objc optional func applyTintColor(_ tintColor: UIColor, to view: UIView)
|
|
70
|
+
|
|
71
|
+
/// Clears the in-memory image cache
|
|
72
|
+
@objc optional func clearMemoryCache()
|
|
73
|
+
|
|
74
|
+
/// Clears the on-disk image cache
|
|
75
|
+
@objc optional func clearDiskCache()
|
|
70
76
|
}
|
package/package.json
CHANGED