User:Nicolas17/MobileMail/MessageViewController/previewActionForSwipeAction:withMessage:forSwipe:
From iPhone Development Wiki
< User:Nicolas17 | MobileMail
This method is actually called
-[MessageViewController _previewActionForSwipeAction:withMessage:forSwipe]
, but underscores cannot be used in wiki page names.-(UIPreviewAction*)_previewActionForSwipeAction:(unsigned long long)action withMessage:(id)message forSwipe:(BOOL)swipe;
This method in MessageViewController
creates a UIPreviewAction object (action shown in the 3D Touch "peek" view).
It's called by leadingPreviewAction
and trailingPreviewAction
to get the actions on the sides of the peek, and by _previewActionsForSwipeActions:excludingSwipeActions:
for the actions at the bottom.
Reverse engineering info
I'm starting to decompile this method and will put the pseudocode in this page.
This method contains two jump tables (at least in arm64), presumably compiled from switch statements, which Hopper doesn't handle automatically even in the disassembly, and it will be a bit of a pain to figure them out manually.
Decompiled code
This is what I have so far decompiling this method.
-(UIPreviewAction*)_previewActionForSwipeAction: (unsigned long long)action
withMessage: (id)message
forSwipe: (BOOL)swipe
{
x20 = swipe
x21 = message
x19 = action
x22 = self
x25 = [self presentingViewController];
if (x25 == 0) {
x25 = [[UIApplication] sharedApplication] sceneController];
}
w28 = 0xc2000000 // from "movz w28, #0xc200, lsl #16"; I don't know if that's correct
x8 = x19 - 5 // _shiftedAction = action - 5
if (x8 > 0) goto L1;
// TODO; involves jumptable
L1: // 0x10009bd4c
if (x8 > 1) goto L2;
// TODO
L2: // 0x10009bdd8
}