[](https://travis-ci.org/Karen Lusinyan/CommonUtils)
To run the example project, clone the repo, and run pod install from the Example directory first.
AppDelegate.m
#import "CommonNotificationManager.h"
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// in-app notification's basic configuration
[CommonNotificationManager sharedInstance].checkNotificationsTimeInterval = 1.0;
[CommonNotificationManager sharedInstance].imageIcon = [UIImage imageNamed:@"apple"];
[CommonNotificationManager sharedInstance].notificationHeight = 120.0;
... do your other staff
}
// alertBody: notification title
// alertMessage: notification message
// alertAction: noticiation action that will be executed when notificaiton did tap
// fireDate: notification valid date, if [NSDate date] > fireDate the notification will be removed, nil means it will be allive until presented
// priority: if it's High, then the notification will be presented immediately
[[CommonNotificationManager sharedInstance] addNotificationWithAlertBody:@"Message"
alertMessage:@"Lorem ipsum..."
alertAction:@"actionName"
fireDate:nil
priority:CommonNotificationPriorityDefault];
[[NSNotificationCenter defaultCenter] addObserverForName:CommonNotificationDidTap
object:nil
queue:[NSOperationQueue currentQueue]
usingBlock:^(NSNotification * _Nonnull note) {
if ([[note object] isMemberOfClass:[CommonNotification class]]) {
CommonNotification *notification = (CommonNotification *)[note object];
// do something with notification
}
}];
CommonUtils is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "CommonUtils"Karen Lusinyan, karen.lusinyan.developerios@gmail.com
CommonUtils is available under the MIT license. See the LICENSE file for more info.
RELEASE-INFO: pod trunk push CommonUtils.podspec