MediaMetadata: strings workaround pigeon
This commit is contained in:
parent
a73374eb78
commit
6d95636b78
5 changed files with 26 additions and 0 deletions
|
|
@ -335,6 +335,12 @@ public class PlatformBridgeApis {
|
|||
this.mediaType = setterArg;
|
||||
}
|
||||
|
||||
private @Nullable Map<String, String> strings;
|
||||
public @Nullable Map<String, String> getStrings() { return strings; }
|
||||
public void setStrings(@Nullable Map<String, String> setterArg) {
|
||||
this.strings = setterArg;
|
||||
}
|
||||
|
||||
private @Nullable List<WebImage> webImages;
|
||||
public @Nullable List<WebImage> getWebImages() { return webImages; }
|
||||
public void setWebImages(@Nullable List<WebImage> setterArg) {
|
||||
|
|
@ -347,6 +353,11 @@ public class PlatformBridgeApis {
|
|||
this.mediaType = setterArg;
|
||||
return this;
|
||||
}
|
||||
private @Nullable Map<String, String> strings;
|
||||
public @NonNull Builder setStrings(@Nullable Map<String, String> setterArg) {
|
||||
this.strings = setterArg;
|
||||
return this;
|
||||
}
|
||||
private @Nullable List<WebImage> webImages;
|
||||
public @NonNull Builder setWebImages(@Nullable List<WebImage> setterArg) {
|
||||
this.webImages = setterArg;
|
||||
|
|
@ -355,6 +366,7 @@ public class PlatformBridgeApis {
|
|||
public @NonNull MediaMetadata build() {
|
||||
MediaMetadata pigeonReturn = new MediaMetadata();
|
||||
pigeonReturn.setMediaType(mediaType);
|
||||
pigeonReturn.setStrings(strings);
|
||||
pigeonReturn.setWebImages(webImages);
|
||||
return pigeonReturn;
|
||||
}
|
||||
|
|
@ -362,6 +374,7 @@ public class PlatformBridgeApis {
|
|||
@NonNull Map<String, Object> toMap() {
|
||||
Map<String, Object> toMapResult = new HashMap<>();
|
||||
toMapResult.put("mediaType", mediaType == null ? null : mediaType.index);
|
||||
toMapResult.put("strings", strings);
|
||||
toMapResult.put("webImages", webImages);
|
||||
return toMapResult;
|
||||
}
|
||||
|
|
@ -369,6 +382,8 @@ public class PlatformBridgeApis {
|
|||
MediaMetadata pigeonResult = new MediaMetadata();
|
||||
Object mediaType = map.get("mediaType");
|
||||
pigeonResult.setMediaType(mediaType == null ? null : MediaType.values()[(int)mediaType]);
|
||||
Object strings = map.get("strings");
|
||||
pigeonResult.setStrings((Map<String, String>)strings);
|
||||
Object webImages = map.get("webImages");
|
||||
pigeonResult.setWebImages((List<WebImage>)webImages);
|
||||
return pigeonResult;
|
||||
|
|
|
|||
|
|
@ -124,8 +124,10 @@ typedef NS_ENUM(NSUInteger, PlayerState) {
|
|||
|
||||
@interface MediaMetadata : NSObject
|
||||
+ (instancetype)makeWithMediaType:(MediaType)mediaType
|
||||
strings:(nullable NSDictionary<NSString *, NSString *> *)strings
|
||||
webImages:(nullable NSArray<WebImage *> *)webImages;
|
||||
@property(nonatomic, assign) MediaType mediaType;
|
||||
@property(nonatomic, strong, nullable) NSDictionary<NSString *, NSString *> * strings;
|
||||
@property(nonatomic, strong, nullable) NSArray<WebImage *> * webImages;
|
||||
@end
|
||||
|
||||
|
|
|
|||
|
|
@ -150,21 +150,25 @@ static id GetNullableObjectAtIndex(NSArray* array, NSInteger key) {
|
|||
|
||||
@implementation MediaMetadata
|
||||
+ (instancetype)makeWithMediaType:(MediaType)mediaType
|
||||
strings:(nullable NSDictionary<NSString *, NSString *> *)strings
|
||||
webImages:(nullable NSArray<WebImage *> *)webImages {
|
||||
MediaMetadata* pigeonResult = [[MediaMetadata alloc] init];
|
||||
pigeonResult.mediaType = mediaType;
|
||||
pigeonResult.strings = strings;
|
||||
pigeonResult.webImages = webImages;
|
||||
return pigeonResult;
|
||||
}
|
||||
+ (MediaMetadata *)fromMap:(NSDictionary *)dict {
|
||||
MediaMetadata *pigeonResult = [[MediaMetadata alloc] init];
|
||||
pigeonResult.mediaType = [GetNullableObject(dict, @"mediaType") integerValue];
|
||||
pigeonResult.strings = GetNullableObject(dict, @"strings");
|
||||
pigeonResult.webImages = GetNullableObject(dict, @"webImages");
|
||||
return pigeonResult;
|
||||
}
|
||||
- (NSDictionary *)toMap {
|
||||
return @{
|
||||
@"mediaType" : @(self.mediaType),
|
||||
@"strings" : (self.strings ?: [NSNull null]),
|
||||
@"webImages" : (self.webImages ?: [NSNull null]),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,15 +169,18 @@ class MediaInfo {
|
|||
class MediaMetadata {
|
||||
MediaMetadata({
|
||||
this.mediaType,
|
||||
this.strings,
|
||||
this.webImages,
|
||||
});
|
||||
|
||||
MediaType? mediaType;
|
||||
Map<String?, String?>? strings;
|
||||
List<WebImage?>? webImages;
|
||||
|
||||
Object encode() {
|
||||
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
|
||||
pigeonMap['mediaType'] = mediaType?.index;
|
||||
pigeonMap['strings'] = strings;
|
||||
pigeonMap['webImages'] = webImages;
|
||||
return pigeonMap;
|
||||
}
|
||||
|
|
@ -188,6 +191,7 @@ class MediaMetadata {
|
|||
mediaType: pigeonMap['mediaType'] != null
|
||||
? MediaType.values[pigeonMap['mediaType']! as int]
|
||||
: null,
|
||||
strings: (pigeonMap['strings'] as Map<Object?, Object?>?)?.cast<String?, String?>(),
|
||||
webImages: (pigeonMap['webImages'] as List<Object?>?)?.cast<WebImage?>(),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ enum StreamType {
|
|||
class MediaMetadata {
|
||||
MediaType? mediaType;
|
||||
// Map<MediaMetadataKey?, String?>? strings; // Can't uncomment this because of https://github.com/flutter/flutter/issues/93525
|
||||
Map<String?, String?>? strings;
|
||||
List<WebImage?>? webImages;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue