appView background update tweak

This commit is contained in:
TrueZhuanjia
2025-07-20 11:37:48 +08:00
parent f843acf12f
commit 2b96bb1c77
3 changed files with 14 additions and 9 deletions
+1 -1
View File
@@ -10,7 +10,7 @@
#import "TemporaryApp.h"
@protocol AppViewUpdateLoopDelegate <NSObject>
- (bool)isStreaming;
- (bool)isInAppView;
@end
+6 -2
View File
@@ -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
@@ -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 {