Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a crash when the user taps play multiple times and the download fails #7799

Merged
merged 1 commit into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ The attachments array (MXAttachment instances).

@property (nonatomic) BOOL customAnimationsEnabled;

@property (nonatomic) BOOL isLoadingVideo;

@end

@implementation MXKAttachmentsViewController
Expand Down Expand Up @@ -969,8 +971,10 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
navigationBarDisplayTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(hideNavigationBar) userInfo:self repeats:NO];
}
}
else
else if (!self.isLoadingVideo)
{
self.isLoadingVideo = YES;

MXKPieChartView *pieChartView = [[MXKPieChartView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];
pieChartView.progress = 0;
pieChartView.progressColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:0.25];
Expand Down Expand Up @@ -1020,6 +1024,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
[selectedCell.moviePlayer.player play];

[pieChartView removeFromSuperview];
self.isLoadingVideo = NO;

[self hideNavigationBar];
}
Expand All @@ -1035,6 +1040,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa
MXLogDebug(@"[MXKAttachmentsVC] video download failed");

[pieChartView removeFromSuperview];
self.isLoadingVideo = NO;

// Display the navigation bar so that the user can leave this screen
self.navigationBarContainer.hidden = NO;
Expand Down
1 change: 1 addition & 0 deletions changelog.d/7791.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a crash when the user taps play multiple times and the video download fails.
Loading