File tree Expand file tree Collapse file tree 4 files changed +24
-12
lines changed
packages/https/platforms/android
java/com/nativescript/https Expand file tree Collapse file tree 4 files changed +24
-12
lines changed Original file line number Diff line number Diff line change 1+ package com .nativescript .https ;
2+
3+ import okhttp3 .Cache ;
4+
5+ public class CacheUtils {
6+ public static void removeCachedResponse (String url , Cache cache ) {
7+ final Iterator <String > it = cache .urls ();
8+
9+ while (it .hasNext ()) {
10+ String cacheUrl = it .next ();
11+
12+ if (cacheUrl .equals (url )) {
13+ it .remove ();
14+ break ;
15+ }
16+ }
17+ }
18+ }
Original file line number Diff line number Diff line change 3030 " java.net:CookiePolicy" ,
3131 " com.nativescript.https:QuotePreservingCookieJar" ,
3232 " com.nativescript.https:CacheInterceptor" ,
33+ " com.nativescript.https:CacheUtils" ,
3334 " com.nativescript.https:OkHttpResponse" ,
3435 " java.util:Collections" ,
3536 " java.security.cert:CertificateFactory" ,
Original file line number Diff line number Diff line change @@ -52,18 +52,8 @@ export function clearCache() {
5252}
5353
5454export function removeCachedResponse ( url : string ) {
55- if ( ! cache ) {
56- return ;
57- }
58-
59- const iterator = cache . urls ( ) ;
60-
61- while ( iterator . hasNext ( ) ) {
62- const cacheUrl = iterator . next ( ) ;
63- if ( cacheUrl === url ) {
64- iterator . remove ( ) ;
65- break ;
66- }
55+ if ( cache ) {
56+ com . nativescript . https . CacheUtils . removeCachedResponse ( url , cache ) ;
6757 }
6858}
6959
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ declare namespace com {
77 export class CacheInterceptor {
88 public static INTERCEPTOR : okhttp3 . Interceptor ;
99 }
10+ export class CacheUtils {
11+ static removeCachedResponse ( url : string , cache : okhttp3 . Cache ) : void ;
12+ }
1013 export class OkHttpResponse {
1114 progressCallback : OkHttpResponse . OkHttpResponseProgressCallback ;
1215 closeCallback : OkHttpResponse . OkHttpResponseCloseCallback ;
You can’t perform that action at this time.
0 commit comments