Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Fix crash when tap ... in story viewer for Messenger 268.1
Browse files Browse the repository at this point in the history
  • Loading branch information
haoict committed Jun 14, 2020
1 parent 893adc8 commit 85dea99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Tweak.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@end

@interface LSStoryOverlayProfileView : UIView
@property(nonatomic) LSStoryOverlayViewController * delegate;
@property(readonly, copy, nonatomic) NSString *storyAuthorId;
@end

@interface LSTextView : UITextView
Expand Down
9 changes: 4 additions & 5 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -249,20 +249,19 @@ static void PreferencesChangedCallback(CFNotificationCenterRef center, void *obs
return;
}
// check if this story is mine
MBUIStoryViewerAuthorOverlayModel *_authorOverlayModel = MSHookIvar<MBUIStoryViewerAuthorOverlayModel *>(self, "_authorOverlayModel");
if ([_authorOverlayModel.authorId isEqual:[[%c(LSAppDelegate) sharedInstance] getCurrentLoggedInUserId]]) {
if ([self.storyAuthorId isEqualToString:[[%c(LSAppDelegate) sharedInstance] getCurrentLoggedInUserId]]) {
%orig;
return;
}

// otherwise show alert with save and original actions
LSStoryOverlayViewController * overlayVC = (LSStoryOverlayViewController *)[[[self nextResponder] nextResponder] nextResponder];
LSStoryBucketViewController * bucketVC = overlayVC.parentViewController;
LSStoryOverlayViewController *overlayVC = (LSStoryOverlayViewController *)[[[self nextResponder] nextResponder] nextResponder];
LSStoryBucketViewController *bucketVC = overlayVC.parentViewController;
[bucketVC _pauseProgressIndicatorWithReset:FALSE];

UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertAction *saveStoryAction = [UIAlertAction actionWithTitle:@"Save Story" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {
LSMediaViewController * mediaVC = bucketVC.currentThreadVC;
LSMediaViewController *mediaVC = bucketVC.currentThreadVC;
[mediaVC saveMedia];
[bucketVC startTimer];
}];
Expand Down

0 comments on commit 85dea99

Please sign in to comment.