All Projects → d7laungani → Dllocalnotifications

d7laungani / Dllocalnotifications

Licence: mit
💬 Easily create Local Notifications in swift - Wrapper of UserNotifications Framework

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Dllocalnotifications

Django Herald
A Django messaging library
Stars: ✭ 159 (-12.64%)
Mutual labels:  notifications
Ember Cli Notifications
⚛ Atom inspired notification messages for ember-cli
Stars: ✭ 168 (-7.69%)
Mutual labels:  notifications
Angular Notifier
A well designed, fully animated, highly customizable, and easy-to-use notification library for your Angular application.
Stars: ✭ 175 (-3.85%)
Mutual labels:  notifications
React Toast Notifications
🍞 A toast notification system for react
Stars: ✭ 2,103 (+1055.49%)
Mutual labels:  notifications
Autoya
thin framework for Unity.
Stars: ✭ 165 (-9.34%)
Mutual labels:  notifications
Notiflix
Notiflix is a JavaScript library for client-side non-blocking notifications, popup boxes, loading indicators, and more that makes your web projects much better.
Stars: ✭ 172 (-5.49%)
Mutual labels:  notifications
Prayer Times Android
A useful Application with a set of tools needed by any muslim.
Stars: ✭ 158 (-13.19%)
Mutual labels:  notifications
Shoutrrr
Notification library for gophers and their furry friends.
Stars: ✭ 177 (-2.75%)
Mutual labels:  notifications
Bitprophet
Node crypto trading platform for Binance exchange.
Stars: ✭ 166 (-8.79%)
Mutual labels:  notifications
Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (-4.4%)
Mutual labels:  notifications
Vue Notifyjs
Minimalist 1kb Notification component
Stars: ✭ 160 (-12.09%)
Mutual labels:  notifications
Screamer Js
Screamer.js is a Vanilla Javascript plugin to provide simple yet fully customisable web notifications using Web Notifications API.
Stars: ✭ 161 (-11.54%)
Mutual labels:  notifications
Web Push Php Example
An example for sending Web Push notifications, using web-push-php
Stars: ✭ 173 (-4.95%)
Mutual labels:  notifications
Nativescript Local Notifications
📫 NativeScript plugin to easily schedule local notifications
Stars: ✭ 159 (-12.64%)
Mutual labels:  notifications
React Notify Toast
Toast notifications for React.js
Stars: ✭ 176 (-3.3%)
Mutual labels:  notifications
Notistack
Highly customizable notification snackbars (toasts) that can be stacked on top of each other
Stars: ✭ 2,562 (+1307.69%)
Mutual labels:  notifications
Timeago
This will help to get how much time have passed. Useful in showing messages, notifications time and etc.
Stars: ✭ 169 (-7.14%)
Mutual labels:  notifications
Cmus Osx
Adds track change notifications, and media key support to cmus.
Stars: ✭ 179 (-1.65%)
Mutual labels:  notifications
Googlecontactseventsnotifier
Receive automatic email notifications before your Google Contacts birthday and other events!
Stars: ✭ 177 (-2.75%)
Mutual labels:  notifications
Amplify Cli
The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Stars: ✭ 2,399 (+1218.13%)
Mutual labels:  notifications

Swift Version CocoaPods Compatible Platform Build Status License

In IOS 10, apple updated their library for Notifications and separated Local and push notifications to a new framework:

User Notifications

This library makes it easy to setup a local notification and also includes easy configuration for repeating notifications using [ .None, .Minute, .Hourly, .Daily, .Monthly, .Yearly] .

It also includes all the new features, including inserting attachments and changing the launch image of a notification.

  1. Features
  2. Requirements
  3. Installation
  4. Usage
  5. Contribute

Features

  • [x] Easily Repeat Notifications
  • [x] Location Based Notifications
  • [x] Category Action buttons
  • [x] Queue to enforce 64 notification limit

Requirements

  • iOS 10.0+
  • Xcode 8.0+

Installation

CocoaPods

You can use CocoaPods to install DLLocalNotifications by adding it to your Podfile:

platform :ios, '10.0'
use_frameworks!

target 'MyApp' do
	pod 'DLLocalNotifications'
end

Note: your iOS deployment target must be 10.0+

Usage

Single fire notification (any date)

Notification that fires once at the date time inputted

Note: If you want the notification to repeat then you need to create a notification based on date components

// The date you would like the notification to fire at
let triggerDate = Date().addingTimeInterval(300)

let firstNotification = DLNotification(identifier: "firstNotification", alertTitle: "Notification Alert", alertBody: "You have successfully created a notification", date: triggerDate)

let scheduler = DLNotificationScheduler()
scheduler.scheduleNotification(notification: firstNotification)
scheduler.scheduleAllNotifications()

Repeating Notification based on date components

The configuration of the repetition is chosen in the repeats parameter that can be [ .none, .minute, .hourly, .daily, .monthly, .yearly] .

// The date you would like the notification to fire at :35 mins every hour

var dateComponents = DateComponents()
dateComponents.minute = 35
dateComponents.second = 0

let firstNotification = DLNotification(identifier: "hourlyNotification", alertTitle: "Notification Alert", alertBody: "You have successfully created a notification", fromDateComponents: dateComponents, repeatInterval: .hourly)

let scheduler = DLNotificationScheduler()
scheduler.scheduleNotification(notification: firstNotification)
scheduler.scheduleAllNotifications()

Notification that repeats from one Date to another with a time interval period

This is useful to setup notifications to repeat every specific time interval for in a specific time period of the day.

let scheduler = DLNotificationScheduler()

// This notification repeats every 15 seconds from a time period starting from 15 seconds from the current time till 5 minutes from the current time

scheduler.repeatsFromToDate(identifier: "First Notification", alertTitle: "Multiple Notifications", alertBody: "Progress", fromDate: Date().addingTimeInterval(15), toDate: Date().addingTimeInterval(300) , interval: 15, repeats: .none )
scheduler.scheduleAllNotifications()

Note: Since this library takes care of the 64 notification limit you would want to call scheduler.scheduleAllNotifications() in your AppDelegate file as well.

Modifying elements of the notification

You can modify elements of the notification before scheduling. Publically accessible variables include:

repeatInterval, alertBody, alertTitle, soundName, fireDate, attachments, launchImageName, category

let firstNotification = DLNotification(identifier: "firstNotification", alertTitle: "Notification Alert", alertBody: "You have successfully created a notification", date: Date(), repeats: .minute)

// You can now change the repeat interval here
firstNotification.repeatInterval = .yearly

// You can add a launch image name
firstNotification.launchImageName = "Hello.png"

let scheduler = DLNotificationScheduler()
scheduler.scheduleNotification(notification: firstNotification)
scheduler.scheduleAllNotifications()

Location Based Notification

The notification is triggered when a user enters a geo-fenced area.

let center = CLLocationCoordinate2D(latitude: 37.335400, longitude: -122.009201)
let region = CLCircularRegion(center: center, radius: 2000.0, identifier: "Headquarters")
region.notifyOnEntry = true
region.notifyOnExit = false

let locationNotification = DLNotification(identifier: "LocationNotification", alertTitle: "Notification Alert", alertBody: "You have reached work", region: region )

let scheduler = DLNotificationScheduler()
scheduler.scheduleNotification(notification: locationNotification)
scheduler.scheduleAllNotifications()

Adding action buttons to a notification

 let scheduler = DLNotificationScheduler()

 let standingCategory = DLCategory(categoryIdentifier: "standingReminder")

 standingCategory.addActionButton(identifier: "willStand", title: "Ok, got it")
 standingCategory.addActionButton(identifier: "willNotStand", title: "Cannot")

 scheduler.scheduleCategories(categories: [standingCategory])

Don't forget to the set the notification category before scheduling the notification using

notification.category = "standingReminder"

Cancelling a notification

 scheduler.cancelNotification(notification: notification)


Contribute

We would love for you to contribute to DLLocalNotifications, check the LICENSE file for more info.

Meta

Devesh Laungani – @d7laungani

Distributed under the MIT license. See LICENSE for more information

https://github.com/d7laungani/

Hire Me

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].