Skip to content

Commit

Permalink
add flag to settings activity
Browse files Browse the repository at this point in the history
  • Loading branch information
mikescamell committed Nov 25, 2024
1 parent 1f4714c commit ef451b7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.core.view.isVisible
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.flowWithLifecycle
import androidx.lifecycle.lifecycleScope
import com.duckduckgo.anvil.annotations.ContributeToActivityStarter
import com.duckduckgo.anvil.annotations.InjectWith
import com.duckduckgo.app.about.AboutScreenNoParams
import com.duckduckgo.app.accessibility.AccessibilityScreens
Expand All @@ -49,7 +48,6 @@ import com.duckduckgo.appbuildconfig.api.AppBuildConfig
import com.duckduckgo.autoconsent.impl.ui.AutoconsentSettingsActivity
import com.duckduckgo.autofill.api.AutofillScreens.AutofillSettingsScreen
import com.duckduckgo.autofill.api.AutofillSettingsLaunchSource
import com.duckduckgo.browser.api.ui.BrowserScreens.NewSettingsScreenNoParams
import com.duckduckgo.common.ui.DuckDuckGoActivity
import com.duckduckgo.common.ui.view.gone
import com.duckduckgo.common.ui.view.listitem.CheckListItem
Expand All @@ -74,7 +72,6 @@ import kotlinx.coroutines.flow.onEach
import timber.log.Timber

@InjectWith(ActivityScope::class)
@ContributeToActivityStarter(NewSettingsScreenNoParams::class, screenName = "newSettings")
class NewSettingsActivity : DuckDuckGoActivity() {

private val viewModel: NewSettingsViewModel by bindViewModel()
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/duckduckgo/app/settings/SettingsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,28 @@ import android.os.Bundle
import com.duckduckgo.anvil.annotations.ContributeToActivityStarter
import com.duckduckgo.anvil.annotations.InjectWith
import com.duckduckgo.browser.api.ui.BrowserScreens.SettingsScreenNoParams
import com.duckduckgo.common.ui.DuckDuckGoActivity
import com.duckduckgo.di.scopes.ActivityScope
import com.duckduckgo.settings.api.NewSettingsFeature
import javax.inject.Inject

@InjectWith(ActivityScope::class)
@ContributeToActivityStarter(SettingsScreenNoParams::class, screenName = "settings")
class SettingsActivity : DuckDuckGoActivity() {

@Inject
lateinit var newSettingsFeature: NewSettingsFeature

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

if (newSettingsFeature.self().isEnabled()) {
startActivity(NewSettingsActivity.intent(this))
} else {
startActivity(LegacySettingsActivity.intent(this))
}
}

companion object {
const val LAUNCH_FROM_NOTIFICATION_PIXEL_NAME = "LAUNCH_FROM_NOTIFICATION_PIXEL_NAME"

Expand Down

0 comments on commit ef451b7

Please sign in to comment.