fix: rename PCloudCloud stuff to PCloud

This commit is contained in:
Manuel Jenny 2021-03-17 16:16:42 +01:00
parent f17df0e179
commit d92e4b0daf
No known key found for this signature in database
GPG Key ID: 1C80FE62B2BEAA18
16 changed files with 92 additions and 95 deletions

View File

@ -5,7 +5,7 @@ import android.content.Context;
import com.pcloud.sdk.ApiError;
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.CloudNodeAlreadyExistsException;
import org.cryptomator.domain.exception.FatalBackendException;
@ -26,11 +26,11 @@ import java.util.List;
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));
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;
public Intercepted(PCloudCloud cloud, Context context, PCloudIdCache idCache) {
public Intercepted(PCloud cloud, Context context, PCloudIdCache idCache) {
this.cloud = new PCloudImpl(context, cloud, idCache);
}
public PCloudFolder root(PCloudCloud cloud) {
public PCloudFolder root(PCloud cloud) {
return this.cloud.root();
}
@Override
public PCloudFolder resolve(PCloudCloud cloud, String path) {
public PCloudFolder resolve(PCloud cloud, String path) {
return this.cloud.resolve(path);
}
@ -194,7 +194,7 @@ class PCloudCloudContentRepository extends InterceptingCloudContentRepository<PC
}
@Override
public String checkAuthenticationAndRetrieveCurrentAccount(PCloudCloud cloud) throws BackendException {
public String checkAuthenticationAndRetrieveCurrentAccount(PCloud cloud) throws BackendException {
try {
return this.cloud.currentAccount();
} catch (ApiError | IOException e) {
@ -203,7 +203,7 @@ class PCloudCloudContentRepository extends InterceptingCloudContentRepository<PC
}
@Override
public void logout(PCloudCloud cloud) throws BackendException {
public void logout(PCloud cloud) throws BackendException {
// empty
}
}

View File

@ -4,7 +4,7 @@ import android.content.Context;
import org.cryptomator.data.repository.CloudContentRepositoryFactory;
import org.cryptomator.domain.Cloud;
import org.cryptomator.domain.PCloudCloud;
import org.cryptomator.domain.PCloud;
import org.cryptomator.domain.repository.CloudContentRepository;
import javax.inject.Inject;
@ -13,13 +13,13 @@ import javax.inject.Singleton;
import static org.cryptomator.domain.CloudType.PCLOUD;
@Singleton
public class PCloudCloudContentRepositoryFactory implements CloudContentRepositoryFactory {
public class PCloudContentRepositoryFactory implements CloudContentRepositoryFactory {
private final Context context;
private final PCloudIdCache idCache;
@Inject
public PCloudCloudContentRepositoryFactory(Context context, PCloudIdCache idCache) {
public PCloudContentRepositoryFactory(Context context, PCloudIdCache idCache) {
this.context = context;
this.idCache = idCache;
}
@ -31,7 +31,7 @@ public class PCloudCloudContentRepositoryFactory implements CloudContentReposito
@Override
public CloudContentRepository cloudContentRepositoryFor(Cloud cloud) {
return new PCloudCloudContentRepository((PCloudCloud) cloud, context, idCache);
return new PCloudContentRepository((PCloud) cloud, context, idCache);
}
}

View File

@ -15,7 +15,7 @@ import com.pcloud.sdk.UploadOptions;
import com.pcloud.sdk.UserInfo;
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.CloudNodeAlreadyExistsException;
import org.cryptomator.domain.exception.NoSuchCloudFileException;
@ -45,11 +45,11 @@ class PCloudImpl {
private final PCloudIdCache idCache;
private final PCloudClientFactory clientFactory = new PCloudClientFactory();
private final PCloudCloud cloud;
private final PCloud cloud;
private final RootPCloudFolder root;
private final Context context;
PCloudImpl(Context context, PCloudCloud cloud, PCloudIdCache idCache) {
PCloudImpl(Context context, PCloud cloud, PCloudIdCache idCache) {
if (cloud.accessToken() == null) {
throw new NoAuthenticationProvidedException(cloud);
}
@ -106,49 +106,49 @@ class PCloudImpl {
public PCloudFile file(PCloudFolder parent, String name, Optional<Long> size) {
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);
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);
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) {
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);
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);
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 {
try {
if (node instanceof PCloudFolder) {
RemoteFolder remoteFolder = client().listFolder(node.getPath()).execute();
idCache.add(PCloudCloudNodeFactory.folder(node.getParent(), remoteFolder));
idCache.add(PCloudNodeFactory.folder(node.getParent(), remoteFolder));
} else {
RemoteFile remoteFile = client().stat(node.getPath()).execute();
idCache.add(PCloudCloudNodeFactory.file(node.getParent(), remoteFile));
idCache.add(PCloudNodeFactory.file(node.getParent(), remoteFile));
}
return true;
} catch (ApiError e) {
@ -177,7 +177,7 @@ class PCloudImpl {
List<RemoteEntry> entryMetadata = listFolderResult.children();
for (RemoteEntry metadata : entryMetadata) {
result.add(idCache.cache(PCloudCloudNodeFactory.from(folder, metadata)));
result.add(idCache.cache(PCloudNodeFactory.from(folder, metadata)));
}
return result;
}
@ -195,7 +195,7 @@ class PCloudImpl {
.createFolder(folder.getParent().getId(), folder.getName()) //
.execute();
return idCache.cache( //
PCloudCloudNodeFactory.folder(folder.getParent(), createdFolder));
PCloudNodeFactory.folder(folder.getParent(), createdFolder));
}
public PCloudNode move(PCloudNode source, PCloudNode target) throws ApiError, BackendException, IOException {
@ -218,7 +218,7 @@ class PCloudImpl {
}
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)
@ -241,7 +241,7 @@ class PCloudImpl {
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) //

View File

@ -1,15 +1,12 @@
package org.cryptomator.data.cloud.pcloud;
import com.google.api.services.drive.model.File;
import com.pcloud.sdk.RemoteEntry;
import com.pcloud.sdk.RemoteFile;
import com.pcloud.sdk.RemoteFolder;
import org.cryptomator.util.Optional;
import java.util.Date;
class PCloudCloudNodeFactory {
class PCloudNodeFactory {
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()));

View File

@ -1,25 +1,25 @@
package org.cryptomator.data.cloud.pcloud;
import org.cryptomator.domain.Cloud;
import org.cryptomator.domain.PCloudCloud;
import org.cryptomator.domain.PCloud;
class RootPCloudFolder extends PCloudFolder {
private final PCloudCloud cloud;
private final PCloud cloud;
private static final long rootFolderId = 0L;
public RootPCloudFolder(PCloudCloud cloud) {
public RootPCloudFolder(PCloud cloud) {
super(null, "", "", rootFolderId);
this.cloud = cloud;
}
@Override
public PCloudCloud getCloud() {
public PCloud getCloud() {
return cloud;
}
@Override
public PCloudFolder withCloud(Cloud cloud) {
return new RootPCloudFolder((PCloudCloud) cloud);
return new RootPCloudFolder((PCloud) cloud);
}
}

View File

@ -4,7 +4,7 @@ import org.cryptomator.data.db.entities.CloudEntity;
import org.cryptomator.domain.Cloud;
import org.cryptomator.domain.CloudType;
import org.cryptomator.domain.DropboxCloud;
import org.cryptomator.domain.PCloudCloud;
import org.cryptomator.domain.PCloud;
import org.cryptomator.domain.GoogleDriveCloud;
import org.cryptomator.domain.LocalStorageCloud;
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.LocalStorageCloud.aLocalStorage;
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;
@Singleton
@ -50,7 +50,7 @@ public class CloudEntityMapper extends EntityMapper<CloudEntity, Cloud> {
.withUsername(entity.getUsername()) //
.build();
case PCLOUD:
return aPCloudCloud() //
return aPCloud() //
.withId(entity.getId()) //
.withUrl(entity.getWebdavUrl()) //
.withAccessToken(entity.getAccessToken()) //
@ -92,9 +92,9 @@ public class CloudEntityMapper extends EntityMapper<CloudEntity, Cloud> {
result.setUsername(((OnedriveCloud) domainObject).username());
break;
case PCLOUD:
result.setAccessToken(((PCloudCloud) domainObject).accessToken());
result.setWebdavUrl(((PCloudCloud) domainObject).url());
result.setUsername(((PCloudCloud) domainObject).username());
result.setAccessToken(((PCloud) domainObject).accessToken());
result.setWebdavUrl(((PCloud) domainObject).url());
result.setUsername(((PCloud) domainObject).username());
break;
case LOCAL:
result.setAccessToken(((LocalStorageCloud) domainObject).rootUri());

View File

@ -5,7 +5,7 @@ import org.cryptomator.data.cloud.dropbox.DropboxCloudContentRepositoryFactory;
import org.cryptomator.data.cloud.googledrive.GoogleDriveCloudContentRepositoryFactory;
import org.cryptomator.data.cloud.local.LocalStorageContentRepositoryFactory;
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.repository.CloudContentRepositoryFactory;
import org.jetbrains.annotations.NotNull;
@ -26,7 +26,7 @@ public class CloudContentRepositoryFactories implements Iterable<CloudContentRep
public CloudContentRepositoryFactories(DropboxCloudContentRepositoryFactory dropboxFactory, //
GoogleDriveCloudContentRepositoryFactory googleDriveFactory, //
OnedriveCloudContentRepositoryFactory oneDriveFactory, //
PCloudCloudContentRepositoryFactory pCloudFactory, //
PCloudContentRepositoryFactory pCloudFactory, //
CryptoCloudContentRepositoryFactory cryptoFactory, //
LocalStorageContentRepositoryFactory localStorageFactory, //
WebDavCloudContentRepositoryFactory webDavFactory) {

View File

@ -2,30 +2,30 @@ package org.cryptomator.domain;
import org.jetbrains.annotations.NotNull;
public class PCloudCloud implements Cloud {
public class PCloud implements Cloud {
private final Long id;
private final String accessToken;
private final String url;
private final String username;
private PCloudCloud(Builder builder) {
private PCloud(Builder builder) {
this.id = builder.id;
this.accessToken = builder.accessToken;
this.url = builder.url;
this.username = builder.username;
}
public static Builder aPCloudCloud() {
public static Builder aPCloud() {
return new Builder();
}
public static Builder aCopyOf(PCloudCloud pCloudCloud) {
public static Builder aCopyOf(PCloud pCloud) {
return new Builder() //
.withId(pCloudCloud.id()) //
.withAccessToken(pCloudCloud.accessToken()) //
.withUrl(pCloudCloud.url()) //
.withUsername(pCloudCloud.username());
.withId(pCloud.id()) //
.withAccessToken(pCloud.accessToken()) //
.withUrl(pCloud.url()) //
.withUsername(pCloud.username());
}
@Override
@ -84,7 +84,7 @@ public class PCloudCloud implements Cloud {
if (obj == this) {
return true;
}
return internalEquals((PCloudCloud) obj);
return internalEquals((PCloud) obj);
}
@Override
@ -92,7 +92,7 @@ public class PCloudCloud implements Cloud {
return id == null ? 0 : id.hashCode();
}
private boolean internalEquals(PCloudCloud obj) {
private boolean internalEquals(PCloud obj) {
return id != null && id.equals(obj.id);
}
@ -126,8 +126,8 @@ public class PCloudCloud implements Cloud {
return this;
}
public PCloudCloud build() {
return new PCloudCloud(this);
public PCloud build() {
return new PCloud(this);
}
}

View File

@ -1,6 +1,6 @@
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.repository.CloudContentRepository;
import org.cryptomator.generator.Parameter;
@ -10,9 +10,9 @@ import org.cryptomator.generator.UseCase;
class ConnectToPCloud {
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.cloud = cloud;
}

View File

@ -1,10 +1,10 @@
package org.cryptomator.presentation.model
import org.cryptomator.domain.Cloud
import org.cryptomator.domain.PCloudCloud
import org.cryptomator.domain.PCloud
import org.cryptomator.presentation.R
class PCloudCloudModel(cloud: Cloud) : CloudModel(cloud) {
class PCloudModel(cloud: Cloud) : CloudModel(cloud) {
override fun name(): Int {
return R.string.cloud_names_pcloud
@ -22,8 +22,8 @@ class PCloudCloudModel(cloud: Cloud) : CloudModel(cloud) {
return cloud().id()
}
private fun cloud(): PCloudCloud {
return toCloud() as PCloudCloud
private fun cloud(): PCloud {
return toCloud() as PCloud
}
override fun cloudType(): CloudTypeModel {

View File

@ -9,7 +9,7 @@ import org.cryptomator.presentation.model.DropboxCloudModel
import org.cryptomator.presentation.model.GoogleDriveCloudModel
import org.cryptomator.presentation.model.LocalStorageModel
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 javax.inject.Inject
@ -25,7 +25,7 @@ class CloudModelMapper @Inject constructor() : ModelMapper<CloudModel, Cloud>()
CloudTypeModel.DROPBOX -> DropboxCloudModel(domainObject)
CloudTypeModel.GOOGLE_DRIVE -> GoogleDriveCloudModel(domainObject)
CloudTypeModel.ONEDRIVE -> OnedriveCloudModel(domainObject)
CloudTypeModel.PCLOUD -> PCloudCloudModel(domainObject)
CloudTypeModel.PCLOUD -> PCloudModel(domainObject)
CloudTypeModel.CRYPTO -> CryptoCloudModel(domainObject)
CloudTypeModel.LOCAL -> LocalStorageModel(domainObject)
CloudTypeModel.WEBDAV -> WebDavCloudModel(domainObject)

View File

@ -13,7 +13,7 @@ import com.pcloud.sdk.AuthorizationRequest
import com.pcloud.sdk.AuthorizationResult
import org.cryptomator.domain.Cloud
import org.cryptomator.domain.LocalStorageCloud
import org.cryptomator.domain.PCloudCloud
import org.cryptomator.domain.PCloud
import org.cryptomator.domain.Vault
import org.cryptomator.domain.di.PerView
import org.cryptomator.domain.usecases.cloud.AddOrChangeCloudConnectionUseCase
@ -194,7 +194,7 @@ class CloudConnectionListPresenter @Inject constructor( //
val accessToken: String = CredentialCryptor //
.getInstance(this.context()) //
.encrypt(authData.token)
val pCloudSkeleton: PCloudCloud = PCloudCloud.aPCloudCloud() //
val pCloudSkeleton: PCloud = PCloud.aPCloud() //
.withAccessToken(accessToken)
.withUrl(authData.apiHost)
.build();
@ -202,7 +202,7 @@ class CloudConnectionListPresenter @Inject constructor( //
.withCloud(pCloudSkeleton) //
.run(object : DefaultResultHandler<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 //
.withCloudType(CloudTypeModel.valueOf(selectedCloudType.get())) //
.run(object : DefaultResultHandler<List<Cloud>>() {
override fun onSuccess(clouds: List<Cloud>) {
clouds.firstOrNull {
(it as PCloudCloud).username() == cloud.username()
}?.let { it as PCloudCloud
saveCloud(PCloudCloud.aCopyOf(it) //
(it as PCloud).username() == cloud.username()
}?.let { it as PCloud
saveCloud(PCloud.aCopyOf(it) //
.withUrl(cloud.url())
.withAccessToken(it.accessToken())
.build())
@ -236,7 +236,7 @@ class CloudConnectionListPresenter @Inject constructor( //
})
}
fun saveCloud(cloud: PCloudCloud) {
fun saveCloud(cloud: PCloud) {
addOrChangeCloudConnectionUseCase //
.withCloud(cloud) //
.run(object : DefaultResultHandler<Void?>() {

View File

@ -2,7 +2,7 @@ package org.cryptomator.presentation.presenter
import org.cryptomator.domain.Cloud
import org.cryptomator.domain.LocalStorageCloud
import org.cryptomator.domain.PCloudCloud
import org.cryptomator.domain.PCloud
import org.cryptomator.domain.WebDavCloud
import org.cryptomator.domain.di.PerView
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.CloudTypeModel
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.mappers.CloudModelMapper
import org.cryptomator.presentation.ui.activity.view.CloudSettingsView
@ -62,7 +62,7 @@ class CloudSettingsPresenter @Inject constructor( //
}
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) {
@ -127,7 +127,7 @@ class CloudSettingsPresenter @Inject constructor( //
.toMutableList() //
.also {
it.add(aWebdavCloud())
it.add(aPCloudCloud())
it.add(aPCloud())
it.add(aLocalCloud())
}
view?.render(cloudModel)
@ -137,8 +137,8 @@ class CloudSettingsPresenter @Inject constructor( //
return WebDavCloudModel(WebDavCloud.aWebDavCloudCloud().build())
}
private fun aPCloudCloud(): PCloudCloudModel {
return PCloudCloudModel(PCloudCloud.aPCloudCloud().build())
private fun aPCloud(): PCloudModel {
return PCloudModel(PCloud.aPCloud().build())
}
private fun aLocalCloud(): CloudModel {

View File

@ -7,7 +7,7 @@ import org.cryptomator.domain.exception.FatalBackendException
import org.cryptomator.presentation.R
import org.cryptomator.presentation.model.CloudModel
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.comparator.CloudModelComparator
import org.cryptomator.presentation.ui.adapter.CloudConnectionListAdapter.CloudConnectionHolder
@ -55,8 +55,8 @@ internal constructor(context: Context) : RecyclerViewBaseAdapter<CloudModel, Clo
if (cloudModel is WebDavCloudModel) {
bindWebDavCloudModel(cloudModel)
} else if (cloudModel is PCloudCloudModel) {
bindPCloudCloudModel(cloudModel)
} else if (cloudModel is PCloudModel) {
bindPCloudModel(cloudModel)
} else if (cloudModel is LocalStorageModel) {
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.cloudSubText.visibility = View.GONE
}

View File

@ -7,7 +7,7 @@ import org.cryptomator.presentation.R
import org.cryptomator.presentation.model.CloudModel
import org.cryptomator.presentation.model.CloudTypeModel
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 kotlinx.android.synthetic.main.dialog_bottom_sheet_cloud_settings.change_cloud
import kotlinx.android.synthetic.main.dialog_bottom_sheet_cloud_settings.delete_cloud
@ -29,7 +29,7 @@ class CloudConnectionSettingsBottomSheet : BaseBottomSheet<CloudConnectionSettin
when (cloudModel.cloudType()) {
CloudTypeModel.WEBDAV -> bindViewForWebDAV(cloudModel as WebDavCloudModel)
CloudTypeModel.PCLOUD -> bindViewForPCloud(cloudModel as PCloudCloudModel)
CloudTypeModel.PCLOUD -> bindViewForPCloud(cloudModel as PCloudModel)
CloudTypeModel.LOCAL -> bindViewForLocal(cloudModel as LocalStorageModel)
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()
}
private fun bindViewForPCloud(cloudModel: PCloudCloudModel) {
private fun bindViewForPCloud(cloudModel: PCloudModel) {
change_cloud.visibility = View.GONE
tv_cloud_name.text = cloudModel.username()
}

View File

@ -34,7 +34,7 @@ import org.cryptomator.presentation.exception.PermissionNotGrantedException
import org.cryptomator.presentation.intent.AuthenticateCloudIntent
import org.cryptomator.presentation.model.CloudModel
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.ProgressStateModel
import org.cryptomator.presentation.model.WebDavCloudModel
@ -291,10 +291,10 @@ class AuthenticateCloudPresenter @Inject constructor( //
}
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)
when {
ExceptionUtil.contains(e, WrongCredentialsException::class.java) -> {