mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-07 08:01:10 +00:00
no message
This commit is contained in:
parent
270bf0278d
commit
2bf7e85910
@ -63,6 +63,7 @@ static dispatch_block_t recursiveBlock(void (^block)(dispatch_block_t recurse))
|
||||
|
||||
if ([currentShouldRestart boolValue])
|
||||
{
|
||||
[currentDisposable setDisposable:nil];
|
||||
id<SDisposable> disposable = [self startWithNext:^(id next)
|
||||
{
|
||||
[subscriber putNext:next];
|
||||
|
@ -171,14 +171,14 @@
|
||||
}
|
||||
|
||||
- (SSignal *)then:(SSignal *)signal
|
||||
{
|
||||
return [[SSignal alloc] initWithGenerator:^(SSubscriber *subscriber)
|
||||
{
|
||||
SDisposableSet *compositeDisposable = [[SDisposableSet alloc] init];
|
||||
|
||||
SMetaDisposable *currentDisposable = [[SMetaDisposable alloc] init];
|
||||
[compositeDisposable add:currentDisposable];
|
||||
|
||||
return [[SSignal alloc] initWithGenerator:^(SSubscriber *subscriber)
|
||||
{
|
||||
[currentDisposable setDisposable:[self startWithNext:^(id next)
|
||||
{
|
||||
[subscriber putNext:next];
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
@interface SSignal (SideEffects)
|
||||
|
||||
- (SSignal *)onStart:(void (^)())f;
|
||||
- (SSignal *)onNext:(void (^)(id next))f;
|
||||
- (SSignal *)afterNext:(void (^)(id next))f;
|
||||
- (SSignal *)onError:(void (^)(id error))f;
|
||||
|
@ -5,6 +5,24 @@
|
||||
|
||||
@implementation SSignal (SideEffects)
|
||||
|
||||
- (SSignal *)onStart:(void (^)())f
|
||||
{
|
||||
return [[SSignal alloc] initWithGenerator:^id<SDisposable> (SSubscriber *subscriber)
|
||||
{
|
||||
f();
|
||||
return [self startWithNext:^(id next)
|
||||
{
|
||||
[subscriber putNext:next];
|
||||
} error:^(id error)
|
||||
{
|
||||
[subscriber putError:error];
|
||||
} completed:^
|
||||
{
|
||||
[subscriber putCompletion];
|
||||
}];
|
||||
}];
|
||||
}
|
||||
|
||||
- (SSignal *)onNext:(void (^)(id next))f
|
||||
{
|
||||
return [[SSignal alloc] initWithGenerator:^id<SDisposable> (SSubscriber *subscriber)
|
||||
|
@ -86,6 +86,8 @@
|
||||
#ifdef DEBUG
|
||||
return [[SSignal alloc] initWithGenerator:^id<SDisposable>(SSubscriber *subscriber)
|
||||
{
|
||||
NSString *traceName = [[NSString alloc] initWithFormat:@"%@#0x%x", name, (int)random()];
|
||||
NSLog(@"trace(%@ start)", traceName);
|
||||
return [self startWithNext:^(id next)
|
||||
{
|
||||
[subscriber putNext:next];
|
||||
@ -95,7 +97,7 @@
|
||||
} completed:^
|
||||
{
|
||||
[subscriber putCompletion];
|
||||
} traceName:name];
|
||||
} traceName:traceName];
|
||||
}];
|
||||
#else
|
||||
return self;
|
||||
|
@ -150,6 +150,11 @@
|
||||
OSSpinLockLock(&_lock);
|
||||
if (!_terminated)
|
||||
{
|
||||
NSLog(@"trace(%@ terminated)", _name);
|
||||
if ([_name hasPrefix:@"bestTcp4Signals"])
|
||||
{
|
||||
int bp = 1;
|
||||
}
|
||||
_terminated = true;
|
||||
_next = nil;
|
||||
_error = nil;
|
||||
@ -169,9 +174,11 @@
|
||||
|
||||
if (fnext)
|
||||
{
|
||||
NSLog(@"(%@ next: %@)", _name, next);
|
||||
NSLog(@"trace(%@ next: %@)", _name, next);
|
||||
fnext(next);
|
||||
}
|
||||
else
|
||||
NSLog(@"trace(%@ next: %@, not accepted)", _name, next);
|
||||
}
|
||||
|
||||
- (void)putError:(id)error
|
||||
@ -193,9 +200,11 @@
|
||||
|
||||
if (ferror)
|
||||
{
|
||||
NSLog(@"(%@ error: %@)", _name, error);
|
||||
NSLog(@"trace(%@ error: %@)", _name, error);
|
||||
ferror(error);
|
||||
}
|
||||
else
|
||||
NSLog(@"trace(%@ error: %@, not accepted)", _name, error);
|
||||
|
||||
if (shouldDispose)
|
||||
[self->_disposable dispose];
|
||||
@ -220,9 +229,11 @@
|
||||
|
||||
if (completed)
|
||||
{
|
||||
NSLog(@"(%@ completed)", _name);
|
||||
NSLog(@"trace(%@ completed)", _name);
|
||||
completed();
|
||||
}
|
||||
else
|
||||
NSLog(@"trace(%@ completed, not accepted)", _name);
|
||||
|
||||
if (shouldDispose)
|
||||
[self->_disposable dispose];
|
||||
@ -230,7 +241,7 @@
|
||||
|
||||
- (void)dispose
|
||||
{
|
||||
NSLog(@"(%@ dispose)", _name);
|
||||
NSLog(@"trace(%@ dispose)", _name);
|
||||
[self->_disposable dispose];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user