From cac8f1cda58394c5337225e956173f71f2f537a2 Mon Sep 17 00:00:00 2001 From: Yauheni Pakala Date: Fri, 5 Jan 2024 21:50:28 +0100 Subject: [PATCH 1/4] Add NullAllowed attributes. Fixes #9 --- samples/ViewController.cs | 15 ++++++++++++--- src/ApiDefinition.cs | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/samples/ViewController.cs b/samples/ViewController.cs index 2bc0e80..da920c3 100644 --- a/samples/ViewController.cs +++ b/samples/ViewController.cs @@ -29,9 +29,18 @@ private void MakeBasic() private void MakeWithDurationAndPosition() { - View!.MakeToast(new NSString("This is a piece of toast on top for 3 seconds"), - 3.0f, - CSToastPosition.Center); + + View!.MakeToast( + message: new NSString("This is a piece of toast on top for 3 seconds"), + duration: 3.0f, + position: CSToastPosition.Center, + title: new NSString("Test Title"), + image: null, + style: null, + completion: (didTap) => + { + Debug.WriteLine(didTap ? "Did Tap" : "No Tap"); + }); } private void MakeWithTitle() diff --git a/src/ApiDefinition.cs b/src/ApiDefinition.cs index 17cdd83..58b97a7 100644 --- a/src/ApiDefinition.cs +++ b/src/ApiDefinition.cs @@ -21,13 +21,24 @@ interface Toast void MakeToast(NSString message, nfloat duration, NSString position); [Export("makeToast:duration:position:title:image:style:completion:")] - void MakeToast(NSString message, nfloat duration, NSString position, NSString title, UIImage image, CSToastStyle style, CompletionDelegate completion); + void MakeToast( + NSString message, + nfloat duration, + NSString position, + [NullAllowed] NSString title, + [NullAllowed] UIImage image, + [NullAllowed] CSToastStyle style, + [NullAllowed] CompletionDelegate completion); [Export("showToast:")] void ShowToast(UIView view); [Export("showToast:duration:position:completion:")] - void ShowToast(UIView view, double duration, NSString position, CompletionDelegate completion); + void ShowToast( + UIView view, + double duration, + NSString position, + [NullAllowed] CompletionDelegate completion); [Export("hideToast:")] void HideToast(UIView view); From cea306c820e74a94b41ec0fc5916217a178a6e50 Mon Sep 17 00:00:00 2001 From: Yauheni Pakala Date: Fri, 5 Jan 2024 21:54:59 +0100 Subject: [PATCH 2/4] Allow custom position --- samples/ViewController.cs | 5 ++++- src/ApiDefinition.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/ViewController.cs b/samples/ViewController.cs index da920c3..758efa1 100644 --- a/samples/ViewController.cs +++ b/samples/ViewController.cs @@ -29,11 +29,14 @@ private void MakeBasic() private void MakeWithDurationAndPosition() { + var position = CSToastPosition.Center; + // or custom coordinates: + // var position = NSValue.FromCGPoint(new CGPoint(30, 200)); View!.MakeToast( message: new NSString("This is a piece of toast on top for 3 seconds"), duration: 3.0f, - position: CSToastPosition.Center, + position: position, title: new NSString("Test Title"), image: null, style: null, diff --git a/src/ApiDefinition.cs b/src/ApiDefinition.cs index 58b97a7..88ddea5 100644 --- a/src/ApiDefinition.cs +++ b/src/ApiDefinition.cs @@ -24,7 +24,7 @@ interface Toast void MakeToast( NSString message, nfloat duration, - NSString position, + NSObject position, [NullAllowed] NSString title, [NullAllowed] UIImage image, [NullAllowed] CSToastStyle style, From 519c7c9257e80166c14cdc1d5b257655a0995aee Mon Sep 17 00:00:00 2001 From: Yauheni Pakala Date: Sat, 6 Jan 2024 17:52:11 +0100 Subject: [PATCH 3/4] Bump macos version --- azure-pipelines/templates/vars.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines/templates/vars.yml b/azure-pipelines/templates/vars.yml index 15e011f..3db285f 100644 --- a/azure-pipelines/templates/vars.yml +++ b/azure-pipelines/templates/vars.yml @@ -1,2 +1,2 @@ variables: - MACOS_VM_IMAGE: 'macos-12' \ No newline at end of file + MACOS_VM_IMAGE: 'macos-13' \ No newline at end of file From a1b2ab6aefc72847a1394108154d7f8ca5ec5ebe Mon Sep 17 00:00:00 2001 From: Yauheni Pakala Date: Sat, 6 Jan 2024 18:12:52 +0100 Subject: [PATCH 4/4] Update nuget package info --- src/ToastBindings.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ToastBindings.csproj b/src/ToastBindings.csproj index e0deab5..e10e6bf 100644 --- a/src/ToastBindings.csproj +++ b/src/ToastBindings.csproj @@ -8,15 +8,15 @@ Toast for Xamarin.iOS Xamarin iOS binding library of Toast - toast notifications to the UIView. Softeq Development Corporation - Copyright © 2018 Softeq Development Corporation - 4.0.0.2 + Copyright © 2024 Softeq Development Corporation + 4.0.0.3 Softeq Development Corp. Softeq Development Corp. https://github.com/Softeq/Toast-xamarin-ios LICENSE - toast;ios;xamarin;binding;softeq;library;uikit;ui + toast;ios;xamarin;binding;softeq;library;uikit;ui;maui;dotnet;mobile README.md - Migration to .NET6 +