forked from firebase/firebase-ios-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Listen sequence numbers (firebase#675)
* Generate and save sequence numbers for listens * Add documentation * Fix include path * Fix unavailable comment * Review feedback
- Loading branch information
Greg Soltis
committed
Jan 17, 2018
1 parent
898dc22
commit 77c95ef
Showing
16 changed files
with
217 additions
and
19 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,37 @@ | ||
/* | ||
* Copyright 2018 Google | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
#import "FSTTypes.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* FSTListenSequence is a monotonic sequence. It is initialized with a minimum value to | ||
* exceed. All subsequent calls to next will return increasing values. | ||
*/ | ||
@interface FSTListenSequence : NSObject | ||
|
||
- (instancetype)initStartingAfter:(FSTListenSequenceNumber)after NS_DESIGNATED_INITIALIZER; | ||
|
||
- (id)init NS_UNAVAILABLE; | ||
|
||
- (FSTListenSequenceNumber)next; | ||
|
||
@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 @@ | ||
#import "FSTListenSequence.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
#pragma mark - FSTListenSequence | ||
|
||
@interface FSTListenSequence () { | ||
FSTListenSequenceNumber _previousSequenceNumber; | ||
} | ||
|
||
@end | ||
|
||
@implementation FSTListenSequence | ||
|
||
#pragma mark - Constructors | ||
|
||
- (instancetype)initStartingAfter:(FSTListenSequenceNumber)after { | ||
self = [super init]; | ||
if (self) { | ||
_previousSequenceNumber = after; | ||
} | ||
return self; | ||
} | ||
|
||
#pragma mark - Public methods | ||
|
||
- (FSTListenSequenceNumber)next { | ||
_previousSequenceNumber++; | ||
return _previousSequenceNumber; | ||
} | ||
|
||
@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
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.