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.

Fix syncing issues with Fission/Webnative

+85 -24
+1
CHANGELOG.md
··· 5 5 - Adjusted search behaviour, now searches while typing (with a small delay). 6 6 - Allows you to make playlists public when using Fission / Webnative. 7 7 - Fixes issue with Safari where reloading after a search caused the loader to be shown indefinitely. 8 + - Fixes syncing issues with Fission/Webnative. 8 9 9 10 10 11 ## 3.3.0
+2 -2
package-lock.json
··· 1 1 { 2 2 "name": "diffuse", 3 - "version": "3.3.0", 3 + "version": "3.4.0", 4 4 "lockfileVersion": 2, 5 5 "requires": true, 6 6 "packages": { 7 7 "": { 8 8 "name": "diffuse", 9 - "version": "3.3.0", 9 + "version": "3.4.0", 10 10 "license": "SEE LICENSE IN LICENSE", 11 11 "dependencies": { 12 12 "@tokenizer/http": "^0.6.2",
+37 -18
src/Applications/Brain/User/State.elm
··· 37 37 initialCommand uiUrl = 38 38 case Url.action uiUrl of 39 39 [ "authenticate", "fission" ] -> 40 - loadEnclosedData 40 + Cmd.batch 41 + [ loadEnclosedData 42 + , loadLocalHypaethralData 43 + { initialUrl = uiUrl 44 + , methodTask = Task.succeed Nothing 45 + } 46 + ] 41 47 42 48 _ -> 43 49 Cmd.batch 44 50 [ loadEnclosedData 45 - , loadSyncMethodAndLocalHypaethralData 51 + , loadLocalHypaethralData 52 + { initialUrl = uiUrl 53 + , methodTask = loadSyncMethod 54 + } 46 55 ] 47 56 48 57 ··· 56 65 |> Common.attemptPortTask (Common.giveUICmdMsg Alien.LoadEnclosedUserData) 57 66 58 67 59 - {-| Loads the "sync method" and "hypaethral" data, 60 - see `Commence` Msg what happens next. 68 + {-| Loads the "sync method". 61 69 -} 62 - loadSyncMethodAndLocalHypaethralData : Cmd Brain.Msg 63 - loadSyncMethodAndLocalHypaethralData = 70 + loadSyncMethod : Task String (Maybe Method) 71 + loadSyncMethod = 64 72 Decode.value 65 73 |> Brain.Task.Ports.fromCache Alien.SyncMethod 66 74 |> Task.mapError TaskPort.errorToStringCustom 75 + |> Task.map (Maybe.andThen decodeMethod) 76 + 77 + 78 + {-| Loads the "sync method" and "hypaethral" data, 79 + see `Commence` Msg what happens next. 80 + -} 81 + loadLocalHypaethralData : { initialUrl : Url, methodTask : Task String (Maybe Method) } -> Cmd Brain.Msg 82 + loadLocalHypaethralData { initialUrl, methodTask } = 83 + methodTask 67 84 |> Task.andThen 68 - (\json -> 69 - let 70 - maybeMethod = 71 - Maybe.andThen decodeMethod json 72 - in 85 + (\maybeMethod -> 73 86 Hypaethral.retrieveLocal 74 87 |> User.retrieveHypaethralData 75 88 |> Task.map ··· 94 107 ( User.encodeHypaethralData User.emptyHypaethralData 95 108 , User.emptyHypaethralData 96 109 ) 97 - |> Commence maybeMethod 110 + |> Commence maybeMethod initialUrl 98 111 |> UserMsg 99 112 ) 100 113 ··· 106 119 update : User.Msg -> Manager 107 120 update msg = 108 121 case msg of 109 - Commence a b -> 110 - commence a b 122 + Commence a b c -> 123 + commence a b c 111 124 112 125 SetSyncMethod a -> 113 126 setSyncMethod a ··· 195 208 -- 🔱 196 209 197 210 198 - commence : Maybe Method -> ( Json.Value, HypaethralData ) -> Manager 199 - commence maybeMethod ( hypaethralJson, hypaethralData ) model = 211 + commence : Maybe Method -> Url -> ( Json.Value, HypaethralData ) -> Manager 212 + commence maybeMethod initialUrl ( hypaethralJson, hypaethralData ) model = 200 213 -- 🚀 201 214 -- Initiated from `initialCommand`. 202 215 -- Loaded the used-sync method and the local hypaethral data. 203 216 { model | userSyncMethod = maybeMethod } 204 217 |> sendHypaethralDataToUI hypaethralJson hypaethralData 205 - -- Next load the hypaethral data from the syncing service. 206 - |> andThen (sync { initialTask = Nothing }) 218 + |> andThen 219 + (case Url.action initialUrl of 220 + [ "authenticate", "fission" ] -> 221 + Common.nudgeUI Alien.CollectFissionCapabilities 222 + 223 + _ -> 224 + sync { initialTask = Nothing } 225 + ) 207 226 208 227 209 228 setSyncMethod : Json.Value -> Manager
+2 -1
src/Applications/Brain/User/Types.elm
··· 2 2 3 3 import Debouncer.Basic as Debouncer 4 4 import Json.Decode as Json 5 + import Url exposing (Url) 5 6 import User.Layer as User exposing (HypaethralBit, HypaethralData) 6 7 import User.Layer.Methods.Dropbox as Dropbox 7 8 ··· 11 12 12 13 13 14 type Msg 14 - = Commence (Maybe User.Method) ( Json.Value, HypaethralData ) 15 + = Commence (Maybe User.Method) Url ( Json.Value, HypaethralData ) 15 16 ----------------------------------------- 16 17 -- Method 17 18 -----------------------------------------
+3
src/Applications/UI.elm
··· 642 642 Alien.AddTracks -> 643 643 TracksMsg (Tracks.Add data) 644 644 645 + Alien.CollectFissionCapabilities -> 646 + SyncingMsg Syncing.CollectFissionCapabilities 647 + 645 648 Alien.FinishedProcessingSource -> 646 649 SourcesMsg (Sources.FinishedProcessingSource data) 647 650
+8 -3
src/Applications/UI/Syncing/State.elm
··· 104 104 _ -> 105 105 Cmd.none 106 106 107 - [ "authenticate", "fission" ] -> 108 - Ports.collectFissionCapabilities () 109 - 110 107 _ -> 111 108 Cmd.none 112 109 ··· 136 133 137 134 BootFailure a -> 138 135 bootFailure a 136 + 137 + CollectFissionCapabilities -> 138 + collectFissionCapabilities 139 139 140 140 ExchangeDropboxAuthCode a -> 141 141 exchangeDropboxAuthCode a ··· 259 259 model 260 260 |> showNotification (Notifications.error err) 261 261 |> andThen Backdrop.setDefault 262 + 263 + 264 + collectFissionCapabilities : Manager 265 + collectFissionCapabilities model = 266 + return model (Ports.collectFissionCapabilities ()) 262 267 263 268 264 269 externalAuth : Method -> String -> Manager
+1
src/Applications/UI/Syncing/Types.elm
··· 42 42 | ActivateSync Method 43 43 | ActivateSyncWithPassphrase Method String 44 44 | BootFailure String 45 + | CollectFissionCapabilities 45 46 | ExchangeDropboxAuthCode (Result Http.Error Dropbox.Tokens) 46 47 | GotSyncMethod Json.Value 47 48 | RemoteStorageWebfinger RemoteStorage.Attributes (Result Http.Error String)
+2
src/Library/Alien.elm
··· 57 57 -- to UI 58 58 ----------------------------------------- 59 59 | AddTracks 60 + | CollectFissionCapabilities 60 61 | FinishedProcessingSource 61 62 | FinishedProcessingSources 62 63 | FinishedSyncing ··· 111 112 -- To UI 112 113 ----------------------------------------- 113 114 , ( "ADD_TRACKS", AddTracks ) 115 + , ( "COLLECT_FISSION_CAPABILITIES", CollectFissionCapabilities ) 114 116 , ( "FINISHED_PROCESSING_SOURCE", FinishedProcessingSource ) 115 117 , ( "FINISHED_PROCESSING_SOURCES", FinishedProcessingSources ) 116 118 , ( "GOT_CACHED_COVER", GotCachedCover )
+29
src/Library/Syncing.elm
··· 1 1 module Syncing exposing (LocalConfig, RemoteConfig, task) 2 2 3 + import DateFormat as Date 3 4 import Json.Decode as Decode 4 5 import Json.Encode as Json 5 6 import Maybe.Extra as Maybe ··· 65 66 |> Task.andThen 66 67 (\maybeModifiedAt -> 67 68 let 69 + formatDate = 70 + Date.format 71 + [ Date.monthNameAbbreviated 72 + , Date.text " " 73 + , Date.dayOfMonthSuffix 74 + , Date.text " " 75 + , Date.yearNumber 76 + , Date.text ", " 77 + , Date.hourMilitaryFixed 78 + , Date.text ":" 79 + , Date.minuteFixed 80 + , Date.text ":" 81 + , Date.secondFixed 82 + ] 83 + 68 84 maybeRemoteModifiedAt = 69 85 Maybe.andThen 70 86 (Decode.decodeValue Time.decoder >> Result.toMaybe) 71 87 maybeModifiedAt 88 + 89 + _ = 90 + Debug.log "remote" (Maybe.map (formatDate Time.utc) maybeRemoteModifiedAt) 91 + 92 + _ = 93 + Debug.log "local" (Maybe.map (formatDate Time.utc) localConfig.localData.modifiedAt) 72 94 in 73 95 case ( maybeRemoteModifiedAt, localConfig.localData.modifiedAt ) of 74 96 ( Just remoteModifiedAt, Just localModifiedAt ) -> ··· 186 208 pushLocalToRemote localConfig remoteConfig { return } = 187 209 localConfig.localData 188 210 |> User.encodedHypaethralDataList 211 + |> (case localConfig.localData.modifiedAt of 212 + Just localModifiedAt -> 213 + (::) ( ModifiedAt, Time.encode localModifiedAt ) 214 + 215 + Nothing -> 216 + identity 217 + ) 189 218 |> List.map (\( bit, data ) -> remoteConfig.save bit data) 190 219 |> Task.sequence 191 220 |> Task.map (\_ -> return)