From a25d05487435d397f3b8cd399ee8355eae497f0d Mon Sep 17 00:00:00 2001 From: Gil Date: Mon, 16 Apr 2018 13:50:11 -0700 Subject: Replace the `SnapshotOptions` object with the behavior enum. (#1109) Instead of calling `get(field, SnapshotOptions.serverTimestampBehavior(.estimate))` call `get(field, serverTimestampBehavior: .estimate)` --- Firestore/Source/Model/FSTFieldValue.h | 5 ----- Firestore/Source/Model/FSTFieldValue.mm | 24 +----------------------- 2 files changed, 1 insertion(+), 28 deletions(-) (limited to 'Firestore/Source/Model') diff --git a/Firestore/Source/Model/FSTFieldValue.h b/Firestore/Source/Model/FSTFieldValue.h index 6914f4d..6f9798a 100644 --- a/Firestore/Source/Model/FSTFieldValue.h +++ b/Firestore/Source/Model/FSTFieldValue.h @@ -25,7 +25,6 @@ @class FIRTimestamp; @class FSTFieldValueOptions; @class FIRGeoPoint; -@class FIRSnapshotOptions; NS_ASSUME_NONNULL_BEGIN @@ -67,10 +66,6 @@ typedef NS_ENUM(NSInteger, FSTServerTimestampBehavior) { timestampsInSnapshotsEnabled:(BOOL)timestampsInSnapshotsEnabled NS_DESIGNATED_INITIALIZER; -/** Creates an FSTFieldValueOptions instance from FIRSnapshotOptions. */ -+ (instancetype)optionsForSnapshotOptions:(FIRSnapshotOptions *)value - timestampsInSnapshotsEnabled:(BOOL)timestampsInSnapshotsEnabled; - @end /** diff --git a/Firestore/Source/Model/FSTFieldValue.mm b/Firestore/Source/Model/FSTFieldValue.mm index 0d7c649..9e77d39 100644 --- a/Firestore/Source/Model/FSTFieldValue.mm +++ b/Firestore/Source/Model/FSTFieldValue.mm @@ -16,10 +16,10 @@ #import "Firestore/Source/Model/FSTFieldValue.h" +#import "FIRDocumentSnapshot.h" #import "FIRTimestamp.h" #import "Firestore/Source/API/FIRGeoPoint+Internal.h" -#import "Firestore/Source/API/FIRSnapshotOptions+Internal.h" #import "Firestore/Source/Model/FSTDocumentKey.h" #import "Firestore/Source/Util/FSTAssert.h" #import "Firestore/Source/Util/FSTClasses.h" @@ -46,28 +46,6 @@ NS_ASSUME_NONNULL_BEGIN @implementation FSTFieldValueOptions -+ (instancetype)optionsForSnapshotOptions:(FIRSnapshotOptions *)options - timestampsInSnapshotsEnabled:(BOOL)timestampsInSnapshotsEnabled { - FSTServerTimestampBehavior convertedServerTimestampBehavior = FSTServerTimestampBehaviorNone; - switch (options.serverTimestampBehavior) { - case FIRServerTimestampBehaviorNone: - convertedServerTimestampBehavior = FSTServerTimestampBehaviorNone; - break; - case FIRServerTimestampBehaviorEstimate: - convertedServerTimestampBehavior = FSTServerTimestampBehaviorEstimate; - break; - case FIRServerTimestampBehaviorPrevious: - convertedServerTimestampBehavior = FSTServerTimestampBehaviorPrevious; - break; - default: - FSTFail(@"Unexpected server timestamp option: %ld", (long)options.serverTimestampBehavior); - } - - return - [[FSTFieldValueOptions alloc] initWithServerTimestampBehavior:convertedServerTimestampBehavior - timestampsInSnapshotsEnabled:timestampsInSnapshotsEnabled]; -} - - (instancetype)initWithServerTimestampBehavior:(FSTServerTimestampBehavior)serverTimestampBehavior timestampsInSnapshotsEnabled:(BOOL)timestampsInSnapshotsEnabled { self = [super init]; -- cgit v1.2.3