Created
May 13, 2015 07:02
-
-
Save Qata/20dafd7c306018b4b7bd to your computer and use it in GitHub Desktop.
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
- (void)viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
@weakify(self); | |
[[[[[[[[self.output.rac_capturedMetadataObjectsSignal filter:^BOOL(AVMetadataMachineReadableCodeObject * codeObject) { | |
return [codeObject isKindOfClass:[AVMetadataMachineReadableCodeObject class]] && [codeObject.type isEqual:@"org.iso.QRCode"]; | |
}] map:^id(AVMetadataMachineReadableCodeObject * codeObject) { | |
return codeObject.stringValue; | |
}].distinctUntilChanged map:^id(NSString * JSONString) { | |
return [NSJSONSerialization JSONObjectWithData:[[JSONString stringByReplacingOccurrencesOfString:@"\\" withString:@""] dataUsingEncoding:NSASCIIStringEncoding] options:0 error:nil]; | |
}] filter:^BOOL(id value) { | |
return value != nil && [value isKindOfClass:[NSDictionary class]]; | |
}] map:^id(NSDictionary * info) { | |
return [FavouriteController tryFavouriteWithInfo:info]; | |
}] filter:^BOOL(id value) { | |
return value != nil; | |
}] take:1] subscribeNext:^(FavouriteController * favourite) { | |
@strongify(self); | |
[self.navigationController pushViewController:[self favouriteControllerFromFavourite:favourite] animated:YES]; | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment