Integrate QFieldCloud subscription API for storage meter#7260
Integrate QFieldCloud subscription API for storage meter#7260
Conversation
🍎 MacOS DMG universal buildsDownload a MacOS DMG universal build of this PR for testing. 📱 Android buildsDownload an Android arm64 build of this PR for testing. Other Android architectures🪟 Windows buildsDownload a Windows build of this PR for testing. 🐧 Linux AppImage buildsDownload a Linux AppImage build of this PR for testing. |
Fetch and display actual storage usage.
0fc5e07 to
cfb62ad
Compare
|
There's a little bit more work needed before we merge this, talked to @mohsenD98 , progress is being made :) |
src/qml/QFieldCloudPopup.qml
Outdated
| connectionSettings.visible = !connectionSettings.visible; | ||
| storageMeterBar.visible = !connectionSettings.visible; |
src/qml/QFieldCloudPopup.qml
Outdated
| if (subscriptionInformation.storageTotal > 0) { | ||
| const usedGB = (subscriptionInformation.storageUsed / (1024 * 1024 * 1024)).toFixed(2); | ||
| const totalGB = (subscriptionInformation.storageTotal / (1024 * 1024 * 1024)).toFixed(2); | ||
| showStorageBar(usedGB, totalGB); |
There was a problem hiding this comment.
We calculate kb/mb/gb using a conversion factor of 1000, not 1024. Proof:
We need to make sure these values align, otherwise we'll get confused users :)
Also, let's have a slightly cleverer calculation here that allows us to show eg 100mb instead of 0.1gb. Basically, if used storage of total storage < 1gb, lets use mb.
There was a problem hiding this comment.
That's intended behavior, see GB vs GiB https://en.wikipedia.org/wiki/Byte#Multiple-byte_units
8a3274d to
b802d44
Compare


🚀 Description
Connect the storage meter bar to the real QFieldCloud subscription API.
Continue #7251
✨ Key Changes
QFieldCloudConnection(C++): AddedQ_INVOKABLE getSubscriptionInfo(user)method that calls the subscription API endpoint and emitssubscriptionInfoReceived(storageUsed, storageTotal)with the parsed byte valuesQFieldCloudPopup.qml: Call thegetSubscriptionInfo()on login, using the current project owner or logged-in usernameDemo