Skip to content

[EC-259] Added Account Switching to Share extension on iOS#1971

Merged
fedemkr merged 9 commits intomasterfrom
EC-259-account-switching-share-extension-ios
Jul 12, 2022
Merged

[EC-259] Added Account Switching to Share extension on iOS#1971
fedemkr merged 9 commits intomasterfrom
EC-259-account-switching-share-extension-ios

Conversation

@fedemkr
Copy link
Member

@fedemkr fedemkr commented Jun 30, 2022

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Added Account Switching to Share extension on iOS and focused on improving memory usage so that the extension doesn't crash.

Code changes

  • MainApplication.cs: Registering AvatarImageSourcePool
  • AccountViewCellViewModel.cs: Adapted to use the AvatarImageSourcePool
  • AvatarImageSource.cs: Added usings to correct disposal of resources
  • AvatarImageSourcePool.cs: Added this pool to reuse instance of AvatarImageSource across the app
  • DateTimePicker.xaml, DateTimePicker.xaml.cs: Control that combines date and time picking, also added the lazy way of inserting it to avoid memory spike.
  • DateTimeViewModel.cs: ViewModel to be used alongside DateTimePicker
  • SendAddEditPage.xaml: Adapted for ...DateTimeViewModel
  • SendAddEditPage.xaml.cs: Removed OnClose Action given that now a different page is used by the extension
  • SendAddEditPageViewModel.cs: Added DeletionDateTimeViewModel and ExpirationDateTimeViewModel to handle date and time and use the DateTimePicker lazily.
  • SendAddOnlyOptionsView.xaml, SendAddOnlyOptionsView.xaml.cs: Added this view to be used lazily by SendAddOnlyPage so avoid memory spiking when loading the page. It's basically the Options part that can be shown/hidden by the button in the SendAddOnlyPage, given that's lazy, it's only going to be loaded the first time the user wants to show the options.
  • SendAddOnlyPage.xaml, SendAddOnlyPage.xaml.cs: Alike SendAddEditPage but it only has add mode and controls that are used only on adding and specifically for the iOS share extension. With this we remove code and the memory usage decreases. Also, it just loads the view directly instead of using LoadOnAppearedAsync given that the load time is almost nothing, therefore the loading indicator is not seen and this doesn't make sense, therefore we save some memory and cpu time here as well.
  • AccountsManager.cs: Added logging, exception handling and improved invoking on main thread to be awaited properly
  • BaseLockPasswordViewController.cs: Added properly disposal of resources and also changed some references to be weak so that things can be garbage collected in the correct moment.
  • ExtendedUIViewController.cs: Added method to apply theme to a UINavigationBar and not only to the current NavigationController
  • AccountSwitchingOverlayHelper.cs: Improved image disposal
  • iOSCoreHelpers.cs: Registering AvatarImageSourcePool and added InitApp<T>(...) method to be reused on the iOS extensions.
  • ExtensionNavigationController.cs: Added proper disposal of controllers when navigating.
  • LoadingViewController.cs: Added account switching, changed navigation controller to use the ExtensionNavigationController for proper disposal of controllers, improved get provider type and improved navigations to dispose resources appropriately.
  • LockPasswordViewController.cs: Added account switching and improved memory usage by disposing resources correctly.
  • MainInterface.storyboard: Refactored to use less navigation controllers and add account switching on lock controller.

Screenshots

Lock with Account Switching

Lock with Account Switching open

Sendwith Account Switching open

Before you submit

  • I have checked for formatting errors (dotnet tool run dotnet-format --check) (required)
  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

@fedemkr fedemkr marked this pull request as ready for review July 4, 2022 17:34
@fedemkr fedemkr requested a review from a team July 4, 2022 17:35
Copy link
Member

@jlf0dev jlf0dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't been in mobile land in a little bit, but went ahead and took a look through this just in case no one else has time. I have a couple questions but overall it looks good.

@fedemkr fedemkr requested a review from jlf0dev July 12, 2022 16:39
@fedemkr fedemkr merged commit 292908f into master Jul 12, 2022
@fedemkr fedemkr deleted the EC-259-account-switching-share-extension-ios branch July 12, 2022 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants