Skip to content
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

fix: Image selector anchor - WPB-11605 #2100

Open
wants to merge 9 commits into
base: release/cycle-3.114
Choose a base branch
from

Conversation

samwyndham
Copy link
Contributor

@samwyndham samwyndham commented Oct 29, 2024

BugWPB-11605 [iOS] Anchor profile image selector popover

Issue

Currently on the navigation overhaul epic branch the popover UIImagePickerController is not properly anchored as it doesn't have a suitable sourceView set.

This PR:

  • Removes an unreferenced protocol, SettingsExternalScreenCellDescriptorType, allowing more flexibility when creating SettingsAppearanceCellDescriptor, and thus allowing the sender of the settings screen to be forwarded to the UIImagePickerControllers picker.
  • Updates ImagePickerManager.showActionSheet(on:completion:) to accept a popoverSourceView which gets set on the popover controller.
  • Uses a popover controller when displaying UIImagePickerController on any iPad, not just regular size classes as is necessary for apples API.
  • Does some general clean up to simplify code and remove optional instance variables

Testing

  1. Please test on a real iPad.
  2. Navigate to Setting
  3. Tap Profile Picture
  4. Tap Choose from Library
  5. Photo picker should be well placed
  6. Navigate to profile
  7. Tap on your profile picker
  8. Tap Choose from Library
  9. Photo picker should be well placed

Also try rotating the device to check things are working

NOTE:

After selecting a photo there is a know issue that is not fixed in this PR: https://wearezeta.atlassian.net/browse/WPB-11929

Checklist

  • Title contains a reference JIRA issue number like [WPB-XXX].
  • Description is filled and free of optional paragraphs.
  • Adds/updates automated tests.

@samwyndham samwyndham requested review from caldrian and agisilaos and removed request for caldrian October 29, 2024 16:06
@echoes-hq echoes-hq bot added the echoes: product-roadmap Work aligned with the customer-announced roadmap, targeting a specific release date. label Oct 29, 2024
@@ -96,23 +107,13 @@ class ImagePickerManager: NSObject {
imagePickerController.cameraDevice = .front
imagePickerController.modalTransitionStyle = .coverVertical
case .photoLibrary, .savedPhotosAlbum:
if viewController.isIPadRegular() {
if viewController.isIPad() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

isIPadRegular isn't sufficient. We need to use a popover on any iPad size

Copy link
Contributor

Choose a reason for hiding this comment

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

I think correct would be to check if the split view controller's layout is collapsed, which is true for iPhones and for iPads when the window is resized so that the horizontal size class is compact.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed with @caldrian here. Is it possible to be done in this PR @samwyndham?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But won't that mean that it is possible to present this on iPad without using a popover? Won't that crash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll see if there is a iPad at work to test this with

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried if it still works with the full-screen requirement disabled
Screenshot 2024-11-11 at 16 22 35
and resized the window so that the layout collapsed.
It looks like it does. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@caldrian You mean you tested there was no crash?

Copy link
Contributor

Choose a reason for hiding this comment

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

No crash and the presentation seems to be correct.

Copy link
Contributor

github-actions bot commented Oct 29, 2024

Test Results

    2 files    288 suites   3m 32s ⏱️
1 784 tests 1 784 ✅ 0 💤 0 ❌
1 792 runs  1 792 ✅ 0 💤 0 ❌

Results for commit b013ec3.

♻️ This comment has been updated with latest results.

Base automatically changed from epic/navigation-overhaul-WPB-6647 to develop October 31, 2024 15:04
@echoes-hq echoes-hq bot added echoes: unplanned Any work item that isn’t part of the product or technical roadmap. echoes: technical-roadmap/technical-debt Changes intended at mitigating risks labels Oct 31, 2024
This abstract type is not referenced and it's conformance limits flexibility fixing this bug
Also ensure a popover is always used for iPad
This variable is not read
@samwyndham samwyndham force-pushed the fix/WPB-11605-image-selector-achor branch from 8086ba2 to a9a55f9 Compare November 1, 2024 15:49
@@ -96,23 +107,13 @@ class ImagePickerManager: NSObject {
imagePickerController.cameraDevice = .front
imagePickerController.modalTransitionStyle = .coverVertical
case .photoLibrary, .savedPhotosAlbum:
if viewController.isIPadRegular() {
if viewController.isIPad() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think correct would be to check if the split view controller's layout is collapsed, which is true for iPhones and for iPads when the window is resized so that the horizontal size class is compact.

Copy link
Contributor

@agisilaos agisilaos left a comment

Choose a reason for hiding this comment

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

Left some comments and questions regarding a PopoverPresentationControllerConfiguration and how to check if it's iPad by checking if SplitViewController layout is collapsed.

@@ -96,23 +107,13 @@ class ImagePickerManager: NSObject {
imagePickerController.cameraDevice = .front
imagePickerController.modalTransitionStyle = .coverVertical
case .photoLibrary, .savedPhotosAlbum:
if viewController.isIPadRegular() {
if viewController.isIPad() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed with @caldrian here. Is it possible to be done in this PR @samwyndham?

@@ -96,23 +107,13 @@ class ImagePickerManager: NSObject {
imagePickerController.cameraDevice = .front
imagePickerController.modalTransitionStyle = .coverVertical
case .photoLibrary, .savedPhotosAlbum:
if viewController.isIPadRegular() {
if viewController.isIPad() {
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried if it still works with the full-screen requirement disabled
Screenshot 2024-11-11 at 16 22 35
and resized the window so that the layout collapsed.
It looks like it does. 👍

# Conflicts:
#	wire-ios/Wire-iOS/Sources/Managers/Image/ImagePickerManager.swift
#	wire-ios/Wire-iOS/Sources/Managers/Image/ProfileImagePickerManager.swift
#	wire-ios/Wire-iOS/Sources/UserInterface/SelfProfile/SelfProfileViewController.swift
#	wire-ios/Wire-iOS/Sources/UserInterface/Settings/CellDescriptors/SettingsCellDescriptor.swift
#	wire-ios/Wire-iOS/Sources/UserInterface/Settings/CellDescriptors/SettingsCellDescriptorFactory+Account.swift
@samwyndham samwyndham changed the base branch from develop to release/cycle-3.114 November 22, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: product-roadmap Work aligned with the customer-announced roadmap, targeting a specific release date. echoes: technical-roadmap/technical-debt Changes intended at mitigating risks echoes: unplanned Any work item that isn’t part of the product or technical roadmap.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants