Skip to content

Commit f679a47

Browse files
authored
Revert "Fix url detector intent detection logic (#6687)" (#6737)
Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1211244094852883?focus=true ### Description - Reverts #6687 ### Steps to test this PR - [x] Go to https://www.tiktok.com/@jackuk02/video/7535539219154980118 - [x] Verify that the link loads correctly (does not loop)
1 parent 76f6d5b commit f679a47

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,6 @@ class SpecialUrlDetectorImpl(
195195
private fun buildIntent(uriString: String, intentFlags: Int): UrlType {
196196
return try {
197197
val intent = Intent.parseUri(uriString, intentFlags)
198-
// only proceed if something can handle it
199-
if (intent == null || packageManager.resolveActivity(intent, 0) == null) {
200-
return UrlType.Unknown(uriString)
201-
}
202198

203199
if (externalAppIntentFlagsFeature.self().isEnabled()) {
204200
intent.addCategory(Intent.CATEGORY_BROWSABLE)

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,26 +293,15 @@ class SpecialUrlDetectorImplTest {
293293
@Test
294294
fun whenUrlIsCustomUriSchemeThenNonHttpAppLinkTypeDetectedWithAdditionalIntentFlags() {
295295
externalAppIntentFlagsFeature.self().setRawStoredState(State(true))
296-
whenever(mockPackageManager.resolveActivity(any(), anyInt())).thenReturn(ResolveInfo())
297296
val type = testee.determineType("myapp:foo bar") as NonHttpAppLink
298297
assertEquals("myapp:foo bar", type.uriString)
299298
assertEquals(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP, type.intent.flags)
300299
assertEquals(Intent.CATEGORY_BROWSABLE, type.intent.categories.first())
301300
}
302301

303-
@Test
304-
fun whenUrlIsCustomUriSchemeAndNoResolveInfoThenUnknownTypeDetected() {
305-
externalAppIntentFlagsFeature.self().setRawStoredState(State(true))
306-
whenever(mockPackageManager.resolveActivity(any(), anyInt())).thenReturn(null)
307-
val expected = Unknown::class
308-
val actual = testee.determineType("myapp:foo bar")
309-
assertEquals(expected, actual::class)
310-
}
311-
312302
@Test
313303
fun whenUrlIsCustomUriSchemeThenNonHttpAppLinkTypeDetectedWithoutAdditionalIntentFlags() {
314304
externalAppIntentFlagsFeature.self().setRawStoredState(State(false))
315-
whenever(mockPackageManager.resolveActivity(any(), anyInt())).thenReturn(ResolveInfo())
316305
val type = testee.determineType("myapp:foo bar") as NonHttpAppLink
317306
assertEquals("myapp:foo bar", type.uriString)
318307
assertEquals(0, type.intent.flags)

0 commit comments

Comments
 (0)