Skip to content

Commit

Permalink
Bump to latest (rc1)
Browse files Browse the repository at this point in the history
- 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)
  • Loading branch information
rookiejava authored and myroot committed Aug 25, 2022
1 parent 34af028 commit 8824f3a
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 81 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions .nuspec/Microsoft.Maui.Controls.MultiTargeting.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('tizen')) != true AND $(TargetFramework.StartsWith('net6.0-tizen')) != true ">
<Compile Remove="**\**\*.Tizen.cs" />
<None Include="**\**\*.Tizen.cs" />
<None Include="**\**\*.Tizen.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\Tizen\**\*.cs" />
<None Include="**\Tizen\**\*.cs" />
<None Include="**\Tizen\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="'$(_MauiNoTargetPlatform)' != 'True'">
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) != true AND '$(TargetFramework)' != 'net6.0'">
Expand Down
25 changes: 0 additions & 25 deletions src/Core/src/Handlers/BoxView/BoxViewHandler.Tizen.cs

This file was deleted.

15 changes: 12 additions & 3 deletions src/Core/src/Handlers/Button/ButtonHandler.Tizen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,18 @@ public static Task MapImageSourceAsync(IButtonHandler handler, IImage image)
return handler.ImageSourceLoader.UpdateImageSourceAsync();
}

//TODO : Need to impl
[MissingMapper]
public static void MapImageSource(ButtonHandler handler, IButton image) { }
public static void MapImageSource(IButtonHandler handler, IButton image) =>
MapImageSourceAsync(handler, image).FireAndForget(handler);

public static Task MapImageSourceAsync(IButtonHandler handler, IButton image)
{
if (image.ImageSource == null)
{
return Task.CompletedTask;
}

return handler.ImageSourceLoader.UpdateImageSourceAsync();
}

[MissingMapper]
public static void MapCharacterSpacing(IButtonHandler handler, ITextStyle button) { }
Expand Down
39 changes: 0 additions & 39 deletions src/Core/src/ImageSources/Tizen/ImageSourceServiceResult.cs

This file was deleted.

12 changes: 0 additions & 12 deletions src/Core/src/Platform/Tizen/BoxViewExtensions.cs

This file was deleted.

53 changes: 53 additions & 0 deletions src/Core/src/Platform/Tizen/ImageExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,58 @@ public static void UpdateIsAnimationPlaying(this Image platformImage, IImageSour
platformImage.IsAnimated = image.IsAnimationPlaying;
platformImage.IsAnimationPlaying = image.IsAnimationPlaying;
}

public static async Task<IImageSourceServiceResult<Image>?> UpdateSourceAsync(this IImageSourcePart image, Image destinationContext, IImageSourceServiceProvider services, Action<Image?> setImage, CancellationToken cancellationToken = default)
{
image.UpdateIsLoading(false);

var imageSource = image.Source;
if (imageSource == null)
return null;

var events = image as IImageSourcePartEvents;

events?.LoadingStarted();
image.UpdateIsLoading(true);

try
{
var service = services.GetRequiredImageSourceService(imageSource);
var result = await service.GetImageAsync(imageSource, destinationContext, cancellationToken);
var tImage = result?.Value;

var applied = !cancellationToken.IsCancellationRequested && tImage != null && imageSource == image.Source;

// only set the image if we are still on the same one
if (applied)
{
setImage.Invoke(tImage);
destinationContext.UpdateIsAnimationPlaying(image);
}

events?.LoadingCompleted(applied);

return result;
}
catch (OperationCanceledException)
{
// no-op
events?.LoadingCompleted(false);
}
catch (Exception ex)
{
events?.LoadingFailed(ex);
}
finally
{
// only mark as finished if we are still working on the same image
if (imageSource == image.Source)
{
image.UpdateIsLoading(false);
}
}

return null;
}
}
}

0 comments on commit 8824f3a

Please sign in to comment.