Merge branch 'bugfix/top_alert_collapse_crash' into 'develop'

prevent retain cycle on auto dismiss block.

See merge request BPHV_MIPS/mvm_core_ui!569
This commit is contained in:
Pfeil, Scott Robert 2020-08-21 13:22:41 -04:00
commit 08bcd545a2

View File

@ -347,12 +347,13 @@
}
dispatch_time_t dispatchTime = dispatch_time(DISPATCH_TIME_NOW, dismissTime * NSEC_PER_SEC);
dispatch_after(dispatchTime, dispatch_get_main_queue(), ^(void){
if (weakSelf && weakSelf.expanded && weakSelf.collapseAutomaticallyAfterExpanded) {
typeof(self) strongSelf = weakSelf;
if (strongSelf && strongSelf.expanded && strongSelf.collapseAutomaticallyAfterExpanded) {
// If accessibility focused, delay collapse.
if ([MVMCoreUIUtility viewContainsAccessiblityFocus:self]) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(accessibilityFocusChanged:) name:UIAccessibilityElementFocusedNotification object:nil];
if ([MVMCoreUIUtility viewContainsAccessiblityFocus:strongSelf]) {
[[NSNotificationCenter defaultCenter] addObserver:strongSelf selector:@selector(accessibilityFocusChanged:) name:UIAccessibilityElementFocusedNotification object:nil];
} else {
[weakSelf collapse];
[strongSelf collapse];
}
}
});