Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Demo/Demo/Gravatar-Demo/DemoQuickEditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,18 +284,18 @@ final class DemoQuickEditorViewController: UIViewController {

lazy var schemeToggle: UISegmentedControl = {
let control = UISegmentedControl(items: [
UIAction.init(title: "System") { _ in self.customColorScheme = .unspecified },
UIAction.init(title: "Light") { _ in self.customColorScheme = .light },
UIAction.init(title: "Dark") { _ in self.customColorScheme = .dark },
UIAction.init(title: "System") { [weak self] _ in self?.customColorScheme = .unspecified },
UIAction.init(title: "Light") { [weak self] _ in self?.customColorScheme = .light },
UIAction.init(title: "Dark") { [weak self] _ in self?.customColorScheme = .dark },
])
control.selectedSegmentIndex = 0
return control
}()

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 },
])
Comment on lines 295 to 299
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

control.selectedSegmentIndex = 0
return control
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UIKit

public class QuickEditorConfiguration {
public struct QuickEditorConfiguration {
let interfaceStyle: UIUserInterfaceStyle
let customImageEditorProvider: CustomImageEditorControllerProvider?

Expand Down
10 changes: 5 additions & 5 deletions Sources/GravatarUI/QuickEditor/QuickEditorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ final class QuickEditorViewController<ImageEditor: ImageEditorView>: UIViewContr

private lazy var isPresented: Binding<Bool> = Binding {
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?()
}
}
Comment on lines 21 to 28
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


Expand Down Expand Up @@ -87,7 +87,6 @@ final class QuickEditorViewController<ImageEditor: ImageEditorView>: UIViewContr

override func viewDidLoad() {
super.viewDidLoad()

quickEditor.willMove(toParent: self)
addChild(quickEditor)
view.addSubview(quickEditor.view)
Expand All @@ -111,7 +110,8 @@ final class QuickEditorViewController<ImageEditor: ImageEditorView>: UIViewContr

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,
Comment on lines 111 to 117
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 🤔

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ class AvatarPickerViewModel: ObservableObject {
// Determine if the warning should be displayed
selectedAvatarURL == nil && loadedAvatarCount > 0
}
.assign(to: \.shouldDisplayNoSelectedAvatarWarning, on: self)
.sink { [weak self] shouldShowWarning in
self?.shouldDisplayNoSelectedAvatarWarning = shouldShowWarning
}
.store(in: &cancellables)

$profileResult.sink { [weak self] profileResult in
Expand Down