12
12
using System . Net . Http ;
13
13
using System . Threading . Tasks ;
14
14
using Foundation ;
15
- using Microsoft . Extensions . Caching . Memory ;
16
15
using Notifo . SDK . Extensions ;
17
16
using Notifo . SDK . Resources ;
18
17
using Serilog ;
@@ -23,7 +22,6 @@ namespace Notifo.SDK.NotifoMobilePush
23
22
{
24
23
internal partial class NotifoMobilePushImplementation : NSObject
25
24
{
26
- private readonly IMemoryCache imageCache = new MemoryCache ( new MemoryCacheOptions ( ) ) ;
27
25
private HttpClient httpClient ;
28
26
private INotificationHandler ? notificationHandler ;
29
27
@@ -300,15 +298,14 @@ public void DidReceiveNotificationResponse(UNNotificationResponse response)
300
298
{
301
299
try
302
300
{
303
- // TODO: Not really sure if the dictionary provides any value at all.
304
- if ( imageCache . TryGetValue ( imageUrl , out string imagePath ) && File . Exists ( imagePath ) )
301
+ // Use the base64 value of the URL.
302
+ var imagePath = Path . Combine ( FileSystem . CacheDirectory , imageUrl . ToBase64 ( ) ) ;
303
+
304
+ if ( File . Exists ( imagePath ) )
305
305
{
306
306
return imagePath ;
307
307
}
308
308
309
- // Use the base64 value of the URL.
310
- imagePath = Path . Combine ( FileSystem . CacheDirectory , imageUrl . ToBase64 ( ) ) ;
311
-
312
309
// Copy directly from the web stream to the image stream to reduce memory allocations.
313
310
using ( var fileStream = new FileStream ( imagePath , FileMode . Open ) )
314
311
{
@@ -318,8 +315,6 @@ public void DidReceiveNotificationResponse(UNNotificationResponse response)
318
315
}
319
316
}
320
317
321
- imageCache . Set ( imageUrl , imagePath ) ;
322
-
323
318
return imagePath ;
324
319
}
325
320
catch ( Exception ex )
0 commit comments