Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ buildscript {
coroutinesVersion = "1.6.1"

// Koin
koinVersion = '2.1.6'
koinVersion = '3.1.6'

// Testing
mockkVersion = '1.12.3'
Expand Down
4 changes: 2 additions & 2 deletions owncloudApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
// Dependencies for app building
implementation "androidx.legacy:legacy-support-v4:$androidX"
implementation "androidx.annotation:annotation:1.3.0"
implementation 'com.google.android.material:material:1.4.0'
implementation 'com.google.android.material:material:1.5.0'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'com.google.android.exoplayer:exoplayer:2.16.1'
implementation 'com.github.aritraroy.PatternLockView:patternlockview:a90b0d4bf0'
Expand Down Expand Up @@ -46,7 +46,7 @@ dependencies {

// Koin dependency injector
implementation "io.insert-koin:koin-core:$koinVersion"
implementation "io.insert-koin:koin-androidx-viewmodel:$koinVersion"
implementation "io.insert-koin:koin-androidx-workmanager:$koinVersion"

// WorkManager
implementation "androidx.work:work-runtime-ktx:2.7.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ class LoginActivityTest {

startKoin {
context
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
ocAuthenticationViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ class LogsListActivityTest {
stopKoin()

startKoin {
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
logListViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,17 @@ class SettingsFragmentTest {
@Before
fun setUp() {
context = InstrumentationRegistry.getInstrumentation().targetContext
settingsViewModel = mockk(relaxUnitFun = true)
moreViewModel = mockk(relaxUnitFun = true)
releaseNotesViewModel = mockk(relaxUnitFun = true)
settingsViewModel = mockk(relaxed = true)
moreViewModel = mockk(relaxed = true)
releaseNotesViewModel = mockk(relaxed = true)

stopKoin()

startKoin {
context
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
settingsViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ class SettingsAdvancedFragmentTest {
@Before
fun setUp() {
context = InstrumentationRegistry.getInstrumentation().targetContext
advancedViewModel = mockk(relaxUnitFun = true)
advancedViewModel = mockk(relaxed = true)

stopKoin()

startKoin {
context
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
advancedViewModel
}
Expand Down Expand Up @@ -105,4 +106,4 @@ class SettingsAdvancedFragmentTest {

prefShowHiddenFiles?.isChecked?.let { assertFalse(it) }
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,16 @@ class SettingsLogsFragmentTest {
@Before
fun setUp() {
context = InstrumentationRegistry.getInstrumentation().targetContext
logsViewModel = mockk(relaxUnitFun = true)
logsViewModel = mockk(relaxed = true)
logListViewModel = mockk(relaxed = true)

stopKoin()

startKoin {
context
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
logsViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ class SettingsMoreFragmentTest {
@Before
fun setUp() {
context = InstrumentationRegistry.getInstrumentation().targetContext
moreViewModel = mockk(relaxUnitFun = true)
moreViewModel = mockk(relaxed = true)

stopKoin()

startKoin {
context
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
moreViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,21 @@ class PassCodeActivityTest {
@Before
fun setUp() {
context = ApplicationProvider.getApplicationContext()
passCodeViewModel = mockk(relaxUnitFun = true)
biometricViewModel = mockk(relaxUnitFun = true)
passCodeViewModel = mockk(relaxed = true)
biometricViewModel = mockk(relaxed = true)

timeToUnlockLiveData = MutableLiveData()
finishTimeToUnlockLiveData = MutableLiveData()
statusLiveData = MutableLiveData()
passcodeLiveData = MutableLiveData()


stopKoin()

startKoin {
allowOverride(override = true)
context
modules(
module(override = true) {
module {
viewModel {
passCodeViewModel
}
Expand All @@ -107,7 +107,6 @@ class PassCodeActivityTest {
every { passCodeViewModel.getFinishedTimeToUnlockLiveData } returns finishTimeToUnlockLiveData
every { passCodeViewModel.status } returns statusLiveData
every { passCodeViewModel.passcode } returns passcodeLiveData

}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ class PatternActivityTest {

startKoin {
context
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
patternViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import com.owncloud.android.R
import com.owncloud.android.presentation.ui.security.BiometricActivity
import com.owncloud.android.presentation.ui.security.BiometricManager
import com.owncloud.android.presentation.ui.security.PREFERENCE_LOCK_TIMEOUT
import com.owncloud.android.presentation.ui.security.passcode.PassCodeActivity
import com.owncloud.android.presentation.ui.security.PatternActivity
import com.owncloud.android.presentation.ui.security.passcode.PassCodeActivity
import com.owncloud.android.presentation.ui.settings.fragments.SettingsSecurityFragment
import com.owncloud.android.presentation.ui.settings.fragments.SettingsSecurityFragment.Companion.PREFERENCE_LOCK_ACCESS_FROM_DOCUMENT_PROVIDER
import com.owncloud.android.presentation.viewmodels.settings.SettingsSecurityViewModel
Expand Down Expand Up @@ -84,16 +84,17 @@ class SettingsSecurityFragmentTest {
@Before
fun setUp() {
context = InstrumentationRegistry.getInstrumentation().targetContext
securityViewModel = mockk(relaxUnitFun = true)
biometricViewModel = mockk(relaxUnitFun = true)
securityViewModel = mockk(relaxed = true)
biometricViewModel = mockk(relaxed = true)
mockkObject(BiometricManager)

stopKoin()

startKoin {
context
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
securityViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ class SearchShareesFragmentTest {

startKoin {
androidContext(ApplicationProvider.getApplicationContext())
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
ocShareViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ class EditPrivateShareFragmentTest {

startKoin {
androidContext(ApplicationProvider.getApplicationContext())
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
ocShareViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ class PublicShareCreationDialogFragmentTest {

startKoin {
androidContext(ApplicationProvider.getApplicationContext())
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
ocCapabilityViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,13 @@ class PublicShareEditionDialogFragmentTest {
fun setUp() {
every { ocCapabilityViewModel.capabilities } returns capabilitiesLiveData

val publicShareDialogFragment = PublicShareDialogFragment.newInstanceToUpdate(
OC_FILE,
OC_ACCOUNT,
OC_SHARE.copy(
shareType = ShareType.PUBLIC_LINK,
shareWith = "user",
name = "Docs link",
permissions = RemoteShare.CREATE_PERMISSION_FLAG,
expirationDate = expirationDate,
isFolder = true
)
)

stopKoin()

startKoin {
androidContext(ApplicationProvider.getApplicationContext())
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
ocCapabilityViewModel
}
Expand All @@ -97,6 +85,19 @@ class PublicShareEditionDialogFragmentTest {
)
}

val publicShareDialogFragment = PublicShareDialogFragment.newInstanceToUpdate(
OC_FILE,
OC_ACCOUNT,
OC_SHARE.copy(
shareType = ShareType.PUBLIC_LINK,
shareWith = "user",
name = "Docs link",
permissions = RemoteShare.CREATE_PERMISSION_FLAG,
expirationDate = expirationDate,
isFolder = true
)
)

ActivityScenario.launch(TestShareFileActivity::class.java).onActivity {
it.startFragment(publicShareDialogFragment)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ class ShareFileFragmentTest {

startKoin {
androidContext(ApplicationProvider.getApplicationContext())
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
ocCapabilityViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ class ShareFolderFragmentTest {

startKoin {
androidContext(ApplicationProvider.getApplicationContext())
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
ocCapabilityViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ import androidx.test.core.app.ActivityScenario
import androidx.test.core.app.ApplicationProvider
import com.owncloud.android.R
import com.owncloud.android.presentation.ui.releasenotes.ReleaseNotesActivity
import com.owncloud.android.utils.releaseNotesList
import com.owncloud.android.presentation.viewmodels.releasenotes.ReleaseNotesViewModel
import com.owncloud.android.utils.click
import com.owncloud.android.utils.matchers.assertChildCount
import com.owncloud.android.utils.matchers.isDisplayed
import com.owncloud.android.utils.matchers.withText
import com.owncloud.android.utils.releaseNotesList
import io.mockk.every
import io.mockk.mockk
import org.junit.Assert.assertEquals
Expand All @@ -51,14 +51,15 @@ class ReleaseNotesActivityTest {
@Before
fun setUp() {
context = ApplicationProvider.getApplicationContext()
releaseNotesViewModel = mockk(relaxUnitFun = true)
releaseNotesViewModel = mockk(relaxed = true)

stopKoin()

startKoin {
context
allowOverride(override = true)
modules(
module(override = true) {
module {
viewModel {
releaseNotesViewModel
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import com.owncloud.android.presentation.UIResult
import com.owncloud.android.providers.ContextProvider
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.launch
import org.koin.core.KoinComponent
import org.koin.core.inject
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
import timber.log.Timber

object ViewModelExt : KoinComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import com.owncloud.android.presentation.manager.AvatarManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import org.koin.core.KoinComponent
import org.koin.core.inject
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
import timber.log.Timber

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import com.owncloud.android.domain.user.model.UserAvatar
import com.owncloud.android.domain.user.usecases.GetUserAvatarAsyncUseCase
import com.owncloud.android.ui.DefaultAvatarTextDrawable
import com.owncloud.android.utils.BitmapUtils
import org.koin.core.KoinComponent
import org.koin.core.component.KoinComponent
import org.koin.core.error.InstanceCreationException
import org.koin.core.inject
import org.koin.core.component.inject
import timber.log.Timber
import kotlin.math.roundToInt

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.koin.core.KoinComponent
import org.koin.core.inject
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject

class AvatarUtils : KoinComponent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ import com.owncloud.android.usecases.UploadFileFromContentUriUseCase
import com.owncloud.android.utils.MimetypeIconUtil
import com.owncloud.android.utils.NotificationUtils
import com.owncloud.android.utils.UPLOAD_NOTIFICATION_CHANNEL_ID
import org.koin.core.KoinComponent
import org.koin.core.inject
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject

import timber.log.Timber
import java.io.File
Expand Down
Loading