Skip to content

Commit

Permalink
Solve conflicts with new_arch/shares branch and keep working on priva…
Browse files Browse the repository at this point in the history
…te shares
  • Loading branch information
davigonz committed Jul 17, 2019
1 parent 6185816 commit 2f069ea
Show file tree
Hide file tree
Showing 56 changed files with 499 additions and 903 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ import com.owncloud.android.lib.common.accounts.AccountUtils
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.status.CapabilityBooleanType
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.presentation.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.sharing.shares.OCShareViewModel
import com.owncloud.android.presentation.sharing.shares.ShareActivity
import com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareViewModel
import com.owncloud.android.presentation.ui.sharing.ShareActivity
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.utils.AccountsManager
import com.owncloud.android.utils.AppTestUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ import com.owncloud.android.lib.common.accounts.AccountUtils
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.status.CapabilityBooleanType
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.presentation.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.sharing.shares.OCShareViewModel
import com.owncloud.android.presentation.sharing.shares.ShareActivity
import com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareViewModel
import com.owncloud.android.presentation.ui.sharing.ShareActivity
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.utils.AccountsManager
import com.owncloud.android.utils.AppTestUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.common.accounts.AccountUtils
import com.owncloud.android.lib.resources.status.CapabilityBooleanType
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.presentation.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.sharing.shares.OCShareViewModel
import com.owncloud.android.presentation.sharing.shares.ShareActivity
import com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareViewModel
import com.owncloud.android.presentation.ui.sharing.ShareActivity
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.utils.AccountsManager
import com.owncloud.android.utils.AppTestUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ import com.owncloud.android.lib.common.accounts.AccountUtils
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.status.CapabilityBooleanType
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.presentation.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.sharing.shares.OCShareViewModel
import com.owncloud.android.presentation.sharing.shares.ShareActivity
import com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareViewModel
import com.owncloud.android.presentation.ui.sharing.ShareActivity
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.utils.AccountsManager
import com.owncloud.android.utils.AppTestUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.common.accounts.AccountUtils
import com.owncloud.android.lib.common.operations.RemoteOperationResult
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.presentation.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.sharing.shares.OCShareViewModel
import com.owncloud.android.presentation.sharing.shares.ShareActivity
import com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareViewModel
import com.owncloud.android.presentation.ui.sharing.ShareActivity
import com.owncloud.android.ui.activity.FileActivity
import com.owncloud.android.utils.AccountsManager
import com.owncloud.android.utils.AppTestUtil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import androidx.test.platform.app.InstrumentationRegistry
import com.owncloud.android.data.DataResult
import com.owncloud.android.data.capabilities.db.OCCapabilityEntity
import com.owncloud.android.domain.capabilities.OCCapabilityRepository
import com.owncloud.android.presentation.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel
import com.owncloud.android.utils.AppTestUtil
import io.mockk.every
import io.mockk.mockkClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import com.owncloud.android.data.DataResult
import com.owncloud.android.domain.sharing.sharees.OCShareeRepository
import com.owncloud.android.lib.resources.shares.GetRemoteShareesOperation
import com.owncloud.android.lib.resources.shares.ShareType
import com.owncloud.android.presentation.sharing.sharees.OCShareeViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareeViewModel
import com.owncloud.android.utils.AppTestUtil
import io.mockk.every
import io.mockk.mockkClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import com.owncloud.android.data.sharing.shares.db.OCShareEntity
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.resources.shares.ShareType
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.presentation.sharing.sharees.SearchShareesFragment
import com.owncloud.android.presentation.ui.sharing.fragments.SearchShareesFragment
import com.owncloud.android.presentation.sharing.shares.views.TestShareFileActivity
import com.owncloud.android.utils.AppTestUtil
import io.mockk.every
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import com.owncloud.android.data.Status
import com.owncloud.android.data.sharing.shares.db.OCShareEntity
import com.owncloud.android.domain.sharing.shares.OCShareRepository
import com.owncloud.android.lib.resources.shares.ShareType
import com.owncloud.android.presentation.sharing.shares.OCShareViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareViewModel
import com.owncloud.android.utils.AppTestUtil
import io.mockk.every
import io.mockk.mockkClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@ import com.owncloud.android.R
import com.owncloud.android.data.capabilities.db.OCCapabilityEntity
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.resources.status.CapabilityBooleanType
import com.owncloud.android.presentation.sharing.shares.fragment.PublicShareDialogFragment
import com.owncloud.android.presentation.ui.sharing.fragments.PublicShareDialogFragment
import com.owncloud.android.utils.AppTestUtil
import com.owncloud.android.utils.DateUtils
import io.mockk.every
import io.mockk.mockkClass
import org.hamcrest.CoreMatchers.not
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import java.text.SimpleDateFormat
import java.util.Date

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import com.owncloud.android.R
import com.owncloud.android.data.sharing.shares.db.OCShareEntity
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.resources.shares.RemoteShare
import com.owncloud.android.presentation.sharing.shares.fragment.PublicShareDialogFragment
import com.owncloud.android.presentation.ui.sharing.fragments.PublicShareDialogFragment
import com.owncloud.android.utils.AppTestUtil
import io.mockk.every
import io.mockk.mockkClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.resources.shares.ShareType
import com.owncloud.android.lib.resources.status.CapabilityBooleanType
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.presentation.sharing.shares.fragment.ShareFileFragment
import com.owncloud.android.presentation.ui.sharing.fragments.ShareFileFragment
import com.owncloud.android.utils.AppTestUtil
import io.mockk.every
import io.mockk.mockkClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import androidx.test.rule.ActivityTestRule
import com.owncloud.android.R
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.presentation.sharing.shares.fragment.ShareFileFragment
import com.owncloud.android.presentation.ui.sharing.fragments.ShareFileFragment
import com.owncloud.android.utils.AppTestUtil
import io.mockk.every
import io.mockk.mockkClass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ package com.owncloud.android.presentation.sharing.shares.views
import com.owncloud.android.data.capabilities.db.OCCapabilityEntity
import com.owncloud.android.data.sharing.shares.db.OCShareEntity
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.presentation.sharing.sharees.SearchShareesFragment
import com.owncloud.android.presentation.sharing.shares.fragment.PublicShareDialogFragment
import com.owncloud.android.presentation.sharing.shares.fragment.ShareFileFragment
import com.owncloud.android.presentation.sharing.shares.fragment.ShareFragmentListener
import com.owncloud.android.presentation.ui.sharing.fragments.SearchShareesFragment
import com.owncloud.android.presentation.ui.sharing.fragments.PublicShareDialogFragment
import com.owncloud.android.presentation.ui.sharing.fragments.ShareFileFragment
import com.owncloud.android.presentation.ui.sharing.fragments.ShareFragmentListener
import com.owncloud.android.testing.SingleFragmentActivity

class TestShareFileActivity : SingleFragmentActivity(), ShareFragmentListener {
class TestShareFileActivity : SingleFragmentActivity(),
ShareFragmentListener {
lateinit var capabilities: OCCapabilityEntity
lateinit var privateShares: ArrayList<OCShareEntity>
lateinit var publicShares: ArrayList<OCShareEntity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.lib.common.accounts.AccountUtils
import com.owncloud.android.lib.resources.status.OwnCloudVersion
import com.owncloud.android.shares.domain.OCShare
import com.owncloud.android.shares.presentation.fragment.EditPrivateShareFragment
import com.owncloud.android.presentation.ui.sharing.fragments.EditPrivateShareFragment
import com.owncloud.android.utils.AccountsManager
import com.owncloud.android.utils.Permissions
import com.owncloud.android.utils.TestUtil
Expand Down
4 changes: 2 additions & 2 deletions owncloudApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
android:syncable="true"
/>
<provider
android:name="com.owncloud.android.presentation.sharing.sharees.UsersAndGroupsSearchProvider"
android:name="com.owncloud.android.presentation.providers.sharing.UsersAndGroupsSearchProvider"
android:authorities="@string/search_suggest_authority"
android:enabled="true"
android:exported="false"
Expand Down Expand Up @@ -247,7 +247,7 @@
<activity android:name=".ui.activity.LocalFolderPickerActivity" />
<activity android:name=".ui.activity.UploadPathActivity" />
<activity
android:name="com.owncloud.android.presentation.sharing.shares.ShareActivity"
android:name="com.owncloud.android.presentation.ui.sharing.ShareActivity"
android:label="@string/share_dialog_title"
android:launchMode="singleTop"
android:theme="@style/Theme.ownCloud"
Expand Down
17 changes: 12 additions & 5 deletions owncloudApp/src/main/java/com/owncloud/android/MainApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ import com.owncloud.android.lib.common.authentication.oauth.OAuth2ClientConfigur
import com.owncloud.android.lib.common.authentication.oauth.OAuth2ProvidersRegistry
import com.owncloud.android.lib.common.authentication.oauth.OwnCloudOAuth2Provider
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.presentation.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.sharing.sharees.OCShareeViewModel
import com.owncloud.android.presentation.sharing.shares.OCShareViewModel
import com.owncloud.android.presentation.viewmodels.capabilities.OCCapabilityViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareeViewModel
import com.owncloud.android.presentation.viewmodels.sharing.OCShareViewModel
import com.owncloud.android.ui.activity.FingerprintActivity
import com.owncloud.android.ui.activity.PassCodeActivity
import com.owncloud.android.ui.activity.PatternLockActivity
Expand Down Expand Up @@ -162,15 +162,22 @@ class MainApp : Application() {

val viewModelModule = module {
viewModel { (filePath: String, account: Account) ->
OCShareViewModel(filePath, androidContext(), account)
OCShareViewModel(
filePath,
androidContext(),
account
)
}

viewModel { (account: Account) ->
OCShareeViewModel(androidContext(), account)
}

viewModel { (account: Account) ->
OCCapabilityViewModel(androidContext(), account)
OCCapabilityViewModel(
androidContext(),
account
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ enum class OperationType {
CREATE_SHARE_WITH_SHAREES,
CREATE_PUBLIC_SHARE,
UPDATE_SHARE,
UPDATE_PUBLIC_SHARE,
REMOVE_SHARE,

// FILES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ data class UIResult<out T>(
LOADING,
ERROR
}

fun isLoading(): Boolean = (status == Status.LOADING)
fun isSuccess(): Boolean = (status == Status.SUCCESS)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.owncloud.android.shares.presentation
package com.owncloud.android.presentation.adapters.sharing

/**
* ownCloud Android client application
Expand Down Expand Up @@ -40,16 +40,16 @@ import java.util.ArrayList
class SharePublicLinkListAdapter(
private val mContext: Context,
resource: Int,
private var publicLinks: ArrayList<OCShare>?,
private var publicLinks: ArrayList<OCShareEntity>?,
private val listener: SharePublicLinkAdapterListener
) : ArrayAdapter<OCShare>(mContext, resource) {
) : ArrayAdapter<OCShareEntity>(mContext, resource) {
init {
publicLinks = ArrayList(publicLinks?.sortedWith(compareBy { it.name }))
}

override fun getCount(): Int = publicLinks?.size ?: 0

override fun getItem(position: Int): OCShare? = publicLinks!![position]
override fun getItem(position: Int): OCShareEntity? = publicLinks!![position]

override fun getItemId(position: Int): Long = 0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package com.owncloud.android.presentation.sharing.sharees
package com.owncloud.android.presentation.adapters.sharing

import android.content.Context
import android.view.LayoutInflater
Expand Down
Loading

0 comments on commit 2f069ea

Please sign in to comment.