fix: rename PCloudCloud stuff to PCloud
This commit is contained in:
parent
f17df0e179
commit
d92e4b0daf
@ -5,7 +5,7 @@ import android.content.Context;
|
|||||||
import com.pcloud.sdk.ApiError;
|
import com.pcloud.sdk.ApiError;
|
||||||
|
|
||||||
import org.cryptomator.data.cloud.InterceptingCloudContentRepository;
|
import org.cryptomator.data.cloud.InterceptingCloudContentRepository;
|
||||||
import org.cryptomator.domain.PCloudCloud;
|
import org.cryptomator.domain.PCloud;
|
||||||
import org.cryptomator.domain.exception.BackendException;
|
import org.cryptomator.domain.exception.BackendException;
|
||||||
import org.cryptomator.domain.exception.CloudNodeAlreadyExistsException;
|
import org.cryptomator.domain.exception.CloudNodeAlreadyExistsException;
|
||||||
import org.cryptomator.domain.exception.FatalBackendException;
|
import org.cryptomator.domain.exception.FatalBackendException;
|
||||||
@ -26,11 +26,11 @@ import java.util.List;
|
|||||||
|
|
||||||
import static org.cryptomator.util.ExceptionUtil.contains;
|
import static org.cryptomator.util.ExceptionUtil.contains;
|
||||||
|
|
||||||
class PCloudCloudContentRepository extends InterceptingCloudContentRepository<PCloudCloud, PCloudNode, PCloudFolder, PCloudFile> {
|
class PCloudContentRepository extends InterceptingCloudContentRepository<PCloud, PCloudNode, PCloudFolder, PCloudFile> {
|
||||||
|
|
||||||
private final PCloudCloud cloud;
|
private final PCloud cloud;
|
||||||
|
|
||||||
public PCloudCloudContentRepository(PCloudCloud cloud, Context context, PCloudIdCache idCache) {
|
public PCloudContentRepository(PCloud cloud, Context context, PCloudIdCache idCache) {
|
||||||
super(new Intercepted(cloud, context, idCache));
|
super(new Intercepted(cloud, context, idCache));
|
||||||
this.cloud = cloud;
|
this.cloud = cloud;
|
||||||
}
|
}
|
||||||
@ -53,20 +53,20 @@ class PCloudCloudContentRepository extends InterceptingCloudContentRepository<PC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Intercepted implements CloudContentRepository<PCloudCloud, PCloudNode, PCloudFolder, PCloudFile> {
|
private static class Intercepted implements CloudContentRepository<PCloud, PCloudNode, PCloudFolder, PCloudFile> {
|
||||||
|
|
||||||
private final PCloudImpl cloud;
|
private final PCloudImpl cloud;
|
||||||
|
|
||||||
public Intercepted(PCloudCloud cloud, Context context, PCloudIdCache idCache) {
|
public Intercepted(PCloud cloud, Context context, PCloudIdCache idCache) {
|
||||||
this.cloud = new PCloudImpl(context, cloud, idCache);
|
this.cloud = new PCloudImpl(context, cloud, idCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCloudFolder root(PCloudCloud cloud) {
|
public PCloudFolder root(PCloud cloud) {
|
||||||
return this.cloud.root();
|
return this.cloud.root();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PCloudFolder resolve(PCloudCloud cloud, String path) {
|
public PCloudFolder resolve(PCloud cloud, String path) {
|
||||||
return this.cloud.resolve(path);
|
return this.cloud.resolve(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ class PCloudCloudContentRepository extends InterceptingCloudContentRepository<PC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String checkAuthenticationAndRetrieveCurrentAccount(PCloudCloud cloud) throws BackendException {
|
public String checkAuthenticationAndRetrieveCurrentAccount(PCloud cloud) throws BackendException {
|
||||||
try {
|
try {
|
||||||
return this.cloud.currentAccount();
|
return this.cloud.currentAccount();
|
||||||
} catch (ApiError | IOException e) {
|
} catch (ApiError | IOException e) {
|
||||||
@ -203,7 +203,7 @@ class PCloudCloudContentRepository extends InterceptingCloudContentRepository<PC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logout(PCloudCloud cloud) throws BackendException {
|
public void logout(PCloud cloud) throws BackendException {
|
||||||
// empty
|
// empty
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,7 +4,7 @@ import android.content.Context;
|
|||||||
|
|
||||||
import org.cryptomator.data.repository.CloudContentRepositoryFactory;
|
import org.cryptomator.data.repository.CloudContentRepositoryFactory;
|
||||||
import org.cryptomator.domain.Cloud;
|
import org.cryptomator.domain.Cloud;
|
||||||
import org.cryptomator.domain.PCloudCloud;
|
import org.cryptomator.domain.PCloud;
|
||||||
import org.cryptomator.domain.repository.CloudContentRepository;
|
import org.cryptomator.domain.repository.CloudContentRepository;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -13,13 +13,13 @@ import javax.inject.Singleton;
|
|||||||
import static org.cryptomator.domain.CloudType.PCLOUD;
|
import static org.cryptomator.domain.CloudType.PCLOUD;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class PCloudCloudContentRepositoryFactory implements CloudContentRepositoryFactory {
|
public class PCloudContentRepositoryFactory implements CloudContentRepositoryFactory {
|
||||||
|
|
||||||
private final Context context;
|
private final Context context;
|
||||||
private final PCloudIdCache idCache;
|
private final PCloudIdCache idCache;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public PCloudCloudContentRepositoryFactory(Context context, PCloudIdCache idCache) {
|
public PCloudContentRepositoryFactory(Context context, PCloudIdCache idCache) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.idCache = idCache;
|
this.idCache = idCache;
|
||||||
}
|
}
|
||||||
@ -31,7 +31,7 @@ public class PCloudCloudContentRepositoryFactory implements CloudContentReposito
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CloudContentRepository cloudContentRepositoryFor(Cloud cloud) {
|
public CloudContentRepository cloudContentRepositoryFor(Cloud cloud) {
|
||||||
return new PCloudCloudContentRepository((PCloudCloud) cloud, context, idCache);
|
return new PCloudContentRepository((PCloud) cloud, context, idCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -15,7 +15,7 @@ import com.pcloud.sdk.UploadOptions;
|
|||||||
import com.pcloud.sdk.UserInfo;
|
import com.pcloud.sdk.UserInfo;
|
||||||
|
|
||||||
import org.cryptomator.data.util.CopyStream;
|
import org.cryptomator.data.util.CopyStream;
|
||||||
import org.cryptomator.domain.PCloudCloud;
|
import org.cryptomator.domain.PCloud;
|
||||||
import org.cryptomator.domain.exception.BackendException;
|
import org.cryptomator.domain.exception.BackendException;
|
||||||
import org.cryptomator.domain.exception.CloudNodeAlreadyExistsException;
|
import org.cryptomator.domain.exception.CloudNodeAlreadyExistsException;
|
||||||
import org.cryptomator.domain.exception.NoSuchCloudFileException;
|
import org.cryptomator.domain.exception.NoSuchCloudFileException;
|
||||||
@ -45,11 +45,11 @@ class PCloudImpl {
|
|||||||
private final PCloudIdCache idCache;
|
private final PCloudIdCache idCache;
|
||||||
|
|
||||||
private final PCloudClientFactory clientFactory = new PCloudClientFactory();
|
private final PCloudClientFactory clientFactory = new PCloudClientFactory();
|
||||||
private final PCloudCloud cloud;
|
private final PCloud cloud;
|
||||||
private final RootPCloudFolder root;
|
private final RootPCloudFolder root;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
|
||||||
PCloudImpl(Context context, PCloudCloud cloud, PCloudIdCache idCache) {
|
PCloudImpl(Context context, PCloud cloud, PCloudIdCache idCache) {
|
||||||
if (cloud.accessToken() == null) {
|
if (cloud.accessToken() == null) {
|
||||||
throw new NoAuthenticationProvidedException(cloud);
|
throw new NoAuthenticationProvidedException(cloud);
|
||||||
}
|
}
|
||||||
@ -106,49 +106,49 @@ class PCloudImpl {
|
|||||||
|
|
||||||
public PCloudFile file(PCloudFolder parent, String name, Optional<Long> size) {
|
public PCloudFile file(PCloudFolder parent, String name, Optional<Long> size) {
|
||||||
if (parent.getId() == null) {
|
if (parent.getId() == null) {
|
||||||
return PCloudCloudNodeFactory.file(parent, name, size);
|
return PCloudNodeFactory.file(parent, name, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
String path = PCloudCloudNodeFactory.getNodePath(parent, name);
|
String path = PCloudNodeFactory.getNodePath(parent, name);
|
||||||
PCloudIdCache.NodeInfo nodeInfo = idCache.get(path);
|
PCloudIdCache.NodeInfo nodeInfo = idCache.get(path);
|
||||||
if (nodeInfo != null && !nodeInfo.isFolder()) {
|
if (nodeInfo != null && !nodeInfo.isFolder()) {
|
||||||
return PCloudCloudNodeFactory.file(parent, name, size, path, nodeInfo.getId());
|
return PCloudNodeFactory.file(parent, name, size, path, nodeInfo.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<RemoteEntry> file = findEntry(parent.getId(), name, false);
|
Optional<RemoteEntry> file = findEntry(parent.getId(), name, false);
|
||||||
if (file.isPresent()) {
|
if (file.isPresent()) {
|
||||||
return idCache.cache(PCloudCloudNodeFactory.file(parent, file.get().asFile()));
|
return idCache.cache(PCloudNodeFactory.file(parent, file.get().asFile()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return PCloudCloudNodeFactory.file(parent, name, size);
|
return PCloudNodeFactory.file(parent, name, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCloudFolder folder(PCloudFolder parent, String name) {
|
public PCloudFolder folder(PCloudFolder parent, String name) {
|
||||||
if (parent.getId() == null) {
|
if (parent.getId() == null) {
|
||||||
return PCloudCloudNodeFactory.folder(parent, name);
|
return PCloudNodeFactory.folder(parent, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
String path = PCloudCloudNodeFactory.getNodePath(parent, name);
|
String path = PCloudNodeFactory.getNodePath(parent, name);
|
||||||
PCloudIdCache.NodeInfo nodeInfo = idCache.get(path);
|
PCloudIdCache.NodeInfo nodeInfo = idCache.get(path);
|
||||||
if (nodeInfo != null && nodeInfo.isFolder()) {
|
if (nodeInfo != null && nodeInfo.isFolder()) {
|
||||||
return PCloudCloudNodeFactory.folder(parent, name, path, nodeInfo.getId());
|
return PCloudNodeFactory.folder(parent, name, path, nodeInfo.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<RemoteEntry> folder = findEntry(parent.getId(), name, true);
|
Optional<RemoteEntry> folder = findEntry(parent.getId(), name, true);
|
||||||
if (folder.isPresent()) {
|
if (folder.isPresent()) {
|
||||||
return idCache.cache(PCloudCloudNodeFactory.folder(parent, folder.get().asFolder()));
|
return idCache.cache(PCloudNodeFactory.folder(parent, folder.get().asFolder()));
|
||||||
}
|
}
|
||||||
return PCloudCloudNodeFactory.folder(parent, name);
|
return PCloudNodeFactory.folder(parent, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean exists(PCloudNode node) throws ApiError, IOException {
|
public boolean exists(PCloudNode node) throws ApiError, IOException {
|
||||||
try {
|
try {
|
||||||
if (node instanceof PCloudFolder) {
|
if (node instanceof PCloudFolder) {
|
||||||
RemoteFolder remoteFolder = client().listFolder(node.getPath()).execute();
|
RemoteFolder remoteFolder = client().listFolder(node.getPath()).execute();
|
||||||
idCache.add(PCloudCloudNodeFactory.folder(node.getParent(), remoteFolder));
|
idCache.add(PCloudNodeFactory.folder(node.getParent(), remoteFolder));
|
||||||
} else {
|
} else {
|
||||||
RemoteFile remoteFile = client().stat(node.getPath()).execute();
|
RemoteFile remoteFile = client().stat(node.getPath()).execute();
|
||||||
idCache.add(PCloudCloudNodeFactory.file(node.getParent(), remoteFile));
|
idCache.add(PCloudNodeFactory.file(node.getParent(), remoteFile));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (ApiError e) {
|
} catch (ApiError e) {
|
||||||
@ -177,7 +177,7 @@ class PCloudImpl {
|
|||||||
|
|
||||||
List<RemoteEntry> entryMetadata = listFolderResult.children();
|
List<RemoteEntry> entryMetadata = listFolderResult.children();
|
||||||
for (RemoteEntry metadata : entryMetadata) {
|
for (RemoteEntry metadata : entryMetadata) {
|
||||||
result.add(idCache.cache(PCloudCloudNodeFactory.from(folder, metadata)));
|
result.add(idCache.cache(PCloudNodeFactory.from(folder, metadata)));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ class PCloudImpl {
|
|||||||
.createFolder(folder.getParent().getId(), folder.getName()) //
|
.createFolder(folder.getParent().getId(), folder.getName()) //
|
||||||
.execute();
|
.execute();
|
||||||
return idCache.cache( //
|
return idCache.cache( //
|
||||||
PCloudCloudNodeFactory.folder(folder.getParent(), createdFolder));
|
PCloudNodeFactory.folder(folder.getParent(), createdFolder));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCloudNode move(PCloudNode source, PCloudNode target) throws ApiError, BackendException, IOException {
|
public PCloudNode move(PCloudNode source, PCloudNode target) throws ApiError, BackendException, IOException {
|
||||||
@ -218,7 +218,7 @@ class PCloudImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
idCache.remove(source);
|
idCache.remove(source);
|
||||||
return idCache.cache(PCloudCloudNodeFactory.from(target.getParent(), relocationResult));
|
return idCache.cache(PCloudNodeFactory.from(target.getParent(), relocationResult));
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCloudFile write(PCloudFile file, DataSource data, final ProgressAware<UploadState> progressAware, boolean replace, long size)
|
public PCloudFile write(PCloudFile file, DataSource data, final ProgressAware<UploadState> progressAware, boolean replace, long size)
|
||||||
@ -241,7 +241,7 @@ class PCloudImpl {
|
|||||||
|
|
||||||
progressAware.onProgress(Progress.completed(UploadState.upload(file)));
|
progressAware.onProgress(Progress.completed(UploadState.upload(file)));
|
||||||
|
|
||||||
return idCache.cache(PCloudCloudNodeFactory.file(file.getParent(), uploadedFile));
|
return idCache.cache(PCloudNodeFactory.file(file.getParent(), uploadedFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
private RemoteFile uploadFile(final PCloudFile file, DataSource data, final ProgressAware<UploadState> progressAware, UploadOptions uploadOptions, final long size) //
|
private RemoteFile uploadFile(final PCloudFile file, DataSource data, final ProgressAware<UploadState> progressAware, UploadOptions uploadOptions, final long size) //
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package org.cryptomator.data.cloud.pcloud;
|
package org.cryptomator.data.cloud.pcloud;
|
||||||
|
|
||||||
import com.google.api.services.drive.model.File;
|
|
||||||
import com.pcloud.sdk.RemoteEntry;
|
import com.pcloud.sdk.RemoteEntry;
|
||||||
import com.pcloud.sdk.RemoteFile;
|
import com.pcloud.sdk.RemoteFile;
|
||||||
import com.pcloud.sdk.RemoteFolder;
|
import com.pcloud.sdk.RemoteFolder;
|
||||||
|
|
||||||
import org.cryptomator.util.Optional;
|
import org.cryptomator.util.Optional;
|
||||||
|
|
||||||
import java.util.Date;
|
class PCloudNodeFactory {
|
||||||
|
|
||||||
class PCloudCloudNodeFactory {
|
|
||||||
|
|
||||||
public static PCloudFile file(PCloudFolder parent, RemoteFile file) {
|
public static PCloudFile file(PCloudFolder parent, RemoteFile file) {
|
||||||
return new PCloudFile(parent, file.name(), getNodePath(parent, file.name()), file.fileId(), Optional.ofNullable(file.size()), Optional.ofNullable(file.lastModified()));
|
return new PCloudFile(parent, file.name(), getNodePath(parent, file.name()), file.fileId(), Optional.ofNullable(file.size()), Optional.ofNullable(file.lastModified()));
|
@ -1,25 +1,25 @@
|
|||||||
package org.cryptomator.data.cloud.pcloud;
|
package org.cryptomator.data.cloud.pcloud;
|
||||||
|
|
||||||
import org.cryptomator.domain.Cloud;
|
import org.cryptomator.domain.Cloud;
|
||||||
import org.cryptomator.domain.PCloudCloud;
|
import org.cryptomator.domain.PCloud;
|
||||||
|
|
||||||
class RootPCloudFolder extends PCloudFolder {
|
class RootPCloudFolder extends PCloudFolder {
|
||||||
|
|
||||||
private final PCloudCloud cloud;
|
private final PCloud cloud;
|
||||||
private static final long rootFolderId = 0L;
|
private static final long rootFolderId = 0L;
|
||||||
|
|
||||||
public RootPCloudFolder(PCloudCloud cloud) {
|
public RootPCloudFolder(PCloud cloud) {
|
||||||
super(null, "", "", rootFolderId);
|
super(null, "", "", rootFolderId);
|
||||||
this.cloud = cloud;
|
this.cloud = cloud;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PCloudCloud getCloud() {
|
public PCloud getCloud() {
|
||||||
return cloud;
|
return cloud;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PCloudFolder withCloud(Cloud cloud) {
|
public PCloudFolder withCloud(Cloud cloud) {
|
||||||
return new RootPCloudFolder((PCloudCloud) cloud);
|
return new RootPCloudFolder((PCloud) cloud);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import org.cryptomator.data.db.entities.CloudEntity;
|
|||||||
import org.cryptomator.domain.Cloud;
|
import org.cryptomator.domain.Cloud;
|
||||||
import org.cryptomator.domain.CloudType;
|
import org.cryptomator.domain.CloudType;
|
||||||
import org.cryptomator.domain.DropboxCloud;
|
import org.cryptomator.domain.DropboxCloud;
|
||||||
import org.cryptomator.domain.PCloudCloud;
|
import org.cryptomator.domain.PCloud;
|
||||||
import org.cryptomator.domain.GoogleDriveCloud;
|
import org.cryptomator.domain.GoogleDriveCloud;
|
||||||
import org.cryptomator.domain.LocalStorageCloud;
|
import org.cryptomator.domain.LocalStorageCloud;
|
||||||
import org.cryptomator.domain.OnedriveCloud;
|
import org.cryptomator.domain.OnedriveCloud;
|
||||||
@ -17,7 +17,7 @@ import static org.cryptomator.domain.DropboxCloud.aDropboxCloud;
|
|||||||
import static org.cryptomator.domain.GoogleDriveCloud.aGoogleDriveCloud;
|
import static org.cryptomator.domain.GoogleDriveCloud.aGoogleDriveCloud;
|
||||||
import static org.cryptomator.domain.LocalStorageCloud.aLocalStorage;
|
import static org.cryptomator.domain.LocalStorageCloud.aLocalStorage;
|
||||||
import static org.cryptomator.domain.OnedriveCloud.aOnedriveCloud;
|
import static org.cryptomator.domain.OnedriveCloud.aOnedriveCloud;
|
||||||
import static org.cryptomator.domain.PCloudCloud.aPCloudCloud;
|
import static org.cryptomator.domain.PCloud.aPCloud;
|
||||||
import static org.cryptomator.domain.WebDavCloud.aWebDavCloudCloud;
|
import static org.cryptomator.domain.WebDavCloud.aWebDavCloudCloud;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@ -50,7 +50,7 @@ public class CloudEntityMapper extends EntityMapper<CloudEntity, Cloud> {
|
|||||||
.withUsername(entity.getUsername()) //
|
.withUsername(entity.getUsername()) //
|
||||||
.build();
|
.build();
|
||||||
case PCLOUD:
|
case PCLOUD:
|
||||||
return aPCloudCloud() //
|
return aPCloud() //
|
||||||
.withId(entity.getId()) //
|
.withId(entity.getId()) //
|
||||||
.withUrl(entity.getWebdavUrl()) //
|
.withUrl(entity.getWebdavUrl()) //
|
||||||
.withAccessToken(entity.getAccessToken()) //
|
.withAccessToken(entity.getAccessToken()) //
|
||||||
@ -92,9 +92,9 @@ public class CloudEntityMapper extends EntityMapper<CloudEntity, Cloud> {
|
|||||||
result.setUsername(((OnedriveCloud) domainObject).username());
|
result.setUsername(((OnedriveCloud) domainObject).username());
|
||||||
break;
|
break;
|
||||||
case PCLOUD:
|
case PCLOUD:
|
||||||
result.setAccessToken(((PCloudCloud) domainObject).accessToken());
|
result.setAccessToken(((PCloud) domainObject).accessToken());
|
||||||
result.setWebdavUrl(((PCloudCloud) domainObject).url());
|
result.setWebdavUrl(((PCloud) domainObject).url());
|
||||||
result.setUsername(((PCloudCloud) domainObject).username());
|
result.setUsername(((PCloud) domainObject).username());
|
||||||
break;
|
break;
|
||||||
case LOCAL:
|
case LOCAL:
|
||||||
result.setAccessToken(((LocalStorageCloud) domainObject).rootUri());
|
result.setAccessToken(((LocalStorageCloud) domainObject).rootUri());
|
||||||
|
@ -5,7 +5,7 @@ import org.cryptomator.data.cloud.dropbox.DropboxCloudContentRepositoryFactory;
|
|||||||
import org.cryptomator.data.cloud.googledrive.GoogleDriveCloudContentRepositoryFactory;
|
import org.cryptomator.data.cloud.googledrive.GoogleDriveCloudContentRepositoryFactory;
|
||||||
import org.cryptomator.data.cloud.local.LocalStorageContentRepositoryFactory;
|
import org.cryptomator.data.cloud.local.LocalStorageContentRepositoryFactory;
|
||||||
import org.cryptomator.data.cloud.onedrive.OnedriveCloudContentRepositoryFactory;
|
import org.cryptomator.data.cloud.onedrive.OnedriveCloudContentRepositoryFactory;
|
||||||
import org.cryptomator.data.cloud.pcloud.PCloudCloudContentRepositoryFactory;
|
import org.cryptomator.data.cloud.pcloud.PCloudContentRepositoryFactory;
|
||||||
import org.cryptomator.data.cloud.webdav.WebDavCloudContentRepositoryFactory;
|
import org.cryptomator.data.cloud.webdav.WebDavCloudContentRepositoryFactory;
|
||||||
import org.cryptomator.data.repository.CloudContentRepositoryFactory;
|
import org.cryptomator.data.repository.CloudContentRepositoryFactory;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -26,7 +26,7 @@ public class CloudContentRepositoryFactories implements Iterable<CloudContentRep
|
|||||||
public CloudContentRepositoryFactories(DropboxCloudContentRepositoryFactory dropboxFactory, //
|
public CloudContentRepositoryFactories(DropboxCloudContentRepositoryFactory dropboxFactory, //
|
||||||
GoogleDriveCloudContentRepositoryFactory googleDriveFactory, //
|
GoogleDriveCloudContentRepositoryFactory googleDriveFactory, //
|
||||||
OnedriveCloudContentRepositoryFactory oneDriveFactory, //
|
OnedriveCloudContentRepositoryFactory oneDriveFactory, //
|
||||||
PCloudCloudContentRepositoryFactory pCloudFactory, //
|
PCloudContentRepositoryFactory pCloudFactory, //
|
||||||
CryptoCloudContentRepositoryFactory cryptoFactory, //
|
CryptoCloudContentRepositoryFactory cryptoFactory, //
|
||||||
LocalStorageContentRepositoryFactory localStorageFactory, //
|
LocalStorageContentRepositoryFactory localStorageFactory, //
|
||||||
WebDavCloudContentRepositoryFactory webDavFactory) {
|
WebDavCloudContentRepositoryFactory webDavFactory) {
|
||||||
|
@ -2,30 +2,30 @@ package org.cryptomator.domain;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class PCloudCloud implements Cloud {
|
public class PCloud implements Cloud {
|
||||||
|
|
||||||
private final Long id;
|
private final Long id;
|
||||||
private final String accessToken;
|
private final String accessToken;
|
||||||
private final String url;
|
private final String url;
|
||||||
private final String username;
|
private final String username;
|
||||||
|
|
||||||
private PCloudCloud(Builder builder) {
|
private PCloud(Builder builder) {
|
||||||
this.id = builder.id;
|
this.id = builder.id;
|
||||||
this.accessToken = builder.accessToken;
|
this.accessToken = builder.accessToken;
|
||||||
this.url = builder.url;
|
this.url = builder.url;
|
||||||
this.username = builder.username;
|
this.username = builder.username;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder aPCloudCloud() {
|
public static Builder aPCloud() {
|
||||||
return new Builder();
|
return new Builder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Builder aCopyOf(PCloudCloud pCloudCloud) {
|
public static Builder aCopyOf(PCloud pCloud) {
|
||||||
return new Builder() //
|
return new Builder() //
|
||||||
.withId(pCloudCloud.id()) //
|
.withId(pCloud.id()) //
|
||||||
.withAccessToken(pCloudCloud.accessToken()) //
|
.withAccessToken(pCloud.accessToken()) //
|
||||||
.withUrl(pCloudCloud.url()) //
|
.withUrl(pCloud.url()) //
|
||||||
.withUsername(pCloudCloud.username());
|
.withUsername(pCloud.username());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,7 +84,7 @@ public class PCloudCloud implements Cloud {
|
|||||||
if (obj == this) {
|
if (obj == this) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return internalEquals((PCloudCloud) obj);
|
return internalEquals((PCloud) obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,7 +92,7 @@ public class PCloudCloud implements Cloud {
|
|||||||
return id == null ? 0 : id.hashCode();
|
return id == null ? 0 : id.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean internalEquals(PCloudCloud obj) {
|
private boolean internalEquals(PCloud obj) {
|
||||||
return id != null && id.equals(obj.id);
|
return id != null && id.equals(obj.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,8 +126,8 @@ public class PCloudCloud implements Cloud {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PCloudCloud build() {
|
public PCloud build() {
|
||||||
return new PCloudCloud(this);
|
return new PCloud(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package org.cryptomator.domain.usecases.cloud;
|
package org.cryptomator.domain.usecases.cloud;
|
||||||
|
|
||||||
import org.cryptomator.domain.PCloudCloud;
|
import org.cryptomator.domain.PCloud;
|
||||||
import org.cryptomator.domain.exception.BackendException;
|
import org.cryptomator.domain.exception.BackendException;
|
||||||
import org.cryptomator.domain.repository.CloudContentRepository;
|
import org.cryptomator.domain.repository.CloudContentRepository;
|
||||||
import org.cryptomator.generator.Parameter;
|
import org.cryptomator.generator.Parameter;
|
||||||
@ -10,9 +10,9 @@ import org.cryptomator.generator.UseCase;
|
|||||||
class ConnectToPCloud {
|
class ConnectToPCloud {
|
||||||
|
|
||||||
private final CloudContentRepository cloudContentRepository;
|
private final CloudContentRepository cloudContentRepository;
|
||||||
private final PCloudCloud cloud;
|
private final PCloud cloud;
|
||||||
|
|
||||||
public ConnectToPCloud(CloudContentRepository cloudContentRepository, @Parameter PCloudCloud cloud) {
|
public ConnectToPCloud(CloudContentRepository cloudContentRepository, @Parameter PCloud cloud) {
|
||||||
this.cloudContentRepository = cloudContentRepository;
|
this.cloudContentRepository = cloudContentRepository;
|
||||||
this.cloud = cloud;
|
this.cloud = cloud;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.cryptomator.presentation.model
|
package org.cryptomator.presentation.model
|
||||||
|
|
||||||
import org.cryptomator.domain.Cloud
|
import org.cryptomator.domain.Cloud
|
||||||
import org.cryptomator.domain.PCloudCloud
|
import org.cryptomator.domain.PCloud
|
||||||
import org.cryptomator.presentation.R
|
import org.cryptomator.presentation.R
|
||||||
|
|
||||||
class PCloudCloudModel(cloud: Cloud) : CloudModel(cloud) {
|
class PCloudModel(cloud: Cloud) : CloudModel(cloud) {
|
||||||
|
|
||||||
override fun name(): Int {
|
override fun name(): Int {
|
||||||
return R.string.cloud_names_pcloud
|
return R.string.cloud_names_pcloud
|
||||||
@ -22,8 +22,8 @@ class PCloudCloudModel(cloud: Cloud) : CloudModel(cloud) {
|
|||||||
return cloud().id()
|
return cloud().id()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cloud(): PCloudCloud {
|
private fun cloud(): PCloud {
|
||||||
return toCloud() as PCloudCloud
|
return toCloud() as PCloud
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun cloudType(): CloudTypeModel {
|
override fun cloudType(): CloudTypeModel {
|
@ -9,7 +9,7 @@ import org.cryptomator.presentation.model.DropboxCloudModel
|
|||||||
import org.cryptomator.presentation.model.GoogleDriveCloudModel
|
import org.cryptomator.presentation.model.GoogleDriveCloudModel
|
||||||
import org.cryptomator.presentation.model.LocalStorageModel
|
import org.cryptomator.presentation.model.LocalStorageModel
|
||||||
import org.cryptomator.presentation.model.OnedriveCloudModel
|
import org.cryptomator.presentation.model.OnedriveCloudModel
|
||||||
import org.cryptomator.presentation.model.PCloudCloudModel
|
import org.cryptomator.presentation.model.PCloudModel
|
||||||
import org.cryptomator.presentation.model.WebDavCloudModel
|
import org.cryptomator.presentation.model.WebDavCloudModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class CloudModelMapper @Inject constructor() : ModelMapper<CloudModel, Cloud>()
|
|||||||
CloudTypeModel.DROPBOX -> DropboxCloudModel(domainObject)
|
CloudTypeModel.DROPBOX -> DropboxCloudModel(domainObject)
|
||||||
CloudTypeModel.GOOGLE_DRIVE -> GoogleDriveCloudModel(domainObject)
|
CloudTypeModel.GOOGLE_DRIVE -> GoogleDriveCloudModel(domainObject)
|
||||||
CloudTypeModel.ONEDRIVE -> OnedriveCloudModel(domainObject)
|
CloudTypeModel.ONEDRIVE -> OnedriveCloudModel(domainObject)
|
||||||
CloudTypeModel.PCLOUD -> PCloudCloudModel(domainObject)
|
CloudTypeModel.PCLOUD -> PCloudModel(domainObject)
|
||||||
CloudTypeModel.CRYPTO -> CryptoCloudModel(domainObject)
|
CloudTypeModel.CRYPTO -> CryptoCloudModel(domainObject)
|
||||||
CloudTypeModel.LOCAL -> LocalStorageModel(domainObject)
|
CloudTypeModel.LOCAL -> LocalStorageModel(domainObject)
|
||||||
CloudTypeModel.WEBDAV -> WebDavCloudModel(domainObject)
|
CloudTypeModel.WEBDAV -> WebDavCloudModel(domainObject)
|
||||||
|
@ -13,7 +13,7 @@ import com.pcloud.sdk.AuthorizationRequest
|
|||||||
import com.pcloud.sdk.AuthorizationResult
|
import com.pcloud.sdk.AuthorizationResult
|
||||||
import org.cryptomator.domain.Cloud
|
import org.cryptomator.domain.Cloud
|
||||||
import org.cryptomator.domain.LocalStorageCloud
|
import org.cryptomator.domain.LocalStorageCloud
|
||||||
import org.cryptomator.domain.PCloudCloud
|
import org.cryptomator.domain.PCloud
|
||||||
import org.cryptomator.domain.Vault
|
import org.cryptomator.domain.Vault
|
||||||
import org.cryptomator.domain.di.PerView
|
import org.cryptomator.domain.di.PerView
|
||||||
import org.cryptomator.domain.usecases.cloud.AddOrChangeCloudConnectionUseCase
|
import org.cryptomator.domain.usecases.cloud.AddOrChangeCloudConnectionUseCase
|
||||||
@ -194,7 +194,7 @@ class CloudConnectionListPresenter @Inject constructor( //
|
|||||||
val accessToken: String = CredentialCryptor //
|
val accessToken: String = CredentialCryptor //
|
||||||
.getInstance(this.context()) //
|
.getInstance(this.context()) //
|
||||||
.encrypt(authData.token)
|
.encrypt(authData.token)
|
||||||
val pCloudSkeleton: PCloudCloud = PCloudCloud.aPCloudCloud() //
|
val pCloudSkeleton: PCloud = PCloud.aPCloud() //
|
||||||
.withAccessToken(accessToken)
|
.withAccessToken(accessToken)
|
||||||
.withUrl(authData.apiHost)
|
.withUrl(authData.apiHost)
|
||||||
.build();
|
.build();
|
||||||
@ -202,7 +202,7 @@ class CloudConnectionListPresenter @Inject constructor( //
|
|||||||
.withCloud(pCloudSkeleton) //
|
.withCloud(pCloudSkeleton) //
|
||||||
.run(object : DefaultResultHandler<String>() {
|
.run(object : DefaultResultHandler<String>() {
|
||||||
override fun onSuccess(username: String?) {
|
override fun onSuccess(username: String?) {
|
||||||
prepareForSavingPCloudCloud(PCloudCloud.aCopyOf(pCloudSkeleton).withUsername(username).build())
|
prepareForSavingPCloud(PCloud.aCopyOf(pCloudSkeleton).withUsername(username).build())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -219,15 +219,15 @@ class CloudConnectionListPresenter @Inject constructor( //
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun prepareForSavingPCloudCloud(cloud: PCloudCloud) {
|
fun prepareForSavingPCloud(cloud: PCloud) {
|
||||||
getCloudsUseCase //
|
getCloudsUseCase //
|
||||||
.withCloudType(CloudTypeModel.valueOf(selectedCloudType.get())) //
|
.withCloudType(CloudTypeModel.valueOf(selectedCloudType.get())) //
|
||||||
.run(object : DefaultResultHandler<List<Cloud>>() {
|
.run(object : DefaultResultHandler<List<Cloud>>() {
|
||||||
override fun onSuccess(clouds: List<Cloud>) {
|
override fun onSuccess(clouds: List<Cloud>) {
|
||||||
clouds.firstOrNull {
|
clouds.firstOrNull {
|
||||||
(it as PCloudCloud).username() == cloud.username()
|
(it as PCloud).username() == cloud.username()
|
||||||
}?.let { it as PCloudCloud
|
}?.let { it as PCloud
|
||||||
saveCloud(PCloudCloud.aCopyOf(it) //
|
saveCloud(PCloud.aCopyOf(it) //
|
||||||
.withUrl(cloud.url())
|
.withUrl(cloud.url())
|
||||||
.withAccessToken(it.accessToken())
|
.withAccessToken(it.accessToken())
|
||||||
.build())
|
.build())
|
||||||
@ -236,7 +236,7 @@ class CloudConnectionListPresenter @Inject constructor( //
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun saveCloud(cloud: PCloudCloud) {
|
fun saveCloud(cloud: PCloud) {
|
||||||
addOrChangeCloudConnectionUseCase //
|
addOrChangeCloudConnectionUseCase //
|
||||||
.withCloud(cloud) //
|
.withCloud(cloud) //
|
||||||
.run(object : DefaultResultHandler<Void?>() {
|
.run(object : DefaultResultHandler<Void?>() {
|
||||||
|
@ -2,7 +2,7 @@ package org.cryptomator.presentation.presenter
|
|||||||
|
|
||||||
import org.cryptomator.domain.Cloud
|
import org.cryptomator.domain.Cloud
|
||||||
import org.cryptomator.domain.LocalStorageCloud
|
import org.cryptomator.domain.LocalStorageCloud
|
||||||
import org.cryptomator.domain.PCloudCloud
|
import org.cryptomator.domain.PCloud
|
||||||
import org.cryptomator.domain.WebDavCloud
|
import org.cryptomator.domain.WebDavCloud
|
||||||
import org.cryptomator.domain.di.PerView
|
import org.cryptomator.domain.di.PerView
|
||||||
import org.cryptomator.domain.exception.FatalBackendException
|
import org.cryptomator.domain.exception.FatalBackendException
|
||||||
@ -17,7 +17,7 @@ import org.cryptomator.presentation.intent.Intents
|
|||||||
import org.cryptomator.presentation.model.CloudModel
|
import org.cryptomator.presentation.model.CloudModel
|
||||||
import org.cryptomator.presentation.model.CloudTypeModel
|
import org.cryptomator.presentation.model.CloudTypeModel
|
||||||
import org.cryptomator.presentation.model.LocalStorageModel
|
import org.cryptomator.presentation.model.LocalStorageModel
|
||||||
import org.cryptomator.presentation.model.PCloudCloudModel
|
import org.cryptomator.presentation.model.PCloudModel
|
||||||
import org.cryptomator.presentation.model.WebDavCloudModel
|
import org.cryptomator.presentation.model.WebDavCloudModel
|
||||||
import org.cryptomator.presentation.model.mappers.CloudModelMapper
|
import org.cryptomator.presentation.model.mappers.CloudModelMapper
|
||||||
import org.cryptomator.presentation.ui.activity.view.CloudSettingsView
|
import org.cryptomator.presentation.ui.activity.view.CloudSettingsView
|
||||||
@ -62,7 +62,7 @@ class CloudSettingsPresenter @Inject constructor( //
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun isWebdavOrPCloudOrLocal(cloudModel: CloudModel): Boolean {
|
private fun isWebdavOrPCloudOrLocal(cloudModel: CloudModel): Boolean {
|
||||||
return cloudModel is WebDavCloudModel || cloudModel is LocalStorageModel || cloudModel is PCloudCloudModel
|
return cloudModel is WebDavCloudModel || cloudModel is LocalStorageModel || cloudModel is PCloudModel
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loginCloud(cloudModel: CloudModel) {
|
private fun loginCloud(cloudModel: CloudModel) {
|
||||||
@ -127,7 +127,7 @@ class CloudSettingsPresenter @Inject constructor( //
|
|||||||
.toMutableList() //
|
.toMutableList() //
|
||||||
.also {
|
.also {
|
||||||
it.add(aWebdavCloud())
|
it.add(aWebdavCloud())
|
||||||
it.add(aPCloudCloud())
|
it.add(aPCloud())
|
||||||
it.add(aLocalCloud())
|
it.add(aLocalCloud())
|
||||||
}
|
}
|
||||||
view?.render(cloudModel)
|
view?.render(cloudModel)
|
||||||
@ -137,8 +137,8 @@ class CloudSettingsPresenter @Inject constructor( //
|
|||||||
return WebDavCloudModel(WebDavCloud.aWebDavCloudCloud().build())
|
return WebDavCloudModel(WebDavCloud.aWebDavCloudCloud().build())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun aPCloudCloud(): PCloudCloudModel {
|
private fun aPCloud(): PCloudModel {
|
||||||
return PCloudCloudModel(PCloudCloud.aPCloudCloud().build())
|
return PCloudModel(PCloud.aPCloud().build())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun aLocalCloud(): CloudModel {
|
private fun aLocalCloud(): CloudModel {
|
||||||
|
@ -7,7 +7,7 @@ import org.cryptomator.domain.exception.FatalBackendException
|
|||||||
import org.cryptomator.presentation.R
|
import org.cryptomator.presentation.R
|
||||||
import org.cryptomator.presentation.model.CloudModel
|
import org.cryptomator.presentation.model.CloudModel
|
||||||
import org.cryptomator.presentation.model.LocalStorageModel
|
import org.cryptomator.presentation.model.LocalStorageModel
|
||||||
import org.cryptomator.presentation.model.PCloudCloudModel
|
import org.cryptomator.presentation.model.PCloudModel
|
||||||
import org.cryptomator.presentation.model.WebDavCloudModel
|
import org.cryptomator.presentation.model.WebDavCloudModel
|
||||||
import org.cryptomator.presentation.model.comparator.CloudModelComparator
|
import org.cryptomator.presentation.model.comparator.CloudModelComparator
|
||||||
import org.cryptomator.presentation.ui.adapter.CloudConnectionListAdapter.CloudConnectionHolder
|
import org.cryptomator.presentation.ui.adapter.CloudConnectionListAdapter.CloudConnectionHolder
|
||||||
@ -55,8 +55,8 @@ internal constructor(context: Context) : RecyclerViewBaseAdapter<CloudModel, Clo
|
|||||||
|
|
||||||
if (cloudModel is WebDavCloudModel) {
|
if (cloudModel is WebDavCloudModel) {
|
||||||
bindWebDavCloudModel(cloudModel)
|
bindWebDavCloudModel(cloudModel)
|
||||||
} else if (cloudModel is PCloudCloudModel) {
|
} else if (cloudModel is PCloudModel) {
|
||||||
bindPCloudCloudModel(cloudModel)
|
bindPCloudModel(cloudModel)
|
||||||
} else if (cloudModel is LocalStorageModel) {
|
} else if (cloudModel is LocalStorageModel) {
|
||||||
bindLocalStorageCloudModel(cloudModel)
|
bindLocalStorageCloudModel(cloudModel)
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ internal constructor(context: Context) : RecyclerViewBaseAdapter<CloudModel, Clo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindPCloudCloudModel(cloudModel: PCloudCloudModel) {
|
private fun bindPCloudModel(cloudModel: PCloudModel) {
|
||||||
itemView.cloudText.text = cloudModel.username()
|
itemView.cloudText.text = cloudModel.username()
|
||||||
itemView.cloudSubText.visibility = View.GONE
|
itemView.cloudSubText.visibility = View.GONE
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import org.cryptomator.presentation.R
|
|||||||
import org.cryptomator.presentation.model.CloudModel
|
import org.cryptomator.presentation.model.CloudModel
|
||||||
import org.cryptomator.presentation.model.CloudTypeModel
|
import org.cryptomator.presentation.model.CloudTypeModel
|
||||||
import org.cryptomator.presentation.model.LocalStorageModel
|
import org.cryptomator.presentation.model.LocalStorageModel
|
||||||
import org.cryptomator.presentation.model.PCloudCloudModel
|
import org.cryptomator.presentation.model.PCloudModel
|
||||||
import org.cryptomator.presentation.model.WebDavCloudModel
|
import org.cryptomator.presentation.model.WebDavCloudModel
|
||||||
import kotlinx.android.synthetic.main.dialog_bottom_sheet_cloud_settings.change_cloud
|
import kotlinx.android.synthetic.main.dialog_bottom_sheet_cloud_settings.change_cloud
|
||||||
import kotlinx.android.synthetic.main.dialog_bottom_sheet_cloud_settings.delete_cloud
|
import kotlinx.android.synthetic.main.dialog_bottom_sheet_cloud_settings.delete_cloud
|
||||||
@ -29,7 +29,7 @@ class CloudConnectionSettingsBottomSheet : BaseBottomSheet<CloudConnectionSettin
|
|||||||
|
|
||||||
when (cloudModel.cloudType()) {
|
when (cloudModel.cloudType()) {
|
||||||
CloudTypeModel.WEBDAV -> bindViewForWebDAV(cloudModel as WebDavCloudModel)
|
CloudTypeModel.WEBDAV -> bindViewForWebDAV(cloudModel as WebDavCloudModel)
|
||||||
CloudTypeModel.PCLOUD -> bindViewForPCloud(cloudModel as PCloudCloudModel)
|
CloudTypeModel.PCLOUD -> bindViewForPCloud(cloudModel as PCloudModel)
|
||||||
CloudTypeModel.LOCAL -> bindViewForLocal(cloudModel as LocalStorageModel)
|
CloudTypeModel.LOCAL -> bindViewForLocal(cloudModel as LocalStorageModel)
|
||||||
else -> throw IllegalStateException("Cloud model is not binded in the view")
|
else -> throw IllegalStateException("Cloud model is not binded in the view")
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ class CloudConnectionSettingsBottomSheet : BaseBottomSheet<CloudConnectionSettin
|
|||||||
tv_cloud_subtext.text = cloudModel.username()
|
tv_cloud_subtext.text = cloudModel.username()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindViewForPCloud(cloudModel: PCloudCloudModel) {
|
private fun bindViewForPCloud(cloudModel: PCloudModel) {
|
||||||
change_cloud.visibility = View.GONE
|
change_cloud.visibility = View.GONE
|
||||||
tv_cloud_name.text = cloudModel.username()
|
tv_cloud_name.text = cloudModel.username()
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import org.cryptomator.presentation.exception.PermissionNotGrantedException
|
|||||||
import org.cryptomator.presentation.intent.AuthenticateCloudIntent
|
import org.cryptomator.presentation.intent.AuthenticateCloudIntent
|
||||||
import org.cryptomator.presentation.model.CloudModel
|
import org.cryptomator.presentation.model.CloudModel
|
||||||
import org.cryptomator.presentation.model.CloudTypeModel
|
import org.cryptomator.presentation.model.CloudTypeModel
|
||||||
import org.cryptomator.presentation.model.PCloudCloudModel
|
import org.cryptomator.presentation.model.PCloudModel
|
||||||
import org.cryptomator.presentation.model.ProgressModel
|
import org.cryptomator.presentation.model.ProgressModel
|
||||||
import org.cryptomator.presentation.model.ProgressStateModel
|
import org.cryptomator.presentation.model.ProgressStateModel
|
||||||
import org.cryptomator.presentation.model.WebDavCloudModel
|
import org.cryptomator.presentation.model.WebDavCloudModel
|
||||||
@ -291,10 +291,10 @@ class AuthenticateCloudPresenter @Inject constructor( //
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun resumed(intent: AuthenticateCloudIntent) {
|
override fun resumed(intent: AuthenticateCloudIntent) {
|
||||||
handlePCloudAuthenticationExceptionIfRequired(intent.cloud() as PCloudCloudModel, intent.error())
|
handlePCloudAuthenticationExceptionIfRequired(intent.cloud() as PCloudModel, intent.error())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handlePCloudAuthenticationExceptionIfRequired(cloud: PCloudCloudModel, e: AuthenticationException) {
|
private fun handlePCloudAuthenticationExceptionIfRequired(cloud: PCloudModel, e: AuthenticationException) {
|
||||||
Timber.tag("AuthicateCloudPrester").e(e)
|
Timber.tag("AuthicateCloudPrester").e(e)
|
||||||
when {
|
when {
|
||||||
ExceptionUtil.contains(e, WrongCredentialsException::class.java) -> {
|
ExceptionUtil.contains(e, WrongCredentialsException::class.java) -> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user