diff --git a/BarrageRenderer/BarrageEngine/BarrageRenderer.m b/BarrageRenderer/BarrageEngine/BarrageRenderer.m index 05dc923..ed213b4 100644 --- a/BarrageRenderer/BarrageEngine/BarrageRenderer.m +++ b/BarrageRenderer/BarrageEngine/BarrageRenderer.m @@ -82,7 +82,7 @@ - (void)initClock __weak id weakSelf = self; _clock = [BarrageClock clockWithHandler:^(NSTimeInterval time){ BarrageRenderer * strongSelf = weakSelf; - _time = time; + self->_time = time; [strongSelf update]; }]; } diff --git a/BarrageRenderer/NHDisplayLink.m b/BarrageRenderer/NHDisplayLink.m index ac1766b..fecb105 100644 --- a/BarrageRenderer/NHDisplayLink.m +++ b/BarrageRenderer/NHDisplayLink.m @@ -85,27 +85,27 @@ - (void)setDispatchQueue:(dispatch_queue_t)dispatchQueue { - (void)start { dispatch_async(_stateChangeQueue, ^{ - if (_isRunning) + if (self->_isRunning) return; - _isRunning = true; + self->_isRunning = true; // We CFRetain self while the displaylink thread is active, to ensure it // always has a valid 'self' pointer. The CFRetain is undone by [1]. CFRetain((__bridge CFTypeRef)self); - CVDisplayLinkStart(_displayLink); + CVDisplayLinkStart(self->_displayLink); }); } - (void)stop { dispatch_async(_stateChangeQueue, ^{ - if (!_isRunning) + if (!self->_isRunning) return; - _isRunning = false; + self->_isRunning = false; // The displaylink thread resumes the queue at [2] - dispatch_suspend(_stateChangeQueue); + dispatch_suspend(self->_stateChangeQueue); }); } diff --git a/bilibili/Browser/AddressBar.m b/bilibili/Browser/AddressBar.m index c3b3bc6..ea39433 100644 --- a/bilibili/Browser/AddressBar.m +++ b/bilibili/Browser/AddressBar.m @@ -78,7 +78,7 @@ - (void)updateSuggestContext{ - (BOOL)textShouldEndEditing:(NSText *)textObject{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [ASTable removeFromSuperview]; + [self->ASTable removeFromSuperview]; }); isEditing = false; return YES; diff --git a/bilibili/Browser/AutoSuggestTable.m b/bilibili/Browser/AutoSuggestTable.m index 0a3a09a..9179e3f 100644 --- a/bilibili/Browser/AutoSuggestTable.m +++ b/bilibili/Browser/AutoSuggestTable.m @@ -130,13 +130,13 @@ - (void)loadOnlineResultAsync:(NSTableView *)tv{ /* Start a new Task */ NSURLSessionDataTask* task = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error == nil) { - if([currentKey isEqualToString:online_cache_key]){ + if([currentKey isEqualToString:self->online_cache_key]){ NSError *err; NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:0 error:&err]; if(err || !dic){ return; } - online_cache = [[NSMutableArray alloc] init]; + self->online_cache = [[NSMutableArray alloc] init]; // FXXK Objective-C JSON processing @try { if(dic[@"result"]){ @@ -146,7 +146,7 @@ - (void)loadOnlineResultAsync:(NSTableView *)tv{ for(int i = 0; i < [b count]; i++){ NSString *bgmName = [b objectAtIndex:i][@"value"]; if(bgmName){ - [online_cache addObject:bgmName]; + [self->online_cache addObject:bgmName]; } } } @@ -157,7 +157,7 @@ - (void)loadOnlineResultAsync:(NSTableView *)tv{ for(int i = 0; i < [tags count]; i++){ NSString *tagName = [tags objectAtIndex:i][@"value"]; if(tagName){ - [online_cache addObject:tagName]; + [self->online_cache addObject:tagName]; } } } @@ -166,7 +166,7 @@ - (void)loadOnlineResultAsync:(NSTableView *)tv{ }@catch ( NSException *e ) { NSLog(@"[AddressBar] Ignore json read exception %@",e); } - NSLog(@"[AddressBar] Online Suggest Load Succeeded with %lu object",(unsigned long)[online_cache count]); + NSLog(@"[AddressBar] Online Suggest Load Succeeded with %lu object",(unsigned long)[self->online_cache count]); dispatch_async(dispatch_get_main_queue(), ^(void){ if(tv){ [tv reloadData]; diff --git a/bilibili/Browser/ToolBar.m b/bilibili/Browser/ToolBar.m index 2ff4cae..ffaeee3 100644 --- a/bilibili/Browser/ToolBar.m +++ b/bilibili/Browser/ToolBar.m @@ -45,7 +45,7 @@ - (id)init{ } -- (void)finalize { +- (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } diff --git a/bilibili/Browser/WebTabView.mm b/bilibili/Browser/WebTabView.mm index af9256c..a9200ee 100644 --- a/bilibili/Browser/WebTabView.mm +++ b/bilibili/Browser/WebTabView.mm @@ -51,7 +51,7 @@ -(void)viewFrameDidChange:(NSRect)newFrame { dispatch_async(dispatch_get_global_queue(0, 0), ^(void){ [[NSUserDefaults standardUserDefaults] setDouble:frame.size.width forKey:@"webwidth"]; [[NSUserDefaults standardUserDefaults] setDouble:frame.size.height forKey:@"webheight"]; - pm = [PluginManager sharedInstance]; + self->pm = [PluginManager sharedInstance]; }); } diff --git a/bilibili/Info.plist b/bilibili/Info.plist index 774a826..4da3a74 100644 --- a/bilibili/Info.plist +++ b/bilibili/Info.plist @@ -233,7 +233,7 @@ CFBundleVersion - 3546 + 3551 Fabric APIKey diff --git a/bilibili/LiveChat/BilibiliSocketProvider.m b/bilibili/LiveChat/BilibiliSocketProvider.m index 89ee904..7cbb392 100644 --- a/bilibili/LiveChat/BilibiliSocketProvider.m +++ b/bilibili/LiveChat/BilibiliSocketProvider.m @@ -58,17 +58,17 @@ - (void)loadWithPlayer: (id)player{ if(range.length > 0){ NSString *server = [resp substringWithRange:range]; NSLog(@"[LiveComment] Found server: %@",server); - host = server; + self->host = server; [self connect]; } }else{ NSLog(@"[LiveComment] Failed with status Code %d",code); - [delegate onNewError:@"无法获取服务器地址"]; + [self->delegate onNewError:@"无法获取服务器地址"]; } } else { NSLog(@"[LiveComment] Failed to request server url: %@", [error localizedDescription]); - [delegate onNewError:@"无法连接到 API"]; + [self->delegate onNewError:@"无法连接到 API"]; } }]; @@ -133,11 +133,11 @@ - (void)reconnect { - (void)doRecv { dispatch_async(dispatch_get_global_queue(0, 0), ^(void){ - while (!disconnected) { + while (!self->disconnected) { uint8_t buf[1024]; - [lock lock]; - ssize_t recvlen = recv(sockfd, buf, 1024, 0); - [lock unlock]; + [self->lock lock]; + ssize_t recvlen = recv(self->sockfd, buf, 1024, 0); + [self->lock unlock]; if(recvlen == 0){ [self reconnect]; return; @@ -149,7 +149,7 @@ - (void)doRecv { return; } - [mBuf appendBytes:buf length:recvlen]; + [self->mBuf appendBytes:buf length:recvlen]; [self checkData]; } }); diff --git a/bilibili/LiveChat/LiveChat.m b/bilibili/LiveChat/LiveChat.m index 7713cfc..fd1a0bf 100644 --- a/bilibili/LiveChat/LiveChat.m +++ b/bilibili/LiveChat/LiveChat.m @@ -48,8 +48,8 @@ - (void)viewDidLoad { - (void)onNewMessage:(NSString *)cmContent :(NSString *)userName :(int)ftype :(int)fsize :(NSColor *)color{ dispatch_async(dispatch_get_main_queue(), ^(void){ bool isBlocked = false; - if([blockwords count] > 0){ - for (NSString* string in blockwords) { + if([self->blockwords count] > 0){ + for (NSString* string in self->blockwords) { if([cmContent containsString:string]){ isBlocked = true; } diff --git a/bilibili/Notifications/Popover.m b/bilibili/Notifications/Popover.m index ce3d975..9653639 100644 --- a/bilibili/Notifications/Popover.m +++ b/bilibili/Notifications/Popover.m @@ -26,7 +26,7 @@ - (id)init{ - (void)startMonitor{ monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask | NSRightMouseDownMask handler:^(NSEvent* evt){ - if(popover.shown){ + if(self->popover.shown){ [self hidePopover:evt]; } }]; diff --git a/bilibili/Player/Control/PlayerControlView.m b/bilibili/Player/Control/PlayerControlView.m index 40f0649..420566b 100644 --- a/bilibili/Player/Control/PlayerControlView.m +++ b/bilibili/Player/Control/PlayerControlView.m @@ -286,23 +286,23 @@ - (IBAction)rightTextSwitch:(id)sender { - (void)onVolume:(double)volume{ dispatch_async(dispatch_get_main_queue(), ^(void){ - volumeSlider.doubleValue = volume; + self->volumeSlider.doubleValue = volume; }); } - (void)onDuration:(double)duration{ dispatch_async(dispatch_get_main_queue(), ^(void){ - timeSlider.maxValue = duration; - rightTimeText.stringValue = [self timeFormatted:duration]; - v_duration = duration; + self->timeSlider.maxValue = duration; + self->rightTimeText.stringValue = [self timeFormatted:duration]; + self->v_duration = duration; }); } - (void)onPlaybackTime:(double)t{ dispatch_async(dispatch_get_main_queue(), ^(void){ - timeSlider.doubleValue = t; - timeText.stringValue = [self timeFormatted:t]; - v_playback_time = t; + self->timeSlider.doubleValue = t; + self->timeText.stringValue = [self timeFormatted:t]; + self->v_playback_time = t; }); } @@ -310,10 +310,10 @@ - (void)onCacheSize:(double)t{ dispatch_async(dispatch_get_main_queue(), ^(void){ if(t > 0){ int sizeMB = t/1024; - rightTimeText.stringValue = [NSString stringWithFormat:@"%d MB",sizeMB]; - if(sizeMB > 10 && !isFirstBuffed){ - isFirstBuffed = YES; - isShowingDuration = YES; + self->rightTimeText.stringValue = [NSString stringWithFormat:@"%d MB",sizeMB]; + if(sizeMB > 10 && !self->isFirstBuffed){ + self->isFirstBuffed = YES; + self->isShowingDuration = YES; } } }); @@ -321,12 +321,12 @@ - (void)onCacheSize:(double)t{ - (void)onCacheFillRate:(double)t{ dispatch_async(dispatch_get_main_queue(), ^(void){ - if(t > 0 && v_duration > 0){ - double playbackRate = (v_playback_time / v_duration)*100; + if(t > 0 && self->v_duration > 0){ + double playbackRate = (self->v_playback_time / self->v_duration)*100; double allRate = playbackRate + t; if(allRate > 90){ - rightTimeText.stringValue = @"缓冲完成"; - isShowingDuration = YES; + self->rightTimeText.stringValue = @"缓冲完成"; + self->isShowingDuration = YES; } } }); @@ -336,11 +336,11 @@ - (void)onCacheFillRate:(double)t{ - (void)onPaused:(int)isPaused{ dispatch_async(dispatch_get_main_queue(), ^(void){ if(isPaused){ - currentPaused = YES; - playPauseButton.state = NSOffState; + self->currentPaused = YES; + self->playPauseButton.state = NSOffState; }else{ - currentPaused = NO; - playPauseButton.state = NSOnState; + self->currentPaused = NO; + self->playPauseButton.state = NSOnState; } }); } @@ -348,11 +348,11 @@ - (void)onPaused:(int)isPaused{ - (void)onMuted:(int)isMuted{ dispatch_async(dispatch_get_main_queue(), ^(void){ if(isMuted){ - currentMuted = YES; - muteButton.state = NSOnState; + self->currentMuted = YES; + self->muteButton.state = NSOnState; }else{ - currentMuted = NO; - muteButton.state = NSOffState; + self->currentMuted = NO; + self->muteButton.state = NSOffState; } }); } @@ -360,11 +360,11 @@ - (void)onMuted:(int)isMuted{ - (void)onSubVisibility:(int)vis{ dispatch_async(dispatch_get_main_queue(), ^(void){ if(vis){ - currentSubVis = YES; - subVisButton.state = NSOffState; + self->currentSubVis = YES; + self->subVisButton.state = NSOffState; }else{ - currentSubVis = NO; - subVisButton.state = NSOnState; + self->currentSubVis = NO; + self->subVisButton.state = NSOnState; } }); } @@ -380,11 +380,11 @@ - (void)onKeepAspect:(int)keep{ [videoView setFrame:rect]; if(keep){ - isKeepAspect = YES; - keepAspectButton.state = NSOffState; + self->isKeepAspect = YES; + self->keepAspectButton.state = NSOffState; }else{ - isKeepAspect = NO; - keepAspectButton.state = NSOnState; + self->isKeepAspect = NO; + self->keepAspectButton.state = NSOnState; } }); } diff --git a/bilibili/Player/PlayerLoader.m b/bilibili/Player/PlayerLoader.m index a0f166c..483fae9 100644 --- a/bilibili/Player/PlayerLoader.m +++ b/bilibili/Player/PlayerLoader.m @@ -121,10 +121,10 @@ - (void)loadVideo:(VideoAddress *)video withAttrs:(NSDictionary *)attrs{ } dispatch_async(vl_queue, ^(void){ NSDictionary *_attrs = attrs; - BOOL haveSub = [subHelper canHandle:_attrs]; + BOOL haveSub = [self->subHelper canHandle:_attrs]; if(haveSub){ [self setText:@"正在下载弹幕/字幕"]; - _attrs = [subHelper getSubtitle:attrs]; + _attrs = [self->subHelper getSubtitle:attrs]; } dispatch_async(dispatch_get_main_queue(), ^(void){ [self _loadVideo:video withAttrs:_attrs]; @@ -163,9 +163,9 @@ - (void)_loadVideo:(VideoAddress *)video withAttrs:(NSDictionary *)attrs{ - (void)showError:(NSString *)title :(NSString *)desc{ dispatch_async(dispatch_get_main_queue(), ^(void){ - hud.mode = MBProgressHUDModeText; - hud.labelText = NSLocalizedString(title, nil); - hud.detailsLabelText = NSLocalizedString(desc, nil); + self->hud.mode = MBProgressHUDModeText; + self->hud.labelText = NSLocalizedString(title, nil); + self->hud.detailsLabelText = NSLocalizedString(desc, nil); [self hide:3.0]; }); } @@ -173,7 +173,7 @@ - (void)showError:(NSString *)title :(NSString *)desc{ - (void)setText:(NSString *)text{ dispatch_async(dispatch_get_main_queue(), ^(void){ [self show]; - hud.labelText = NSLocalizedString(text, nil); + self->hud.labelText = NSLocalizedString(text, nil); }); } @@ -192,7 +192,7 @@ - (void)show{ - (void)hide:(NSTimeInterval)i{ dispatch_async(dispatch_get_main_queue(), ^(void){ - [hud hide:YES afterDelay:i]; + [self->hud hide:YES afterDelay:i]; [NSTimer scheduledTimerWithTimeInterval:i+0.5 target:self selector:@selector(hideWindow) @@ -258,4 +258,4 @@ - (void)drawRect:(NSRect)rect //NSRectFill([selfframe]); } -@end \ No newline at end of file +@end diff --git a/bilibili/Player/PlayerView.mm b/bilibili/Player/PlayerView.mm index 1e7d971..6f9e42a 100644 --- a/bilibili/Player/PlayerView.mm +++ b/bilibili/Player/PlayerView.mm @@ -89,10 +89,10 @@ - (void)viewDidLoad { // The window is not got initialized here // But sometimes viewDidAppear not get called.... dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - if(!windowSetup){ + if(!self->windowSetup){ CLS_LOG(@"Forced a window setup"); [self setupWindow]; - windowSetup = YES; + self->windowSetup = YES; } }); } @@ -189,7 +189,7 @@ - (void)loadVideo:(VideoAddress *)video{ NSString *fvHost = [[NSURL URLWithString:firstVideo] host]; if([fvHost length] > 0){ - videoDomain = fvHost; + self->videoDomain = fvHost; } [self playVideo: playURL]; @@ -623,7 +623,7 @@ - (void) handleEvent:(mpv_event *)event case MPV_EVENT_PLAYBACK_RESTART: { dispatch_async(dispatch_get_main_queue(), ^{ [self.loadingImage setAnimates:NO]; - [LoadingView setHidden:YES]; + [self->LoadingView setHidden:YES]; }); break; } @@ -640,7 +640,7 @@ - (void) handleEvent:(mpv_event *)event } if(endFile){ dispatch_async(dispatch_get_main_queue(), ^{ - [LoadingView setHidden:NO]; + [self->LoadingView setHidden:NO]; [self.textTip setStringValue:NSLocalizedString(@"播放完成,关闭窗口继续", nil)]; [self runAutoSwitch]; [self.view.window performClose:self]; diff --git a/bilibili/Player/PlayerWindow.m b/bilibili/Player/PlayerWindow.m index 35f9a29..4ace0b8 100644 --- a/bilibili/Player/PlayerWindow.m +++ b/bilibili/Player/PlayerWindow.m @@ -408,9 +408,9 @@ - (void)keyDown:(NSEvent*)event { } dispatch_async(dispatch_get_main_queue(), ^{ NSStoryboard *storyBoard = [NSStoryboard storyboardWithName:@"Main" bundle:nil]; - postCommentWindowC = [storyBoard instantiateControllerWithIdentifier:@"PostCommentWindow"]; - [postCommentWindowC showWindow:self]; - PostComment *pcv = (PostComment *)postCommentWindowC.window.contentViewController; + self->postCommentWindowC = [storyBoard instantiateControllerWithIdentifier:@"PostCommentWindow"]; + [self->postCommentWindowC showWindow:self]; + PostComment *pcv = (PostComment *)self->postCommentWindowC.window.contentViewController; [pcv setPlayer:self.player]; }); } @@ -425,14 +425,14 @@ - (void)keyDown:(NSEvent*)event { NSUInteger flags = [[NSApp currentEvent] modifierFlags]; if ((flags & NSCommandKeyMask)) { [self toggleFullScreen:self]; // Command+F key to toggle fullscreen - }else if(frontMost){ + }else if(self->frontMost){ [self setLevel:NSNormalWindowLevel]; - frontMost = NO; + self->frontMost = NO; }else{ [self setLevel:NSScreenSaverWindowLevel + 1]; // F key to front most [self orderFront:nil]; [self becomeKeyWindow]; - frontMost = YES; + self->frontMost = YES; } }); break; diff --git a/bilibili/Player/Util Window/AirPlayView.mm b/bilibili/Player/Util Window/AirPlayView.mm index 6661707..f323382 100644 --- a/bilibili/Player/Util Window/AirPlayView.mm +++ b/bilibili/Player/Util Window/AirPlayView.mm @@ -49,17 +49,17 @@ - (void)refreshDeviceList { [refreshBtn setEnabled:NO]; [refreshBtn setTitle:NSLocalizedString(@"读取中", NULL)]; dispatch_async(queue, ^(void){ - NSDictionary *ddlist = ap->getDeviceList(); + NSDictionary *ddlist = self->ap->getDeviceList(); for(id key in ddlist){ NSArray *arr = [NSArray arrayWithObjects:key, ddlist[key] , nil]; - [deviceList addObject:arr]; + [self->deviceList addObject:arr]; } dispatch_async(dispatch_get_main_queue(), ^(void){ NSLog(@"Ready to reload"); - [tableView reloadData]; - [refreshBtn setTitle:NSLocalizedString(@"刷新",NULL)]; - [refreshBtn setEnabled:YES]; + [self->tableView reloadData]; + [self->refreshBtn setTitle:NSLocalizedString(@"刷新",NULL)]; + [self->refreshBtn setEnabled:YES]; [self writeLog:@"设备列表刷新成功,请在左边选择一个服务器进行连接"]; }); }); @@ -78,14 +78,14 @@ - (IBAction)connAction:(id)sender { [refreshBtn setEnabled:NO]; dispatch_async(queue, ^(void){ [self writeLog:@"正在初始化引擎(注意:暂时不支持分段视频与弹幕)"]; - bool suc = ap->selectDevice(sel_devName,sel_domain); + bool suc = self->ap->selectDevice(self->sel_devName,self->sel_domain); if(!suc){ [self writeLog:@"无法查找到设备地址"]; [self connStop]; return; } [self writeLog:@"正在尝试连接设备"]; - suc = ap->reverse(); + suc = self->ap->reverse(); if(!suc){ [self writeLog:@"无法连接到指定设备"]; [self connStop]; @@ -95,10 +95,10 @@ - (IBAction)connAction:(id)sender { VP_Bilibili *bili = [VP_Bilibili sharedInstance]; - NSMutableDictionary *params = [[bili generateParamsFromURL:apwc.url] mutableCopy]; + NSMutableDictionary *params = [[bili generateParamsFromURL:self->apwc.url] mutableCopy]; - params[@"cid"] = apwc.cid; - params[@"title"] = apwc.vtitle; + params[@"cid"] = self->apwc.cid; + params[@"title"] = self->apwc.vtitle; params[@"forceType"] = @"mp4"; NSString *playurl; @@ -122,11 +122,11 @@ - (IBAction)connAction:(id)sender { return; } [self writeLog:@"视频解析成功,正在尝试开始播放"]; - ap->playVideo([playurl cStringUsingEncoding:NSUTF8StringEncoding], 0); + self->ap->playVideo([playurl cStringUsingEncoding:NSUTF8StringEncoding], 0); [self writeLog:@"已发起播放,请查看电视"]; dispatch_async(dispatch_get_main_queue(), ^(void){ - isPlaying = true; - [disconnBtn setEnabled:YES]; + self->isPlaying = true; + [self->disconnBtn setEnabled:YES]; }); }); } @@ -167,10 +167,10 @@ - (IBAction)playWithQT:(id)sender { - (IBAction)stopAction:(id)sender { dispatch_async(queue, ^(void){ - ap->stop(); - ap->disconnect(); + self->ap->stop(); + self->ap->disconnect(); sleep(0.1); - ap->clear(); + self->ap->clear(); dispatch_async(dispatch_get_main_queue(), ^(void){ [self.view.window close]; }); @@ -179,8 +179,8 @@ - (IBAction)stopAction:(id)sender { - (void)connStop { dispatch_async(dispatch_get_main_queue(), ^(void){ - [connectBtn setEnabled:YES]; - [refreshBtn setEnabled:YES]; + [self->connectBtn setEnabled:YES]; + [self->refreshBtn setEnabled:YES]; }); } @@ -240,10 +240,10 @@ - (void)writeLog:(NSString*)text NSString *userContent = [NSString stringWithFormat:@"%@\n",NSLocalizedString(text, NULL)]; NSAttributedString* attr = [[NSAttributedString alloc] initWithString:userContent]; - [[textView textStorage] appendAttributedString:timeattr]; - [[textView textStorage] appendAttributedString:attr]; + [[self->textView textStorage] appendAttributedString:timeattr]; + [[self->textView textStorage] appendAttributedString:attr]; - [textView scrollRangeToVisible:NSMakeRange([[textView string] length], 0)]; + [self->textView scrollRangeToVisible:NSMakeRange([[self->textView string] length], 0)]; }); } @@ -253,4 +253,4 @@ @implementation AirPlayWindowController -@end \ No newline at end of file +@end diff --git a/bilibili/RemoteCall/HTTPServer.mm b/bilibili/RemoteCall/HTTPServer.mm index 93f7276..3d46fb7 100644 --- a/bilibili/RemoteCall/HTTPServer.mm +++ b/bilibili/RemoteCall/HTTPServer.mm @@ -186,7 +186,7 @@ - (void)startHTTPServer{ }else if([action isEqualToString:@"updatePlugIn"]){ [self installPlugIn:data]; }else if([action isEqualToString:@"setcookie"]){ - cookie = data; + self->cookie = data; }else if([action isEqualToString:@"goURL"]){ WebTabView *tv = (WebTabView *)[browser activeTabContents]; if(!tv){ @@ -270,20 +270,20 @@ - (void)startHTTPServer{ NSArray *arr = [[PluginManager sharedInstance] getList]; rep = [GCDWebServerDataResponse responseWithJSONObject:arr]; }else if([action isEqualToString:@"scriptList"]){ - NSArray *scList = [browserEIF GetScriptList]; + NSArray *scList = [self->browserEIF GetScriptList]; rep = [GCDWebServerDataResponse responseWithJSONObject:scList]; }else if([action isEqualToString:@"history"]){ NSString *origin = [request headers][@"Origin"]; if(origin && [origin isEqualToString:@"http://_bilimac_newtab.loli.video"]){ int page = [data intValue]; - NSArray *hsList = [browserEIF GetHistory:page]; + NSArray *hsList = [self->browserEIF GetHistory:page]; rep = [GCDWebServerDataResponse responseWithJSONObject:hsList]; } }else if([action isEqualToString:@"delHistory"]){ NSString *origin = [request headers][@"Origin"]; if(origin && [origin isEqualToString:@"http://_bilimac_newtab.loli.video"]){ - BOOL result = [browserEIF DelHistory:data]; + BOOL result = [self->browserEIF DelHistory:data]; if(!result){ rep = [GCDWebServerDataResponse responseWithText:@"error"]; } diff --git a/bilibili/RemoteCall/PluginManager.m b/bilibili/RemoteCall/PluginManager.m index c807444..0aedbdd 100644 --- a/bilibili/RemoteCall/PluginManager.m +++ b/bilibili/RemoteCall/PluginManager.m @@ -221,7 +221,7 @@ - (void)install:(NSString *)name :(id)view :(int)instType{ NSURLSessionDataTask* task = [bgsession dataTaskWithURL:URL completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { if (error == nil) { if(!data || ![[response className] isEqualToString:@"NSHTTPURLResponse"]){ - hud.labelText = NSLocalizedString(@"插件信息解析失败,返回内容为空", nil); + self->hud.labelText = NSLocalizedString(@"插件信息解析失败,返回内容为空", nil); [self hidehud]; return; } @@ -230,33 +230,33 @@ - (void)install:(NSString *)name :(id)view :(int)instType{ NSError *err; id object = [NSJSONSerialization JSONObjectWithData:data options:0 error:&err]; if(!object || err){ - hud.labelText = NSLocalizedString(@"插件信息解析失败,连接可能被劫持", nil); + self->hud.labelText = NSLocalizedString(@"插件信息解析失败,连接可能被劫持", nil); [self hidehud]; return; } if (![object respondsToSelector:@selector(integerForKey:)]) { - hud.labelText = NSLocalizedString(@"插件信息解析失败,返回内容错误", nil); + self->hud.labelText = NSLocalizedString(@"插件信息解析失败,返回内容错误", nil); [self hidehud]; return; } NSInteger minver = [object integerForKey:@"minver"]; - if(ver < minver){ - hud.labelText = NSLocalizedString(@"您的客户端版本过旧,无法安装该插件", nil); + if(self->ver < minver){ + self->hud.labelText = NSLocalizedString(@"您的客户端版本过旧,无法安装该插件", nil); [self hidehud]; return; } NSInteger maxver = [object integerForKey:@"maxver"]; - if(ver > maxver){ - hud.labelText = NSLocalizedString(@"该插件无法兼容,请等待作者更新", nil); + if(self->ver > maxver){ + self->hud.labelText = NSLocalizedString(@"该插件无法兼容,请等待作者更新", nil); [self hidehud]; return; } NSString *downloadAddr = [object objectForKey:@"download"]; if(!downloadAddr){ - hud.labelText = NSLocalizedString(@"没有找到下载地址", nil); + self->hud.labelText = NSLocalizedString(@"没有找到下载地址", nil); [self hidehud]; return; } @@ -265,7 +265,7 @@ - (void)install:(NSString *)name :(id)view :(int)instType{ if(filename && [filename length] > 0){ @try { NSError *err; - NSString *path = [NSString stringWithFormat:@"%@%@.bundle",sprtdir,filename]; + NSString *path = [NSString stringWithFormat:@"%@%@.bundle",self->sprtdir,filename]; [[NSFileManager defaultManager] removeItemAtPath:path error:&err]; NSLog(@"[PluginManager] Removed old plugin, Error: %@",err); } @@ -276,20 +276,20 @@ - (void)install:(NSString *)name :(id)view :(int)instType{ if(instType == 1){ - hud.labelText = NSLocalizedString(@"正在更新解析模块", nil); + self->hud.labelText = NSLocalizedString(@"正在更新解析模块", nil); }else{ - hud.labelText = NSLocalizedString(@"正在下载插件", nil); + self->hud.labelText = NSLocalizedString(@"正在下载插件", nil); } - hud.mode = MBProgressHUDModeAnnularDeterminate; - bgsession = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil]; + self->hud.mode = MBProgressHUDModeAnnularDeterminate; + self->bgsession = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:nil]; NSLog(@"Plugin download address: %@",downloadAddr); - NSURLSessionDownloadTask *downloadTask = [bgsession downloadTaskWithURL:[NSURL URLWithString:downloadAddr]]; + NSURLSessionDownloadTask *downloadTask = [self->bgsession downloadTaskWithURL:[NSURL URLWithString:downloadAddr]]; [downloadTask resume]; } else { if(instType == 1){ - hud.labelText = NSLocalizedString(@"解析模块更新失败", nil); + self->hud.labelText = NSLocalizedString(@"解析模块更新失败", nil); }else{ - hud.labelText = NSLocalizedString(@"插件安装失败,无法连接到服务器", nil); + self->hud.labelText = NSLocalizedString(@"插件安装失败,无法连接到服务器", nil); } [self hidehud]; @@ -303,13 +303,13 @@ - (void)install:(NSString *)name :(id)view :(int)instType{ - (void)hidehud{ dispatch_async(dispatch_get_main_queue(), ^(void){ - if(lastInstType == 1){ - [hud hide:YES afterDelay:0.5]; + if(self->lastInstType == 1){ + [self->hud hide:YES afterDelay:0.5]; }else{ - [hud hide:YES afterDelay:1.5]; + [self->hud hide:YES afterDelay:1.5]; } - hud.mode = MBProgressHUDModeText; - isRunning = false; + self->hud.mode = MBProgressHUDModeText; + self->isRunning = false; }); } @@ -392,7 +392,7 @@ -(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask double process = (double)totalBytesWritten / totalBytesExpectedToWrite; dispatch_async(dispatch_get_main_queue(), ^(void){ // The real gui progress seems to 0-60, not 0-1 - hud.progress = process*60; + self->hud.progress = process*60; }); } diff --git a/bilibili/RemoteCall/PreloadManager.m b/bilibili/RemoteCall/PreloadManager.m index 02d4064..533b0fc 100644 --- a/bilibili/RemoteCall/PreloadManager.m +++ b/bilibili/RemoteCall/PreloadManager.m @@ -37,7 +37,7 @@ - (void)preloadComment:(NSString *)cid{ if (error == nil && [[response className] isEqualToString:@"NSHTTPURLResponse"]) { int code = (int)((NSHTTPURLResponse*)response).statusCode; if(code == 200){ - cmPreloadList[cid] = data; + self->cmPreloadList[cid] = data; NSLog(@"[PreloadManager] Comment Preloaded for %@",cid); }else{ NSLog(@"[PreloadManager] Comment Preload Failed: Status Code %d",code); diff --git a/chromium-tabs b/chromium-tabs index cdea132..31c7573 160000 --- a/chromium-tabs +++ b/chromium-tabs @@ -1 +1 @@ -Subproject commit cdea132680f144d7b29ac66779c488682bb03486 +Subproject commit 31c7573338539631cfe63700c4873df0a419103f