aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Model
diff options
context:
space:
mode:
authorGravatar Konstantin Varlamov <var-const@users.noreply.github.com>2018-02-20 17:33:57 -0500
committerGravatar GitHub <noreply@github.com>2018-02-20 17:33:57 -0500
commit14ea068f5fd03a658017f8472a4078a727fabc3a (patch)
tree56696c49546e2147ec1b8ebdeba24dd292f0c951 /Firestore/Source/Model
parentde00de25deebc35c4c7167135d5b1f29a7d9fe6f (diff)
Make FSTTimestamp into a public Firestore class (#698)
- FSTTimestamp is now FIRTimestamp, under Firestore/Source/{Public,API}. This is a temporary solution; eventually, FIRTimestamp is supposed to live somewhere under Firebase; - move most internal Timestamp methods to the public header (the only exception is ISOString).
Diffstat (limited to 'Firestore/Source/Model')
-rw-r--r--Firestore/Source/Model/FSTFieldValue.h10
-rw-r--r--Firestore/Source/Model/FSTFieldValue.mm15
-rw-r--r--Firestore/Source/Model/FSTMutation.h6
-rw-r--r--Firestore/Source/Model/FSTMutation.mm17
-rw-r--r--Firestore/Source/Model/FSTMutationBatch.h6
-rw-r--r--Firestore/Source/Model/FSTMutationBatch.mm5
6 files changed, 31 insertions, 28 deletions
diff --git a/Firestore/Source/Model/FSTFieldValue.h b/Firestore/Source/Model/FSTFieldValue.h
index c8118c6..be8ba45 100644
--- a/Firestore/Source/Model/FSTFieldValue.h
+++ b/Firestore/Source/Model/FSTFieldValue.h
@@ -22,7 +22,7 @@
@class FSTDocumentKey;
@class FSTFieldPath;
-@class FSTTimestamp;
+@class FIRTimestamp;
@class FSTFieldValueOptions;
@class FIRGeoPoint;
@class FIRSnapshotOptions;
@@ -164,8 +164,8 @@ typedef NS_ENUM(NSInteger, FSTServerTimestampBehavior) {
* A timestamp value stored in Firestore.
*/
@interface FSTTimestampValue : FSTFieldValue <NSDate *>
-+ (instancetype)timestampValue:(FSTTimestamp *)value;
-- (FSTTimestamp *)internalValue;
++ (instancetype)timestampValue:(FIRTimestamp *)value;
+- (FIRTimestamp *)internalValue;
@end
/**
@@ -181,10 +181,10 @@ typedef NS_ENUM(NSInteger, FSTServerTimestampBehavior) {
* sort by their localWriteTime.
*/
@interface FSTServerTimestampValue : FSTFieldValue <id>
-+ (instancetype)serverTimestampValueWithLocalWriteTime:(FSTTimestamp *)localWriteTime
++ (instancetype)serverTimestampValueWithLocalWriteTime:(FIRTimestamp *)localWriteTime
previousValue:(nullable FSTFieldValue *)previousValue;
-@property(nonatomic, strong, readonly) FSTTimestamp *localWriteTime;
+@property(nonatomic, strong, readonly) FIRTimestamp *localWriteTime;
@property(nonatomic, strong, readonly, nullable) FSTFieldValue *previousValue;
@end
diff --git a/Firestore/Source/Model/FSTFieldValue.mm b/Firestore/Source/Model/FSTFieldValue.mm
index 3f3548c..5ef64e1 100644
--- a/Firestore/Source/Model/FSTFieldValue.mm
+++ b/Firestore/Source/Model/FSTFieldValue.mm
@@ -16,12 +16,13 @@
#import "Firestore/Source/Model/FSTFieldValue.h"
+#import "FIRTimestamp.h"
+
#include "Firestore/core/src/firebase/firestore/util/comparison.h"
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
#import "Firestore/Source/API/FIRGeoPoint+Internal.h"
#import "Firestore/Source/API/FIRSnapshotOptions+Internal.h"
-#import "Firestore/Source/Core/FSTTimestamp.h"
#import "Firestore/Source/Model/FSTDocumentKey.h"
#import "Firestore/Source/Model/FSTPath.h"
#import "Firestore/Source/Util/FSTAssert.h"
@@ -424,19 +425,19 @@ struct Comparator<NSString *> {
#pragma mark - FSTTimestampValue
@interface FSTTimestampValue ()
-@property(nonatomic, strong, readonly) FSTTimestamp *internalValue;
+@property(nonatomic, strong, readonly) FIRTimestamp *internalValue;
@end
@implementation FSTTimestampValue
-+ (instancetype)timestampValue:(FSTTimestamp *)value {
++ (instancetype)timestampValue:(FIRTimestamp *)value {
return [[FSTTimestampValue alloc] initWithValue:value];
}
-- (id)initWithValue:(FSTTimestamp *)value {
+- (id)initWithValue:(FIRTimestamp *)value {
self = [super init];
if (self) {
- _internalValue = value; // FSTTimestamp is immutable.
+ _internalValue = value; // FIRTimestamp is immutable.
}
return self;
}
@@ -476,13 +477,13 @@ struct Comparator<NSString *> {
@implementation FSTServerTimestampValue
-+ (instancetype)serverTimestampValueWithLocalWriteTime:(FSTTimestamp *)localWriteTime
++ (instancetype)serverTimestampValueWithLocalWriteTime:(FIRTimestamp *)localWriteTime
previousValue:(nullable FSTFieldValue *)previousValue {
return [[FSTServerTimestampValue alloc] initWithLocalWriteTime:localWriteTime
previousValue:previousValue];
}
-- (id)initWithLocalWriteTime:(FSTTimestamp *)localWriteTime
+- (id)initWithLocalWriteTime:(FIRTimestamp *)localWriteTime
previousValue:(nullable FSTFieldValue *)previousValue {
self = [super init];
if (self) {
diff --git a/Firestore/Source/Model/FSTMutation.h b/Firestore/Source/Model/FSTMutation.h
index 7c5f6de..72f6a25 100644
--- a/Firestore/Source/Model/FSTMutation.h
+++ b/Firestore/Source/Model/FSTMutation.h
@@ -23,7 +23,7 @@
@class FSTMaybeDocument;
@class FSTObjectValue;
@class FSTSnapshotVersion;
-@class FSTTimestamp;
+@class FIRTimestamp;
NS_ASSUME_NONNULL_BEGIN
@@ -200,7 +200,7 @@ typedef NS_ENUM(NSUInteger, FSTPreconditionExists) {
*/
- (nullable FSTMaybeDocument *)applyTo:(nullable FSTMaybeDocument *)maybeDoc
baseDocument:(nullable FSTMaybeDocument *)baseDoc
- localWriteTime:(FSTTimestamp *)localWriteTime
+ localWriteTime:(FIRTimestamp *)localWriteTime
mutationResult:(nullable FSTMutationResult *)mutationResult;
/**
@@ -209,7 +209,7 @@ typedef NS_ENUM(NSUInteger, FSTPreconditionExists) {
*/
- (nullable FSTMaybeDocument *)applyTo:(nullable FSTMaybeDocument *)maybeDoc
baseDocument:(nullable FSTMaybeDocument *)baseDoc
- localWriteTime:(nullable FSTTimestamp *)localWriteTime;
+ localWriteTime:(nullable FIRTimestamp *)localWriteTime;
@property(nonatomic, strong, readonly) FSTDocumentKey *key;
diff --git a/Firestore/Source/Model/FSTMutation.mm b/Firestore/Source/Model/FSTMutation.mm
index c249138..e702644 100644
--- a/Firestore/Source/Model/FSTMutation.mm
+++ b/Firestore/Source/Model/FSTMutation.mm
@@ -16,8 +16,9 @@
#import "Firestore/Source/Model/FSTMutation.h"
+#import "FIRTimestamp.h"
+
#import "Firestore/Source/Core/FSTSnapshotVersion.h"
-#import "Firestore/Source/Core/FSTTimestamp.h"
#import "Firestore/Source/Model/FSTDocument.h"
#import "Firestore/Source/Model/FSTDocumentKey.h"
#import "Firestore/Source/Model/FSTFieldValue.h"
@@ -238,14 +239,14 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable FSTMaybeDocument *)applyTo:(nullable FSTMaybeDocument *)maybeDoc
baseDocument:(nullable FSTMaybeDocument *)baseDoc
- localWriteTime:(FSTTimestamp *)localWriteTime
+ localWriteTime:(FIRTimestamp *)localWriteTime
mutationResult:(nullable FSTMutationResult *)mutationResult {
@throw FSTAbstractMethodException(); // NOLINT
}
- (nullable FSTMaybeDocument *)applyTo:(nullable FSTMaybeDocument *)maybeDoc
baseDocument:(nullable FSTMaybeDocument *)baseDoc
- localWriteTime:(nullable FSTTimestamp *)localWriteTime {
+ localWriteTime:(nullable FIRTimestamp *)localWriteTime {
return
[self applyTo:maybeDoc baseDocument:baseDoc localWriteTime:localWriteTime mutationResult:nil];
}
@@ -292,7 +293,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable FSTMaybeDocument *)applyTo:(nullable FSTMaybeDocument *)maybeDoc
baseDocument:(nullable FSTMaybeDocument *)baseDoc
- localWriteTime:(FSTTimestamp *)localWriteTime
+ localWriteTime:(FIRTimestamp *)localWriteTime
mutationResult:(nullable FSTMutationResult *)mutationResult {
if (mutationResult) {
FSTAssert(!mutationResult.transformResults, @"Transform results received by FSTSetMutation.");
@@ -368,7 +369,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable FSTMaybeDocument *)applyTo:(nullable FSTMaybeDocument *)maybeDoc
baseDocument:(nullable FSTMaybeDocument *)baseDoc
- localWriteTime:(FSTTimestamp *)localWriteTime
+ localWriteTime:(FIRTimestamp *)localWriteTime
mutationResult:(nullable FSTMutationResult *)mutationResult {
if (mutationResult) {
FSTAssert(!mutationResult.transformResults, @"Transform results received by FSTPatchMutation.");
@@ -458,7 +459,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable FSTMaybeDocument *)applyTo:(nullable FSTMaybeDocument *)maybeDoc
baseDocument:(nullable FSTMaybeDocument *)baseDoc
- localWriteTime:(FSTTimestamp *)localWriteTime
+ localWriteTime:(FIRTimestamp *)localWriteTime
mutationResult:(nullable FSTMutationResult *)mutationResult {
if (mutationResult) {
FSTAssert(mutationResult.transformResults,
@@ -500,7 +501,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (NSArray<FSTFieldValue *> *)localTransformResultsWithBaseDocument:
(FSTMaybeDocument *_Nullable)baseDocument
- writeTime:(FSTTimestamp *)localWriteTime {
+ writeTime:(FIRTimestamp *)localWriteTime {
NSMutableArray<FSTFieldValue *> *transformResults = [NSMutableArray array];
for (FSTFieldTransform *fieldTransform in self.fieldTransforms) {
if ([fieldTransform.transform isKindOfClass:[FSTServerTimestampTransform class]]) {
@@ -570,7 +571,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable FSTMaybeDocument *)applyTo:(nullable FSTMaybeDocument *)maybeDoc
baseDocument:(nullable FSTMaybeDocument *)baseDoc
- localWriteTime:(FSTTimestamp *)localWriteTime
+ localWriteTime:(FIRTimestamp *)localWriteTime
mutationResult:(nullable FSTMutationResult *)mutationResult {
if (mutationResult) {
FSTAssert(!mutationResult.transformResults,
diff --git a/Firestore/Source/Model/FSTMutationBatch.h b/Firestore/Source/Model/FSTMutationBatch.h
index 145adfa..1de79fe 100644
--- a/Firestore/Source/Model/FSTMutationBatch.h
+++ b/Firestore/Source/Model/FSTMutationBatch.h
@@ -21,7 +21,7 @@
#import "Firestore/Source/Model/FSTDocumentVersionDictionary.h"
@class FSTMutation;
-@class FSTTimestamp;
+@class FIRTimestamp;
@class FSTMutationResult;
@class FSTMutationBatchResult;
@class FSTSnapshotVersion;
@@ -45,7 +45,7 @@ extern const FSTBatchID kFSTBatchIDUnknown;
/** Initializes a mutation batch with the given batchID, localWriteTime, and mutations. */
- (instancetype)initWithBatchID:(FSTBatchID)batchID
- localWriteTime:(FSTTimestamp *)localWriteTime
+ localWriteTime:(FIRTimestamp *)localWriteTime
mutations:(NSArray<FSTMutation *> *)mutations NS_DESIGNATED_INITIALIZER;
- (id)init NS_UNAVAILABLE;
@@ -86,7 +86,7 @@ extern const FSTBatchID kFSTBatchIDUnknown;
- (FSTDocumentKeySet *)keys;
@property(nonatomic, assign, readonly) FSTBatchID batchID;
-@property(nonatomic, strong, readonly) FSTTimestamp *localWriteTime;
+@property(nonatomic, strong, readonly) FIRTimestamp *localWriteTime;
@property(nonatomic, strong, readonly) NSArray<FSTMutation *> *mutations;
@end
diff --git a/Firestore/Source/Model/FSTMutationBatch.mm b/Firestore/Source/Model/FSTMutationBatch.mm
index 01adca7..07aadbb 100644
--- a/Firestore/Source/Model/FSTMutationBatch.mm
+++ b/Firestore/Source/Model/FSTMutationBatch.mm
@@ -16,8 +16,9 @@
#import "Firestore/Source/Model/FSTMutationBatch.h"
+#import "FIRTimestamp.h"
+
#import "Firestore/Source/Core/FSTSnapshotVersion.h"
-#import "Firestore/Source/Core/FSTTimestamp.h"
#import "Firestore/Source/Model/FSTDocument.h"
#import "Firestore/Source/Model/FSTDocumentKey.h"
#import "Firestore/Source/Model/FSTMutation.h"
@@ -30,7 +31,7 @@ const FSTBatchID kFSTBatchIDUnknown = -1;
@implementation FSTMutationBatch
- (instancetype)initWithBatchID:(FSTBatchID)batchID
- localWriteTime:(FSTTimestamp *)localWriteTime
+ localWriteTime:(FIRTimestamp *)localWriteTime
mutations:(NSArray<FSTMutation *> *)mutations {
self = [super init];
if (self) {