-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from hansemannn/fix/mapped-timestamp
fix: map timestamp correctly, add "queryDocuments"
- Loading branch information
Showing
9 changed files
with
220 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// TiFirestoreUtils.h | ||
// titanium-firebase-firestore | ||
// | ||
// Created by Hans Knöchel on 06.12.22. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface TiFirestoreUtils : NSObject | ||
|
||
+ (NSDictionary *)mappedFirestoreValue:(id)value; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// TiFirestoreUtils.m | ||
// titanium-firebase-firestore | ||
// | ||
// Created by Hans Knöchel on 06.12.22. | ||
// | ||
|
||
#import "TiFirestoreUtils.h" | ||
#import <FirebaseFirestore/FirebaseFirestore.h> | ||
|
||
@implementation TiFirestoreUtils | ||
|
||
+ (NSDictionary *)mappedFirestoreValue:(NSDictionary<NSString *, id> *)value | ||
{ | ||
NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; | ||
|
||
[value enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull value, BOOL *_Nonnull stop) { | ||
// Handle timestamps as a native type | ||
if ([value isKindOfClass:[FIRTimestamp class]]) { | ||
FIRTimestamp *timestamp = (FIRTimestamp *)value; | ||
result[key] = @{ | ||
@"seconds" : @(timestamp.seconds), | ||
@"nanoseconds" : @(timestamp.nanoseconds) | ||
}; | ||
// Handle all other values directly | ||
} else { | ||
result[key] = value; | ||
} | ||
}]; | ||
|
||
return result; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.