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