You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.7KB

  1. @interface NCNotificationShortLookViewController
  2. -(id)_presentedLongLookViewController;
  3. -(void)addGestureRecognizer:(id)arg1;
  4. @property (assign, nonatomic) UIView *view;
  5. @end
  6. @interface NCNotificationListCell
  7. -(void)_executeDefaultActionIfCompleted;
  8. -(void)setExecutingDefaultAction:(BOOL)arg1;
  9. -(void)setSupportsSwipeToDefaultAction:(BOOL)arg1 ;
  10. -(BOOL)isActionButtonsFullyRevealed;
  11. -(NCNotificationShortLookViewController *)contentViewController;
  12. @end
  13. @interface SBLockScreenManager
  14. +(SBLockScreenManager *)sharedInstance;
  15. -(BOOL)isUILocked;
  16. @end
  17. %hook NCNotificationListCell
  18. CGFloat myThreshold = 0;
  19. -(CGFloat)_defaultActionExecuteThreshold{return myThreshold;}
  20. -(CGFloat)_defaultActionTriggerThreshold{return myThreshold;}
  21. -(CGFloat)_defaultActionOvershootContentOffset{return 0;}
  22. -(void)layoutSubviews{
  23. %orig;
  24. bool isLocked = [[%c(SBLockScreenManager) sharedInstance] isUILocked];
  25. if(isLocked == true){
  26. if(MSHookIvar<NSMutableArray *>([self contentViewController].view, "_gestureRecognizers") == nil)
  27. {
  28. UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dood:)];
  29. [[self contentViewController].view addGestureRecognizer:singleFingerTap];
  30. [self setSupportsSwipeToDefaultAction:false];
  31. }
  32. }
  33. }
  34. %new
  35. -(void)dood:(UITapGestureRecognizer *)recognizer{
  36. bool isLocked = [[%c(SBLockScreenManager) sharedInstance] isUILocked];
  37. if((isLocked == true) && ([self isActionButtonsFullyRevealed] == false) && ([[self contentViewController] _presentedLongLookViewController] == nil))
  38. {
  39. myThreshold = -1;
  40. [self setSupportsSwipeToDefaultAction:true];
  41. [self _executeDefaultActionIfCompleted];
  42. [self setSupportsSwipeToDefaultAction:false];
  43. myThreshold = 0;
  44. }
  45. }
  46. %end