Skip to content

Commit 8824f3a

Browse files
rookiejavamyroot
authored andcommitted
Bump to latest (rc1)
- ImageButtonHandler and Handler Re-usability (dotnet#2352) - Remove IBoxView (dotnet#2619) - Add SupportedOSPlatformVersion (dotnet#2565) - Merge all the .NET 6 projects/solutions (dotnet#2505) - Shadow Support (dotnet#570) - Add IndicatorView handler(dotnet#2038)
1 parent 34af028 commit 8824f3a

File tree

7 files changed

+67
-81
lines changed

7 files changed

+67
-81
lines changed
File renamed without changes.

.nuspec/Microsoft.Maui.Controls.MultiTargeting.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
</ItemGroup>
3232
<ItemGroup Condition="$(TargetFramework.StartsWith('tizen')) != true AND $(TargetFramework.StartsWith('net6.0-tizen')) != true ">
3333
<Compile Remove="**\**\*.Tizen.cs" />
34-
<None Include="**\**\*.Tizen.cs" />
34+
<None Include="**\**\*.Tizen.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
3535
<Compile Remove="**\Tizen\**\*.cs" />
36-
<None Include="**\Tizen\**\*.cs" />
36+
<None Include="**\Tizen\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
3737
</ItemGroup>
3838
<ItemGroup Condition="'$(_MauiNoTargetPlatform)' != 'True'">
3939
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) != true AND '$(TargetFramework)' != 'net6.0'">

src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Core/src/Handlers/Button/ButtonHandler.Tizen.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,18 @@ public static Task MapImageSourceAsync(IButtonHandler handler, IImage image)
4646
return handler.ImageSourceLoader.UpdateImageSourceAsync();
4747
}
4848

49-
//TODO : Need to impl
50-
[MissingMapper]
51-
public static void MapImageSource(ButtonHandler handler, IButton image) { }
49+
public static void MapImageSource(IButtonHandler handler, IButton image) =>
50+
MapImageSourceAsync(handler, image).FireAndForget(handler);
51+
52+
public static Task MapImageSourceAsync(IButtonHandler handler, IButton image)
53+
{
54+
if (image.ImageSource == null)
55+
{
56+
return Task.CompletedTask;
57+
}
58+
59+
return handler.ImageSourceLoader.UpdateImageSourceAsync();
60+
}
5261

5362
[MissingMapper]
5463
public static void MapCharacterSpacing(IButtonHandler handler, ITextStyle button) { }

src/Core/src/ImageSources/Tizen/ImageSourceServiceResult.cs

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/Core/src/Platform/Tizen/BoxViewExtensions.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/Core/src/Platform/Tizen/ImageExtensions.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,58 @@ public static void UpdateIsAnimationPlaying(this Image platformImage, IImageSour
1818
platformImage.IsAnimated = image.IsAnimationPlaying;
1919
platformImage.IsAnimationPlaying = image.IsAnimationPlaying;
2020
}
21+
22+
public static async Task<IImageSourceServiceResult<Image>?> UpdateSourceAsync(this IImageSourcePart image, Image destinationContext, IImageSourceServiceProvider services, Action<Image?> setImage, CancellationToken cancellationToken = default)
23+
{
24+
image.UpdateIsLoading(false);
25+
26+
var imageSource = image.Source;
27+
if (imageSource == null)
28+
return null;
29+
30+
var events = image as IImageSourcePartEvents;
31+
32+
events?.LoadingStarted();
33+
image.UpdateIsLoading(true);
34+
35+
try
36+
{
37+
var service = services.GetRequiredImageSourceService(imageSource);
38+
var result = await service.GetImageAsync(imageSource, destinationContext, cancellationToken);
39+
var tImage = result?.Value;
40+
41+
var applied = !cancellationToken.IsCancellationRequested && tImage != null && imageSource == image.Source;
42+
43+
// only set the image if we are still on the same one
44+
if (applied)
45+
{
46+
setImage.Invoke(tImage);
47+
destinationContext.UpdateIsAnimationPlaying(image);
48+
}
49+
50+
events?.LoadingCompleted(applied);
51+
52+
return result;
53+
}
54+
catch (OperationCanceledException)
55+
{
56+
// no-op
57+
events?.LoadingCompleted(false);
58+
}
59+
catch (Exception ex)
60+
{
61+
events?.LoadingFailed(ex);
62+
}
63+
finally
64+
{
65+
// only mark as finished if we are still working on the same image
66+
if (imageSource == image.Source)
67+
{
68+
image.UpdateIsLoading(false);
69+
}
70+
}
71+
72+
return null;
73+
}
2174
}
2275
}

0 commit comments

Comments
 (0)