A music player that connects to your cloud/distributed storage.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Refactor Equalizer state

+370 -278
+31 -21
src/Applications/UI.elm
··· 32 32 import UI.Authentication.State as Authentication 33 33 import UI.Backdrop as Backdrop 34 34 import UI.Common.State as Common 35 - import UI.Equalizer as Equalizer 35 + import UI.Equalizer.State as Equalizer 36 + import UI.Equalizer.View as Equalizer 36 37 import UI.EtCetera.State as EtCetera 37 38 import UI.Interface.State as Interface 38 39 import UI.Page as Page ··· 52 53 import UI.Tracks.ContextMenu as Tracks 53 54 import UI.Tracks.State as Tracks 54 55 import UI.Types as UI exposing (..) 55 - import UI.User.State as User 56 + import UI.User.State.Export as User 57 + import UI.User.State.Import as User 56 58 import UI.View exposing (view) 57 59 import Url exposing (Protocol(..), Url) 58 60 import User.Layer exposing (..) ··· 158 160 159 161 Reply reply -> 160 162 Reply.translate reply 161 - 162 - -- 163 - Alfred a -> 164 - Alfred.update a 165 - 166 - Audio a -> 167 - Audio.update a 168 163 169 164 ----------------------------------------- 170 165 -- Authentication ··· 208 203 , msg = sub 209 204 } 210 205 211 - EqualizerMsg sub -> 212 - \model -> 213 - Return3.wieldNested 214 - Reply.translate 215 - { mapCmd = EqualizerMsg 216 - , mapModel = \child -> { model | equalizer = child } 217 - , update = Equalizer.update 218 - } 219 - { model = model.equalizer 220 - , msg = sub 221 - } 222 - 223 206 PlaylistsMsg sub -> 224 207 \model -> 225 208 Return3.wieldNested ··· 269 252 } 270 253 271 254 ----------------------------------------- 255 + -- Equalizer 256 + ----------------------------------------- 257 + ActivateKnob a b -> 258 + Equalizer.organize (Equalizer.activateKnob a b) 259 + 260 + AdjustKnob a -> 261 + Equalizer.organize (Equalizer.adjustKnob a) 262 + 263 + DeactivateKnob _ -> 264 + Equalizer.deactivateKnob 265 + 266 + ResetKnob a -> 267 + Equalizer.resetKnob a 268 + 269 + ----------------------------------------- 272 270 -- Interface 273 271 ----------------------------------------- 274 272 Blur -> ··· 367 365 LoadHypaethralUserData a -> 368 366 User.loadHypaethralUserData a 369 367 368 + UI.SaveEnclosedUserData -> 369 + User.saveEnclosedUserData 370 + 370 371 ----------------------------------------- 371 372 -- 📭 Et Cetera 372 373 ----------------------------------------- ··· 375 376 376 377 SetIsOnline a -> 377 378 EtCetera.setIsOnline a 379 + 380 + ----------------------------------------- 381 + -- 🦉 Nested 382 + ----------------------------------------- 383 + Alfred a -> 384 + Alfred.update a 385 + 386 + Audio a -> 387 + Audio.update a 378 388 379 389 380 390
+1 -1
src/Applications/UI/Authentication/State.elm
··· 17 17 18 18 19 19 20 - -- 📣 20 + -- 🔱 21 21 22 22 23 23 authenticationBootFailure : String -> Manager
+1 -1
src/Applications/UI/Common/State.elm
··· 9 9 10 10 11 11 12 - -- 📣 12 + -- 🔱 13 13 14 14 15 15 showNotification : Notification Reply -> Manager
+5 -199
src/Applications/UI/Equalizer.elm src/Applications/UI/Equalizer/View.elm
··· 1 - module UI.Equalizer exposing (Model, Msg(..), adjustAllKnobs, initialModel, update, view) 1 + module UI.Equalizer.View exposing (view) 2 2 3 3 import Chunky exposing (..) 4 4 import Chunky.Styled ··· 17 17 import Html.Styled.Events 18 18 import Json.Decode as Decode 19 19 import Material.Icons as Icons 20 - import Return3 as Return exposing (..) 21 20 import Svg.Styled 22 21 import Svg.Styled.Attributes 22 + import UI.Equalizer.Types as Equalizer 23 23 import UI.Kit 24 24 import UI.Navigation exposing (..) 25 25 import UI.Page 26 26 import UI.Ports as Ports 27 - import UI.Reply exposing (Reply(..)) 28 - 29 - 30 - 31 - -- 🌳 32 - 33 - 34 - type Knob 35 - = Low 36 - | Mid 37 - | High 38 - | Volume 39 - 40 - 41 - type alias Model = 42 - { low : Float 43 - , mid : Float 44 - , high : Float 45 - , volume : Float 46 - 47 - -- 48 - , activeKnob : Maybe Knob 49 - , startCoordinates : Coordinates 50 - } 51 - 52 - 53 - initialModel : Model 54 - initialModel = 55 - { low = defaultSettings.low 56 - , mid = defaultSettings.mid 57 - , high = defaultSettings.high 58 - , volume = defaultSettings.volume 59 - 60 - -- Knob interactions 61 - -------------------- 62 - , activeKnob = Nothing 63 - , startCoordinates = { x = 0, y = 0 } 64 - } 65 - 66 - 67 - 68 - -- 📣 69 - 70 - 71 - type Msg 72 - = ActivateKnob Knob Pointer.Event 73 - | AdjustKnob Pointer.Event 74 - | DeactivateKnob Pointer.Event 75 - | ResetKnob Knob 76 - 77 - 78 - update : Msg -> Model -> Return Model Msg Reply 79 - update msg model = 80 - case msg of 81 - ----------------------------------------- 82 - -- Activate 83 - ----------------------------------------- 84 - ActivateKnob theKnob { pointer } -> 85 - { model 86 - | activeKnob = Just theKnob 87 - , startCoordinates = Coordinates.fromTuple pointer.clientPos 88 - } 89 - |> return 90 - 91 - ----------------------------------------- 92 - -- Adjust 93 - ----------------------------------------- 94 - AdjustKnob { pointer } -> 95 - let 96 - start = 97 - model.startCoordinates 98 - 99 - end = 100 - (\( a, b ) -> { x = a, y = b }) 101 - pointer.clientPos 102 - 103 - x = 104 - end.x - start.x 105 - 106 - y = 107 - start.y - end.y 108 - 109 - distance = 110 - sqrt (x ^ 2 + y ^ 2) 111 - 112 - angle = 113 - atan2 x y 114 - * (180 / pi) 115 - |> max (maxAngle * -1) 116 - |> min maxAngle 117 - 118 - value = 119 - case ( distance > 10, model.activeKnob ) of 120 - ( True, Just Volume ) -> 121 - Just ( Volume, (maxAngle + angle) / (maxAngle * 2) ) 122 - 123 - ( True, Just knobType ) -> 124 - Just ( knobType, angle / maxAngle ) 125 - 126 - _ -> 127 - Nothing 128 - 129 - newModel = 130 - case value of 131 - Just ( Low, v ) -> 132 - { model | low = v } 133 - 134 - Just ( Mid, v ) -> 135 - { model | mid = v } 136 - 137 - Just ( High, v ) -> 138 - { model | high = v } 139 - 140 - Just ( Volume, v ) -> 141 - { model | volume = v } 142 - 143 - Nothing -> 144 - model 145 - in 146 - case value of 147 - Just ( knobType, v ) -> 148 - returnCommandWithModel newModel (adjustKnob knobType v) 149 - 150 - Nothing -> 151 - return newModel 152 - 153 - ----------------------------------------- 154 - -- Deactivate 155 - ----------------------------------------- 156 - DeactivateKnob _ -> 157 - Return.replyWithModel 158 - { model | activeKnob = Nothing } 159 - SaveEnclosedUserData 160 - 161 - ----------------------------------------- 162 - -- Reset 163 - ----------------------------------------- 164 - ResetKnob Low -> 165 - reset { model | low = defaultSettings.low } Low defaultSettings.low 166 - 167 - ResetKnob Mid -> 168 - reset { model | mid = defaultSettings.mid } Mid defaultSettings.mid 169 - 170 - ResetKnob High -> 171 - reset { model | high = defaultSettings.high } High defaultSettings.high 172 - 173 - ResetKnob Volume -> 174 - reset { model | volume = defaultSettings.volume } Volume defaultSettings.volume 175 - 176 - 177 - 178 - -- 📣 ░░ KNOBS & THINGS 179 - 180 - 181 - adjustKnob : Knob -> Float -> Cmd Msg 182 - adjustKnob knobType value = 183 - Ports.adjustEqualizerSetting 184 - { value = value 185 - , knob = 186 - case knobType of 187 - Low -> 188 - "LOW" 189 - 190 - Mid -> 191 - "MID" 192 - 193 - High -> 194 - "HIGH" 195 - 196 - Volume -> 197 - "VOLUME" 198 - } 199 - 200 - 201 - adjustAllKnobs : Model -> Cmd Msg 202 - adjustAllKnobs model = 203 - Cmd.batch 204 - [ adjustKnob Low model.low 205 - , adjustKnob Mid model.mid 206 - , adjustKnob High model.high 207 - , adjustKnob Volume model.volume 208 - ] 209 - 210 - 211 - reset : Model -> Knob -> Float -> Return Model Msg Reply 212 - reset newModel knobType value = 213 - ( newModel 214 - , adjustKnob knobType value 215 - , [ SaveEnclosedUserData ] 216 - ) 27 + import UI.Types exposing (Msg(..)) 217 28 218 29 219 30 220 31 -- 🗺 221 32 222 33 223 - view : Model -> Html Msg 34 + view : Equalizer.Model -> Html Msg 224 35 view model = 225 36 UI.Kit.receptacle 226 37 { scrolling = True } ··· 251 62 ] 252 63 253 64 254 - eqView : Model -> Html Msg 65 + eqView : Equalizer.Model -> Html Msg 255 66 eqView model = 256 67 chunk 257 68 [ C.text_center ] ··· 428 239 knobSize : Float 429 240 knobSize = 430 241 36 431 - 432 - 433 - maxAngle : Float 434 - maxAngle = 435 - 135 436 242 437 243 438 244
+227
src/Applications/UI/Equalizer/State.elm
··· 1 + module UI.Equalizer.State exposing (..) 2 + 3 + import Chunky exposing (..) 4 + import Chunky.Styled 5 + import Color exposing (Color) 6 + import Color.Ext as Color 7 + import Common 8 + import Coordinates exposing (Coordinates) 9 + import Css 10 + import Css.Classes as C 11 + import Css.Ext as Css 12 + import Equalizer exposing (..) 13 + import Html exposing (Html) 14 + import Html.Events.Extra.Pointer as Pointer 15 + import Html.Styled 16 + import Html.Styled.Attributes exposing (css) 17 + import Html.Styled.Events 18 + import Json.Decode as Decode 19 + import Management 20 + import Material.Icons as Icons 21 + import Monocle.Lens as Lens exposing (Lens) 22 + import Return exposing (return) 23 + import Svg.Styled 24 + import Svg.Styled.Attributes 25 + import UI.Equalizer.Types as Equalizer exposing (..) 26 + import UI.Kit 27 + import UI.Navigation exposing (..) 28 + import UI.Page 29 + import UI.Ports as Ports 30 + import UI.Reply exposing (Reply(..)) 31 + import UI.Types as UI exposing (..) 32 + import UI.User.State.Export as User 33 + 34 + 35 + 36 + -- 🌳 37 + 38 + 39 + type alias Model = 40 + { low : Float 41 + , mid : Float 42 + , high : Float 43 + , volume : Float 44 + 45 + -- 46 + , activeKnob : Maybe Knob 47 + , startCoordinates : Coordinates 48 + } 49 + 50 + 51 + initialModel : Model 52 + initialModel = 53 + { low = defaultSettings.low 54 + , mid = defaultSettings.mid 55 + , high = defaultSettings.high 56 + , volume = defaultSettings.volume 57 + 58 + -- Knob interactions 59 + -------------------- 60 + , activeKnob = Nothing 61 + , startCoordinates = { x = 0, y = 0 } 62 + } 63 + 64 + 65 + lens : Lens UI.Model Equalizer.Model 66 + lens = 67 + { get = .equalizer 68 + , set = \equalizer ui -> { ui | equalizer = equalizer } 69 + } 70 + 71 + 72 + 73 + -- 📣 74 + 75 + 76 + organize : Organizer Equalizer.Model -> Manager 77 + organize = 78 + Management.organize lens 79 + 80 + 81 + 82 + -- 🔱 83 + 84 + 85 + activateKnob : Knob -> Pointer.Event -> Organizer Equalizer.Model 86 + activateKnob theKnob { pointer } model = 87 + Return.singleton 88 + { model 89 + | activeKnob = Just theKnob 90 + , startCoordinates = Coordinates.fromTuple pointer.clientPos 91 + } 92 + 93 + 94 + adjustKnob : Pointer.Event -> Organizer Equalizer.Model 95 + adjustKnob { pointer } model = 96 + let 97 + start = 98 + model.startCoordinates 99 + 100 + end = 101 + (\( a, b ) -> { x = a, y = b }) 102 + pointer.clientPos 103 + 104 + x = 105 + end.x - start.x 106 + 107 + y = 108 + start.y - end.y 109 + 110 + distance = 111 + sqrt (x ^ 2 + y ^ 2) 112 + 113 + angle = 114 + atan2 x y 115 + * (180 / pi) 116 + |> max (maxAngle * -1) 117 + |> min maxAngle 118 + 119 + value = 120 + case ( distance > 10, model.activeKnob ) of 121 + ( True, Just Volume ) -> 122 + Just ( Volume, (maxAngle + angle) / (maxAngle * 2) ) 123 + 124 + ( True, Just knobType ) -> 125 + Just ( knobType, angle / maxAngle ) 126 + 127 + _ -> 128 + Nothing 129 + 130 + newModel = 131 + case value of 132 + Just ( Low, v ) -> 133 + { model | low = v } 134 + 135 + Just ( Mid, v ) -> 136 + { model | mid = v } 137 + 138 + Just ( High, v ) -> 139 + { model | high = v } 140 + 141 + Just ( Volume, v ) -> 142 + { model | volume = v } 143 + 144 + Nothing -> 145 + model 146 + in 147 + case value of 148 + Just ( knobType, v ) -> 149 + return newModel (adjustKnobUsingPort knobType v) 150 + 151 + Nothing -> 152 + Return.singleton newModel 153 + 154 + 155 + deactivateKnob : Manager 156 + deactivateKnob model = 157 + model 158 + |> organize (\m -> Return.singleton { m | activeKnob = Nothing }) 159 + |> Return.andThen User.saveEnclosedUserData 160 + 161 + 162 + resetKnob : Knob -> Manager 163 + resetKnob knob model = 164 + model 165 + |> organize (resetKnobOrganizer knob) 166 + |> Return.andThen User.saveEnclosedUserData 167 + 168 + 169 + 170 + -- ⚗️ 171 + 172 + 173 + adjustKnobUsingPort : Knob -> Float -> Cmd Msg 174 + adjustKnobUsingPort knobType value = 175 + Ports.adjustEqualizerSetting 176 + { value = value 177 + , knob = 178 + case knobType of 179 + Low -> 180 + "LOW" 181 + 182 + Mid -> 183 + "MID" 184 + 185 + High -> 186 + "HIGH" 187 + 188 + Volume -> 189 + "VOLUME" 190 + } 191 + 192 + 193 + adjustAllKnobs : Equalizer.Model -> Cmd Msg 194 + adjustAllKnobs model = 195 + Cmd.batch 196 + [ adjustKnobUsingPort Low model.low 197 + , adjustKnobUsingPort Mid model.mid 198 + , adjustKnobUsingPort High model.high 199 + , adjustKnobUsingPort Volume model.volume 200 + ] 201 + 202 + 203 + 204 + -- ㊙️ 205 + 206 + 207 + resetKnobOrganizer : Knob -> Organizer Equalizer.Model 208 + resetKnobOrganizer knob model = 209 + case knob of 210 + Low -> 211 + reset { model | low = defaultSettings.low } Low defaultSettings.low 212 + 213 + Mid -> 214 + reset { model | mid = defaultSettings.mid } Mid defaultSettings.mid 215 + 216 + High -> 217 + reset { model | high = defaultSettings.high } High defaultSettings.high 218 + 219 + Volume -> 220 + reset { model | volume = defaultSettings.volume } Volume defaultSettings.volume 221 + 222 + 223 + reset : Equalizer.Model -> Knob -> Float -> ( Equalizer.Model, Cmd Msg ) 224 + reset newModel knobType value = 225 + ( newModel 226 + , adjustKnobUsingPort knobType value 227 + )
+20
src/Applications/UI/Equalizer/Types.elm
··· 1 + module UI.Equalizer.Types exposing (..) 2 + 3 + import Coordinates exposing (Coordinates) 4 + import Equalizer exposing (..) 5 + 6 + 7 + 8 + -- 🌳 9 + 10 + 11 + type alias Model = 12 + { low : Float 13 + , mid : Float 14 + , high : Float 15 + , volume : Float 16 + 17 + -- 18 + , activeKnob : Maybe Knob 19 + , startCoordinates : Coordinates 20 + }
+1 -1
src/Applications/UI/EtCetera/State.elm
··· 29 29 30 30 31 31 32 - -- 📣 32 + -- 🔱 33 33 34 34 35 35 setIsOnline : Bool -> Manager
+1 -1
src/Applications/UI/Interface/State.elm
··· 29 29 30 30 31 31 32 - -- 📣 32 + -- 🔱 33 33 34 34 35 35 blur : Manager
+4 -34
src/Applications/UI/Reply/Translate.elm
··· 55 55 import UI.Console 56 56 import UI.ContextMenu 57 57 import UI.Demo as Demo 58 - import UI.Equalizer as Equalizer 59 58 import UI.Interface.State as Interface 60 59 import UI.Navigation as Navigation 61 60 import UI.Notifications ··· 531 530 |> Ports.toBrain 532 531 |> return (Lens.modify Tracks.lens (\m -> { m | cached = [] }) model) 533 532 |> andThen (Return.performance <| TracksMsg Tracks.Harvest) 534 - |> andThen (translate <| SaveEnclosedUserData) 533 + |> andThen (translate <| Reply.SaveEnclosedUserData) 535 534 |> andThen (translate <| ShowWarningNotification "Tracks cache was cleared") 536 535 537 536 DisableTracksGrouping -> ··· 670 669 model 671 670 ) 672 671 |> andThen (Return.performance <| TracksMsg Tracks.Harvest) 673 - |> andThen (translate SaveEnclosedUserData) 672 + |> andThen (translate Reply.SaveEnclosedUserData) 674 673 675 674 RemoveTracksWithSourceId sourceId -> 676 675 let ··· 795 794 |> File.Select.file [ "application/json" ] 796 795 |> return model 797 796 798 - SaveEnclosedUserData -> 799 - model 800 - |> exportEnclosed 801 - |> Alien.broadcast Alien.SaveEnclosedUserData 802 - |> Ports.toBrain 803 - |> return model 797 + Reply.SaveEnclosedUserData -> 798 + Return.performance UI.SaveEnclosedUserData model 804 799 805 800 SaveFavourites -> 806 801 model.tracks.favourites ··· 893 888 894 889 895 890 -- USER 896 - 897 - 898 - exportEnclosed : Model -> Json.Encode.Value 899 - exportEnclosed model = 900 - let 901 - equalizerSettings = 902 - { low = model.equalizer.low 903 - , mid = model.equalizer.mid 904 - , high = model.equalizer.high 905 - , volume = model.equalizer.volume 906 - } 907 - in 908 - encodeEnclosedData 909 - { cachedTracks = model.tracks.cached 910 - , equalizerSettings = equalizerSettings 911 - , grouping = model.tracks.grouping 912 - , onlyShowCachedTracks = model.tracks.cachedOnly 913 - , onlyShowFavourites = model.tracks.favouritesOnly 914 - , repeat = model.queue.repeat 915 - , searchTerm = model.tracks.searchTerm 916 - , selectedPlaylist = Maybe.map .name model.tracks.selectedPlaylist 917 - , shuffle = model.queue.shuffle 918 - , sortBy = model.tracks.sortBy 919 - , sortDirection = model.tracks.sortDirection 920 - } 921 891 922 892 923 893 gatherSettings : Model -> Settings.Settings
+1 -1
src/Applications/UI/Routing/State.elm
··· 18 18 19 19 20 20 21 - -- 📣 21 + -- 🔱 22 22 23 23 24 24 changeUrlUsingPage : Page -> Manager
+1 -1
src/Applications/UI/Services/State.elm
··· 13 13 14 14 15 15 16 - -- 📣 16 + -- 🔱 17 17 18 18 19 19 gotLastFmSession : Result Http.Error String -> Manager
+2 -2
src/Applications/UI/Tracks/State.elm
··· 27 27 28 28 29 29 30 - -- 📣 30 + -- 🔱 31 31 32 32 33 33 downloadTracksFinished : Manager ··· 92 92 ) 93 93 -- TODO: Make sync 94 94 |> Return.effect_ (\_ -> Return.task <| TracksMsg Tracks.Harvest) 95 - |> Return.effect_ (\_ -> Return.task <| Reply SaveEnclosedUserData) 95 + |> Return.effect_ (\_ -> Return.task <| Reply Reply.SaveEnclosedUserData)
+15 -5
src/Applications/UI/Types.elm
··· 16 16 import Debouncer.Basic as Debouncer exposing (Debouncer) 17 17 import Dict exposing (Dict) 18 18 import Dict.Ext as Dict 19 + import Equalizer exposing (Knob) 19 20 import File exposing (File) 20 21 import File.Download 21 22 import File.Select ··· 59 60 import UI.ContextMenu 60 61 import UI.Demo as Demo 61 62 import UI.DnD as DnD 62 - import UI.Equalizer as Equalizer 63 + import UI.Equalizer.Types as Equalizer 63 64 import UI.Navigation as Navigation 64 65 import UI.Notifications 65 66 import UI.Page as Page exposing (Page) ··· 151 152 type Msg 152 153 = Bypass 153 154 | Reply Reply 154 - -- 155 - | Alfred (Alfred.Msg Msg) 156 - | Audio Audio.Msg 157 155 ----------------------------------------- 158 156 -- Authentication 159 157 ----------------------------------------- ··· 166 164 ----------------------------------------- 167 165 | AuthenticationMsg Authentication.Msg 168 166 | BackdropMsg Backdrop.Msg 169 - | EqualizerMsg Equalizer.Msg 170 167 | PlaylistsMsg Playlists.Msg 171 168 | QueueMsg Queue.Msg 172 169 | SourcesMsg Sources.Msg 173 170 | TracksMsg Tracks.Msg 174 171 ----------------------------------------- 172 + -- Equalizer 173 + ----------------------------------------- 174 + | ActivateKnob Knob Pointer.Event 175 + | AdjustKnob Pointer.Event 176 + | DeactivateKnob Pointer.Event 177 + | ResetKnob Knob 178 + ----------------------------------------- 175 179 -- Interface 176 180 ----------------------------------------- 177 181 | Blur ··· 216 220 | ImportJson String 217 221 | LoadEnclosedUserData Json.Decode.Value 218 222 | LoadHypaethralUserData Json.Decode.Value 223 + | SaveEnclosedUserData 219 224 ----------------------------------------- 220 225 -- 📭 Et Cetera 221 226 ----------------------------------------- 222 227 | SetCurrentTime Time.Posix 223 228 | SetIsOnline Bool 229 + ----------------------------------------- 230 + -- 🦉 Nested 231 + ----------------------------------------- 232 + | Alfred (Alfred.Msg Msg) 233 + | Audio Audio.Msg 224 234 225 235 226 236 type alias Organizer model =
+3 -3
src/Applications/UI/User/State.elm src/Applications/UI/User/State/Import.elm
··· 1 - module UI.User.State exposing (..) 1 + module UI.User.State.Import exposing (..) 2 2 3 3 import File exposing (File) 4 4 import Json.Decode ··· 17 17 import UI.Audio.State as Audio 18 18 import UI.Backdrop as Backdrop 19 19 import UI.Common.State as Common exposing (showNotification) 20 - import UI.Equalizer as Equalizer 20 + import UI.Equalizer.State as Equalizer 21 21 import UI.Page as Page exposing (Page) 22 22 import UI.Playlists as Playlists 23 23 import UI.Ports as Ports ··· 241 241 } 242 242 -- 243 243 , Cmd.batch 244 - [ Cmd.map EqualizerMsg (Equalizer.adjustAllKnobs newEqualizer) 244 + [ Equalizer.adjustAllKnobs newEqualizer 245 245 , Ports.setRepeat data.repeat 246 246 ] 247 247 --
+39
src/Applications/UI/User/State/Export.elm
··· 1 + module UI.User.State.Export exposing (..) 2 + 3 + import Alien 4 + import Return 5 + import UI.Ports as Ports 6 + import UI.Types as UI exposing (..) 7 + import User.Layer exposing (..) 8 + 9 + 10 + 11 + -- 🔱 12 + 13 + 14 + saveEnclosedUserData : Manager 15 + saveEnclosedUserData model = 16 + let 17 + equalizerSettings = 18 + { low = model.equalizer.low 19 + , mid = model.equalizer.mid 20 + , high = model.equalizer.high 21 + , volume = model.equalizer.volume 22 + } 23 + in 24 + { cachedTracks = model.tracks.cached 25 + , equalizerSettings = equalizerSettings 26 + , grouping = model.tracks.grouping 27 + , onlyShowCachedTracks = model.tracks.cachedOnly 28 + , onlyShowFavourites = model.tracks.favouritesOnly 29 + , repeat = model.queue.repeat 30 + , searchTerm = model.tracks.searchTerm 31 + , selectedPlaylist = Maybe.map .name model.tracks.selectedPlaylist 32 + , shuffle = model.queue.shuffle 33 + , sortBy = model.tracks.sortBy 34 + , sortDirection = model.tracks.sortDirection 35 + } 36 + |> encodeEnclosedData 37 + |> Alien.broadcast Alien.SaveEnclosedUserData 38 + |> Ports.toBrain 39 + |> Return.return model
+5 -7
src/Applications/UI/View.elm
··· 31 31 import UI.Backdrop as Backdrop 32 32 import UI.Console 33 33 import UI.ContextMenu 34 - import UI.Equalizer as Equalizer 34 + import UI.Equalizer.View as Equalizer 35 35 import UI.Navigation as Navigation 36 36 import UI.Notifications 37 37 import UI.Page as Page ··· 71 71 [ on "tap" (Json.Decode.succeed HideOverlay) ] 72 72 73 73 else if Maybe.isJust model.equalizer.activeKnob then 74 - [ Pointer.onMove (EqualizerMsg << Equalizer.AdjustKnob) 75 - , Pointer.onUp (EqualizerMsg << Equalizer.DeactivateKnob) 76 - , Pointer.onCancel (EqualizerMsg << Equalizer.DeactivateKnob) 74 + [ Pointer.onMove AdjustKnob 75 + , Pointer.onUp DeactivateKnob 76 + , Pointer.onCancel DeactivateKnob 77 77 ] 78 78 79 79 else if model.isDragging then ··· 180 180 -------- 181 181 , case model.page of 182 182 Page.Equalizer -> 183 - model.equalizer 184 - |> Lazy.lazy Equalizer.view 185 - |> Html.map EqualizerMsg 183 + Lazy.lazy Equalizer.view model.equalizer 186 184 187 185 Page.Index -> 188 186 nothing
+13 -1
src/Library/Equalizer.elm
··· 1 - module Equalizer exposing (Settings, defaultSettings, encodeSettings, settingsDecoder) 1 + module Equalizer exposing (..) 2 2 3 3 import Json.Decode 4 4 import Json.Encode ··· 8 8 -- 🌳 9 9 10 10 11 + type Knob 12 + = Low 13 + | Mid 14 + | High 15 + | Volume 16 + 17 + 11 18 type alias Settings = 12 19 { low : Float 13 20 , mid : Float 14 21 , high : Float 15 22 , volume : Float 16 23 } 24 + 25 + 26 + maxAngle : Float 27 + maxAngle = 28 + 135 17 29 18 30 19 31