Skip to content

Commit

Permalink
Merge pull request #14 from tiagomartinho/master
Browse files Browse the repository at this point in the history
shows correct app name + adds API to set time text in banner
  • Loading branch information
pikacode authored Nov 15, 2016
2 parents 8046202 + bbae74e commit 676de8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion EBForeNotification/Classes/EBBannerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ -(void)setUserInfo:(NSDictionary *)userInfo{
appIcon = [UIImage imageNamed:@"AppIcon80x80"];
}
[self.icon_image setImage:appIcon];
NSDictionary *infoDictionary = [[NSBundle bundleForClass:[self class]] infoDictionary];
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
// app名称
NSString *appName = [infoDictionary objectForKey:@"CFBundleName"];
if (!appName) {
Expand Down
5 changes: 5 additions & 0 deletions EBForeNotification/Classes/EBForeNotification.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#import "EBMuteDetector.h"

NSString *const EBBannerViewDidClick = @"EBBannerViewDidClick";
NSString *EBBannerViewTimeText = @"现在"; //默认弹窗时间 default banner time

@implementation EBForeNotification

Expand Down Expand Up @@ -45,6 +46,10 @@ +(void)handleRemoteNotification:(NSDictionary*)userInfo soundID:(int)soundID isI
}
}

+(void)setBannerViewTimeText:(NSString*)timeText {
EBBannerViewTimeText = timeText;
}

#pragma mark - private

+(void)showBannerWithUserInfo:(NSDictionary*)userInfo soundID:(int)soundID isIos10:(BOOL)isIos10{
Expand Down
7 changes: 3 additions & 4 deletions EBForeNotification/EBForeNotification.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@
#import <Foundation/Foundation.h>

extern NSString *const EBBannerViewDidClick; //监听点击弹窗的事件
extern NSString *EBBannerViewTimeText; //默认弹窗时间 default banner time

@interface EBForeNotification : NSObject
+(void)handleRemoteNotification:(NSDictionary*)userInfo soundID:(int)soundID;
+(void)handleRemoteNotification:(NSDictionary*)userInfo customSound:(NSString*)soundName;
+(void)handleRemoteNotification:(NSDictionary*)userInfo soundID:(int)soundID isIos10:(BOOL)isIos10;
+(void)handleRemoteNotification:(NSDictionary*)userInfo customSound:(NSString*)soundName isIos10:(BOOL)isIos10;
+(void)setBannerViewTimeText:(NSString*)timeText;
@end

static NSString *const EBBannerViewTimeText = @"现在"; //默认弹窗时间 default banner time


/*
⭐1.在 AppDelegate.m 中,调用示例如下:
Expand Down Expand Up @@ -189,4 +188,4 @@ static NSString *const EBBannerViewTimeText = @"现在"; //默认弹窗时间
4095 - - Vibrate There was no category for this sound before 2.2.
In the SDK this is the constant kSystemSoundID_Vibrate.
*/
*/

0 comments on commit 676de8e

Please sign in to comment.