Skip to content

Commit

Permalink
Merge pull request #15 from LottieFiles/feat/webp
Browse files Browse the repository at this point in the history
feat: webp support
  • Loading branch information
samuelOsborne authored Feb 21, 2024
2 parents 9f9ae83 + d42272c commit 055e2cd
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 83 deletions.
89 changes: 11 additions & 78 deletions Sources/DotLottie/Public/dotlottie_player.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ public struct Manifest {
public var generator: String?
public var keywords: String?
public var revision: UInt32?
public var themes: ManifestThemes?
public var themes: [ManifestTheme]?
public var states: [String]?
public var version: String?

Expand All @@ -1382,7 +1382,7 @@ public struct Manifest {
generator: String?,
keywords: String?,
revision: UInt32?,
themes: ManifestThemes?,
themes: [ManifestTheme]?,
states: [String]?,
version: String?
) {
Expand Down Expand Up @@ -1459,7 +1459,7 @@ public struct FfiConverterTypeManifest: FfiConverterRustBuffer {
generator: FfiConverterOptionString.read(from: &buf),
keywords: FfiConverterOptionString.read(from: &buf),
revision: FfiConverterOptionUInt32.read(from: &buf),
themes: FfiConverterOptionTypeManifestThemes.read(from: &buf),
themes: FfiConverterOptionSequenceTypeManifestTheme.read(from: &buf),
states: FfiConverterOptionSequenceString.read(from: &buf),
version: FfiConverterOptionString.read(from: &buf)
)
Expand All @@ -1473,7 +1473,7 @@ public struct FfiConverterTypeManifest: FfiConverterRustBuffer {
FfiConverterOptionString.write(value.generator, into: &buf)
FfiConverterOptionString.write(value.keywords, into: &buf)
FfiConverterOptionUInt32.write(value.revision, into: &buf)
FfiConverterOptionTypeManifestThemes.write(value.themes, into: &buf)
FfiConverterOptionSequenceTypeManifestTheme.write(value.themes, into: &buf)
FfiConverterOptionSequenceString.write(value.states, into: &buf)
FfiConverterOptionString.write(value.version, into: &buf)
}
Expand Down Expand Up @@ -1625,16 +1625,16 @@ public func FfiConverterTypeManifestAnimation_lower(_ value: ManifestAnimation)

public struct ManifestTheme {
public var id: String
public var values: [String]
public var animations: [String]

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(
id: String,
values: [String]
animations: [String]
) {
self.id = id
self.values = values
self.animations = animations
}
}

Expand All @@ -1643,15 +1643,15 @@ extension ManifestTheme: Equatable, Hashable {
if lhs.id != rhs.id {
return false
}
if lhs.values != rhs.values {
if lhs.animations != rhs.animations {
return false
}
return true
}

public func hash(into hasher: inout Hasher) {
hasher.combine(id)
hasher.combine(values)
hasher.combine(animations)
}
}

Expand All @@ -1660,13 +1660,13 @@ public struct FfiConverterTypeManifestTheme: FfiConverterRustBuffer {
return
try ManifestTheme(
id: FfiConverterString.read(from: &buf),
values: FfiConverterSequenceString.read(from: &buf)
animations: FfiConverterSequenceString.read(from: &buf)
)
}

public static func write(_ value: ManifestTheme, into buf: inout [UInt8]) {
FfiConverterString.write(value.id, into: &buf)
FfiConverterSequenceString.write(value.values, into: &buf)
FfiConverterSequenceString.write(value.animations, into: &buf)
}
}

Expand All @@ -1678,52 +1678,6 @@ public func FfiConverterTypeManifestTheme_lower(_ value: ManifestTheme) -> RustB
return FfiConverterTypeManifestTheme.lower(value)
}

public struct ManifestThemes {
public var value: [ManifestTheme]?

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(
value: [ManifestTheme]?)
{
self.value = value
}
}

extension ManifestThemes: Equatable, Hashable {
public static func == (lhs: ManifestThemes, rhs: ManifestThemes) -> Bool {
if lhs.value != rhs.value {
return false
}
return true
}

public func hash(into hasher: inout Hasher) {
hasher.combine(value)
}
}

public struct FfiConverterTypeManifestThemes: FfiConverterRustBuffer {
public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ManifestThemes {
return
try ManifestThemes(
value: FfiConverterOptionSequenceTypeManifestTheme.read(from: &buf)
)
}

public static func write(_ value: ManifestThemes, into buf: inout [UInt8]) {
FfiConverterOptionSequenceTypeManifestTheme.write(value.value, into: &buf)
}
}

public func FfiConverterTypeManifestThemes_lift(_ buf: RustBuffer) throws -> ManifestThemes {
return try FfiConverterTypeManifestThemes.lift(buf)
}

public func FfiConverterTypeManifestThemes_lower(_ value: ManifestThemes) -> RustBuffer {
return FfiConverterTypeManifestThemes.lower(value)
}

// Note that we don't yet support `indirect` for enums.
// See https://github.com/mozilla/uniffi-rs/issues/396 for further discussion.
public enum Mode {
Expand Down Expand Up @@ -1883,27 +1837,6 @@ private struct FfiConverterOptionTypeManifest: FfiConverterRustBuffer {
}
}

private struct FfiConverterOptionTypeManifestThemes: FfiConverterRustBuffer {
typealias SwiftType = ManifestThemes?

public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
guard let value = value else {
writeInt(&buf, Int8(0))
return
}
writeInt(&buf, Int8(1))
FfiConverterTypeManifestThemes.write(value, into: &buf)
}

public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
switch try readInt(&buf) as Int8 {
case 0: return nil
case 1: return try FfiConverterTypeManifestThemes.read(from: &buf)
default: throw UniffiInternalError.unexpectedOptionalTag
}
}
}

private struct FfiConverterOptionSequenceString: FfiConverterRustBuffer {
typealias SwiftType = [String]?

Expand Down
10 changes: 5 additions & 5 deletions Sources/DotLottieCore/DotLottiePlayer.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,30 @@
<key>BinaryPath</key>
<string>DotLottiePlayer.framework/DotLottiePlayer</string>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>DotLottiePlayer.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<string>macos</string>
</dict>
<dict>
<key>BinaryPath</key>
<string>DotLottiePlayer.framework/DotLottiePlayer</string>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>DotLottiePlayer.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
<string>ios</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 055e2cd

Please sign in to comment.