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.

63 line
1.8KB

  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. bool changeThreshold = false;
  19. -(CGFloat)_defaultActionExecuteThreshold{
  20. if(changeThreshold == false){
  21. return %orig;
  22. }else{
  23. return -1;
  24. }
  25. }
  26. -(CGFloat)_defaultActionTriggerThreshold{
  27. if(changeThreshold){
  28. return %orig;
  29. }else{
  30. return -1;
  31. }
  32. }
  33. -(CGFloat)_defaultActionOvershootContentOffset{return 0;}
  34. -(void)layoutSubviews{
  35. %orig;
  36. bool isLocked = [[%c(SBLockScreenManager) sharedInstance] isUILocked];
  37. if(isLocked == true){
  38. if(MSHookIvar<NSMutableArray *>([self contentViewController].view, "_gestureRecognizers") == nil)
  39. {
  40. UITapGestureRecognizer *singleFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dood:)];
  41. [[self contentViewController].view addGestureRecognizer:singleFingerTap];
  42. [self setSupportsSwipeToDefaultAction:false];
  43. }
  44. }
  45. }
  46. %new
  47. -(void)dood:(UITapGestureRecognizer *)recognizer{
  48. bool isLocked = [[%c(SBLockScreenManager) sharedInstance] isUILocked];
  49. if((isLocked == true) && ([self isActionButtonsFullyRevealed] == false) && ([[self contentViewController] _presentedLongLookViewController] == nil))
  50. {
  51. changeThreshold = true;
  52. [self setSupportsSwipeToDefaultAction:true];
  53. [self _executeDefaultActionIfCompleted];
  54. [self setSupportsSwipeToDefaultAction:false];
  55. changeThreshold = false;
  56. }
  57. }
  58. %end