Skip to content

Commit

Permalink
update nugets.
Browse files Browse the repository at this point in the history
  • Loading branch information
softlion committed Feb 23, 2024
1 parent 9561de1 commit d03c93c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 23 deletions.
5 changes: 5 additions & 0 deletions MauiDemo/MauiDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,10 @@
<ItemGroup>
<ProjectReference Include="..\Vapolia.UserInteraction\Vapolia.UserInteraction.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.7" />
</ItemGroup>

</Project>
40 changes: 22 additions & 18 deletions Vapolia.UserInteraction/UserInteraction.ios.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ public partial class UserInteraction

internal static uint PlatformDefaultColor { set => defaultColor = FromArgb(value); }

private static UIViewController? CurrentViewController()
{
try
{
var uiViewController = Platform.GetCurrentUIViewController();
if(uiViewController != null)
return uiViewController;
}
catch (NullReferenceException)
{
}

Log?.LogWarning("Input: no window/nav controller on which to display");
return null;
}


static UIColor FromArgb(uint value)
=> new UIColor((value >> 16 & 0xff)/255f, (value >> 8 & 0xff)/255f, (value & 0xff)/255f, (value >> 24 & 0xff)/255f);

Expand Down Expand Up @@ -139,7 +156,7 @@ void ConfigureTextField(UITextField textField)
}


var presentingVc = Platform.GetCurrentUIViewController();
var presentingVc = CurrentViewController();
if (presentingVc != null)
{
UIApplication.SharedApplication.InvokeOnMainThread(() =>
Expand All @@ -151,8 +168,6 @@ void ConfigureTextField(UITextField textField)
presentingVc.PresentViewController(alert, true, null);
});
}
else
Log?.LogWarning("Input: no window/nav controller on which to display");

return tcs.Task;
}
Expand Down Expand Up @@ -222,26 +237,21 @@ void Do()
alert.DismissViewController(true, null);
}), true);

var presentingVc = Platform.GetCurrentUIViewController();
var presentingVc = CurrentViewController();
if (presentingVc != null)
UIApplication.SharedApplication.InvokeOnMainThread(() =>
{
presentingVc.PresentViewController(alert, true, null);
});
else
Log?.LogWarning("Input: no window/nav controller on which to display");
});
}
}

static Task PlatformActivityIndicator(CancellationToken dismiss, double? apparitionDelay = null, uint? argbColor = null)
{
var presentingVc = Platform.GetCurrentUIViewController();
var presentingVc = CurrentViewController();
if (presentingVc == null)
{
Log?.LogWarning("UserInteraction.ActivityIndicator: no window on which to display");
return Task.CompletedTask;
}

var tcs = new TaskCompletionSource<int>();

Expand Down Expand Up @@ -329,12 +339,9 @@ internal static Task<int> PlatformMenu(CancellationToken dismiss, bool userCanDi
System.Drawing.RectangleF? position = null,
string? title = null, string? description = null, int defaultActionIndex = -1, string? cancelButton = null, string? destroyButton = null, params string[] otherButtons)
{
var presentingVc = Platform.GetCurrentUIViewController();
var presentingVc = CurrentViewController();
if (presentingVc == null)
{
Log?.LogWarning("UserInteraction.Menu: no window on which to display");
return Task.FromResult(0);
}

var tcs = new TaskCompletionSource<int>();

Expand Down Expand Up @@ -393,12 +400,9 @@ internal static Task<int> PlatformMenu(CancellationToken dismiss, bool userCanDi

internal static Task PlatformToast(string text, ToastStyle style = ToastStyle.Notice, ToastDuration duration = ToastDuration.Normal, ToastPosition position = ToastPosition.Bottom, int positionOffset = 20, CancellationToken? dismiss = null)
{
var presentingVc = Platform.GetCurrentUIViewController();
var presentingVc = CurrentViewController();
if (presentingVc == null)
{
Log?.LogWarning("UserInteraction.Toast: no window on which to display");
return Task.CompletedTask;
}

var tcs = new TaskCompletionSource<int>();

Expand Down
16 changes: 11 additions & 5 deletions Vapolia.UserInteraction/Vapolia.UserInteraction.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,29 @@
<Compile Include="**\*.windows.*.cs" />
</ItemGroup>

<ItemGroup>
<Compile Remove="obj/**/*.cs" />
<Compile Remove="bin/**/*.cs" />
</ItemGroup>

<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">
<PackageReference Include="Vapolia.FluentLayouts" Version="1.0.0-ci2480247012" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS'))">
<PackageReference Include="Cirrious.FluentLayout" Version="3.0.0" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2612" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2622" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.1" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid'))">
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2612" />
<PackageReference Include="Xamarin.Forms" Version="5.0.0.2622" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.0" />
<PackageReference Include="Xamarin.Essentials" Version="1.8.1" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.9.0.3" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('net8.0'))">
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.0-rc.2.9511" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit d03c93c

Please sign in to comment.