Skip to content

Conversation

@etoledom
Copy link
Contributor

Closes #

Description

This PR fixes a retain cycle on QuickEditorViewController, and in DemoQuickEditorViewController

Testing Steps

  • Run the demo app
  • Go to Quick Editor demo screen
  • Display the Quick Editor
  • Close and display it again a few times.
  • Go back to the root screen of the demo app
  • Check the Debug Memory Graph on xcode
    • Check that there are no references to QuickEditorViewController, InnerHeightUIHostingController, or DemoQuickEditorViewController in the graph.

@etoledom etoledom requested a review from pinarol May 28, 2025 10:38
@etoledom etoledom self-assigned this May 28, 2025
@etoledom etoledom added Bug Something isn't working [Feature] Gravatar-QuickEditor Gravatar Quick Editor [Priority] High labels May 28, 2025
Comment on lines 295 to 299
lazy var imageEditorToggle: UISegmentedControl = {
let control = UISegmentedControl(items: [
UIAction.init(title: "Default Image Editor") { _ in self.useCustomImageEditor = false },
UIAction.init(title: "Custom Image Editor") { _ in self.useCustomImageEditor = true },
UIAction.init(title: "Default Image Editor") { [weak self] _ in self?.useCustomImageEditor = false },
UIAction.init(title: "Custom Image Editor") { [weak self] _ in self?.useCustomImageEditor = true },
])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are an extra retention on DemoQuickEditorViewController

Comment on lines 21 to 28
true
} set: { isPresented in
} set: { [weak self] isPresented in
Task { @MainActor in
guard !isPresented else { return }
self.dismiss(animated: true)
self.onDismiss?()
self?.dismiss(animated: true)
self?.onDismiss?()
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was the main culprit

@wpmobilebot
Copy link

wpmobilebot commented May 28, 2025

App Icon📲 You can test the changes from this Pull Request in Gravatar Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar Prototype Build
Build Number2385
VersionPR #765
Bundle IDcom.automattic.gravatar-sdk-demo-uikit.prototype-build
Commitd08b5e9
Installation URL3fqucm57gdm20
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Comment on lines 111 to 117
func updateDetents() {
if let sheet = sheetPresentationController {
sheet.animateChanges {
sheet.animateChanges { [weak self] in
guard let self else { return }
sheet.detents = QEDetent.detents(
for: scopeOption,
intrinsicHeight: sheetHeight,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This I think is doing nothing 🤔

pinarol added 2 commits May 28, 2025 12:07
`.assign(to: \.shouldDisplayNoSelectedAvatarWarning, on: self)` captures self strongly
Copy link
Contributor

@pinarol pinarol left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@etoledom etoledom merged commit 3c2ecd5 into etoledom/uikit-sheet-presentation May 28, 2025
8 checks passed
@etoledom etoledom deleted the etoledom/fix-memory-issues branch May 28, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working [Feature] Gravatar-QuickEditor Gravatar Quick Editor [Priority] High

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants