Skip to content

Commit

Permalink
Merge pull request #16 from spoonconsulting/change-statusBarOrientati…
Browse files Browse the repository at this point in the history
…on-to-interfaceOrientation

use interfaceOrientation for ios 13+
  • Loading branch information
parveshneedhoo authored Jul 13, 2023
2 parents 269f7d6 + 57deac5 commit 86f002b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v2
- uses: bahmutov/npm-install@v1
- id: publish
uses: JS-DevTools/npm-publish@v1
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.npm_token }}

4 changes: 4 additions & 0 deletions CHANGELOD.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [2.0.4](https://github.com/spoonconsulting/cordova-plugin-telerik-imagepicker/compare/2.0.3...2.0.4) (2023-07-12)

* **ios:** Use interfaceOrientation for ios 13+.

## [2.0.3](https://github.com/spoonconsulting/cordova-plugin-telerik-imagepicker/compare/2.0.2...2.0.3) (2023-02-27)

* **android:** Add READ_MEDIA_IMAGES permission for Android 13(Required in API 33).
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spoonconsulting/cordova-plugin-telerik-imagepicker",
"version": "2.0.3",
"version": "2.0.4",
"cordova_name": "ImagePicker",
"description": "This plugin allows selection of multiple images from the camera roll / gallery in a phonegap app",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<plugin xmlns="http://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="@spoonconsulting/cordova-plugin-telerik-imagepicker"
version="2.0.3">
version="2.0.4">

<name>ImagePicker</name>

Expand Down
13 changes: 11 additions & 2 deletions src/ios/GMImagePicker/GMGridViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ -(id)initWithPicker:(GMImagePickerController *)picker
}
else
{
if(UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation))
if(UIInterfaceOrientationIsLandscape([self getOrientation]))
{
screenHeight = CGRectGetWidth(picker.view.bounds);
screenWidth = CGRectGetHeight(picker.view.bounds);
Expand All @@ -108,7 +108,7 @@ -(id)initWithPicker:(GMImagePickerController *)picker
}


UICollectionViewFlowLayout *layout = [self collectionViewFlowLayoutForOrientation:[UIApplication sharedApplication].statusBarOrientation];
UICollectionViewFlowLayout *layout = [self collectionViewFlowLayoutForOrientation:[self getOrientation]];
if (self = [super initWithCollectionViewLayout:layout])
{
//Compute the thumbnail pixel size:
Expand Down Expand Up @@ -794,5 +794,14 @@ - (NSArray *)assetsAtIndexPaths:(NSArray *)indexPaths
return assets;
}

- (UIInterfaceOrientation) getOrientation {
if (@available(iOS 13.0, *)) {
UIWindowScene *activeWindow = (UIWindowScene *)[[[UIApplication sharedApplication] windows] firstObject];
return [activeWindow interfaceOrientation] ?: UIInterfaceOrientationPortrait;
} else {
return [[UIApplication sharedApplication] statusBarOrientation];
}
}


@end

0 comments on commit 86f002b

Please sign in to comment.