-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ (llm|lld): delete local app data on uninstall and uninstallAll #7744
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
4 Skipped Deployments
|
9d11323
to
938e6b6
Compare
938e6b6
to
8ba07fc
Compare
d2884b6
to
61a89c9
Compare
subscriber.complete(); | ||
}), | ||
// Delete the app data from the storage | ||
switchMap(() => deleteAppData(appName, deviceModelId, storageProvider)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interaction with data storage in this file is counter to the initial pattern.
This restoreAppData
as well as backupAppData
are dedicated to data stream programming. I think that the data deletion use case should be enchained in restoreAppDataUseCase
where all the parameters are already present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, the deleting the local data is not part of the data restoration workflow. It is an operation independent and should not be injected into normal restoration workflow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sense, i will fix this
61a89c9
to
c9b5761
Compare
c9b5761
to
2d7d5de
Compare
2d7d5de
to
6bd15b3
Compare
@@ -12,9 +12,9 @@ export default function uninstallAppWithBackup( | |||
app: ApplicationVersion | App, | |||
deviceId: DeviceModelId, | |||
storage: StorageProvider<AppStorageType>, | |||
shouldBackup: boolean = true, | |||
deleteAppDataBackup: boolean = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[SHOULD] The naming of deleteAppDataBackup
is a bit strange because it doesn't match with what setting it to true
will do, it doesn't actually delete any app data here (shouldBackup
seemed much better to me it that's how it's supposed to work)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
expect(events).toHaveLength(5); | ||
expect(events[0]).toEqual({ | ||
type: RestoreAppDataEventType.AppDataInitialized, | ||
}); | ||
expect(events[1]).toEqual({ | ||
type: RestoreAppDataEventType.Progress, | ||
data: expect.any(Number), | ||
}); | ||
expect(events[2]).toEqual({ | ||
type: RestoreAppDataEventType.Progress, | ||
data: expect.any(Number), | ||
}); | ||
expect(events[3]).toEqual({ | ||
type: RestoreAppDataEventType.Progress, | ||
data: expect.any(Number), | ||
}); | ||
expect(events[4]).toEqual({ | ||
type: RestoreAppDataEventType.AppDataRestored, | ||
}); | ||
done(); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[SHOULD] if expect throws, done
will never be called and the test will just be timing out, without an easy to read error message. In async tests with done
, all expect
should be surrounded with a try/catch with something like catch(caughtError) { done(caughtError) }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[ASK] Unrelated to the first comment: could use one expect(events).toEqual(expectedArray) instead of 5 expects, no ? Not crucial though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
}); | ||
expect(events[4]).toEqual({ | ||
type: RestoreAppDataEventType.AppDataRestored, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comments as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
libs/ledger-live-common/src/device/use-cases/appDataBackup/restoreAppDataUseCase.test.ts
Outdated
Show resolved
Hide resolved
@@ -10,6 +10,7 @@ export type ExecArgs = { | |||
app: App; | |||
modelId?: DeviceModelId; | |||
storage?: StorageProvider<AppStorageType>; | |||
deleteAppDataBackup?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[COULD] maybe add some TSdoc on those args
import uninstallApp from "../../hw/uninstallApp"; | ||
import uninstallAppWithBackup from "../../hw/uninstallAppWithBackup"; | ||
|
||
export const execWithTransport = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[COULD] Maybe it's worth adding a bit of TSDoc to explain what this does, and even potentially rename it to something less mysterious...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things to fix in async unit tests.
Also I think the name of the deleteAppDataBackup
is maybe a bit too vague.
And I'm not sure I understand where the actual deletion of locally stored app data is done for app uninstallation, deleteAppDataUseCaseDI
is never called in uninstall flows as far as I understand 🤔
Things are done here https://github.com/LedgerHQ/ledger-live/pull/7744/files#diff-cadd4d39653d7214faf8f5dd226d1a6e9c4fc35c45e66a08787170bcc9097d71 to know how to handle each case. (the state) But fair point I will rename |
6bd15b3
to
7e81505
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 👍
✅ Checklist
npx changeset
was attached.📝 Description
This PR makes sure to remove local app data when uninstalling app through the manager on LLD/LLM + all changes required in LLC to make it work
❓ Context
🧐 Checklist for the PR Reviewers