Skip to content

Commit d9d9cd9

Browse files
committed
Adding Acr.userDialogs.Maui
1 parent 065d8e3 commit d9d9cd9

9 files changed

+145
-59
lines changed

Acr.UserDialogs.sln

+59
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1212
Build.slnf = Build.slnf
1313
icon.png = icon.png
1414
readme.md = readme.md
15+
src\Directory.build.props = src\Directory.build.props
1516
EndProjectSection
1617
EndProject
1718
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "sample\Sample\Sample.csproj", "{15294F23-E346-4DD3-A0EA-FDAB8F73B9A9}"
1819
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Acr.UserDialogs.Maui", "src\Acr.UserDialogs.Maui\Acr.UserDialogs.Maui.csproj", "{D45ECD34-ED85-4F09-914F-0D2A566C39C3}"
21+
EndProject
1922
Global
2023
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2124
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@@ -173,6 +176,62 @@ Global
173176
{15294F23-E346-4DD3-A0EA-FDAB8F73B9A9}.Release|x86.ActiveCfg = Release|Any CPU
174177
{15294F23-E346-4DD3-A0EA-FDAB8F73B9A9}.Release|x86.Build.0 = Release|Any CPU
175178
{15294F23-E346-4DD3-A0EA-FDAB8F73B9A9}.Release|x86.Deploy.0 = Release|Any CPU
179+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
180+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
181+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|ARM.ActiveCfg = Debug|Any CPU
182+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|ARM.Build.0 = Debug|Any CPU
183+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
184+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
185+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
186+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
187+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|Mixed Platforms.ActiveCfg = Debug|Any CPU
188+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|Mixed Platforms.Build.0 = Debug|Any CPU
189+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|x64.ActiveCfg = Debug|Any CPU
190+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|x64.Build.0 = Debug|Any CPU
191+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
192+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
193+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
194+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|Any CPU.Build.0 = Debug|Any CPU
195+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|ARM.ActiveCfg = Debug|Any CPU
196+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|ARM.Build.0 = Debug|Any CPU
197+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
198+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|iPhone.Build.0 = Debug|Any CPU
199+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
200+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
201+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|Mixed Platforms.ActiveCfg = Debug|Any CPU
202+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|Mixed Platforms.Build.0 = Debug|Any CPU
203+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|x64.ActiveCfg = Debug|Any CPU
204+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|x64.Build.0 = Debug|Any CPU
205+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|x86.ActiveCfg = Debug|Any CPU
206+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.AppStore|x86.Build.0 = Debug|Any CPU
207+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
208+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
209+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|ARM.ActiveCfg = Debug|Any CPU
210+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|ARM.Build.0 = Debug|Any CPU
211+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|iPhone.ActiveCfg = Debug|Any CPU
212+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|iPhone.Build.0 = Debug|Any CPU
213+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
214+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
215+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
216+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
217+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|x64.ActiveCfg = Debug|Any CPU
218+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|x64.Build.0 = Debug|Any CPU
219+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|x86.ActiveCfg = Debug|Any CPU
220+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Debug|x86.Build.0 = Debug|Any CPU
221+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
222+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|Any CPU.Build.0 = Release|Any CPU
223+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|ARM.ActiveCfg = Release|Any CPU
224+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|ARM.Build.0 = Release|Any CPU
225+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|iPhone.ActiveCfg = Release|Any CPU
226+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|iPhone.Build.0 = Release|Any CPU
227+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
228+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
229+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
230+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
231+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|x64.ActiveCfg = Release|Any CPU
232+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|x64.Build.0 = Release|Any CPU
233+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|x86.ActiveCfg = Release|Any CPU
234+
{D45ECD34-ED85-4F09-914F-0D2A566C39C3}.Release|x86.Build.0 = Release|Any CPU
176235
EndGlobalSection
177236
GlobalSection(SolutionProperties) = preSolution
178237
HideSolutionNode = FALSE

Build.slnf

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"solution": {
3-
"path": "Acr.UserDialogs.sln",
4-
"projects": [
5-
"src\\Acr.UserDialogs\\Acr.UserDialogs.csproj"
6-
]
7-
}
2+
"solution": {
3+
"path": "Acr.UserDialogs.sln",
4+
"projects": [
5+
"src\\Acr.UserDialogs\\Acr.UserDialogs.csproj",
6+
"src\\Acr.UserDialogs.Maui\\Acr.UserDialogs.Maui.csproj"
7+
]
8+
}
89
}

readme.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,22 @@ A cross platform library that allows you to call for standard user dialogs from
2323

2424
## Support Platforms
2525

26-
v7.x Supports
27-
* iOS 8+
28-
* Android
29-
* Universal Windows Platform (Win10/UWP)
30-
* NET Standard 2.0
31-
32-
v8.x Supports ONLY .NET 6 target
33-
* .NET for Android (major target 12)
34-
* .NET for iOS
35-
* .NET for MacCatalyst
36-
3726
v9.x Supports ONLY .NET 8 target
3827
* .NET for Android
3928
* .NET for iOS
4029
* .NET for MacCatalyst
4130

4231
## Setup
4332

33+
### MAUI Users
34+
Install Acr.UserDialogs.Maui from NuGet
35+
36+
In your MauiProgram.cs, add the following
37+
38+
```csharp
39+
40+
```
41+
4442
To use, simply reference the nuget package in each of your platform projects. If you are getting issues with System.Drawing.Color, please make sure you are using the latest version of Xamarin
4543

4644
#### iOS and Windows

sample/Sample/MauiProgram.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace Samples;
1+
using Acr.UserDialogs;
2+
3+
namespace Sample;
24

35

46
public static class MauiProgram
@@ -8,6 +10,7 @@ public static MauiApp CreateMauiApp()
810
var builder = MauiApp.CreateBuilder();
911
builder
1012
.UseMauiApp<App>()
13+
.UseUserDialogs()
1114
.ConfigureFonts(fonts =>
1215
{
1316
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");

sample/Sample/Sample.csproj

+5-10
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,9 @@
3737
<MauiFont Include="Resources\Fonts\*" />
3838
</ItemGroup>
3939

40-
<ItemGroup>
41-
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.14" />
42-
<ProjectReference Include="..\..\src\Acr.UserDialogs\Acr.UserDialogs.csproj" />
43-
</ItemGroup>
44-
<ItemGroup>
45-
<None Remove="Resources\Raw\" />
46-
</ItemGroup>
47-
<ItemGroup>
48-
<Folder Include="Resources\Raw\" />
49-
</ItemGroup>
40+
<ItemGroup>
41+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.14" />
42+
<ProjectReference Include="..\..\src\Acr.UserDialogs.Maui\Acr.UserDialogs.Maui.csproj" />
43+
<ProjectReference Include="..\..\src\Acr.UserDialogs\Acr.UserDialogs.csproj" />
44+
</ItemGroup>
5045
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net8.0;net8.0-ios;net8.0-maccatalyst;net8.0-android</TargetFrameworks>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.7" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\Acr.UserDialogs\Acr.UserDialogs.csproj" />
15+
</ItemGroup>
16+
</Project>
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace Acr.UserDialogs;
2+
3+
4+
public static class MauiExtensions
5+
{
6+
public static MauiAppBuilder UseUserDialogs(this MauiAppBuilder builder)
7+
{
8+
#if ANDROID
9+
UserDialogs.Init(() => Platform.CurrentActivity);
10+
builder.Services.AddSingleton(UserDialogs.Instance);
11+
12+
#elif IOS || MACCATALYST
13+
builder.Services.AddSingleton(UserDialogs.Instance);
14+
15+
#else
16+
throw new ApplicationException("This plugin only works with .NET 8.0 for Android, iOS, and Mac Catalyst. You are calling this, but it isn't from one of those targets!");
17+
18+
#endif
19+
20+
return builder;
21+
}
22+
}

src/Acr.UserDialogs/Acr.UserDialogs.csproj

+1-31
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,14 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net8.0;net8.0-ios;net8.0-android;net8.0-maccatalyst;net8.0-macos</TargetFrameworks>
4-
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows</TargetFrameworks>
5-
<!--<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>-->
6-
<PackageProjectUrl>https://github.com/aritchie/userdialogs</PackageProjectUrl>
3+
<TargetFrameworks>net8.0;net8.0-ios;net8.0-android;net8.0-maccatalyst</TargetFrameworks>
74
<Product>$(AssemblyName) ($(TargetFramework))</Product>
8-
<Authors>Allan Ritchie</Authors>
9-
<Description>A cross platform library that allows you to call for standard user dialogs from a shared/portable library. Supports Android, iOS, and UWP</Description>
10-
<PackageTags>ios android xamarin xam.pcl dialogs plugin</PackageTags>
11-
<PackageReleaseNotes>https://github.com/aritchie/userdialogs/raw/master/ChangeLog.md</PackageReleaseNotes>
12-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
13-
<LangVersion>latest</LangVersion>
14-
<NoWarn>$(NoWarn);1591;1701;1591;1702;1705;VSX1000;NU1603</NoWarn>
15-
<RepositoryUrl>https://github.com/aritchie/userdialogs</RepositoryUrl>
16-
<RepositoryType>git</RepositoryType>
17-
<PackageIcon>icon.png</PackageIcon>
18-
<PackageReadmeFile>readme.md</PackageReadmeFile>
19-
</PropertyGroup>
20-
21-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
22-
<IncludeSource>True</IncludeSource>
23-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
24-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
25-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
26-
<PublishRepositoryUrl>True</PublishRepositoryUrl>
27-
<EmbedUntrackedSources>True</EmbedUntrackedSources>
28-
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true' OR '$(CI)' == 'true'">true</ContinuousIntegrationBuild>
295
</PropertyGroup>
306

317
<ItemGroup>
328
<None Include="$(SolutionDir)icon.png" Pack="true" PackagePath="icon.png" />
339
<None Include="$(SolutionDir)readme.md" Pack="true" PackagePath="readme.md" />
3410
<None Include="Platforms\**\*.*" />
3511
<Compile Remove="Platforms\**\*.*" />
36-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
37-
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133">
38-
<PrivateAssets>all</PrivateAssets>
39-
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
40-
</PackageReference>
4112
</ItemGroup>
4213

4314
<ItemGroup Condition="$(TargetFramework.Contains('android'))">
@@ -63,7 +34,6 @@
6334
<Compile Include="Platforms\Windows\**\*.cs" />
6435
<Page Include="Platforms\Windows\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
6536
<Compile Update="Platforms\Windows\**\*.xaml.cs" SubType="Code" DependentUpon="%(Filename)" />
66-
6737
<!--
6838
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.756" />
6939
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.4.240211001" />

src/Directory.build.props

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project>
2+
<PropertyGroup>
3+
<Authors>Allan Ritchie</Authors>
4+
<PackageProjectUrl>https://github.com/aritchie/userdialogs</PackageProjectUrl>
5+
<Description>A cross platform library that allows you to call for standard user dialogs from a shared/portable library. Supports Android, iOS, and UWP</Description>
6+
<PackageTags>ios android xamarin xam.pcl dialogs plugin</PackageTags>
7+
<PackageReleaseNotes>https://github.com/aritchie/userdialogs/raw/master/ChangeLog.md</PackageReleaseNotes>
8+
<PackageIconUrl>https://github.com/aritchie/userdialogs/raw/master/icon.png</PackageIconUrl>
9+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
10+
<LangVersion>latest</LangVersion>
11+
<NoWarn>$(NoWarn);1591;1701;1591;1702;1705;VSX1000;NU1603</NoWarn>
12+
<RepositoryUrl>https://github.com/aritchie/userdialogs</RepositoryUrl>
13+
<RepositoryType>git</RepositoryType>
14+
</PropertyGroup>
15+
<ItemGroup>
16+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
17+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133">
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
20+
</PackageReference>
21+
</ItemGroup>
22+
</Project>

0 commit comments

Comments
 (0)