Skip to content

Commit

Permalink
Fix Rebase Issues
Browse files Browse the repository at this point in the history
Git didnt pick up all the changes and the rebase left some files in a wierd way. I have restored broken files to their state on main
  • Loading branch information
Axemasta committed Feb 8, 2024
1 parent 4291bc6 commit 98cb2df
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public override void TouchesCancelled(NSSet touches, UIEvent? evt)
public void Initialize()
{
Drawable = new DrawingViewDrawable(this);
proxy = new(this);
Lines.CollectionChanged += OnLinesCollectionChanged;
}

/// <inheritdoc/>
Expand All @@ -58,7 +58,6 @@ protected override void Dispose(bool disposing)
if (disposing)
{
currentPath.Dispose();
proxy?.Dispose();
}

base.Dispose(disposing);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public partial class MauiDrawingView
PointF previousPoint;
PathF currentPath = new();
MauiDrawingLine? currentLine;
MauiDrawingViewProxy? proxy;
Paint paint = new SolidPaint(DrawingViewDefaults.BackgroundColor);

/// <summary>
Expand Down
27 changes: 10 additions & 17 deletions src/CommunityToolkit.Maui.Core/Views/Popup/MauiPopup.macios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace CommunityToolkit.Maui.Core.Views;
public class MauiPopup : UIViewController
{
readonly IMauiContext mauiContext;
readonly WeakReference<UIViewController?> viewControllerReference = new(null);

/// <summary>
/// Constructor of <see cref="MauiPopup"/>.
Expand All @@ -32,11 +31,7 @@ public MauiPopup(IMauiContext mauiContext)
/// </summary>
public IPopup? VirtualView { get; private set; }

internal UIViewController? ViewController
{
get => viewControllerReference.TryGetTarget(out var viewController) ? viewController : null;
set => viewControllerReference.SetTarget(value);
}
internal UIViewController? ViewController { get; private set; }

/// <summary>
/// Method to update the Popup's size.
Expand Down Expand Up @@ -212,14 +207,22 @@ void SetView(UIView view, PageHandler control)

void SetPresentationController()
{
var popOverDelegate = new PopoverDelegate(this);
var popOverDelegate = new PopoverDelegate();
popOverDelegate.PopoverDismissedEvent += HandlePopoverDelegateDismissed;

UIPopoverPresentationController presentationController = (UIPopoverPresentationController)(PresentationController ?? throw new InvalidOperationException($"{nameof(PresentationController)} cannot be null."));
presentationController.SourceView = ViewController?.View ?? throw new InvalidOperationException($"{nameof(ViewController.View)} cannot be null.");

presentationController.Delegate = popOverDelegate;
}

[MemberNotNull(nameof(VirtualView))]
void HandlePopoverDelegateDismissed(object? sender, UIPresentationController e)
{
_ = VirtualView ?? throw new InvalidOperationException($"{nameof(VirtualView)} cannot be null.");
VirtualView.Handler?.Invoke(nameof(IPopup.OnDismissedByTappingOutsideOfPopup));
}

void AddToCurrentPageViewController(UIViewController viewController)
{
viewController.PresentViewController(this, true, null);
Expand All @@ -229,22 +232,12 @@ sealed class PopoverDelegate : UIPopoverPresentationControllerDelegate
{
readonly WeakEventManager popoverDismissedEventManager = new();

public PopoverDelegate(MauiPopup mauiPopup)
{
this.mauiPopup = new(mauiPopup);
PopoverDismissedEvent += HandlePopoverDelegateDismissed;
}

public event EventHandler<UIPresentationController> PopoverDismissedEvent
{
add => popoverDismissedEventManager.AddEventHandler(value);
remove => popoverDismissedEventManager.RemoveEventHandler(value);
}

MauiPopup MauiPopup => mauiPopup.TryGetTarget(out var virtualView)
? virtualView
: throw new ObjectDisposedException(nameof(MauiPopup));

public override UIModalPresentationStyle GetAdaptivePresentationStyle(UIPresentationController forPresentationController) =>
UIModalPresentationStyle.None;

Expand Down

0 comments on commit 98cb2df

Please sign in to comment.