2
0

Honour animated property better.

Also: don't need to force a layout if not in an animation block.
This commit is contained in:
Maarten Billemont 2020-04-12 19:13:34 -04:00
parent f80ffd078b
commit b428ee0003

View File

@ -512,16 +512,24 @@
- (void)updateAnimated:(BOOL)animated {
Weakify( self );
if (![NSThread isMainThread]) {
PearlMainQueueOperation( ^{
Strongify( self );
[self updateAnimated:animated];
} );
return;
}
[UIView animateWithDuration:animated? .3f: 0 animations:^{
if (animated)
[UIView animateWithDuration:.3f animations:^{
[self updateWasAnimated:animated];
}];
else
[self updateWasAnimated:animated];
}
- (void)updateWasAnimated:(BOOL)animated {
Weakify( self );
MPSiteEntity *mainSite = [self siteInContext:[MPiOSAppDelegate managedObjectContextForMainThreadIfReady]];
// UI
@ -572,7 +580,7 @@
wrn( @"Could not load cell content: key unavailable." );
PearlMainQueueOperation( ^{
Strongify( self );
[self updateAnimated:YES];
[self updateAnimated:animated];
} );
return;
}
@ -632,12 +640,12 @@
wrn( @"Could not load cell content: store unavailable." );
PearlMainQueueOperation( ^{
Strongify( self );
[self updateAnimated:YES];
[self updateAnimated:animated];
} );
}
if (animated)
[self.contentView layoutIfNeeded];
}];
}
- (void)updateSiteName:(MPSiteEntity *)site {