Skip to content

Commit ae9b877

Browse files
committed
Merge branch 'hotfix/5.207.1'
2 parents ea20305 + 7e5f80e commit ae9b877

File tree

7 files changed

+12
-97
lines changed

7 files changed

+12
-97
lines changed

app/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,8 @@ dependencies {
437437
androidTestImplementation "androidx.test.ext:junit-ktx:_"
438438
androidTestImplementation "androidx.test.espresso:espresso-core:_"
439439
androidTestImplementation "androidx.test.espresso:espresso-web:_"
440-
androidTestImplementation project(':feature-toggles-test')
441440

442441
testImplementation project(':vpn-api-test')
443-
testImplementation project(':feature-toggles-test')
444442
testImplementation "org.mockito.kotlin:mockito-kotlin:_"
445443
testImplementation Testing.junit4
446444
testImplementation AndroidX.archCore.testing

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

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ import com.duckduckgo.common.utils.device.DeviceInfo
167167
import com.duckduckgo.downloads.api.DownloadStateListener
168168
import com.duckduckgo.downloads.api.FileDownloader
169169
import com.duckduckgo.downloads.api.FileDownloader.PendingFileDownload
170-
import com.duckduckgo.feature.toggles.api.FakeFeatureToggleFactory
171-
import com.duckduckgo.feature.toggles.api.FakeToggleStore
172170
import com.duckduckgo.feature.toggles.api.FeatureToggle
173171
import com.duckduckgo.feature.toggles.api.Toggle
174172
import com.duckduckgo.history.api.HistoryEntry.VisitedPage
@@ -474,7 +472,6 @@ class BrowserTabViewModelTest {
474472
private val mockUserBrowserProperties: UserBrowserProperties = mock()
475473
private val mockAutoCompleteRepository: AutoCompleteRepository = mock()
476474
private val commandActionMapper: CommandActionMapper = mock()
477-
private val newStateKillSwitch = FakeFeatureToggleFactory.create(NewStateKillSwitch::class.java, FakeToggleStore())
478475

479476
@Before
480477
fun before() {
@@ -557,7 +554,7 @@ class BrowserTabViewModelTest {
557554
whenever(fireproofDialogsEventHandler.event).thenReturn(fireproofDialogsEventHandlerLiveData)
558555
whenever(cameraHardwareChecker.hasCameraHardware()).thenReturn(true)
559556
whenever(mockPrivacyProtectionsPopupManager.viewState).thenReturn(flowOf(PrivacyProtectionsPopupViewState.Gone))
560-
newStateKillSwitch.self().setEnabled(Toggle.State(true))
557+
561558
testee = BrowserTabViewModel(
562559
statisticsUpdater = mockStatisticsUpdater,
563560
queryUrlConverter = mockOmnibarConverter,
@@ -622,7 +619,6 @@ class BrowserTabViewModelTest {
622619
userBrowserProperties = mockUserBrowserProperties,
623620
history = mockNavigationHistory,
624621
commandActionMapper = commandActionMapper,
625-
newStateKillSwitch = newStateKillSwitch,
626622
)
627623

628624
testee.loadData("abc", null, false)
@@ -5349,39 +5345,6 @@ class BrowserTabViewModelTest {
53495345
verify(mockPixel).fire(OnboardingExperimentPixel.PixelName.ONBOARDING_VISIT_SITE_CUSTOM)
53505346
}
53515347

5352-
@Test
5353-
fun whenNavigationStateUnchangedButDifferentUrlThenUpdateUrl() {
5354-
val httpUrl = "http://example.com/"
5355-
val httpsUrl = "https://example.com/"
5356-
loadUrl(httpsUrl, isBrowserShowing = true)
5357-
assertEquals(httpsUrl, testee.url)
5358-
assertEquals(httpsUrl, omnibarViewState().omnibarText)
5359-
testee.siteLiveData.value?.url = httpUrl
5360-
assertEquals(httpUrl, testee.siteLiveData.value?.url)
5361-
5362-
updateUrl(httpsUrl, httpsUrl, true)
5363-
assertEquals(httpsUrl, testee.url)
5364-
assertEquals(httpsUrl, testee.siteLiveData.value?.url)
5365-
assertEquals(httpsUrl, omnibarViewState().omnibarText)
5366-
}
5367-
5368-
@Test
5369-
fun whenNavigationStateUnchangedButDifferentUrlAndFeatureDisableThenDoNotUpdateUrl() {
5370-
newStateKillSwitch.self().setEnabled(Toggle.State(false))
5371-
val httpUrl = "http://example.com/"
5372-
val httpsUrl = "https://example.com/"
5373-
loadUrl(httpsUrl, isBrowserShowing = true)
5374-
assertEquals(httpsUrl, testee.url)
5375-
assertEquals(httpsUrl, omnibarViewState().omnibarText)
5376-
testee.siteLiveData.value?.url = httpUrl
5377-
assertEquals(httpUrl, testee.siteLiveData.value?.url)
5378-
5379-
updateUrl(httpsUrl, httpsUrl, true)
5380-
assertEquals(httpUrl, testee.url)
5381-
assertEquals(httpUrl, testee.siteLiveData.value?.url)
5382-
assertEquals(httpsUrl, omnibarViewState().omnibarText)
5383-
}
5384-
53855348
private fun aCredential(): LoginCredentials {
53865349
return LoginCredentials(domain = null, username = null, password = null)
53875350
}

app/src/main/java/com/duckduckgo/app/browser/BrowserTabViewModel.kt

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ class BrowserTabViewModel @Inject constructor(
269269
private val userBrowserProperties: UserBrowserProperties,
270270
private val history: NavigationHistory,
271271
private val commandActionMapper: CommandActionMapper,
272-
private val newStateKillSwitch: NewStateKillSwitch,
273272
) : WebViewClientListener,
274273
EditSavedSiteListener,
275274
DeleteBookmarkListener,
@@ -1094,16 +1093,7 @@ class BrowserTabViewModel @Inject constructor(
10941093
is WebNavigationStateChange.PageCleared -> pageCleared()
10951094
is WebNavigationStateChange.UrlUpdated -> urlUpdated(stateChange.url)
10961095
is WebNavigationStateChange.PageNavigationCleared -> disableUserNavigation()
1097-
is WebNavigationStateChange.Unchanged -> {
1098-
stateChange.url?.let {
1099-
updateWhenInputUrlIsDifferentThanLoadedUrl(it)
1100-
}
1101-
}
1102-
is WebNavigationStateChange.Other -> {
1103-
stateChange.url?.let {
1104-
updateWhenInputUrlIsDifferentThanLoadedUrl(it)
1105-
}
1106-
}
1096+
else -> {}
11071097
}
11081098

11091099
if ((newWebNavigationState.progress ?: 0) >= SHOW_CONTENT_MIN_PROGRESS) {
@@ -1112,12 +1102,6 @@ class BrowserTabViewModel @Inject constructor(
11121102
navigationAwareLoginDetector.onEvent(NavigationEvent.WebNavigationEvent(stateChange))
11131103
}
11141104

1115-
private fun updateWhenInputUrlIsDifferentThanLoadedUrl(loadedUrl: String) {
1116-
if (newStateKillSwitch.self().isEnabled() && loadedUrl != site?.url) {
1117-
urlUpdated(loadedUrl)
1118-
}
1119-
}
1120-
11211105
override fun onPageContentStart(url: String) {
11221106
showWebContent()
11231107
}

app/src/main/java/com/duckduckgo/app/browser/NewStateKillSwitch.kt

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

app/src/main/java/com/duckduckgo/app/browser/WebNavigationState.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ sealed class WebNavigationStateChange {
4141

4242
data class UrlUpdated(val url: String) : WebNavigationStateChange()
4343
object PageCleared : WebNavigationStateChange()
44-
data class Unchanged(val url: String?) : WebNavigationStateChange()
44+
object Unchanged : WebNavigationStateChange()
4545
object PageNavigationCleared : WebNavigationStateChange()
46-
data class Other(val url: String?) : WebNavigationStateChange()
46+
object Other : WebNavigationStateChange()
4747
}
4848

4949
fun WebNavigationState.compare(previous: WebNavigationState?): WebNavigationStateChange {
5050
if (this == previous) {
51-
return WebNavigationStateChange.Unchanged(currentUrl)
51+
return WebNavigationStateChange.Unchanged
5252
}
5353

5454
if (this is EmptyNavigationState) {
@@ -59,7 +59,7 @@ fun WebNavigationState.compare(previous: WebNavigationState?): WebNavigationStat
5959
return WebNavigationStateChange.PageCleared
6060
}
6161

62-
val latestUrl = currentUrl ?: return WebNavigationStateChange.Other(null)
62+
val latestUrl = currentUrl ?: return WebNavigationStateChange.Other
6363

6464
// A new page load is identified by the original url changing
6565
if (originalUrl != previous?.originalUrl) {
@@ -76,7 +76,7 @@ fun WebNavigationState.compare(previous: WebNavigationState?): WebNavigationStat
7676
return WebNavigationStateChange.UrlUpdated(latestUrl)
7777
}
7878

79-
return WebNavigationStateChange.Other(currentUrl)
79+
return WebNavigationStateChange.Other
8080
}
8181

8282
data class WebViewNavigationState(

app/src/test/java/com/duckduckgo/app/browser/WebNavigationStateComparisonTest.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ class WebNavigationStateComparisonTest {
3333
@Test
3434
fun whenPreviousStateAndLatestStateSameThenCompareReturnsUnchanged() {
3535
val state = buildState("http://foo.com", "http://subdomain.foo.com")
36-
assertEquals(Unchanged("http://subdomain.foo.com"), state.compare(state))
36+
assertEquals(Unchanged, state.compare(state))
3737
}
3838

3939
@Test
4040
fun whenPreviousStateAndLatestStateEqualThenCompareReturnsUnchanged() {
4141
val previousState = buildState("http://foo.com", "http://subdomain.foo.com")
4242
val latestState = buildState("http://foo.com", "http://subdomain.foo.com")
43-
assertEquals(Unchanged("http://subdomain.foo.com"), latestState.compare(previousState))
43+
assertEquals(Unchanged, latestState.compare(previousState))
4444
}
4545

4646
@Test
@@ -124,14 +124,14 @@ class WebNavigationStateComparisonTest {
124124
fun whenPreviousContainsAnOriginalUrlAndCurrentUrlAndLatestContainsSameOriginalUrlAndNoCurrentUrlThenCompareReturnsOther() {
125125
val previousState = buildState("http://same.com", "http://subdomain.previous.com")
126126
val latestState = buildState("http://same.com", null)
127-
assertEquals(Other(null), latestState.compare(previousState))
127+
assertEquals(Other, latestState.compare(previousState))
128128
}
129129

130130
@Test
131131
fun whenPreviousContainsAnOriginalUrlAndCurrentUrlAndLatestStateContainsDifferentOriginalUrlAndNoCurrentUrlThenCompareReturnsOther() {
132132
val previousState = buildState("http://previous.com", "http://subdomain.previous.com")
133133
val latestState = buildState("http://latest.com", null)
134-
assertEquals(Other(null), latestState.compare(previousState))
134+
assertEquals(Other, latestState.compare(previousState))
135135
}
136136

137137
private fun buildState(

app/version/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION=5.207.0
1+
VERSION=5.207.1

0 commit comments

Comments
 (0)