55 lines
1.8 KiB
Java
55 lines
1.8 KiB
Java
package com.franmontiel.persistentcookiejar;
|
|
|
|
import com.franmontiel.persistentcookiejar.cache.CookieCache;
|
|
import com.franmontiel.persistentcookiejar.cache.SetCookieCache;
|
|
import com.franmontiel.persistentcookiejar.persistence.CookiePersistor;
|
|
import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor;
|
|
import f0.n;
|
|
import f0.w;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
public class PersistentCookieJar implements ClearableCookieJar {
|
|
public CookieCache b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public CookiePersistor f2227c;
|
|
|
|
public PersistentCookieJar(CookieCache cookieCache, CookiePersistor cookiePersistor) {
|
|
this.b = cookieCache;
|
|
this.f2227c = cookiePersistor;
|
|
((SetCookieCache) cookieCache).addAll(((SharedPrefsCookiePersistor) cookiePersistor).c());
|
|
}
|
|
|
|
@Override // f0.p
|
|
public synchronized void a(w wVar, List<n> list) {
|
|
this.b.addAll(list);
|
|
CookiePersistor cookiePersistor = this.f2227c;
|
|
ArrayList arrayList = new ArrayList();
|
|
for (n nVar : list) {
|
|
if (nVar.m) {
|
|
arrayList.add(nVar);
|
|
}
|
|
}
|
|
cookiePersistor.a(arrayList);
|
|
}
|
|
|
|
@Override // f0.p
|
|
public synchronized List<n> b(w wVar) {
|
|
ArrayList arrayList;
|
|
ArrayList arrayList2 = new ArrayList();
|
|
arrayList = new ArrayList();
|
|
Iterator<n> it = this.b.iterator();
|
|
while (it.hasNext()) {
|
|
n next = it.next();
|
|
if (next.h < System.currentTimeMillis()) {
|
|
arrayList2.add(next);
|
|
it.remove();
|
|
} else if (next.a(wVar)) {
|
|
arrayList.add(next);
|
|
}
|
|
}
|
|
this.f2227c.removeAll(arrayList2);
|
|
return arrayList;
|
|
}
|
|
}
|