-
Notifications
You must be signed in to change notification settings - Fork 841
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
[PM-7407] Implemented check for organizations with unassigned items #3150
[PM-7407] Implemented check for organizations with unassigned items #3150
Conversation
@@ -186,6 +186,8 @@ public interface IStateService | |||
Task<BwRegion?> GetActiveUserRegionAsync(); | |||
Task<BwRegion?> GetPreAuthRegionAsync(); | |||
Task SetPreAuthRegionAsync(BwRegion value); | |||
Task<bool> GetShouldCheckOrganizationUnassignedItemsAsync(string userId = null); |
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.
🤔 Naming wise, following a similar pattern to the other prompts (e.g. Get/Set UnassignedItemsPromptShownAsync
) would make it easier to find this in the future.
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.
The problem is that this getter doesn't return if the prompt has been shown or not, it returns whether the check (and potentially the prompt) should be done or not, i.e. if the user chose "Remind me later" or not.
Also there are also two other that have Should
:
- GetShouldTrustDeviceAsync
- GetShouldConnectToWatchAsync
Even though I agree having everything with the same name structure is better, but on the other hand I like having specific naming so one can exactly know what the method/property does without having to look much in other places.
What do you think?
@@ -136,6 +137,7 @@ public static class Constants | |||
public static string ShouldConnectToWatchKey(string userId) => $"shouldConnectToWatch_{userId}"; | |||
public static string ScreenCaptureAllowedKey(string userId) => $"screenCaptureAllowed_{userId}"; | |||
public static string PendingAdminAuthRequest(string userId) => $"pendingAdminAuthRequest_{userId}"; | |||
public static string ShouldCheckOrganizationUnassignedItemsKey(string userId) => $"shouldCheckOrganizationUnassignedItems_{userId}"; |
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.
⛏️ (not really relevant but worth mentioning) other similar constants don't have verbiage like "ShouldCheck".
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.
IMO without the "should check" one doesn't know what the flag is for, only that it has to do with organization unassigned items. However, if having the verbiage alike others is more important I can change it.
@@ -829,6 +829,24 @@ public async Task RestoreWithServerAsync(string id) | |||
await ClearCacheAsync(); | |||
} | |||
|
|||
public async Task<bool> VerifyOrganizationHasUnassignedItemsAsync() | |||
{ | |||
var organizations = await _stateService.GetOrganizationsAsync(); |
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.
🤔 I'm not sure if it's possible for this to return 0 orgs and the next call returning true, I just noticed other clients aren't checking this.
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.
This is exactly why I had to wait for synchronization to complete, otherwise we'd have 0 orgs right after logging in given the sync wouldn't have finished.
I could remove this alongside the sync wait but it will fire a request to the server for users that don't have organizations which IMO is a waste of resources and given that we're waiting for sync to finish we should have the latest organizations state when checking it.
@@ -233,6 +233,7 @@ private async Task UnlockedAsync() | |||
} | |||
var previousPage = await AppHelpers.ClearPreviousPage(); | |||
|
|||
_appOptions.HasJustLoggedInOrUnlocked = true; |
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.
💭 Instead of having this variable scattered around and risk missing a path to the vault, can't we just check once on TabsPage.OnCreate with a control variable HasRunCheckOrganizationUnassignedItems
?
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.
The problem is that TabsPage.OnCreate
can be called when the vault has timeout never, then it's not technically after login/unlock as it will be called when opening the app and given timeout never the vault would be already unlocked.
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.
Thanks for adding the self-host message!
Type of change
Objective
Add check for organization with unassigned items to display a message to the user if it's needed.
Code changes
GroupingsPage
AppOptions
and passed along the options object to get to theGroupingsPage
Screenshots
Unassigned items notice iOS
Unassigned items notice Android
Before you submit
dotnet format --verify-no-changes
) (required)