From a52cd9d3d25a8cf90f3474f7766b7761c4fe2038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mare=C4=8Dek?= Date: Wed, 30 Aug 2023 13:07:48 +0200 Subject: [PATCH] MAUI .NET 8 --- Lottie.Android/Lottie.Android.csproj | 2 +- Lottie.Maui/Lottie.Maui.csproj | 7 +-- .../Platforms/Ios/AnimationViewRenderer.cs | 2 + Lottie.iOS/ApiDefinitions.Ios.cs | 48 +++++++++--------- Lottie.iOS/Lottie.iOS.csproj | 4 +- .../Maui/Lottie.Sample/Lottie.Sample.csproj | 14 +++-- Samples/Maui/Lottie.Sample/MainPage.xaml | 45 +++++++--------- Samples/Maui/Lottie.Sample/MauiProgram.cs | 18 +++++-- ...nSans-Regular.ttf => OpenSans_Regular.ttf} | Bin ...ans-Semibold.ttf => OpenSans_Semibold.ttf} | Bin .../Resources/Raw/animation_llq1y8ia.json | 1 + 11 files changed, 78 insertions(+), 63 deletions(-) rename Samples/Maui/Lottie.Sample/Resources/Fonts/{OpenSans-Regular.ttf => OpenSans_Regular.ttf} (100%) rename Samples/Maui/Lottie.Sample/Resources/Fonts/{OpenSans-Semibold.ttf => OpenSans_Semibold.ttf} (100%) create mode 100644 Samples/Maui/Lottie.Sample/Resources/Raw/animation_llq1y8ia.json diff --git a/Lottie.Android/Lottie.Android.csproj b/Lottie.Android/Lottie.Android.csproj index 9c4d70b..a4e189d 100644 --- a/Lottie.Android/Lottie.Android.csproj +++ b/Lottie.Android/Lottie.Android.csproj @@ -1,6 +1,6 @@  - net6.0-android + net8.0-android Lottie.Android Lottie.Android Render After Effects animations natively on Android, iOS, MacOS, TVOs and UWP diff --git a/Lottie.Maui/Lottie.Maui.csproj b/Lottie.Maui/Lottie.Maui.csproj index 6f2a72b..d4e4f7e 100644 --- a/Lottie.Maui/Lottie.Maui.csproj +++ b/Lottie.Maui/Lottie.Maui.csproj @@ -1,7 +1,8 @@  - net6.0-android;net6.0-ios;net6.0-maccatalyst - $(TargetFrameworks);net6.0-windows10.0.19041.0 + net8.0-android;net8.0-ios + true @@ -70,6 +71,6 @@ - + diff --git a/Lottie.Maui/Platforms/Ios/AnimationViewRenderer.cs b/Lottie.Maui/Platforms/Ios/AnimationViewRenderer.cs index 4cff0ae..80aff5f 100644 --- a/Lottie.Maui/Platforms/Ios/AnimationViewRenderer.cs +++ b/Lottie.Maui/Platforms/Ios/AnimationViewRenderer.cs @@ -48,6 +48,8 @@ protected override void OnElementChanged(ElementChangedEventArgs CompletionBlock = _animationCompletionBlock }; + _animationView.Layer.MasksToBounds = true; + var composition = e.NewElement.GetAnimation(); _animationView.SceneModel = composition; e.NewElement.InvokeAnimationLoaded(composition); diff --git a/Lottie.iOS/ApiDefinitions.Ios.cs b/Lottie.iOS/ApiDefinitions.Ios.cs index 0965ae9..bffc68f 100644 --- a/Lottie.iOS/ApiDefinitions.Ios.cs +++ b/Lottie.iOS/ApiDefinitions.Ios.cs @@ -1,4 +1,4 @@ -using System; +using System; using CoreGraphics; using Foundation; using ObjCRuntime; @@ -7,7 +7,7 @@ namespace Airbnb.Lottie { // @interface LOTAnimationTransitionController : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTAnimationTransitionController : IUIViewControllerAnimatedTransitioning { // -(instancetype _Nonnull)initWithAnimationNamed:(NSString * _Nonnull)animation fromLayerNamed:(NSString * _Nullable)fromLayer toLayerNamed:(NSString * _Nullable)toLayer applyAnimationTransform:(BOOL)applyAnimationTransform; @@ -72,7 +72,7 @@ interface LOTAnimatedSwitch } // @interface LOTCacheProvider : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTCacheProvider { // +(id)imageCache; @@ -84,7 +84,7 @@ interface LOTCacheProvider // @protocol LOTImageCache [Protocol, Model] - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTImageCache { // @required -(UIImage *)imageForKey:(NSString *)key; @@ -238,14 +238,14 @@ interface LOTKeypath // @protocol LOTValueDelegate [Protocol, Model] - [BaseType(typeof(NSObject))] + ////[BaseType(typeof(NSObject))] interface LOTValueDelegate { } // @protocol LOTColorValueDelegate [Protocol, Model] - [BaseType(typeof(LOTValueDelegate))] + //[BaseType(typeof(LOTValueDelegate))] interface LOTColorValueDelegate { // @required -(CGColorRef)colorForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startColor:(CGColorRef)startColor endColor:(CGColorRef)endColor currentColor:(CGColorRef)interpolatedColor; @@ -256,7 +256,7 @@ interface LOTColorValueDelegate // @protocol LOTNumberValueDelegate [Protocol, Model] - [BaseType(typeof(LOTValueDelegate))] + //[BaseType(typeof(LOTValueDelegate))] interface LOTNumberValueDelegate { // @required -(CGFloat)floatValueForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startValue:(CGFloat)startValue endValue:(CGFloat)endValue currentValue:(CGFloat)interpolatedValue; @@ -267,7 +267,7 @@ interface LOTNumberValueDelegate // @protocol LOTPointValueDelegate [Protocol, Model] - [BaseType(typeof(LOTValueDelegate))] + //[BaseType(typeof(LOTValueDelegate))] interface LOTPointValueDelegate { // @required -(CGPoint)pointForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint currentPoint:(CGPoint)interpolatedPoint; @@ -278,7 +278,7 @@ interface LOTPointValueDelegate // @protocol LOTSizeValueDelegate [Protocol, Model] - [BaseType(typeof(LOTValueDelegate))] + //[BaseType(typeof(LOTValueDelegate))] interface LOTSizeValueDelegate { // @required -(CGSize)sizeForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress startSize:(CGSize)startSize endSize:(CGSize)endSize currentSize:(CGSize)interpolatedSize; @@ -289,7 +289,7 @@ interface LOTSizeValueDelegate // @protocol LOTPathValueDelegate [Protocol, Model] - [BaseType(typeof(LOTValueDelegate))] + //[BaseType(typeof(LOTValueDelegate))] interface LOTPathValueDelegate { // @required -(CGPathRef)pathForFrame:(CGFloat)currentFrame startKeyframe:(CGFloat)startKeyframe endKeyframe:(CGFloat)endKeyframe interpolatedProgress:(CGFloat)interpolatedProgress; @@ -473,7 +473,7 @@ interface LOTAnimationView } // @interface LOTAnimationCache : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTAnimationCache { // +(instancetype _Nonnull)sharedCache; @@ -519,7 +519,7 @@ interface LOTAnimationCache unsafe delegate CGPath LOTPathValueCallbackBlock(nfloat currentFrame, nfloat startKeyFrame, nfloat endKeyFrame, nfloat interpolatedProgress); // @interface LOTColorBlockCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTColorBlockCallback : LOTColorValueDelegate { // +(instancetype _Nonnull)withBlock:(LOTColorValueCallbackBlock _Nonnull)block; @@ -533,7 +533,7 @@ interface LOTColorBlockCallback : LOTColorValueDelegate } // @interface LOTNumberBlockCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTNumberBlockCallback : LOTNumberValueDelegate { // +(instancetype _Nonnull)withBlock:(LOTNumberValueCallbackBlock _Nonnull)block; @@ -547,7 +547,7 @@ interface LOTNumberBlockCallback : LOTNumberValueDelegate } // @interface LOTPointBlockCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTPointBlockCallback : LOTPointValueDelegate { // +(instancetype _Nonnull)withBlock:(LOTPointValueCallbackBlock _Nonnull)block; @@ -561,7 +561,7 @@ interface LOTPointBlockCallback : LOTPointValueDelegate } // @interface LOTSizeBlockCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTSizeBlockCallback : LOTSizeValueDelegate { // +(instancetype _Nonnull)withBlock:(LOTSizeValueCallbackBlock _Nonnull)block; @@ -575,7 +575,7 @@ interface LOTSizeBlockCallback : LOTSizeValueDelegate } // @interface LOTPathBlockCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTPathBlockCallback : LOTPathValueDelegate { // +(instancetype _Nonnull)withBlock:(LOTPathValueCallbackBlock _Nonnull)block; @@ -589,7 +589,7 @@ interface LOTPathBlockCallback : LOTPathValueDelegate } // @interface LOTPointInterpolatorCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTPointInterpolatorCallback : LOTPointValueDelegate { // +(instancetype _Nonnull)withFromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint; @@ -611,7 +611,7 @@ interface LOTPointInterpolatorCallback : LOTPointValueDelegate } // @interface LOTSizeInterpolatorCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTSizeInterpolatorCallback : LOTSizeValueDelegate { // +(instancetype _Nonnull)withFromSize:(CGSize)fromSize toSize:(CGSize)toSize; @@ -633,7 +633,7 @@ interface LOTSizeInterpolatorCallback : LOTSizeValueDelegate } // @interface LOTFloatInterpolatorCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTFloatInterpolatorCallback : LOTNumberValueDelegate { // +(instancetype _Nonnull)withFromFloat:(CGFloat)fromFloat toFloat:(CGFloat)toFloat; @@ -655,7 +655,7 @@ interface LOTFloatInterpolatorCallback : LOTNumberValueDelegate } // @interface LOTColorValueCallback : NSObject - [BaseType(typeof(NSObject))] + ////[BaseType(typeof(NSObject))] interface LOTColorValueCallback : LOTColorValueDelegate { // +(instancetype _Nonnull)withCGColor:(CGColorRef _Nonnull)color; @@ -669,7 +669,7 @@ interface LOTColorValueCallback : LOTColorValueDelegate } // @interface LOTNumberValueCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTNumberValueCallback : LOTNumberValueDelegate { // +(instancetype _Nonnull)withFloatValue:(CGFloat)numberValue; @@ -683,7 +683,7 @@ interface LOTNumberValueCallback : LOTNumberValueDelegate } // @interface LOTPointValueCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTPointValueCallback : LOTPointValueDelegate { // +(instancetype _Nonnull)withPointValue:(CGPoint)pointValue; @@ -697,7 +697,7 @@ interface LOTPointValueCallback : LOTPointValueDelegate } // @interface LOTSizeValueCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTSizeValueCallback : LOTSizeValueDelegate { // +(instancetype _Nonnull)withPointValue:(CGSize)sizeValue; @@ -711,7 +711,7 @@ interface LOTSizeValueCallback : LOTSizeValueDelegate } // @interface LOTPathValueCallback : NSObject - [BaseType(typeof(NSObject))] + //[BaseType(typeof(NSObject))] interface LOTPathValueCallback : LOTPathValueDelegate { // +(instancetype _Nonnull)withCGPath:(CGPathRef _Nonnull)path; diff --git a/Lottie.iOS/Lottie.iOS.csproj b/Lottie.iOS/Lottie.iOS.csproj index a1a8464..aabb810 100644 --- a/Lottie.iOS/Lottie.iOS.csproj +++ b/Lottie.iOS/Lottie.iOS.csproj @@ -1,12 +1,14 @@  - net6.0-ios;net6.0-maccatalyst + + net8.0-ios Lottie.iOS Lottie.iOS Render After Effects animations natively on Android, iOS, MacOS, TVOs and UWP Com.Airbnb.iOS.Lottie false true + true 2.6.0 diff --git a/Samples/Maui/Lottie.Sample/Lottie.Sample.csproj b/Samples/Maui/Lottie.Sample/Lottie.Sample.csproj index e5d337c..8789d8e 100644 --- a/Samples/Maui/Lottie.Sample/Lottie.Sample.csproj +++ b/Samples/Maui/Lottie.Sample/Lottie.Sample.csproj @@ -1,8 +1,9 @@  - net7.0-android;net7.0-ios;net7.0-maccatalyst - $(TargetFrameworks);net7.0-windows10.0.19041.0 + net8.0-android;net8.0-ios + Exe @@ -28,7 +29,7 @@ 10.0.17763.0 10.0.17763.0 6.5 - + @@ -49,7 +50,12 @@ - + + + + + + diff --git a/Samples/Maui/Lottie.Sample/MainPage.xaml b/Samples/Maui/Lottie.Sample/MainPage.xaml index d836a68..79bb433 100644 --- a/Samples/Maui/Lottie.Sample/MainPage.xaml +++ b/Samples/Maui/Lottie.Sample/MainPage.xaml @@ -1,41 +1,32 @@  - - + + + + + - - -