[firestore][ios] implement Blob support
This commit is contained in:
parent
d180b40d19
commit
5906d20ce0
|
@ -208,6 +208,10 @@ static NSMutableDictionary *_listeners;
|
||||||
typeMap[@"type"] = @"number";
|
typeMap[@"type"] = @"number";
|
||||||
}
|
}
|
||||||
typeMap[@"value"] = value;
|
typeMap[@"value"] = value;
|
||||||
|
} else if ([value isKindOfClass:[NSData class]]) {
|
||||||
|
typeMap[@"type"] = @"blob";
|
||||||
|
NSData *blob = (NSData *)value;
|
||||||
|
typeMap[@"value"] = [blob base64EncodedStringWithOptions:0];
|
||||||
} else {
|
} else {
|
||||||
// TODO: Log an error
|
// TODO: Log an error
|
||||||
typeMap[@"type"] = @"null";
|
typeMap[@"type"] = @"null";
|
||||||
|
@ -248,6 +252,8 @@ static NSMutableDictionary *_listeners;
|
||||||
return [RNFirebaseFirestoreDocumentReference parseJSMap:firestore jsMap:value];
|
return [RNFirebaseFirestoreDocumentReference parseJSMap:firestore jsMap:value];
|
||||||
} else if ([type isEqualToString:@"reference"]) {
|
} else if ([type isEqualToString:@"reference"]) {
|
||||||
return [firestore documentWithPath:value];
|
return [firestore documentWithPath:value];
|
||||||
|
} else if ([type isEqualToString:@"blob"]) {
|
||||||
|
return [[NSData alloc] initWithBase64EncodedString:(NSString *) value options:0];
|
||||||
} else if ([type isEqualToString:@"geopoint"]) {
|
} else if ([type isEqualToString:@"geopoint"]) {
|
||||||
NSDictionary *geopoint = (NSDictionary*)value;
|
NSDictionary *geopoint = (NSDictionary*)value;
|
||||||
NSNumber *latitude = geopoint[@"latitude"];
|
NSNumber *latitude = geopoint[@"latitude"];
|
||||||
|
|
Loading…
Reference in New Issue