fix: instantiate separate idCache for each PCloud instance

This commit is contained in:
Manuel Jenny 2021-03-23 15:07:46 +01:00
parent d3bb9d30aa
commit 6ccee05851
No known key found for this signature in database
GPG Key ID: 1C80FE62B2BEAA18
3 changed files with 8 additions and 10 deletions

View File

@ -28,8 +28,8 @@ class PCloudContentRepository extends InterceptingCloudContentRepository<PCloud,
private final PCloud cloud;
public PCloudContentRepository(PCloud cloud, Context context, PCloudIdCache idCache) {
super(new Intercepted(cloud, context, idCache));
public PCloudContentRepository(PCloud cloud, Context context) {
super(new Intercepted(cloud, context));
this.cloud = cloud;
}
@ -59,8 +59,8 @@ class PCloudContentRepository extends InterceptingCloudContentRepository<PCloud,
private final PCloudImpl cloud;
public Intercepted(PCloud cloud, Context context, PCloudIdCache idCache) {
this.cloud = new PCloudImpl(context, cloud, idCache);
public Intercepted(PCloud cloud, Context context) {
this.cloud = new PCloudImpl(context, cloud);
}
public PCloudFolder root(PCloud cloud) {

View File

@ -16,12 +16,10 @@ import static org.cryptomator.domain.CloudType.PCLOUD;
public class PCloudContentRepositoryFactory implements CloudContentRepositoryFactory {
private final Context context;
private final PCloudIdCache idCache;
@Inject
public PCloudContentRepositoryFactory(Context context, PCloudIdCache idCache) {
public PCloudContentRepositoryFactory(Context context) {
this.context = context;
this.idCache = idCache;
}
@Override
@ -31,7 +29,7 @@ public class PCloudContentRepositoryFactory implements CloudContentRepositoryFac
@Override
public CloudContentRepository cloudContentRepositoryFor(Cloud cloud) {
return new PCloudContentRepository((PCloud) cloud, context, idCache);
return new PCloudContentRepository((PCloud) cloud, context);
}
}

View File

@ -70,14 +70,14 @@ class PCloudImpl {
private final String UTF_8 = "UTF-8";
PCloudImpl(Context context, PCloud cloud, PCloudIdCache idCache) {
PCloudImpl(Context context, PCloud cloud) {
if (cloud.accessToken() == null) {
throw new NoAuthenticationProvidedException(cloud);
}
this.context = context;
this.cloud = cloud;
this.idCache = idCache;
this.idCache = new PCloudIdCache();
this.root = new RootPCloudFolder(cloud);
this.sharedPreferencesHandler = new SharedPreferencesHandler(context);
}