Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Commit

Permalink
follow up for #1247 and #1591. obfuscate private APIs. swizzle via +i…
Browse files Browse the repository at this point in the history
…nitialize
  • Loading branch information
jessesquires committed May 23, 2016
1 parent 5cb6acf commit 9c43534
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions JSQMessagesViewController/Controllers/JSQMessagesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,18 @@ const void (^swizzleOnClass)(Class k) = ^(Class klass) {
removeWorkaround();
});
};
swizzleOnClass(NSClassFromString(@"_UIRotatingAlertController"));
swizzleOnClass(NSClassFromString(@"WKActionSheet"));

// _UIRotatingAlertController
Class alertClass = NSClassFromString([NSString stringWithFormat:@"%@%@%@", @"_U", @"IRotat", @"ingAlertController"]);
if (alertClass) {
swizzleOnClass(alertClass);
}

// WKActionSheet
Class actionSheetClass = NSClassFromString([NSString stringWithFormat:@"%@%@%@", @"W", @"KActio", @"nSheet"]);
if (actionSheetClass) {
swizzleOnClass(actionSheetClass);
}
}


Expand Down Expand Up @@ -148,6 +158,13 @@ + (instancetype)messagesViewController
bundle:[NSBundle bundleForClass:[JSQMessagesViewController class]]];
}

+ (void)initialize {
[super initialize];
if (self == [JSQMessagesViewController self]) {
JSQInstallWorkaroundForSheetPresentationIssue26295020();
}
}

#pragma mark - Initialization

- (void)jsq_configureMessagesViewController
Expand Down Expand Up @@ -194,8 +211,6 @@ - (void)jsq_configureMessagesViewController
panGestureRecognizer:self.collectionView.panGestureRecognizer
delegate:self];
}

JSQInstallWorkaroundForSheetPresentationIssue26295020();
}

- (void)dealloc
Expand Down

0 comments on commit 9c43534

Please sign in to comment.