Skip to content

0724/LNRSimpleNotifications

 
 

Repository files navigation

#LNRSimpleNotifications TSMessages is an amazingly powerful in-app notifications library but requires a lot of setup. LNRSimpleNotifications is a simplified version for the developer who wants beautiful in-app notifications in minutes.

Budweiser Made in America Screenshot LNRSimpleNotifications Demo Screenshot Wakarusa Screenshot

##How do I set it up?

We're glad you asked.

If your project is in Swift:

  1. Install the Pod. Remember to add use_frameworks! to your Podfile.
  2. Add the AudioToolbox framework to your project.
  3. Add import LNRSimpleNotifications in the classes you want to trigger or style your in-app notifications.
  4. (Optional) Style your notifications in your AppDelegate's application:didFinishLaunchingWithOptions: method or your notification manager's initializer.
  5. There is no step Five.

If your project is in Objective-C:

  1. Install the Pod. Remember to add use_frameworks! to your Podfile.
  2. Add the AudioToolbox framework to your project.
  3. Set "Defines Modules" to Yes in your build settings.
  4. Import the LNRSimpleNotification module's Xcode-generated Swift header file in the classes you want to trigger and style your in-app notifications. The name of this header should be #import <LNRSimpleNotifications/LNRSimpleNotifications-Swift.h>.
  5. (Optional) Style your notifications in your AppDelegate's application:didFinishLaunchingWithOptions: method or your notification manager's initializer.

Demo Project

To run the demo project clone the repo, and run pod install from the Example directory first.

##How do I use it? Configure up your notification styles once in your app. We usually use the method application:didFinishLaunchingWithOptions: in AppDelegate.m. The init method for whatever class is triggering your in-app notifications is also a good choice.

AppDelegate.m

import LNRSimpleNotifications

###

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.
        
        LNRSimpleNotifications.sharedNotificationManager.notificationsPosition = LNRNotificationPosition.Top
        LNRSimpleNotifications.sharedNotificationManager.notificationsBackgroundColor = UIColor.whiteColor()
        LNRSimpleNotifications.sharedNotificationManager.notificationsTitleTextColor = UIColor.blackColor()
        LNRSimpleNotifications.sharedNotificationManager.notificationsBodyTextColor = UIColor.darkGrayColor()
        LNRSimpleNotifications.sharedNotificationManager.notificationsSeperatorColor = UIColor.grayColor()
        
        var alertSoundURL: NSURL? = NSBundle.mainBundle().URLForResource("click", withExtension: "wav")
        if let _ = alertSoundURL {
            var mySound: SystemSoundID = 0
            AudioServicesCreateSystemSoundID(alertSoundURL!, &mySound)
            LNRSimpleNotifications.sharedNotificationManager.notificationSound = mySound
        }
        
        return true
    }

You can also configure an icon that will appear in your notification and set a custom font for the notification title and body.

If you don't set any theme options your notifications will default to black text on a white background with no notification sound or icon.

The Class Triggering Notifications

import LNRSimpleNotifications

###

func methodThatTriggersNotification:(title: String, body: String) {
	LNRSimpleNotifications.sharedNotificationManager.showNotification("Test Title", body: "Test Body", callback: { () -> Void in
		LNRSimpleNotifications.sharedNotificationManager.dismissActiveNotification({ () -> Void in
			println("Notification dismissed")
		})
	})
}

##Who's using LNRSimpleNotifications? At the moment we know we've used it in:

We're doing more music festivals this year, so you'll see our simple yet stylish notifications in our apps a few more times this Summer and Fall.

Have you used LNRSimpleNotifications in a project? Want your app featured here? Let us know at dev@lisnr.com.

##Known Bugs

###Since 0.1.0

  1. If you trigger notifications very rapidly they'll start appearing immediately instead of waiting for the one before to be dismissed before displaying. If this happens notifications will start appearing over notifications that were already on screen.

##Pull Requests? Absolutely!

##About LISNR

LISNR is a startup leveraging high frequency, inaudible sounds waves to transmit data over audio. Using our technology we have activated synchronized light shows at concerts, triggered location-based notifications, rewarded music fans with behind-the-scenes content, delivered at-shelf product information, and solved pain points in sports stadiums for the Dallas Cowboys, Swedish House Mafia, Roc Nation, AT&T, Budweiser, and many more.

Want to know more about LISNR? Reach out to dev@lisnr.com.

##License

LNRSimpleNotifications is available under the MIT license. See LICENSE.txt for details.

##Credits

LNRSimpleNotifications is based on TSMessages, developed by Felix Krause. If LNRSimpleNotifications isn't quite what you're looking for we recommend you check it out.

About

Simple Swift in-app notifications

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 96.4%
  • Ruby 3.6%