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
@interface NodeViewController : NSObject | |
@property (nonatomic, strong) Node *node; | |
- (id)initWithNode:(Node *)node; | |
@end | |
@implementation NodeViewController | |
- (id)initWithNode:(Node *)node { | |
NSParameterAssert(node); | |
if (self = [super init]) { | |
_node = node; |
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
- (RACSignal *)updateState { | |
return [[self updateCheckWithDelay:0.0f] catch:^RACSignal *(NSError *error) { | |
[[self updateCheckUntilSucceded] subscribeNext:^(id x) { | |
NSLog(@"new profile: %@", x); | |
}]; | |
return [RACSignal error:error]; | |
}]; | |
} | |
- (RACSignal *)updateCheckWithDelay:(NSTimeInterval)delaySec { |
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)refreshProfile { | |
RACSignal *fetchSignal = [[self fetchProfile] replayLast]; | |
[fetchSignal subscribeNext:^(id x) { | |
// update profile | |
// goto itunes | |
// etc. | |
}]; | |
[[fetchSignal filter:^BOOL(id value) { | |
return [value isEqualToNumber:@(499)]; | |
}] subscribeNext:^(id x) { |
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
@protocol CMRRequest <NSObject> | |
@property (nonatomic, readonly) id CMRHTTPOptions; | |
- (NSMutableURLRequest *)buildRequestWithBaseURL:(NSURL* )baseURL; | |
@end | |
@protocol CMREndpoint <NSObject> |
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
// CloudShare SharePoint | |
NSString *kCSFolderURL = @"http://uvo13v3ow3jmtx8iunr.env.cloudshare.com/Shared Documents/"; | |
NSString *kCSFilename = @"85b5a608d1e533af644251901044da15.docx"; | |
// Mail.Ru SharePoint | |
NSString *kMRFolderURL = @"https://owa.attachmail.ru/Shared Documents/"; | |
NSString *kMRFilename = @"1.docx"; | |
// Target SharePoint | |
BOOL useMRSP = YES; |
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
#import <POSInputStreamLibrary/POSBlobInputStreamDataSource.h> | |
@interface MRCDataStreamDataSource : NSObject <POSBlobInputStreamDataSource> | |
// The designated initializer. | |
- (nonnull instancetype)initWithData:(nonnull NSData *)data; | |
// Hidden initializers. | |
- (nonnull instancetype)init NS_UNAVAILABLE; | |
+ (nonnull instancetype)new NS_UNAVAILABLE; | |
@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
- (NSURLSessionUploadTask *)uploadData:(NSData *)data toURL:(NSURL *)URL { | |
NSMutableHTTPRequest *request = [[NSMutableHTTPRequest alloc] initWithURL:URL]; | |
request.HTTPMethod = @"PUT"; | |
request.HTTPBodyStream = [NSInputStream inputStreamWithData:data]; | |
NSURLSession *session = [NSURLSession sharedSession]; | |
NSURLSessionUploadTask *task = [session uploadTaskWithStreamedRequest:request] | |
return task; | |
} |
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
#import "MRCDataStreamDataSource.h" | |
@interface MRCDataStreamDataSource () | |
@property (nonatomic, readonly) NSData *data; | |
@property (nonatomic) NSUInteger readOffset; | |
@property (nonatomic, getter = isOpenCompleted) BOOL openCompleted; | |
@property (nonatomic) NSError *error; | |
@end | |
@implementation MRCDataStreamDataSource |
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
@interface NSInputStream (MRC) | |
+ (instancetype)mrc_inputStreamWithData:(NSData *)data; | |
@end | |
@implementation NSInputStream (MRC) | |
+ (instancetype)mrc_inputStreamWithData:(NSData *)data { | |
MRCDataStreamDataSource *dataSource = [[MRCDataStreamDataSource alloc] initWithData:data]; | |
POSBlobInputStream *stream = [[POSBlobInputStream alloc] initWithDataSource:dataSource]; | |
stream.shouldNotifyCoreFoundationAboutStatusChange = NO; | |
return stream; |
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
@implementation PHImageManager (MRCApp) | |
+ (RACSignal *)p_fetchALAssetForVideoAsset:(PHAsset *)asset { | |
POSRX_CHECK(asset); | |
PHVideoRequestOptions *options = [PHVideoRequestOptions new]; | |
options.version = PHVideoRequestOptionsVersionCurrent; | |
options.deliveryMode = PHVideoRequestOptionsDeliveryModeHighQualityFormat; | |
options.networkAccessAllowed = YES; | |
return [self p_fetchALAssetForAsset:asset withURL:asset.mrc_videoAssetURL]; | |
} |
OlderNewer