Skip to content

Commit

Permalink
Merge pull request #576 from skywinder/develop
Browse files Browse the repository at this point in the history
Release 2.7.4 for master
  • Loading branch information
Wei18 authored Mar 18, 2024
2 parents 0c6f615 + 6c402f0 commit c2429a6
Show file tree
Hide file tree
Showing 16 changed files with 297 additions and 112 deletions.
14 changes: 13 additions & 1 deletion .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -227,12 +227,24 @@
"review",
"maintenance"
]
},
{
"login": "Wei18",
"name": "Wei",
"avatar_url": "https://avatars.githubusercontent.com/u/11254896?v=4",
"profile": "https://www.linkedin.com/in/wei-cao-67b5b315a",
"contributions": [
"infra",
"review",
"maintenance"
]
}
],
"contributorsPerLine": 7,
"projectName": "ActionSheetPicker-3.0",
"projectOwner": "skywinder",
"repoType": "github",
"repoHost": "https://github.com",
"skipCi": true
"skipCi": true,
"commitType": "docs"
}
21 changes: 10 additions & 11 deletions .github/workflows/ci.yml → .github/workflows/CIBuild.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
name: CI
name: CI Build

on:
push:
branches:
- develop
paths:
- 'ActionSheetPicker-3.0.podspec'
- 'Package.swift'
- 'CoreActionSheetPicker/**'

jobs:

build:
strategy:
fail-fast: false
matrix:
xcode:
# - "12.5.1"
- "13.2.1"
os:
- macos-11
# - macos-latest

include:
- xcode: "13.2.1"
os: macos-11
# - xcode: "15.2"
# os: macOS-14
runs-on: ${{ matrix.os }}
env:
DEVELOPER_DIR: "/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer"
steps:
- uses: actions/checkout@v4

- name: "Build SwiftPackage"
run: |
# Starting with Xcode 11, xcodebuild supports SwiftPM packages out of the box.
Expand All @@ -32,7 +32,6 @@ jobs:
-scheme CoreActionSheetPicker \
-sdk iphonesimulator \
-destination "name=iPhone 11 Pro"
- name: "Build CocoaPods"
run: |
gem install cocoapods
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/UpdateChangelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Update Changelog

on:
schedule:
# Will run at 01:00 on the 1st and 15th of every month
- cron: "30 1 1,15 * *"

concurrency:
group: update-changelog
cancel-in-progress: true

jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
- uses: actions/cache@v4
with:
path: ${{ env.GEM_HOME }}
key: ${{ runner.os }}
- name: "Update CHANGELOG.md"
env:
CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gem install github_changelog_generator
- name: "Commit CHANGELOG.md"
run: |
github_changelog_generator -u skywinder -p ActionSheetPicker-3.0
git add CHANGELOG.md
if [ ! -n "$(git status -s)" ]; then
echo "NOTHING TO COMMIT"
else
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git commit -m "Update CHANGELOG.md"
git push --no-verify
fi
2 changes: 1 addition & 1 deletion ActionSheetPicker-3.0.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'ActionSheetPicker-3.0'
spec.version = '2.7.3'
spec.version = '2.7.4'
spec.summary = 'Easily present an ActionSheet with a PickerView, allowing the user to select from a number of immutable options.'
spec.description = <<-DESC
Better version of ActionSheetPicker with support iOS9 and other improvements:
Expand Down
154 changes: 129 additions & 25 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ that one isn't already logged.
Fork this repository, make it awesomer (preferably in a branch named for the
topic), send a pull request!

Bonus: Add a video/gif/image for your changes.

All code contributions should match our [coding
conventions](https://github.com/NYTimes/objective-c-style-guide).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ @interface AbstractActionSheetPicker () <UIGestureRecognizerDelegate>
@property(nonatomic, assign) SEL successAction;
@property(nonatomic, assign) SEL cancelAction;
@property(nonatomic, strong) UIViewController *popOverViewController;
@property(nonatomic, strong) UITapGestureRecognizer *windowTapAction;
@property(nonatomic, assign) NSInteger windowTapActionRetryCount;
@property(nonatomic, strong) CIFilter *filter;
@property(nonatomic, strong) CIContext *context;
@property(nonatomic, strong) NSObject *selfReference;
Expand Down Expand Up @@ -287,38 +289,51 @@ - (void)showActionSheetPicker {
[self presentPickerForView:masterView];
}

[self addTapDismissAction];
}

- (void)addTapDismissAction {
if (!self.pickerView) {
NSAssert(_pickerView != NULL, @"Picker view failed to instantiate, perhaps you have invalid component data.");
return;
}
if (self.windowTapActionRetryCount > 10) {
NSAssert(NO, @"Failed to find Picker view's window. This may cause a memory leak.");
}
if (!self.pickerView.window) {
self.windowTapActionRetryCount += 1;
dispatch_async(dispatch_get_main_queue(), ^{
[self addTapDismissAction];
});
return;
}

#pragma clang diagnostic push
#pragma ide diagnostic ignored "UnavailableInDeploymentTarget"
{
SEL sel;
switch (self.tapDismissAction) {
case TapActionDismiss: {
case TapActionDismiss:
// add tap dismiss action
self.actionSheet.superview.userInteractionEnabled = YES;
UITapGestureRecognizer *tapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissPicker)];
tapAction.delegate = self;
[self.actionSheet.superview addGestureRecognizer:tapAction];
sel = @selector(dismissPicker);
break;
}
case TapActionSuccess: {
case TapActionSuccess:
// add tap success action with dismissPicker
self.actionSheet.superview.userInteractionEnabled = YES;
UITapGestureRecognizer *tapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionPickerDone:)];
tapAction.delegate = self;
[self.actionSheet.superview addGestureRecognizer:tapAction];
sel = @selector(actionPickerDone:);
break;
}
case TapActionCancel: {
case TapActionCancel:
// add tap cancel action with dismissPicker
self.actionSheet.superview.userInteractionEnabled = YES;
UITapGestureRecognizer *tapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(actionPickerCancel:)];
tapAction.delegate = self;
[self.actionSheet.superview addGestureRecognizer:tapAction];
sel = @selector(actionPickerCancel:);
break;
}
};
if (sel) {
self.actionSheet.window.userInteractionEnabled = YES;
self.windowTapAction = [[UITapGestureRecognizer alloc] initWithTarget:self action:sel];
self.windowTapAction.delegate = self;
[self.actionSheet.window addGestureRecognizer:self.windowTapAction];
}
}
#pragma clang diagnostic pop

}

- (IBAction)actionPickerDone:(id)sender {
Expand All @@ -339,6 +354,7 @@ - (void)dismissPicker {
self.actionSheet = nil;
self.popOverViewController = nil;
self.selfReference = nil;
[self.pickerView.window removeGestureRecognizer:self.windowTapAction];
}

#pragma mark - Custom Buttons
Expand Down Expand Up @@ -797,6 +813,13 @@ - (void)presentPopover:(UIViewController *)viewController {

#pragma mark UIGestureRecognizerDelegate

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
if (IS_IPAD) {
return YES;
}
return NO;
}

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
CGPoint toolbarLocation = [gestureRecognizer locationInView:self.toolbar];
CGPoint actionSheetLocation = [gestureRecognizer locationInView:self.actionSheet];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ @implementation ActionSheetDatePicker
@synthesize datePickerStyle = _datePickerStyle;


-(UIDatePickerStyle)datePickerStyle {
- (UIDatePickerStyle)datePickerStyle {
if (_datePickerStyle != UIDatePickerStyleAutomatic) {
return _datePickerStyle;
} else {
Expand Down Expand Up @@ -168,7 +168,7 @@ - (instancetype)initWithTitle:(NSString *)title
}

- (UIView *)configuredPickerView {
CGRect datePickerFrame = CGRectMake(0, 40, self.viewSize.width, 216);
CGRect datePickerFrame = CGRectMake(0, 44, self.viewSize.width, self.getDatePickerHeight);
UIDatePicker *datePicker = [[UIDatePicker alloc] initWithFrame:datePickerFrame];
datePicker.datePickerMode = self.datePickerMode;
datePicker.maximumDate = self.maximumDate;
Expand Down Expand Up @@ -290,14 +290,13 @@ - (void)customButtonPressed:(id)sender {
}
}

- (CGFloat)getDatePickerHeight
{
- (CGFloat)getDatePickerHeight {
CGFloat height = 216.0;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 // Xcode 12 and iOS 14, or greater
if (@available(iOS 14.0, *)) {
if (_datePickerStyle == UIDatePickerStyleCompact) {
if (self.datePickerStyle == UIDatePickerStyleCompact) {
height = 90.0;
} else if (_datePickerStyle == UIDatePickerStyleInline) {
} else if (self.datePickerStyle == UIDatePickerStyleInline) {
switch (_datePickerMode) {
case UIDatePickerModeDate:
height = 350.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// Copyright (c) 2012 Club 15CC. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <AbstractActionSheetPicker.h>
#import <ActionSheetCustomPickerDelegate.h>
#import "AbstractActionSheetPicker.h"
#import "ActionSheetCustomPickerDelegate.h"

@interface ActionSheetCustomPicker : AbstractActionSheetPicker
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import <UIKit/UIKit.h>
#import <AbstractActionSheetPicker.h>
#import "AbstractActionSheetPicker.h"

@protocol ActionSheetCustomPickerDelegate <UIPickerViewDelegate, UIPickerViewDataSource>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <AbstractActionSheetPicker.h>
#import "AbstractActionSheetPicker.h"

@class ActionSheetDatePicker;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <AbstractActionSheetPicker.h>
#import <DistancePickerView.h>
#import "AbstractActionSheetPicker.h"
#import "DistancePickerView.h"

@interface ActionSheetDistancePicker : AbstractActionSheetPicker <UIPickerViewDelegate, UIPickerViewDataSource>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <AbstractActionSheetPicker.h>
#import "AbstractActionSheetPicker.h"

@class ActionSheetLocalePicker;
typedef void(^ActionLocaleDoneBlock)(ActionSheetLocalePicker *picker, NSTimeZone * selectedValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <AbstractActionSheetPicker.h>
#import "AbstractActionSheetPicker.h"

@class ActionSheetMultipleStringPicker;
typedef void(^ActionMultipleStringDoneBlock)(ActionSheetMultipleStringPicker *picker, NSArray *selectedIndexes, id selectedValues);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//

#import <AbstractActionSheetPicker.h>
#import "AbstractActionSheetPicker.h"

@class ActionSheetStringPicker;
typedef void(^ActionStringDoneBlock)(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue);
Expand Down
Loading

0 comments on commit c2429a6

Please sign in to comment.