diff --git a/VoidLink/UIAppView.h b/VoidLink/UIAppView.h index 9554d036..4bf31c45 100644 --- a/VoidLink/UIAppView.h +++ b/VoidLink/UIAppView.h @@ -10,7 +10,7 @@ #import "TemporaryApp.h" @protocol AppViewUpdateLoopDelegate -- (bool)isStreaming; +- (bool)isInAppView; @end diff --git a/VoidLink/UIAppView.m b/VoidLink/UIAppView.m index 71cfbfda..5975b34f 100644 --- a/VoidLink/UIAppView.m +++ b/VoidLink/UIAppView.m @@ -5,6 +5,10 @@ // Created by Diego Waxemberg on 10/22/14. // Copyright (c) 2014 Moonlight Stream. All rights reserved. // +// Created by True砖家 on 2025.7.20. +// Copyright © 2025 True砖家 @ Bilibili. All rights reserved. +// + #import "UIAppView.h" #import "AppAssetManager.h" @@ -255,7 +259,7 @@ static UIImage* noImage; - (void) updateLoop { // Stop immediately if the view has been detached - if ([self.updateLoopDelegate isStreaming] || self.superview == nil) { + if (self.superview == nil) { return; } @@ -277,7 +281,7 @@ static UIImage* noImage; [self setAlpha:_app.hidden ? 0.4 : 1.0]; // Queue the next refresh cycle - [self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE]; + if([self.updateLoopDelegate isInAppView]) [self performSelector:@selector(updateLoop) withObject:self afterDelay:REFRESH_CYCLE]; } @end diff --git a/VoidLink/ViewControllers/MainFrameViewController.m b/VoidLink/ViewControllers/MainFrameViewController.m index ab79384f..6383fc2f 100644 --- a/VoidLink/ViewControllers/MainFrameViewController.m +++ b/VoidLink/ViewControllers/MainFrameViewController.m @@ -387,11 +387,12 @@ static NSMutableSet* hostList; //[self applyNavBarAppearance:navBarAppearance]; } -- (void)appButtonTappedForHost:(TemporaryHost *)host { +- (void)appButtonTappedForHost:(TemporaryHost *)host{ if (host.state != StateOnline) return; _selectedHost = host; - if (host.state == StateOnline && host.pairState == PairStatePaired && host.appList.count > 0) { - [self switchToAppView]; + if(host.state == StateOnline && host.pairState == PairStatePaired){ + [self updateAppsForHost:host]; + if(host.appList.count>0) [self switchToAppView]; } } @@ -492,7 +493,7 @@ static NSMutableSet* hostList; - (void) noneUserInitiatedHostAction:(TemporaryHost *)host view:(UIView *)view { - Log(LOG_D, @"Clicked host: %@", host.name); + NSLog(@"Clicked host: %@", host.name); _selectedHost = host; //_appManager = [[AppAssetManager alloc] initWithCallback:self]; [self.collectionView setCollectionViewLayout:self.collectionViewLayout]; @@ -2002,8 +2003,8 @@ static NSMutableSet* hostList; [self.collectionView reloadData]; } -- (bool)isStreaming{ - return self.revealViewController.isStreaming; +- (bool)isInAppView{ + return !self.revealViewController.isStreaming && _enteredAppView; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {