File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 107107- (void )inputView:(id )arg1 didTapLikeButton:(id )arg2 {
108108 CONFIRMPOSTLIKE (%orig );
109109}
110+
111+ // For some stupid reason they removed the "liketapped" methods on newer Instagram versions
112+ // Now we have to do a shitty workaround instead :(
113+ // Works 99% of the time, but sometimes clicks get through directly to the like button (somehow)
114+ - (void )layoutSubviews {
115+ %orig ;
116+
117+ if (![SCIUtils getBoolPref: @" like_confirm" ]) return ;
118+
119+ UIButton *likeButton = [self valueForKey: @" likeButton" ];
120+ if (!likeButton) return ;
121+
122+ // 129115 = L(12) I(9) K(11) E(5)
123+ static NSInteger kOverlayTag = 129115 ;
124+ if ([likeButton viewWithTag: kOverlayTag ]) return ;
125+
126+ UIButton *overlay = [UIButton buttonWithType: UIButtonTypeCustom];
127+ overlay.tag = kOverlayTag ;
128+ overlay.frame = likeButton.bounds ;
129+ overlay.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
130+ [overlay addTarget: self action: @selector (overlayTapped: ) forControlEvents: UIControlEventTouchUpInside];
131+ [likeButton addSubview: overlay];
132+ }
133+
134+ %new - (void )overlayTapped:(UIButton *)overlay {
135+ UIButton *likeButton = (UIButton *)overlay.superview ;
136+
137+ [SCIUtils showConfirmation: ^{
138+ dispatch_async (dispatch_get_main_queue (), ^{
139+ [likeButton sendActionsForControlEvents: UIControlEventTouchUpInside];
140+ });
141+ }];
142+ }
110143%end
111144
112145// DM like button (seems to be hidden)
You can’t perform that action at this time.
0 commit comments