Skip to content

Commit

Permalink
Maintain compatibility with iOS 7 as per this release 2.1.2 and seman…
Browse files Browse the repository at this point in the history
…tic versioning.

Minimum required version is iOS 7 so remove innecessary animation code.
Set up example project deployment target to iOS 7.
Revert podspec to use iOS 7, marks this committ as release 2.1.2.
  • Loading branch information
Adonis Peralta committed Jan 24, 2017
1 parent 19e5198 commit 11210b2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 42 deletions.
6 changes: 2 additions & 4 deletions Example/RMessage.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -332,7 +332,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand All @@ -347,7 +347,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
INFOPLIST_FILE = RMessage/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.testdomain.RMessage;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -361,7 +360,6 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
INFOPLIST_FILE = RMessage/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.testdomain.RMessage;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
4 changes: 2 additions & 2 deletions RMessage.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Pod::Spec.new do |s|
s.name = "RMessage"
s.version = "2.1.1"
s.version = "2.1.2"
s.summary = "Easy to use and customizable messages/notifications for iOS"
s.description = <<-DESC
This framework provides an easy to use class to show little notification views on the top of the screen.
Expand All @@ -23,7 +23,7 @@ There are 4 different types already set up for you: Success, Error, Warning, Mes
s.source = { :git => "https://github.com/donileo/RMessage.git", :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/donileo'

s.platform = :ios, '9.0'
s.platform = :ios, '7.0'
s.requires_arc = true

s.source_files = 'RMessage/**/*.{h,m}'
Expand Down
59 changes: 23 additions & 36 deletions RMessage/RMessageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ + (BOOL)isNavigationBarHiddenForNavigationController:(UINavigationController *)n
}
}

+ (BOOL)runtimeIsIos7OrHigher
+ (BOOL)compilingForHigherThanIosVersion:(CGFloat)version
{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= version * 10000
return YES;
#else
return NO;
Expand Down Expand Up @@ -386,8 +386,12 @@ - (void)setupLayout
attribute:NSLayoutAttributeCenterX
multiplier:1.f
constant:0.f];
centerXConstraint.active = YES;
self.topToVCLayoutConstraint.active = YES;
if ([RMessageView compilingForHigherThanIosVersion:8.f]) {
centerXConstraint.active = YES;
self.topToVCLayoutConstraint.active = YES;
} else {
[self.viewController.view addConstraints:@[centerXConstraint, self.topToVCLayoutConstraint]];
}
}

- (void)executeMessageViewCallBack
Expand Down Expand Up @@ -669,39 +673,22 @@ - (void)animateMessage
{
[self.superview layoutIfNeeded];
self.alpha = 0.f;
if ([RMessageView runtimeIsIos7OrHigher]) {
[UIView animateWithDuration:kRMessageAnimationDuration + 0.2f
delay:0.f
usingSpringWithDamping:0.7
initialSpringVelocity:0.f
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction
animations:^{
self.alpha = self.messageOpacity;
self.topToVCLayoutConstraint.constant = self.topToVCFinalConstant;
[self.superview layoutIfNeeded];
[UIView animateWithDuration:kRMessageAnimationDuration + 0.2f
delay:0.f
usingSpringWithDamping:0.7
initialSpringVelocity:0.f
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction
animations:^{
self.alpha = self.messageOpacity;
self.topToVCLayoutConstraint.constant = self.topToVCFinalConstant;
[self.superview layoutIfNeeded];
}
completion:^(BOOL finished) {
self.messageIsFullyDisplayed = YES;
if ([self.delegate respondsToSelector:@selector(messageViewDidPresent:)]) {
[self.delegate messageViewDidPresent:self];
}
completion:^(BOOL finished) {
self.messageIsFullyDisplayed = YES;
if ([self.delegate respondsToSelector:@selector(messageViewDidPresent:)]) {
[self.delegate messageViewDidPresent:self];
}
}];

} else {
[UIView animateWithDuration:kRMessageAnimationDuration + 0.2f
delay:0.f
options:UIViewAnimationOptionCurveEaseInOut | UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction
animations:^{
self.alpha = self.messageOpacity;
self.topToVCLayoutConstraint.constant = self.topToVCFinalConstant;
[self.superview layoutIfNeeded];
} completion:^(BOOL finished) {
self.messageIsFullyDisplayed = YES;
if ([self.delegate respondsToSelector:@selector(messageViewDidPresent:)]) {
[self.delegate messageViewDidPresent:self];
}
}];
}
}];
}

- (void)dismiss
Expand Down

0 comments on commit 11210b2

Please sign in to comment.