appView background update tweak

This commit is contained in:
TrueZhuanjia committed 2025-07-20 11:37:48 +08:00
1 parent f843acf12f
commit 2b96bb1c77
3 files changed
+14 -9

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@
#import "TemporaryApp.h" #import "TemporaryApp.h"
@protocol AppViewUpdateLoopDelegate <NSObject> @protocol AppViewUpdateLoopDelegate <NSObject>
- (bool)isStreaming; - (bool)isInAppView;
@end @end
+6 -2
View File
@@ -5,6 +5,10 @@
// Created by Diego Waxemberg on 10/22/14. // Created by Diego Waxemberg on 10/22/14.
// Copyright (c) 2014 Moonlight Stream. All rights reserved. // 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 "UIAppView.h"
#import "AppAssetManager.h" #import "AppAssetManager.h"
@@ -255,7 +259,7 @@ static UIImage* noImage;
- (void) updateLoop { - (void) updateLoop {
// Stop immediately if the view has been detached // Stop immediately if the view has been detached
if ([self.updateLoopDelegate isStreaming] || self.superview == nil) { if (self.superview == nil) {
return; return;
} }
@@ -277,7 +281,7 @@ static UIImage* noImage;
[self setAlpha:_app.hidden ? 0.4 : 1.0]; [self setAlpha:_app.hidden ? 0.4 : 1.0];
// Queue the next refresh cycle // 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 @end
@@ -387,11 +387,12 @@ static NSMutableSet* hostList;
//[self applyNavBarAppearance:navBarAppearance]; //[self applyNavBarAppearance:navBarAppearance];
} }
- (void)appButtonTappedForHost:(TemporaryHost *)host { - (void)appButtonTappedForHost:(TemporaryHost *)host{
if (host.state != StateOnline) return; if (host.state != StateOnline) return;
_selectedHost = host; _selectedHost = host;
if (host.state == StateOnline && host.pairState == PairStatePaired && host.appList.count > 0) { if(host.state == StateOnline && host.pairState == PairStatePaired){
[self switchToAppView]; [self updateAppsForHost:host];
if(host.appList.count>0) [self switchToAppView];
} }
} }
@@ -492,7 +493,7 @@ static NSMutableSet* hostList;
- (void) noneUserInitiatedHostAction:(TemporaryHost *)host view:(UIView *)view { - (void) noneUserInitiatedHostAction:(TemporaryHost *)host view:(UIView *)view {
Log(LOG_D, @"Clicked host: %@", host.name); NSLog(@"Clicked host: %@", host.name);
_selectedHost = host; _selectedHost = host;
//_appManager = [[AppAssetManager alloc] initWithCallback:self]; //_appManager = [[AppAssetManager alloc] initWithCallback:self];
[self.collectionView setCollectionViewLayout:self.collectionViewLayout]; [self.collectionView setCollectionViewLayout:self.collectionViewLayout];
@@ -2002,8 +2003,8 @@ static NSMutableSet* hostList;
[self.collectionView reloadData]; [self.collectionView reloadData];
} }
- (bool)isStreaming{ - (bool)isInAppView{
return self.revealViewController.isStreaming; return !self.revealViewController.isStreaming && _enteredAppView;
} }
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {