Skip to content

Commit

Permalink
Rework use of isViewDidLoad in DetailVC
Browse files Browse the repository at this point in the history
- Use descriptive ivar name
- Simplify code inside condition check
- Add detailed comment
  • Loading branch information
wutschel committed Oct 27, 2024
1 parent 4ec7135 commit a81f1be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion XBMC Remote/DetailViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
BOOL enableDiskCache;
CGFloat iOSYDelta;
__weak IBOutlet UIToolbar *buttonsViewBgToolbar;
BOOL isViewDidLoad;
BOOL loadAndPresentDataOnViewDidAppear;
BOOL forceMusicAlbumMode;
NSMutableDictionary *epgDict;
NSMutableArray *epgDownloadQueue;
Expand Down
18 changes: 9 additions & 9 deletions XBMC Remote/DetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -5551,16 +5551,16 @@ - (void)viewDidAppear:(BOOL)animated {
else {
self.navigationController.navigationBar.tintColor = ICON_TINT_COLOR;
}
if (isViewDidLoad) {

// We load data only in viewDidAppear as loading/presenting is tightly coupled and we want
// the layout to be ready. We do not want to repeat loading/presenting, if we re-enter the
// same controller instance from another view, e.g. when coming back from detail view.
if (loadAndPresentDataOnViewDidAppear) {
[self initIpadCornerInfo];
if (globalSearchView) {
[self retrieveGlobalData:NO];
}
else {
[self startRetrieveDataWithRefresh:NO];
}
isViewDidLoad = NO;
[self startRetrieveDataWithRefresh:NO];
loadAndPresentDataOnViewDidAppear = NO;
}

if (channelListView || channelGuideView) {
[channelListUpdateTimer invalidate];
// Set up a timer that will always trigger at the start of each local minute. This supports
Expand Down Expand Up @@ -5949,7 +5949,7 @@ - (void)viewDidLoad {
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
hiddenLabel = [userDefaults boolForKey:@"hidden_label_preference"];
noItemsLabel.text = LOCALIZED_STR(@"No items found.");
isViewDidLoad = YES;
loadAndPresentDataOnViewDidAppear = YES;
sectionHeight = LIST_SECTION_HEADER_HEIGHT;
epglockqueue = dispatch_queue_create("com.epg.arrayupdate", DISPATCH_QUEUE_SERIAL);
epgDict = [NSMutableDictionary new];
Expand Down

0 comments on commit a81f1be

Please sign in to comment.