Skip to content

Commit 19af6fe

Browse files
authored
Fix iPad share sheet covering QR code (#539)
* Fix iPad share sheet covering QR code (#539) The share sheet popover on iPad was appearing centered over the QR code, covering it entirely. Now the popover anchors to the bottom of the source view with an upward arrow, so the QR code remains visible. Fixes both ConversationShareView and AutoShareSheetView. Stacked on #538. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Anchor iPad share sheet popover to bottom to avoid covering QR code > - Updates `UIActivityViewController` popover configuration in [ConversationShareView.swift](https://github.com/xmtplabs/convos-ios/pull/539/files#diff-0b61b1a39f237dac83028d3a0b4a1ba744cb88f15934fd101e4b1f3a68cbbec9) and [AutoShareSheetView.swift](https://github.com/xmtplabs/convos-ios/pull/539/files#diff-621c78e434aee4ede856c47b009aefd7589beefb5c9aaf92b90c0ec022b5bf6a) to anchor to the bottom of the view with an upward arrow instead of centering without arrows > - Adjusts message attachment placeholder alignment in [MessagesGroupItemView.swift](https://github.com/xmtplabs/convos-ios/pull/539/files#diff-34b33cae925fe553d357af97d04319b8de2de329c1903afe72c915e36aa98774) to align trailing for outgoing messages and leading for incoming messages in regular width, with side padding > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized 37fceeb.</sup> > <!-- Macroscope's review summary ends here --> > <!-- macroscope-ui-refresh --> <!-- Macroscope's pull request summary ends here --> * Add bottom padding to quickname sheet on iPad (#540) * Fix iPad photo alignment: left-align incoming, right-align outgoing Photos on iPad were center-aligned. Now incoming photos align to the leading edge and outgoing photos align to the trailing edge, with step4x (16pt) padding on the respective side. Applies to loaded photos, loading placeholders, and error placeholders. * Fix iPad share sheet covering QR code Position the share sheet popover at the bottom of the source view with an upward arrow direction, so it appears below the QR code instead of covering it. Fixes both ConversationShareView and AutoShareSheetView. * Reduce QR code size on iPhone to avoid share sheet overlap Increase shareSheetFraction from 0.45 to 0.55 so the QR code sizes itself smaller, leaving room for the share sheet on iPhone. * Add bottom padding to quickname sheet on iPad Match the bottom padding used by FeatureInfoSheet: step10x on iPad (regular width), step6x on iPhone. --------- Co-authored-by: yewreeka <7864+yewreeka@users.noreply.github.com>
1 parent fc1eb8e commit 19af6fe

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

Convos/Conversation Detail/Conversation Detail Drawer/WhatIsQuicknameView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ struct WhatIsQuicknameView: View {
44
let onContinue: () -> Void
55

66
@State private var quicknameSettings: QuicknameSettingsViewModel = .shared
7+
@Environment(\.horizontalSizeClass) private var horizontalSizeClass: UserInterfaceSizeClass?
78

89
var body: some View {
910
VStack(alignment: .leading, spacing: DesignConstants.Spacing.step4x) {
@@ -58,6 +59,7 @@ struct WhatIsQuicknameView: View {
5859
.padding(.top, DesignConstants.Spacing.step4x)
5960
}
6061
.padding([.leading, .top, .trailing], DesignConstants.Spacing.step10x)
62+
.padding(.bottom, horizontalSizeClass == .regular ? DesignConstants.Spacing.step10x : DesignConstants.Spacing.step6x)
6163
}
6264
}
6365

Convos/Conversation Detail/ConversationShareView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct ConversationShareOverlay: View {
1717
private static let headerHeight: CGFloat = 40.0
1818
private static let cardPadding: CGFloat = 40.0
1919
private static let maxQRSize: CGFloat = 220.0
20-
private static let shareSheetFraction: CGFloat = 0.45
20+
private static let shareSheetFraction: CGFloat = 0.55
2121

2222
private var qrDisplaySize: CGFloat {
2323
let screenHeight = UIScreen.main.bounds.height
@@ -187,11 +187,11 @@ private struct ShareSheetPresenter: UIViewControllerRepresentable {
187187
popover.sourceView = uiViewController.view
188188
popover.sourceRect = CGRect(
189189
x: uiViewController.view.bounds.midX,
190-
y: uiViewController.view.bounds.midY,
190+
y: uiViewController.view.bounds.maxY,
191191
width: 0,
192192
height: 0
193193
)
194-
popover.permittedArrowDirections = []
194+
popover.permittedArrowDirections = .up
195195
}
196196

197197
activityVC.completionWithItemsHandler = { _, _, _, _ in

Convos/Shared Views/AutoShareSheetView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ private struct ActivityViewController: UIViewControllerRepresentable {
7272
popover.sourceView = uiViewController.view
7373
popover.sourceRect = CGRect(
7474
x: uiViewController.view.bounds.midX,
75-
y: uiViewController.view.bounds.midY,
75+
y: uiViewController.view.bounds.maxY,
7676
width: 0,
7777
height: 0
7878
)
79-
popover.permittedArrowDirections = []
79+
popover.permittedArrowDirections = .up
8080
}
8181

8282
activityVC.completionWithItemsHandler = { _, _, _, _ in

0 commit comments

Comments
 (0)