Skip to content

Commit 8406903

Browse files
Narush Dzianisdenisnarush
authored andcommitted
fixes iOS 12.+ crushes, Add libs to x86_64
1 parent fc5dcc3 commit 8406903

File tree

4 files changed

+35
-9
lines changed

4 files changed

+35
-9
lines changed

android/libs/x86_64/libiconv.so

910 KB
Binary file not shown.

android/libs/x86_64/libzbarjni.so

170 KB
Binary file not shown.

ios/CsZBar.m

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface
3535

3636
#pragma mark - Plugin API
3737

38+
+ (UIView*) searchToolbarFrom:(UIView*) topView {
39+
UIView* result = nil;
40+
for (UIView* testView in topView.subviews) {
41+
if([testView isKindOfClass:[UIToolbar class]]){
42+
result = testView;
43+
break;
44+
} else {
45+
if ([testView.subviews count] > 0){
46+
result = [self searchToolbarFrom:testView];
47+
if (result != nil){
48+
break;
49+
}
50+
}
51+
}
52+
}
53+
return result;
54+
};
55+
3856
- (void)scan: (CDVInvokedUrlCommand*)command;
3957
{
4058
if (self.scanInProgress) {
@@ -49,7 +67,7 @@ - (void)scan: (CDVInvokedUrlCommand*)command;
4967
self.scanReader = [AlmaZBarReaderViewController new];
5068

5169
self.scanReader.readerDelegate = self;
52-
self.scanReader.supportedOrientationsMask = ZBarOrientationMask(UIInterfaceOrientationPortrait);
70+
self.scanReader.supportedOrientationsMask = ZBarOrientationMask(UIInterfaceOrientationPortrait || UIDeviceOrientationLandscapeRight || UIDeviceOrientationLandscapeLeft);
5371

5472
// Get user parameters
5573
NSDictionary *params = (NSDictionary*) [command argumentAtIndex:0];
@@ -72,16 +90,22 @@ - (void)scan: (CDVInvokedUrlCommand*)command;
7290
}
7391

7492
// Hack to hide the bottom bar's Info button... originally based on http://stackoverflow.com/a/16353530
75-
NSInteger infoButtonIndex;
76-
if ([[[UIDevice currentDevice] systemVersion] compare:@"10.0" options:NSNumericSearch] != NSOrderedAscending) {
77-
infoButtonIndex = 1;
78-
} else {
79-
infoButtonIndex = 3;
93+
94+
UIView* testView = self.scanReader.view;
95+
UIView* toolBar = [[self class] searchToolbarFrom:testView];
96+
97+
for (UIBarButtonItem* item in ((UIToolbar*)toolBar).items) {
98+
if (item.customView != nil){
99+
if([item.customView isKindOfClass:[UIButton class]]){
100+
UIButton* but = (UIButton*)item.customView;
101+
if (but.buttonType == UIButtonTypeInfoLight
102+
|| but.buttonType == UIButtonTypeInfoDark){
103+
but.hidden = YES;
104+
}
105+
}
106+
}
80107
}
81-
UIView *infoButton = [[[[[self.scanReader.view.subviews objectAtIndex:2] subviews] objectAtIndex:0] subviews] objectAtIndex:infoButtonIndex];
82-
[infoButton setHidden:YES];
83108

84-
//UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; [button setTitle:@"Press Me" forState:UIControlStateNormal]; [button sizeToFit]; [self.view addSubview:button];
85109
CGRect screenRect = [[UIScreen mainScreen] bounds];
86110
CGFloat screenWidth = screenRect.size.width;
87111
CGFloat screenHeight = screenRect.size.height;

plugin.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@
5757
<source-file src="android/libs/arm64-v8a/libzbarjni.so" target-dir="libs/arm64-v8a" />s
5858
<source-file src="android/libs/x86/libiconv.so" target-dir="libs/x86" />
5959
<source-file src="android/libs/x86/libzbarjni.so" target-dir="libs/x86" />
60+
<source-file src="android/libs/x86_64/libiconv.so" target-dir="libs/x86_64" />
61+
<source-file src="android/libs/x86_64/libzbarjni.so" target-dir="libs/x86_64" />
6062
<source-file src="android/res/drawable/camera_flash.png" target-dir="res/drawable"/>
6163
<source-file src="android/res/drawable/camera_flash.png" target-dir="res/drawable-hdpi"/>
6264
<source-file src="android/res/drawable/camera_flash.png" target-dir="res/drawable-ldpi"/>

0 commit comments

Comments
 (0)