Conversation
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
|
Yea I really would rather this doesn't use db calls at all and instead just touches the objects in their respective places (ie on the LunaPlugin class). There's layers of abstraction already in place to avoid the nightmare that idb is so best to use that. That also simplifies it down to just reading and writing to the objects in question. |
Inrixia
left a comment
There was a problem hiding this comment.
Please move away from using idb directly. See my comment above
…d Tidal.featureFlags
| //feature flags | ||
| const tidalFlags = Tidal.featureFlags; | ||
| const featureFlags: Record<string, boolean> = {}; | ||
| for (const [name, flag] of Object.entries(tidalFlags)) | ||
| featureFlags[name] = flag.value; |
There was a problem hiding this comment.
Would it make sense to export only redux.store.getState().featureFlags.userOverrides here instead of all flags? That way the export would only contain flags the user explicitly toggled, rather than all ~39 flags with their current values. It could help avoid creating unintended overrides if Tidal changes a default between export and import.
This will change to:
const featureFlags = redux.store.getState().featureFlags.userOverrides;There was a problem hiding this comment.
redux.store.getState().featureFlags.userOverrides seems to return only one latest toggled feature flag for some reason so i used the original code and added a check for if the flag is enabled
There was a problem hiding this comment.
Odd. On my end, it gives every change that I toggled:
[SettingsTransfer] userOverrides would export: 2 {reactions: true, open-links-in-desktop-app: false}
There was a problem hiding this comment.
oh i know why, its because i had imported all my previous toggled feature flags and only toggled the one manually. so if someone runs the export on previously imported settings it would only return values that they would toggle after importing
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
Inrixia
left a comment
There was a problem hiding this comment.
Looks good, quite a few changes and some nits and scope creep from me.
Most of the minor stuff can be resolved easily
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
code stripping full storage dump clear stores before importing export only enabled feature flags dump plugin storage in LunaPlugin dump and clear methods in ReactiveStore downloadObject helper function
|
my bad for dumping everything into one commit, i got a bit carried away and forgot to commit until i had like half of the things done |
| const tidalFlags = Tidal.featureFlags; | ||
| const featureFlags: Record<string, boolean> = {}; | ||
| for (const [name, flag] of Object.entries(tidalFlags)) | ||
| if (flag.value) | ||
| featureFlags[name] = flag.value; |
There was a problem hiding this comment.
This would also pick up flags that are true by default even if the user never changed them. And if a user explicitly set a flag to false it would get filtered out by the if (flag.value) check.
|
I haven't found any other solution to the feature flags export so this is the only way to have both:
|
|
Just exporting the overrides and importing them should work perfectly? |
|
it does, but when using redux.store.getState().featureFlags.userOverridesthe exported and then later imported feature flags dont appear in this object so we have to use |
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
Inrixia
left a comment
There was a problem hiding this comment.
Only two changes really needed and this will be ready to merge.
Looking great, thanks again for the work on this <3
plugins/ui/src/SettingsPage/SettingsTab/LunaSettingsTransfer.tsx
Outdated
Show resolved
Hide resolved
| try | ||
| { | ||
| //feature flags | ||
| const featureFlags = redux.store.getState().featureFlags.userOverrides as Record<string, boolean>;; |
|
|
||
| const result = await confirm({ | ||
| title: "Import Settings", | ||
| description: `Import settings exported on ${new Date(data.timestamp).toLocaleString()}? Existing settings will be cleared and replaced, then the app will restart.`, |
There was a problem hiding this comment.
Comment says "Existing settings will be cleared and replaced" but seems not to?
Add a section to settings for importing/exporting: