Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mikescamell committed Nov 20, 2024
1 parent ad25ebd commit 16d4729
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ import com.duckduckgo.common.ui.view.listitem.TwoLineListItem
import com.duckduckgo.common.ui.viewbinding.viewBinding
import com.duckduckgo.common.utils.notification.checkPermissionAndNotify
import com.duckduckgo.di.scopes.ActivityScope
import javax.inject.Inject
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import javax.inject.Inject

@InjectWith(ActivityScope::class)
class NotificationsActivity : DuckDuckGoActivity() {
Expand Down Expand Up @@ -74,7 +74,6 @@ class NotificationsActivity : DuckDuckGoActivity() {
private fun render(viewState: ViewState) {
viewState.notificationItems.forEach { notificationItem ->
TwoLineListItem(this).apply {

setPrimaryText(notificationItem.title)
setSecondaryText(notificationItem.subtitle)
setOnClickListener {
Expand All @@ -88,7 +87,7 @@ class NotificationsActivity : DuckDuckGoActivity() {

private fun addNotification(
id: Int,
notification: Notification
notification: Notification,
) {
NotificationManagerCompat.from(this)
.checkPermissionAndNotify(context = this, id = id, notification = notification)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class NotificationViewModel @Inject constructor(
val id: Int,
val title: String,
val subtitle: String,
val notification: Notification
val notification: Notification,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ open class BrowserActivity : DuckDuckGoActivity() {
}

fun launchSettings() {
if(settings.isNewSettingsEnabled) {
if (settings.isNewSettingsEnabled) {
globalActivityStarter.start(this, NewSettingsScreenNoParams)
} else {
startActivity(SettingsActivity.intent(this))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import com.duckduckgo.app.settings.NewSettingsActivity
import com.duckduckgo.app.settings.SettingsActivity
import com.duckduckgo.appbuildconfig.api.AppBuildConfig
import com.duckduckgo.appbuildconfig.api.isInternalBuild
import com.duckduckgo.browser.api.ui.BrowserScreens.NewSettingsScreenNoParams
import com.duckduckgo.common.ui.themepreview.ui.AppComponentsActivity
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.di.scopes.AppScope
Expand Down Expand Up @@ -142,9 +141,9 @@ class AppShortcutCreator @Inject constructor(

private fun buildAndroidDesignSystemShortcut(context: Context): ShortcutInfo {
val browserActivity = BrowserActivity.intent(context).also { it.action = Intent.ACTION_VIEW }
val settingsActivity = if(settings.isNewSettingsEnabled) {
val settingsActivity = if (settings.isNewSettingsEnabled) {
NewSettingsActivity.intent(context).also { it.action = Intent.ACTION_VIEW }
}else {
} else {
SettingsActivity.intent(context).also { it.action = Intent.ACTION_VIEW }
}
val adsActivity = AppComponentsActivity.intent(context).also { it.action = Intent.ACTION_VIEW }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import com.duckduckgo.app.statistics.pixels.Pixel
import com.duckduckgo.browser.api.ui.BrowserScreens.NewSettingsScreenNoParams
import com.duckduckgo.common.utils.DispatcherProvider
import com.duckduckgo.di.scopes.AppScope
import com.duckduckgo.mobile.android.R as CommonR
import com.duckduckgo.navigation.api.GlobalActivityStarter
import com.duckduckgo.settings.api.Settings
import com.duckduckgo.mobile.android.R as CommonR
import com.squareup.anvil.annotations.ContributesMultibinding
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import timber.log.Timber


@InjectWith(ActivityScope::class)
@ContributeToActivityStarter(NewSettingsScreenNoParams::class, screenName = "newSettings")
class NewSettingsActivity : DuckDuckGoActivity() {
Expand Down Expand Up @@ -271,7 +270,9 @@ class NewSettingsActivity : DuckDuckGoActivity() {
viewsPrivacy.cookiePopupProtectionSetting.setSecondaryText(getString(com.duckduckgo.app.browser.R.string.cookiePopupProtectionEnabled))
viewsPrivacy.cookiePopupProtectionSetting.setItemStatus(CheckListItem.CheckItemStatus.ENABLED)
} else {
viewsPrivacy.cookiePopupProtectionSetting.setSecondaryText(getString(com.duckduckgo.app.browser.R.string.cookiePopupProtectionDescription))
viewsPrivacy.cookiePopupProtectionSetting.setSecondaryText(
getString(com.duckduckgo.app.browser.R.string.cookiePopupProtectionDescription),
)
viewsPrivacy.cookiePopupProtectionSetting.setItemStatus(CheckListItem.CheckItemStatus.DISABLED)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ class TabSwitcherActivity : DuckDuckGoActivity(), TabSwitcherListener, Coroutine
}

private fun showSettings() {
if(settings.isNewSettingsEnabled) {
if (settings.isNewSettingsEnabled) {
globalActivityStarter.start(this, NewSettingsScreenNoParams)
} else {
startActivity(SettingsActivity.intent(this))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class RealNetPDisabledNotificationBuilder @Inject constructor(
override fun buildVpnAccessRevokedNotification(context: Context): Notification {
registerChannel(context)

val intent = if(settings.isNewSettingsEnabled) {
val intent = if (settings.isNewSettingsEnabled) {
globalActivityStarter.startIntent(context, NewSettingsScreenNoParams)
} else {
globalActivityStarter.startIntent(context, SettingsScreenNoParams)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.duckduckgo.feature.toggles.api.Toggle.DefaultValue
scope = AppScope::class,
featureName = "updatedSettings",
)
interface UpdatedSettingsFeature{
interface UpdatedSettingsFeature {

@DefaultValue(false)
fun self(): Toggle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import javax.inject.Inject
@SingleInstanceIn(AppScope::class)
class RealSettings @Inject constructor(
private val updatedSettingsFeature: UpdatedSettingsFeature,
): Settings {
) : Settings {

override val isNewSettingsEnabled: Boolean
get() = updatedSettingsFeature.self().isEnabled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class PrivacyProFeatureStore @Inject constructor(

private fun SharedPreferences.save(
key: String,
state: State
state: State,
) {
coroutineScope.launch(dispatcherProvider.io()) {
edit(commit = true) { putString(key, stateAdapter.toJson(state)) }
Expand Down

0 comments on commit 16d4729

Please sign in to comment.