mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
- Using same clang format file for old and new files. - Moving out all TextSecure code to allow other clients (OS X, iOS) to integrate easily TextSecure functionality. - Use TextSecure API to signup.
43 lines
1.1 KiB
Objective-C
43 lines
1.1 KiB
Objective-C
#import <Foundation/Foundation.h>
|
|
#import "CollapsingFutures.h"
|
|
#import "Queue.h"
|
|
|
|
typedef void (^LatestValueCallback)(id latestValue);
|
|
|
|
/**
|
|
*
|
|
* An ObservableValue represents an asynchronous stream of values, such as 'latest state of toggle' or 'latest sensor
|
|
* reading'.
|
|
*
|
|
*/
|
|
@interface ObservableValue : NSObject {
|
|
@protected
|
|
NSMutableSet *callbacks;
|
|
@private
|
|
Queue *queuedActionsToRun;
|
|
@private
|
|
bool isRunningActions;
|
|
@protected
|
|
bool sealed;
|
|
}
|
|
|
|
@property (readonly, atomic) id currentValue;
|
|
|
|
- (void)watchLatestValueOnArbitraryThread:(LatestValueCallback)callback
|
|
untilCancelled:(TOCCancelToken *)untilCancelledToken;
|
|
|
|
- (void)watchLatestValue:(LatestValueCallback)callback
|
|
onThread:(NSThread *)thread
|
|
untilCancelled:(TOCCancelToken *)untilCancelledToken;
|
|
|
|
@end
|
|
|
|
@interface ObservableValueController : ObservableValue
|
|
|
|
+ (ObservableValueController *)observableValueControllerWithInitialValue:(id)value;
|
|
- (void)updateValue:(id)value;
|
|
- (void)adjustValue:(id (^)(id))adjustment;
|
|
- (void)sealValue;
|
|
|
|
@end
|