Skip to content

Commit fcb6ebb

Browse files
committed
Address API proposal feedback.
1 parent 5fd1c1c commit fcb6ebb

16 files changed

+81
-74
lines changed

Firestore/Example/Tests/API/FIRBsonTypesUnitTests.mm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ @interface FIRBsonTypesUnitTests : XCTestCase
3333
@implementation FIRBsonTypesUnitTests
3434

3535
- (void)testMinKeySingleton {
36-
FIRMinKey *minKey1 = [FIRMinKey instance];
37-
FIRMinKey *minKey2 = [FIRMinKey instance];
36+
FIRMinKey *minKey1 = [FIRMinKey shared];
37+
FIRMinKey *minKey2 = [FIRMinKey shared];
3838
XCTAssertEqual(minKey1, minKey2);
3939
XCTAssertTrue([minKey1 isEqual:minKey2]);
4040
}
4141

4242
- (void)testMaxKeySingleton {
43-
FIRMaxKey *maxKey1 = [FIRMaxKey instance];
44-
FIRMaxKey *maxKey2 = [FIRMaxKey instance];
43+
FIRMaxKey *maxKey1 = [FIRMaxKey shared];
44+
FIRMaxKey *maxKey2 = [FIRMaxKey shared];
4545
XCTAssertEqual(maxKey1, maxKey2);
4646
XCTAssertTrue([maxKey1 isEqual:maxKey2]);
4747
}
@@ -128,15 +128,15 @@ - (void)testCreateAndReadAndCompareBsonBinaryData {
128128
}
129129

130130
- (void)testFieldValueMinKey {
131-
FIRMinKey *minKey1 = [FIRMinKey instance];
132-
FIRMinKey *minKey2 = [FIRMinKey instance];
131+
FIRMinKey *minKey1 = [FIRMinKey shared];
132+
FIRMinKey *minKey2 = [FIRMinKey shared];
133133
XCTAssertEqual(minKey1, minKey2);
134134
XCTAssertTrue([minKey1 isEqual:minKey2]);
135135
}
136136

137137
- (void)testFieldValueMaxKey {
138-
FIRMaxKey *maxKey1 = [FIRMaxKey instance];
139-
FIRMaxKey *maxKey2 = [FIRMaxKey instance];
138+
FIRMaxKey *maxKey1 = [FIRMaxKey shared];
139+
FIRMaxKey *maxKey2 = [FIRMaxKey shared];
140140
XCTAssertEqual(maxKey1, maxKey2);
141141
XCTAssertTrue([maxKey1 isEqual:maxKey2]);
142142
}

Firestore/Source/API/FIRFieldValue.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,11 @@ + (nonnull FIRVectorValue *)vectorWithArray:(nonnull NSArray<NSNumber *> *)array
189189
}
190190

191191
+ (nonnull FIRMinKey *)minKey {
192-
return [FIRMinKey instance];
192+
return [FIRMinKey shared];
193193
}
194194

195195
+ (nonnull FIRMaxKey *)maxKey {
196-
return [FIRMaxKey instance];
196+
return [FIRMaxKey shared];
197197
}
198198

199199
+ (nonnull FIRRegexValue *)regexWithPattern:(nonnull NSString *)pattern

Firestore/Source/API/FIRMaxKey.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ @implementation FIRMaxKey
2222
static FIRMaxKey *sharedInstance = nil;
2323
static dispatch_once_t onceToken;
2424

25-
+ (FIRMaxKey *)instance {
25+
+ (FIRMaxKey *)shared {
2626
dispatch_once(&onceToken, ^{
2727
sharedInstance = [[self alloc] init];
2828
});

Firestore/Source/API/FIRMinKey.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ @implementation FIRMinKey
2222
static FIRMinKey *sharedInstance = nil;
2323
static dispatch_once_t onceToken;
2424

25-
+ (FIRMinKey *)instance {
25+
+ (FIRMinKey *)shared {
2626
dispatch_once(&onceToken, ^{
2727
sharedInstance = [[self alloc] init];
2828
});

Firestore/Source/API/FSTUserDataWriter.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ - (id)convertedValue:(const google_firestore_v1_Value &)value {
122122
return MakeFIRGeoPoint(
123123
GeoPoint(value.geo_point_value.latitude, value.geo_point_value.longitude));
124124
case TypeOrder::kMinKey:
125-
return [FIRMinKey instance];
125+
return [FIRMinKey shared];
126126
case TypeOrder::kMaxKey:
127-
return [FIRMaxKey instance];
127+
return [FIRMaxKey shared];
128128
case TypeOrder::kRegex:
129129
return [self convertedRegex:value.map_value];
130130
case TypeOrder::kBsonObjectId:

Firestore/Source/Public/FirebaseFirestore/FIRBsonBinaryData.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
2323
*/
2424
NS_SWIFT_SENDABLE
2525
NS_SWIFT_NAME(BsonBinaryData)
26-
@interface FIRBsonBinaryData : NSObject <NSCopying>
26+
__attribute__((objc_subclassing_restricted))
27+
@interface FIRBsonBinaryData : NSObject<NSCopying>
2728

2829
/** An 8-bit unsigned integer denoting the subtype of the data. */
2930
@property(atomic, readonly) uint8_t subtype;

Firestore/Source/Public/FirebaseFirestore/FIRBsonObjectId.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
2323
*/
2424
NS_SWIFT_SENDABLE
2525
NS_SWIFT_NAME(BsonObjectId)
26-
@interface FIRBsonObjectId : NSObject <NSCopying>
26+
__attribute__((objc_subclassing_restricted))
27+
@interface FIRBsonObjectId : NSObject<NSCopying>
2728

2829
/** The 24-character hex string representation of the ObjectId. */
2930
@property(atomic, copy, readonly) NSString *value;

Firestore/Source/Public/FirebaseFirestore/FIRBsonTimestamp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ NS_ASSUME_NONNULL_BEGIN
2424
*/
2525
NS_SWIFT_SENDABLE
2626
NS_SWIFT_NAME(BsonTimestamp)
27-
@interface FIRBsonTimestamp : NSObject <NSCopying>
27+
__attribute__((objc_subclassing_restricted))
28+
@interface FIRBsonTimestamp : NSObject<NSCopying>
2829

2930
/** The underlying unsigned 32-bit integer for seconds */
3031
@property(atomic, readonly) uint32_t seconds;

Firestore/Source/Public/FirebaseFirestore/FIRInt32Value.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ NS_ASSUME_NONNULL_BEGIN
2323
*/
2424
NS_SWIFT_SENDABLE
2525
NS_SWIFT_NAME(Int32Value)
26-
@interface FIRInt32Value : NSObject <NSCopying>
26+
__attribute__((objc_subclassing_restricted))
27+
@interface FIRInt32Value : NSObject<NSCopying>
2728

2829
/** The 32-bit integer value. */
2930
@property(atomic, assign, readonly) int32_t value;

Firestore/Source/Public/FirebaseFirestore/FIRMaxKey.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@ NS_ASSUME_NONNULL_BEGIN
2323
*/
2424
NS_SWIFT_SENDABLE
2525
NS_SWIFT_NAME(MaxKey)
26+
__attribute__((objc_subclassing_restricted))
2627
@interface FIRMaxKey : NSObject
2728

2829
/** Returns the only instance of MaxKey. */
29-
+ (FIRMaxKey *)instance;
30+
@property(class, readonly) FIRMaxKey *shared;
3031

3132
/** Returns true if the given object is equal to this, and false otherwise. */
3233
- (BOOL)isEqual:(id)object;

0 commit comments

Comments
 (0)