Skip to content

Commit

Permalink
Open deep links, CR changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelplazaspalacio committed Oct 26, 2023
1 parent 7412640 commit ab48949
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import com.owncloud.android.extensions.showMessageInSnackbar
import com.owncloud.android.lib.common.accounts.AccountTypeUtils
import com.owncloud.android.lib.common.accounts.AccountUtils
import com.owncloud.android.lib.common.network.CertificateCombinedException
import com.owncloud.android.presentation.authentication.AccountUtils.getAccounts
import com.owncloud.android.presentation.authentication.AccountUtils.getUsernameOfAccount
import com.owncloud.android.presentation.authentication.oauth.OAuthUtils
import com.owncloud.android.presentation.common.UIResult
Expand Down Expand Up @@ -193,7 +194,7 @@ class LoginActivity : AppCompatActivity(), SslUntrustedCertDialog.OnSslUntrusted
private fun handleDeepLink() {
if (intent.data != null) {
authenticationViewModel.launchedFromDeepLink = true
if (com.owncloud.android.presentation.authentication.AccountUtils.getAccounts(baseContext).isNotEmpty()) {
if (getAccounts(baseContext).isNotEmpty()) {
launchFileDisplayActivity()
} else {
showMessageInSnackbar(message = baseContext.getString(R.string.uploader_wrn_no_account_title))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class FileOperationsViewModel(
private val createFileWithAppProviderUseCase: CreateFileWithAppProviderUseCase,
private val setFilesAsAvailableOfflineUseCase: SetFilesAsAvailableOfflineUseCase,
private val unsetFilesAsAvailableOfflineUseCase: UnsetFilesAsAvailableOfflineUseCase,
private val manageDeepLinkUseCase: ManageDeepLinkUseCase,
private val contextProvider: ContextProvider,
private val coroutinesDispatcherProvider: CoroutinesDispatcherProvider,
private val manageDeepLinkUseCase: ManageDeepLinkUseCase,
) : ViewModel() {

private val _createFolder = MediatorLiveData<Event<UIResult<Unit>>>()
Expand Down Expand Up @@ -97,11 +97,11 @@ class FileOperationsViewModel(
private val _createFileWithAppProviderFlow = MutableStateFlow<Event<UIResult<String>>?>(null)
val createFileWithAppProviderFlow: StateFlow<Event<UIResult<String>>?> = _createFileWithAppProviderFlow

val openDialogs = mutableListOf<FileAlreadyExistsDialog>()

private val _deepLinkFlow = MutableStateFlow<Event<UIResult<OCFile?>>?>(null)
val deepLinkFlow: StateFlow<Event<UIResult<OCFile?>>?> = _deepLinkFlow

val openDialogs = mutableListOf<FileAlreadyExistsDialog>()

// Used to save the last operation folder
private var lastTargetFolder: OCFile? = null

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @author Manuel Plazas Palacio
*
* Copyright (C) 2022 ownCloud GmbH.
* Copyright (C) 2023 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand All @@ -20,6 +20,6 @@

package com.owncloud.android.domain.exceptions

class DeepLinkException() : Exception(INVALID_FORMAT)
class DeepLinkException : Exception(INVALID_FORMAT)

const val INVALID_FORMAT = "Invalid deep link format"
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @author Manuel Plazas Palacio
*
* Copyright (C) 2022 ownCloud GmbH.
* Copyright (C) 2023 ownCloud GmbH.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
Expand All @@ -23,6 +23,7 @@ package com.owncloud.android.domain.files.usecases
import com.owncloud.android.domain.BaseUseCaseWithResult
import com.owncloud.android.domain.exceptions.DeepLinkException
import com.owncloud.android.domain.files.model.OCFile
import com.owncloud.android.domain.files.model.OCFile.Companion.PATH_SEPARATOR
import java.net.URI

class ManageDeepLinkUseCase : BaseUseCaseWithResult<OCFile?, ManageDeepLinkUseCase.Params>() {
Expand All @@ -39,7 +40,6 @@ class ManageDeepLinkUseCase : BaseUseCaseWithResult<OCFile?, ManageDeepLinkUseCa
data class Params(val uri: URI)

companion object {
const val PATH_SEPARATOR = "/"
const val DEEP_LINK_PREVIOUS_PATH_SEGMENT = "f"
}

Expand Down

0 comments on commit ab48949

Please sign in to comment.