Skip to content

Commit

Permalink
Set report flow to form when launchiung hybrid site from the prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
CrisBarreiro committed Nov 27, 2024
1 parent d81c9a7 commit d8bdb6c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ import com.duckduckgo.autofill.api.domain.app.LoginTriggerType
import com.duckduckgo.autofill.api.emailprotection.EmailInjector
import com.duckduckgo.browser.api.WebViewVersionProvider
import com.duckduckgo.browser.api.brokensite.BrokenSiteData
import com.duckduckgo.browser.api.brokensite.BrokenSiteData.ReportFlow.PROMPT
import com.duckduckgo.common.ui.DuckDuckGoFragment
import com.duckduckgo.common.ui.store.BrowserAppTheme
import com.duckduckgo.common.ui.view.DaxDialog
Expand Down Expand Up @@ -272,6 +273,7 @@ import com.duckduckgo.navigation.api.GlobalActivityStarter
import com.duckduckgo.navigation.api.GlobalActivityStarter.DeeplinkActivityParams
import com.duckduckgo.privacy.dashboard.api.ui.PrivacyDashboardHybridScreenParams
import com.duckduckgo.privacy.dashboard.api.ui.PrivacyDashboardHybridScreenParams.BrokenSiteForm
import com.duckduckgo.privacy.dashboard.api.ui.PrivacyDashboardHybridScreenParams.BrokenSiteForm.BrokenSiteFormReportFlow
import com.duckduckgo.privacy.dashboard.api.ui.WebBrokenSiteForm
import com.duckduckgo.privacyprotectionspopup.api.PrivacyProtectionsPopup
import com.duckduckgo.privacyprotectionspopup.api.PrivacyProtectionsPopupFactory
Expand Down Expand Up @@ -1906,7 +1908,11 @@ class BrowserTabFragment :
val context = context ?: return

if (webBrokenSiteForm.shouldUseWebBrokenSiteForm()) {
globalActivityStarter.startIntent(context, BrokenSiteForm(tabId))
val reportFlow = when (data.reportFlow) {
PROMPT -> BrokenSiteFormReportFlow.PROMPT
else -> BrokenSiteFormReportFlow.MENU
}
globalActivityStarter.startIntent(context, BrokenSiteForm(tabId, reportFlow))
?.let { startActivity(it) }
} else {
val options = ActivityOptions.makeSceneTransitionAnimation(browserActivity).toBundle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,10 @@ sealed class PrivacyDashboardHybridScreenParams : GlobalActivityStarter.Activity
* Use this parameter to launch the site breakage reporting form.
* @param tabId The tab ID
*/
data class BrokenSiteForm(override val tabId: String) : PrivacyDashboardHybridScreenParams()
data class BrokenSiteForm(override val tabId: String, val reportFlow: BrokenSiteFormReportFlow) : PrivacyDashboardHybridScreenParams() {
enum class BrokenSiteFormReportFlow {
MENU,
PROMPT,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ class PrivacyDashboardHybridActivity : DuckDuckGoActivity() {
onSubmitBrokenSiteReport = { payload ->
val reportFlow = when (params) {
is PrivacyDashboardPrimaryScreen, null -> ReportFlow.DASHBOARD
is BrokenSiteForm -> ReportFlow.MENU
is BrokenSiteForm -> {
if ((params as BrokenSiteForm).reportFlow == BrokenSiteForm.BrokenSiteFormReportFlow.MENU) {
ReportFlow.MENU
} else {
ReportFlow.PROMPT
}
}
}
viewModel.onSubmitBrokenSiteReport(payload, reportFlow)
},
Expand Down

0 comments on commit d8bdb6c

Please sign in to comment.