Skip to content

Commit a785ce2

Browse files
committed
Merge branch 'release/5.79.0' into main
2 parents 642ffab + 37650af commit a785ce2

File tree

67 files changed

+391
-730
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+391
-730
lines changed

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

TRANSLATIONS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Thank you for taking the time to contribute to DuckDuckGo! :sparkles:
33

44
If you know any of the following languages and would like to help us improve the translations for them, please follow the instructions below.
55

6+
⚠️ We only accept translations tweaks that fix actual issues (typos, grammatical errors) and won't accept minor changes that are only focused on tweaking the wording.
7+
68
## List of languages
79
1. Bulgarian (bg)
810
1. Croatian (hr)
@@ -34,7 +36,7 @@ If you know any of the following languages and would like to help us improve the
3436
1. Each language has a [`values`](https://github.com/duckduckgo/Android/tree/develop/app/src/main/res) directory containing the language code, and the `strings.xml` file contains the translations. Examples:
3537
- Italian translation files are located within `app/src/main/res/values-it/strings.xml`
3638
- Spanish translation files are located within `app/src/main/res/values-es/strings.xml`
37-
1. If you notice anything which could be improved, you should create a PR containing the improved language suggestions.
39+
1. If you notice anything which should be fixed, you should create a PR containing the improved language suggestions.
3840
1. Make the changes to the relevant `strings.xml` file
3941
1. Test the app in the language you've improved, and ensure the changed strings look good
4042
1. Create a PR. As well as the changes themselves, explaining _why_ the changes are an improvement helps a lot.

app/src/androidTest/java/com/duckduckgo/app/browser/BrowserTabViewModelTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ class BrowserTabViewModelTest {
553553
testee.onUserSubmittedQuery("foo")
554554

555555
coroutineRule.runBlocking {
556-
verify(mockTabsRepository).delete(selectedTabLiveData.value!!)
556+
verify(mockTabsRepository).deleteTabAndSelectSource(selectedTabLiveData.value!!.tabId)
557557
}
558558
}
559559

@@ -1218,7 +1218,7 @@ class BrowserTabViewModelTest {
12181218
testee.onRefreshRequested()
12191219

12201220
coroutineRule.runBlocking {
1221-
verify(mockTabsRepository).delete(selectedTabLiveData.value!!)
1221+
verify(mockTabsRepository).deleteTabAndSelectSource(selectedTabLiveData.value!!.tabId)
12221222
}
12231223
}
12241224

@@ -1519,7 +1519,7 @@ class BrowserTabViewModelTest {
15191519
showErrorWithAction.action()
15201520

15211521
coroutineRule.runBlocking {
1522-
verify(mockTabsRepository).delete(selectedTabLiveData.value!!)
1522+
verify(mockTabsRepository).deleteTabAndSelectSource(selectedTabLiveData.value!!.tabId)
15231523
}
15241524
}
15251525

@@ -1691,7 +1691,7 @@ class BrowserTabViewModelTest {
16911691
fun whenCloseCurrentTabSelectedThenTabDeletedFromRepository() = runBlocking {
16921692
givenOneActiveTabSelected()
16931693
testee.closeCurrentTab()
1694-
verify(mockTabsRepository).delete(selectedTabLiveData.value!!)
1694+
verify(mockTabsRepository).deleteTabAndSelectSource(selectedTabLiveData.value!!.tabId)
16951695
}
16961696

16971697
@Test
@@ -1723,7 +1723,7 @@ class BrowserTabViewModelTest {
17231723

17241724
testee.onUserPressedBack()
17251725

1726-
verify(mockTabsRepository).deleteCurrentTabAndSelectSource()
1726+
verify(mockTabsRepository).deleteTabAndSelectSource("TAB_ID")
17271727
}
17281728

17291729
@Test

app/src/androidTest/java/com/duckduckgo/app/browser/logindetection/BrowserTabFireproofDialogsEventHandlerTest.kt

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import com.duckduckgo.app.global.events.db.UserEventsStore
3232
import com.duckduckgo.app.pixels.AppPixelName
3333
import com.duckduckgo.app.runBlocking
3434
import com.duckduckgo.app.settings.db.SettingsDataStore
35-
import com.duckduckgo.app.statistics.Variant
3635
import com.duckduckgo.app.statistics.VariantManager
3736
import com.duckduckgo.app.statistics.pixels.Pixel
3837
import com.nhaarman.mockitokotlin2.mock
@@ -168,17 +167,14 @@ class BrowserTabFireproofDialogsEventHandlerTest {
168167
}
169168

170169
@Test
171-
fun whenExpVariantUserDismissedFireproofLoginDialogwThenRegisterEvent() = coroutineRule.runBlocking {
172-
givenFireproofLoginExperimentEnabled()
173-
170+
fun whenUserDismissedFireproofLoginDialogThenRegisterEvent() = coroutineRule.runBlocking {
174171
testee.onUserDismissedFireproofLoginDialog()
175172

176173
verify(mockUserEventsStore).registerUserEvent(FIREPROOF_LOGIN_DIALOG_DISMISSED)
177174
}
178175

179176
@Test
180-
fun whenExpVariantUserDismissedFireproofLoginDialogTwiceInRowThenAskToDisableLoginDetection() = coroutineRule.runBlocking {
181-
givenFireproofLoginExperimentEnabled()
177+
fun whenUserDismissedFireproofLoginDialogTwiceInRowThenAskToDisableLoginDetection() = coroutineRule.runBlocking {
182178
givenUserPreviouslyDismissedDialog()
183179

184180
testee.onUserDismissedFireproofLoginDialog()
@@ -188,8 +184,7 @@ class BrowserTabFireproofDialogsEventHandlerTest {
188184
}
189185

190186
@Test
191-
fun whenExpVariantUserEnabledFireproofLoginDetectionThenNeverAskToDisableIt() = coroutineRule.runBlocking {
192-
givenFireproofLoginExperimentEnabled()
187+
fun whenUserEnabledFireproofLoginDetectionThenNeverAskToDisableIt() = coroutineRule.runBlocking {
193188
givenUserEnabledFireproofLoginDetection()
194189
givenUserPreviouslyDismissedDialog()
195190

@@ -200,8 +195,7 @@ class BrowserTabFireproofDialogsEventHandlerTest {
200195
}
201196

202197
@Test
203-
fun whenExpVariantUserDidNotDisableLoginDetectionThenNeverAskToDisableItAgain() = coroutineRule.runBlocking {
204-
givenFireproofLoginExperimentEnabled()
198+
fun whenUserDidNotDisableLoginDetectionThenNeverAskToDisableItAgain() = coroutineRule.runBlocking {
205199
givenUserDidNotDisableLoginDetection()
206200
givenUserPreviouslyDismissedDialog()
207201

@@ -294,16 +288,6 @@ class BrowserTabFireproofDialogsEventHandlerTest {
294288
.thenReturn(UserEventEntity(FIREPROOF_LOGIN_DIALOG_DISMISSED))
295289
}
296290

297-
private fun givenFireproofLoginExperimentEnabled() {
298-
whenever(mockVariantManager.getVariant()).thenReturn(
299-
Variant(
300-
key = "",
301-
features = listOf(VariantManager.VariantFeature.LoginDetectionEnabled),
302-
filterBy = { true }
303-
)
304-
)
305-
}
306-
307291
private suspend fun givenUserTriedFireButton() {
308292
whenever(mockUserEventsStore.getUserEvent(FIRE_BUTTON_EXECUTED)).thenReturn(UserEventEntity(FIRE_BUTTON_EXECUTED))
309293
}

app/src/androidTest/java/com/duckduckgo/app/statistics/VariantManagerTest.kt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,6 @@ class VariantManagerTest {
7777
}
7878
}
7979

80-
// Fireproof Login experiment
81-
@Test
82-
fun fireproofLoginDetectionControlVariantHasExpectedWeightAndFeatures() {
83-
val variant = variants.first { it.key == "zq" }
84-
assertEqualsDouble(1.0, variant.weight)
85-
assertEquals(0, variant.features.size)
86-
}
87-
88-
@Test
89-
fun fireproofLoginDetectionExperimentVariantHasExpectedWeightAndFeatures() {
90-
val variant = variants.first { it.key == "zw" }
91-
assertEqualsDouble(1.0, variant.weight)
92-
assertEquals(1, variant.features.size)
93-
assertEquals(LoginDetectionEnabled, variant.features[0])
94-
}
95-
9680
@Suppress("SameParameterValue")
9781
private fun assertEqualsDouble(expected: Double, actual: Double) {
9882
val comparison = expected.compareTo(actual)

app/src/androidTest/java/com/duckduckgo/app/tabs/model/TabDataRepositoryTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ class TabDataRepositoryTest {
320320
}
321321

322322
@Test
323-
fun whenDeleteCurrentTabAndSelectSourceLiveSelectedTabReturnsToSourceTab() = runBlocking<Unit> {
323+
fun whenDeleteTabAndSelectSourceLiveSelectedTabReturnsToSourceTab() = runBlocking<Unit> {
324324
val db = createDatabase()
325325
val dao = db.tabsDao()
326326
val sourceTab = TabEntity(tabId = "sourceId", url = "http://www.example.com", position = 0)
@@ -331,7 +331,7 @@ class TabDataRepositoryTest {
331331
var currentSelectedTabId = testee.liveSelectedTab.blockingObserve()?.tabId
332332
assertEquals(currentSelectedTabId, tabToDelete.tabId)
333333

334-
testee.deleteCurrentTabAndSelectSource()
334+
testee.deleteTabAndSelectSource("tabToDeleteId")
335335

336336
currentSelectedTabId = testee.liveSelectedTab.blockingObserve()?.tabId
337337
assertEquals(currentSelectedTabId, sourceTab.tabId)

app/src/main/java/com/duckduckgo/app/bookmarks/ui/BookmarksViewModel.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import dagger.multibindings.IntoSet
3737
import io.reactivex.schedulers.Schedulers
3838
import kotlinx.coroutines.NonCancellable
3939
import kotlinx.coroutines.launch
40+
import javax.inject.Provider
4041
import javax.inject.Singleton
4142

4243
class BookmarksViewModel(
@@ -127,23 +128,23 @@ class BookmarksViewModelFactoryModule {
127128
@Singleton
128129
@IntoSet
129130
fun provideBookmarksViewModelFactory(
130-
dao: BookmarksDao,
131-
faviconManager: FaviconManager,
132-
dispatcherProvider: DispatcherProvider
131+
dao: Provider<BookmarksDao>,
132+
faviconManager: Provider<FaviconManager>,
133+
dispatcherProvider: Provider<DispatcherProvider>
133134
): ViewModelFactoryPlugin {
134135
return BookmarksViewModelFactory(dao, faviconManager, dispatcherProvider)
135136
}
136137
}
137138

138139
private class BookmarksViewModelFactory(
139-
private val dao: BookmarksDao,
140-
private val faviconManager: FaviconManager,
141-
private val dispatcherProvider: DispatcherProvider
140+
private val dao: Provider<BookmarksDao>,
141+
private val faviconManager: Provider<FaviconManager>,
142+
private val dispatcherProvider: Provider<DispatcherProvider>
142143
) : ViewModelFactoryPlugin {
143144
override fun <T : ViewModel?> create(modelClass: Class<T>): T? {
144145
with(modelClass) {
145146
return when {
146-
isAssignableFrom(BookmarksViewModel::class.java) -> (BookmarksViewModel(dao, faviconManager, dispatcherProvider) as T)
147+
isAssignableFrom(BookmarksViewModel::class.java) -> (BookmarksViewModel(dao.get(), faviconManager.get(), dispatcherProvider.get()) as T)
147148
else -> null
148149
}
149150
}

app/src/main/java/com/duckduckgo/app/brokensite/BrokenSiteViewModel.kt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import com.squareup.anvil.annotations.ContributesTo
3535
import dagger.Module
3636
import dagger.Provides
3737
import dagger.multibindings.IntoSet
38+
import javax.inject.Provider
3839
import javax.inject.Singleton
3940

4041
class BrokenSiteViewModel(private val pixel: Pixel, private val brokenSiteSender: BrokenSiteSender) : ViewModel() {
@@ -134,21 +135,21 @@ class BrokenSiteViewModelFactoryModule {
134135
@Singleton
135136
@IntoSet
136137
fun provideBrokenSiteViewModelFactory(
137-
pixel: Pixel,
138-
brokenSiteSender: BrokenSiteSender
138+
pixel: Provider<Pixel>,
139+
brokenSiteSender: Provider<BrokenSiteSender>
139140
): ViewModelFactoryPlugin {
140141
return BrokenSiteViewModelFactory(pixel, brokenSiteSender)
141142
}
142143
}
143144

144145
private class BrokenSiteViewModelFactory(
145-
private val pixel: Pixel,
146-
private val brokenSiteSender: BrokenSiteSender
146+
private val pixel: Provider<Pixel>,
147+
private val brokenSiteSender: Provider<BrokenSiteSender>
147148
) : ViewModelFactoryPlugin {
148149
override fun <T : ViewModel?> create(modelClass: Class<T>): T? {
149150
with(modelClass) {
150151
return when {
151-
isAssignableFrom(BrokenSiteViewModel::class.java) -> (BrokenSiteViewModel(pixel, brokenSiteSender) as T)
152+
isAssignableFrom(BrokenSiteViewModel::class.java) -> (BrokenSiteViewModel(pixel.get(), brokenSiteSender.get()) as T)
152153
else -> null
153154
}
154155
}

0 commit comments

Comments
 (0)