Skip to content

Commit fd4da38

Browse files
committed
Merge branch 'master' into feature/added-support-old-framework
2 parents 925e516 + 77b116d commit fd4da38

File tree

6 files changed

+106
-7
lines changed

6 files changed

+106
-7
lines changed

samples/Main.storyboard

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3-
<device id="retina4_7" orientation="portrait">
4-
<adaptation id="fullscreen"/>
5-
</device>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3+
<device id="retina4_7" orientation="portrait" appearance="light"/>
64
<dependencies>
7-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
87
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
98
</dependencies>
109
<scenes>
@@ -20,38 +19,64 @@
2019
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
2120
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2221
<subviews>
23-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ulO-pt-Awz">
22+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ulO-pt-Awz">
2423
<rect key="frame" x="0.0" y="100" width="375" height="30"/>
2524
<constraints>
2625
<constraint firstAttribute="height" constant="30" id="52Z-4q-3kU"/>
2726
</constraints>
2827
<state key="normal" title="Basic usage"/>
2928
</button>
30-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JYx-0k-Dz1">
29+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="JYx-0k-Dz1">
3130
<rect key="frame" x="0.0" y="138" width="375" height="30"/>
3231
<constraints>
3332
<constraint firstAttribute="height" constant="30" id="LUL-9G-oiK"/>
3433
</constraints>
3534
<state key="normal" title="Make with duration"/>
3635
</button>
36+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UhU-8c-F0m" userLabel="Hide Toast">
37+
<rect key="frame" x="112.5" y="176" width="75" height="35"/>
38+
<state key="normal" title="Button"/>
39+
<buttonConfiguration key="configuration" style="plain" title="Hide Toasts"/>
40+
</button>
41+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mhs-jY-F3O" userLabel="Clear Queue">
42+
<rect key="frame" x="187.5" y="176" width="75" height="35"/>
43+
<state key="normal" title="Button"/>
44+
<buttonConfiguration key="configuration" style="plain" title="Clear Queue"/>
45+
</button>
46+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6KJ-0o-GoE" userLabel="Hide Toast And Clear Queue">
47+
<rect key="frame" x="0.0" y="219" width="375" height="35"/>
48+
<state key="normal" title="Button"/>
49+
<buttonConfiguration key="configuration" style="plain" title="Hide Toasts And Clear Queue"/>
50+
</button>
3751
</subviews>
3852
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
3953
<constraints>
4054
<constraint firstAttribute="trailing" secondItem="JYx-0k-Dz1" secondAttribute="trailing" id="1tF-6H-Dqg"/>
55+
<constraint firstItem="mhs-jY-F3O" firstAttribute="top" secondItem="JYx-0k-Dz1" secondAttribute="bottom" constant="8" id="2cT-xS-Odr"/>
56+
<constraint firstItem="6KJ-0o-GoE" firstAttribute="leading" secondItem="JYx-0k-Dz1" secondAttribute="leading" id="4yi-Ka-CRV"/>
57+
<constraint firstItem="UhU-8c-F0m" firstAttribute="top" secondItem="JYx-0k-Dz1" secondAttribute="bottom" constant="8" id="5vX-WS-Pdr"/>
58+
<constraint firstItem="mhs-jY-F3O" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="ARQ-W1-fbJ"/>
4159
<constraint firstItem="ulO-pt-Awz" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="BxJ-Ka-IMi"/>
60+
<constraint firstItem="6KJ-0o-GoE" firstAttribute="top" secondItem="mhs-jY-F3O" secondAttribute="bottom" constant="8" id="YWQ-sN-cAQ"/>
4261
<constraint firstAttribute="trailing" secondItem="ulO-pt-Awz" secondAttribute="trailing" id="ZLc-TP-SRw"/>
62+
<constraint firstItem="UhU-8c-F0m" firstAttribute="trailing" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="jmg-Iq-fez"/>
63+
<constraint firstItem="6KJ-0o-GoE" firstAttribute="trailing" secondItem="JYx-0k-Dz1" secondAttribute="trailing" id="mO7-CL-wle"/>
4364
<constraint firstItem="JYx-0k-Dz1" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="nIp-jj-R8g"/>
4465
<constraint firstItem="ulO-pt-Awz" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="80" id="rP9-xa-MIr"/>
4566
<constraint firstItem="JYx-0k-Dz1" firstAttribute="top" secondItem="ulO-pt-Awz" secondAttribute="bottom" constant="8" id="sjY-qf-oke"/>
4667
</constraints>
4768
</view>
4869
<connections>
4970
<outlet property="BasicUsageBtn" destination="ulO-pt-Awz" id="GwC-0i-FqH"/>
71+
<outlet property="ClearQueueBtn" destination="mhs-jY-F3O" id="Yay-2e-QLY"/>
72+
<outlet property="HideToastsAndClearQueueBtn" destination="6KJ-0o-GoE" id="YGR-a5-W1h"/>
73+
<outlet property="HideToastsBtn" destination="UhU-8c-F0m" id="cKa-ar-t2L"/>
5074
<outlet property="MakeWithDurationBtn" destination="JYx-0k-Dz1" id="LTc-VC-dCQ"/>
5175
</connections>
5276
</viewController>
5377
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
5478
</objects>
79+
<point key="canvasLocation" x="-41" y="-69"/>
5580
</scene>
5681
</scenes>
5782
</document>

samples/ToastSamples.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,10 @@
3838
<ItemGroup>
3939
<ProjectReference Include="..\src\ToastBindings.csproj" />
4040
</ItemGroup>
41+
<!-- Temporary solution for net6.0 https://github.com/dotnet/maui/discussions/15540#discussioncomment-6554443 -->
42+
<!-- Can be removed after updating to net8.0 https://github.com/xamarin/xamarin-macios/issues/18964 -->
43+
<PropertyGroup>
44+
<MtouchLink>SdkOnly</MtouchLink>
45+
<MtouchExtraArgs>$(MtouchExtraArgs) --weak-framework=NewsstandKit</MtouchExtraArgs>
46+
</PropertyGroup>
4147
</Project>

samples/ViewController.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,28 @@ public override void ViewDidLoad()
1818
{
1919
base.ViewDidLoad();
2020

21+
CSToastManager.SetQueueEnabled(true);
22+
2123
BasicUsageBtn.TouchUpInside += (sender, e) => MakeBasic();
2224
MakeWithDurationBtn.TouchUpInside += (sender, e) => MakeWithDurationAndPosition();
25+
HideToastsBtn.TouchUpInside += (s, e) => HideAllToast();
26+
HideToastsAndClearQueueBtn.TouchUpInside += (s, e) => HideToastAndClearQueue();
27+
ClearQueueBtn.TouchUpInside += (s, e) => ClearQueue();
28+
}
29+
30+
private void ClearQueue()
31+
{
32+
ToastService.ClearToastQueue(View!);
33+
}
34+
35+
private void HideToastAndClearQueue()
36+
{
37+
ToastService.HideAllToasts(View!);
38+
}
39+
40+
private void HideAllToast()
41+
{
42+
ToastService.HideAllToasts(View!, false);
2343
}
2444

2545
private void MakeBasic()

samples/ViewController.designer.cs

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ApiDefinition.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ void ShowToast(
4242

4343
[Export("hideToast:")]
4444
void HideToast(UIView view);
45+
46+
[Export("hideAllToasts")]
47+
void HideAllToasts();
48+
49+
[Export("hideAllToasts:clearQueue:")]
50+
void HideAllToasts(bool includeActivity, bool clearQueue);
51+
52+
[Export("clearToastQueue")]
53+
void ClearToastQueue();
4554
}
4655

4756
[BaseType(typeof(NSObject))]

src/ToastService.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@ public static void HideToast(UIView view, UIView toast)
1515
view.HideToast(toast);
1616
}
1717

18+
public static void HideAllToasts(UIView view)
19+
{
20+
view.HideAllToasts();
21+
}
22+
23+
public static void HideAllToasts(UIView view, bool clearQueue)
24+
{
25+
view.HideAllToasts(false, clearQueue);
26+
}
27+
28+
public static void ClearToastQueue(UIView view)
29+
{
30+
view.ClearToastQueue();
31+
}
32+
1833
public static void ShowToast(UIView parentView,
1934
UIView toastView,
2035
ToastPosition? toastPosition = null,

0 commit comments

Comments
 (0)