From 98f0427ea2b3bf5605d1f9e49ce0621b166facc2 Mon Sep 17 00:00:00 2001 From: Sebastian Kaspari Date: Fri, 30 Aug 2019 15:50:02 +0200 Subject: [PATCH] [fenix] Fix ktlint MaxLineLength issues. --- .../components/toolbar/BrowserFragmentStore.kt | 4 ++-- .../fenix/exceptions/ExceptionsFragmentStore.kt | 5 ++++- .../library/bookmarks/BookmarkFragmentStore.kt | 17 ++++++++++++++--- .../library/history/HistoryFragmentStore.kt | 11 +++++++++-- .../account/AccountSettingsFragmentStore.kt | 5 ++++- 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserFragmentStore.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserFragmentStore.kt index 5f5ba3a12b..bd9f6ae75f 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserFragmentStore.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/BrowserFragmentStore.kt @@ -50,8 +50,8 @@ sealed class QuickActionSheetAction : BrowserFragmentAction() { /** * Reducers for [BrowserFragmentStore]. * - * A top level reducer that receives the current [BrowserFragmentState] and an [Action] and then delegates to the proper child - * + * A top level reducer that receives the current [BrowserFragmentState] and an [Action] and then + * delegates to the proper child */ private fun browserStateReducer( state: BrowserFragmentState, diff --git a/app/src/main/java/org/mozilla/fenix/exceptions/ExceptionsFragmentStore.kt b/app/src/main/java/org/mozilla/fenix/exceptions/ExceptionsFragmentStore.kt index 720f5a97a2..c61c308715 100644 --- a/app/src/main/java/org/mozilla/fenix/exceptions/ExceptionsFragmentStore.kt +++ b/app/src/main/java/org/mozilla/fenix/exceptions/ExceptionsFragmentStore.kt @@ -36,7 +36,10 @@ data class ExceptionsFragmentState(val items: List) : State /** * The ExceptionsState Reducer. */ -private fun exceptionsStateReducer(state: ExceptionsFragmentState, action: ExceptionsFragmentAction): ExceptionsFragmentState { +private fun exceptionsStateReducer( + state: ExceptionsFragmentState, + action: ExceptionsFragmentAction +): ExceptionsFragmentState { return when (action) { is ExceptionsFragmentAction.Change -> state.copy(items = action.list) } diff --git a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragmentStore.kt b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragmentStore.kt index 34674b061a..9d9b8953dc 100644 --- a/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragmentStore.kt +++ b/app/src/main/java/org/mozilla/fenix/library/bookmarks/BookmarkFragmentStore.kt @@ -45,13 +45,20 @@ sealed class BookmarkFragmentAction : Action { * @param action the action to perform * @return the new bookmarks state */ -private fun bookmarkFragmentStateReducer(state: BookmarkFragmentState, action: BookmarkFragmentAction): BookmarkFragmentState { +private fun bookmarkFragmentStateReducer( + state: BookmarkFragmentState, + action: BookmarkFragmentAction +): BookmarkFragmentState { return when (action) { is BookmarkFragmentAction.Change -> { val items = state.mode.selectedItems.filter { it in action.tree } state.copy( tree = action.tree, - mode = if (items.isEmpty()) BookmarkFragmentState.Mode.Normal else BookmarkFragmentState.Mode.Selecting(items.toSet()) + mode = if (items.isEmpty()) { + BookmarkFragmentState.Mode.Normal + } else { + BookmarkFragmentState.Mode.Selecting(items.toSet()) + } ) } is BookmarkFragmentAction.Select -> @@ -59,7 +66,11 @@ private fun bookmarkFragmentStateReducer(state: BookmarkFragmentState, action: B is BookmarkFragmentAction.Deselect -> { val items = state.mode.selectedItems - action.item state.copy( - mode = if (items.isEmpty()) BookmarkFragmentState.Mode.Normal else BookmarkFragmentState.Mode.Selecting(items) + mode = if (items.isEmpty()) { + BookmarkFragmentState.Mode.Normal + } else { + BookmarkFragmentState.Mode.Selecting(items) + } ) } BookmarkFragmentAction.DeselectAll -> diff --git a/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragmentStore.kt b/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragmentStore.kt index dd8a4db4ff..44ea6e1ccb 100644 --- a/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragmentStore.kt +++ b/app/src/main/java/org/mozilla/fenix/library/history/HistoryFragmentStore.kt @@ -52,14 +52,21 @@ data class HistoryFragmentState(val items: List, val mode: Mode) : /** * The HistoryState Reducer. */ -private fun historyStateReducer(state: HistoryFragmentState, action: HistoryFragmentAction): HistoryFragmentState { +private fun historyStateReducer( + state: HistoryFragmentState, + action: HistoryFragmentAction +): HistoryFragmentState { return when (action) { is HistoryFragmentAction.AddItemForRemoval -> state.copy(mode = HistoryFragmentState.Mode.Editing(state.mode.selectedItems + action.item)) is HistoryFragmentAction.RemoveItemForRemoval -> { val selected = state.mode.selectedItems - action.item state.copy( - mode = if (selected.isEmpty()) HistoryFragmentState.Mode.Normal else HistoryFragmentState.Mode.Editing(selected) + mode = if (selected.isEmpty()) { + HistoryFragmentState.Mode.Normal + } else { + HistoryFragmentState.Mode.Editing(selected) + } ) } is HistoryFragmentAction.ExitEditMode -> state.copy(mode = HistoryFragmentState.Mode.Normal) diff --git a/app/src/main/java/org/mozilla/fenix/settings/account/AccountSettingsFragmentStore.kt b/app/src/main/java/org/mozilla/fenix/settings/account/AccountSettingsFragmentStore.kt index 4c92754906..6cc70e57b4 100644 --- a/app/src/main/java/org/mozilla/fenix/settings/account/AccountSettingsFragmentStore.kt +++ b/app/src/main/java/org/mozilla/fenix/settings/account/AccountSettingsFragmentStore.kt @@ -44,7 +44,10 @@ sealed class AccountSettingsFragmentAction : Action { /** * The SearchState Reducer. */ -private fun accountStateReducer(state: AccountSettingsFragmentState, action: AccountSettingsFragmentAction): AccountSettingsFragmentState { +private fun accountStateReducer( + state: AccountSettingsFragmentState, + action: AccountSettingsFragmentAction +): AccountSettingsFragmentState { return when (action) { is AccountSettingsFragmentAction.SyncFailed -> state.copy(lastSyncedDate = LastSyncTime.Failed(action.time)) is AccountSettingsFragmentAction.SyncEnded -> state.copy(lastSyncedDate = LastSyncTime.Success(action.time))