Skip to content

Commit 683be0c

Browse files
committed
Merge branch 'dev'
2 parents 51fa0b1 + a5d616e commit 683be0c

25 files changed

+75
-222
lines changed

EBForeNotification.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
#
1717

1818
s.name = "EBForeNotification"
19-
s.version = "1.0.2"
19+
s.version = "1.0.4"
2020
s.summary = "iOS 前台推送及事件处理。iOS Foreground Push Notification and event-handle."
2121

2222
# This description is used to generate tags and improve search results.
@@ -93,7 +93,7 @@ Pod::Spec.new do |s|
9393
#
9494

9595
#s.source_files = "Classes", "Classes/**/*.{h,m}"
96-
s.source_files = "EBForeNotification", "EBForeNotification/*.{h,m}"
96+
s.source_files = "EBForeNotification", "EBForeNotification/*.{h,m}","EBForeNotification/Classes", "EBForeNotification/Classes/*.{h,m}"
9797

9898
#s.exclude_files = "Classes/Exclude"
9999

@@ -109,7 +109,7 @@ Pod::Spec.new do |s|
109109
#
110110

111111
# s.resource = "icon.png"
112-
s.resources = "EBForeNotification/*.xib"
112+
s.resources = "EBForeNotification/*.xib", "EBForeNotification/Classes/*.xib"
113113

114114
# s.preserve_paths = "FilesToSave", "MoreFilesToSave"
115115

EBForeNotification/EBBannerView.h renamed to EBForeNotification/Classes/EBBannerView.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define BannerStayTime 4.7
1212
#define BannerAnimationTime 0.3
1313

14-
@interface EBBannerView : UIView
14+
@interface EBBannerView : UIWindow
1515
@property (nonatomic, retain)NSDictionary *userInfo;
1616
-(void)removeWithAnimation;
1717
@end

EBForeNotification/EBBannerView.m renamed to EBForeNotification/Classes/EBBannerView.m

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88

99
#import "EBBannerView.h"
1010
#import "EBForeNotification.h"
11-
#import "UIViewController+EBForeNotification.h"
1211
#import "UIImage+ColorAtPoint.h"
1312

1413
@interface EBBannerView()
15-
1614
@property (weak, nonatomic) IBOutlet UIImageView *icon_image;
1715
@property (weak, nonatomic) IBOutlet UILabel *title_label;
1816
@property (weak, nonatomic) IBOutlet UILabel *content_label;
@@ -25,11 +23,15 @@ @implementation EBBannerView
2523
#define BannerHeight 70
2624
#define BannerWidth [UIScreen mainScreen].bounds.size.width
2725

26+
UIWindow *originWindow;
27+
2828
-(void)awakeFromNib{
2929
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarOrientationChange:) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
30-
self.userInfo = [NSDictionary dictionary];
3130
[self apperWithAnimation];
3231
[self addGestureRecognizer];
32+
self.windowLevel = UIWindowLevelAlert;
33+
originWindow = [UIApplication sharedApplication].keyWindow;
34+
[self makeKeyAndVisible];
3335
[super awakeFromNib];
3436
}
3537

@@ -54,10 +56,12 @@ -(void)setUserInfo:(NSDictionary *)userInfo{
5456
self.title_label.text = appName;
5557
self.content_label.text = self.userInfo[@"aps"][@"alert"];
5658
self.time_label.text = EBBannerViewTimeText;
59+
[originWindow makeKeyAndVisible];
5760
self.time_label.textColor = [UIImage colorAtPoint:self.time_label.center];
5861
self.time_label.alpha = 0.7;
59-
self.line_view.backgroundColor = [UIImage colorAtPoint:self.line_view.center];
60-
self.line_view.alpha = 0.7;
62+
CGPoint lineCenter = self.line_view.center;
63+
self.line_view.backgroundColor = [UIImage colorAtPoint:CGPointMake(lineCenter.x, lineCenter.y - 7)];
64+
self.line_view.alpha = 0.5;
6165
}
6266

6367
-(void)statusBarOrientationChange:(NSNotification *)notification{
@@ -83,13 +87,6 @@ -(void)swipeGesture:(UISwipeGestureRecognizer*)gesture{
8387
}
8488

8589
-(void)apperWithAnimation{
86-
if ([[EBBannerView appRootViewController] isKindOfClass:[UINavigationController class]]) {
87-
UINavigationController *controller = (UINavigationController*)[EBBannerView appRootViewController];
88-
controller.EBForegroundNotificationStatusBarHidden = YES;
89-
controller.childViewControllerForStatusBarHidden.EBForegroundNotificationStatusBarHidden = YES;
90-
}else{
91-
[EBBannerView appRootViewController].EBForegroundNotificationStatusBarHidden = YES;
92-
}
9390
self.frame = CGRectMake(0, 0, BannerWidth, 0);
9491
[UIView animateWithDuration:BannerAnimationTime animations:^{
9592
self.frame = CGRectMake(0, 0, BannerWidth, BannerHeight);
@@ -111,13 +108,6 @@ -(void)removeWithAnimation{
111108
} completion:^(BOOL finished) {
112109
self.frame = CGRectMake(0, 0, BannerWidth, 0);
113110
[self removeFromSuperview];
114-
if ([[EBBannerView appRootViewController] isKindOfClass:[UINavigationController class]]) {
115-
UINavigationController *controller = (UINavigationController*)[EBBannerView appRootViewController];
116-
controller.childViewControllerForStatusBarHidden.EBForegroundNotificationStatusBarHidden = NO;
117-
controller.EBForegroundNotificationStatusBarHidden = NO;
118-
}else{
119-
[EBBannerView appRootViewController].EBForegroundNotificationStatusBarHidden = YES;
120-
}
121111
SharedBannerView = nil;
122112
}];
123113
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<outlet property="time_label" destination="Zvg-9L-jbZ" id="Zqp-sX-vo1"/>
100100
<outlet property="title_label" destination="SfK-LV-meM" id="tuy-Is-x7O"/>
101101
</connections>
102-
<point key="canvasLocation" x="423" y="298.5"/>
102+
<point key="canvasLocation" x="306" y="219.5"/>
103103
</view>
104104
</objects>
105105
</document>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
#import <AudioToolbox/AudioToolbox.h>
1111
#import <UIKit/UIKit.h>
1212
#import "EBBannerView.h"
13-
#import "UIViewController+EBForeNotification.h"
13+
#import "UIImage+ColorAtPoint.h"
14+
1415

1516
NSString *const EBBannerViewDidClick = @"EBBannerViewDidClick";
1617

EBForeNotification/UIImage+ColorAtPoint.m renamed to EBForeNotification/Classes/UIImage+ColorAtPoint.m

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,10 @@ +(UIColor *)colorAtPoint:(CGPoint)point{
1818

1919
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
2020

21-
2221
if (!CGRectContainsPoint(CGRectMake(0.0f, 0.0f, viewImage.size.width, viewImage.size.height), point)) {
23-
2422
return nil;
25-
2623
}
2724

28-
2925
NSInteger pointX = trunc(point.x);
3026

3127
NSInteger pointY = trunc(point.y);
@@ -46,19 +42,7 @@ +(UIColor *)colorAtPoint:(CGPoint)point{
4642

4743
unsigned char pixelData[4] = { 0, 0, 0, 0 };
4844

49-
CGContextRef context = CGBitmapContextCreate(pixelData,
50-
51-
1,
52-
53-
1,
54-
55-
bitsPerComponent,
56-
57-
bytesPerRow,
58-
59-
colorSpace,
60-
61-
kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
45+
CGContextRef context = CGBitmapContextCreate(pixelData, 1, 1, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
6246

6347
CGColorSpaceRelease(colorSpace);
6448

@@ -86,5 +70,4 @@ +(UIColor *)colorAtPoint:(CGPoint)point{
8670
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
8771
}
8872

89-
9073
@end

EBForeNotification/UIViewController+EBForeNotification.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

EBForeNotification/UIViewController+EBForeNotification.m

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)