@@ -50,24 +50,20 @@ @interface TIPSPDFViewControllerProxy ()
5050
5151@property (nonatomic ) KrollCallback *didTapOnAnnotationCallback;
5252@property (nonatomic , weak ) TiProxy *parentProxy;
53- @property (atomic , assign ) UIInterfaceOrientation lockedInterfaceOrientationValue;
5453@property (atomic ) UIColor *linkAnnotationBorderBackedColor;
5554@property (atomic ) UIColor *linkAnnotationHighlightBackedColor;
5655
5756@end
5857
5958@implementation TIPSPDFViewControllerProxy
6059
61- @synthesize lockedInterfaceOrientationValue = _lockedInterfaceOrientationValue;
62-
6360// /////////////////////////////////////////////////////////////////////////////////////////////////
6461#pragma mark - Lifecycle
6562
6663- (id )initWithPDFController : (TIPSPDFViewController *)pdfController context : (id <TiEvaluator>)context parentProxy : (TiProxy *)parentProxy {
6764 if ((self = [super _initWithPageContext: context])) {
6865 PSTiLog (@" init TIPSPDFViewControllerProxy" );
6966 self.parentProxy = parentProxy;
70- self.lockedInterfaceOrientationValue = -1 ;
7167 self.controller = pdfController;
7268 self.controller .delegate = self;
7369 // As long as pdfController exists, we're not getting released.
@@ -137,7 +133,7 @@ - (void)setLinkAnnotationHighlightColor:(id)arg {
137133- (void )setEditableAnnotationTypes : (id )arg {
138134 ENSURE_UI_THREAD (setEditableAnnotationTypes, arg);
139135
140- NSMutableOrderedSet *editableAnnotationTypes = [NSMutableOrderedSet orderedSet ];
136+ NSMutableSet *editableAnnotationTypes = [NSMutableSet set ];
141137 if ([arg isKindOfClass: NSArray .class]) {
142138 for (__strong NSString *item in arg) {
143139 item = PSSafeCast (item, NSString .class );
@@ -146,8 +142,10 @@ - (void)setEditableAnnotationTypes:(id)arg {
146142 }
147143 }
148144 }
149- self.controller .document .editableAnnotationTypes = editableAnnotationTypes;
150- [self .controller reloadData ];
145+
146+ [self .controller updateConfigurationWithBuilder: ^(PSPDFConfigurationBuilder *builder) {
147+ builder.editableAnnotationTypes = editableAnnotationTypes;
148+ }];
151149}
152150
153151- (void )setThumbnailFilterOptions : (id )arg {
@@ -276,14 +274,6 @@ - (void)setDidTapOnAnnotationCallback:(KrollCallback *)callback {
276274 }
277275}
278276
279- - (id )currentInterfaceOrientation {
280- __block UIInterfaceOrientation interfaceOrientation;
281- dispatch_sync (dispatch_get_main_queue (), ^{
282- interfaceOrientation = self.controller .interfaceOrientation ;
283- });
284- return @(interfaceOrientation);
285- }
286-
287277- (void )saveAnnotations : (id )args {
288278 ENSURE_UI_THREAD (saveAnnotations, args);
289279
@@ -333,14 +323,20 @@ - (void)setOpenInOptions:(id)arg {
333323- (void )hidePopover : (id )args {
334324 ENSURE_UI_THREAD (hidePopover, args);
335325
336- BOOL animated = [args count ] == 1 && [args[0 ] boolValue ];
326+ BOOL const animated = [args count ] == 1 && [args[0 ] boolValue ];
337327 [self .controller.presentedViewController dismissViewControllerAnimated: animated completion: NULL ];
338328}
339329
330+ #define PSPDF_SILENCE_CALL_TO_UNKNOWN_SELECTOR (expression ) \
331+ _Pragma (" clang diagnostic push" ) \
332+ _Pragma (" clang diagnostic ignored \" -Warc-performSelector-leaks\" " ) \
333+ expression \
334+ _Pragma (" clang diagnostic pop" )
335+
340336- (void )showBarButton : (SEL )barButtonSEL action : (id )action {
341337 dispatch_async (dispatch_get_main_queue (), ^{
342- UIBarButtonItem *barButtonItem = [self .controller performSelector: barButtonSEL];
343- id sender = action ? [action[0 ] view ] : self;
338+ PSPDF_SILENCE_CALL_TO_UNKNOWN_SELECTOR ( UIBarButtonItem *barButtonItem = [self .controller performSelector: barButtonSEL];)
339+ id const sender = action ? [action[0 ] view ] : self;
344340 tipspdf_targetActionBlock (barButtonItem.target , barButtonItem.action )(sender);
345341 });
346342}
0 commit comments