Giter Site home page Giter Site logo

d7laungani / dllocalnotifications Goto Github PK

View Code? Open in Web Editor NEW
213.0 7.0 37.0 296 KB

:speech_balloon: Easily create Local Notifications in swift - Wrapper of UserNotifications Framework

License: MIT License

Ruby 1.75% Objective-C 1.19% Swift 97.06%
local-notifications notifications scheduled-notifications user-notifications-framework local-notification-helper

dllocalnotifications's People

Contributors

d7laungani avatar raguiar2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dllocalnotifications's Issues

Feature Ask: Custom Repeats

I have a question about the notification scheduling capabilities of this library. I'm trying to build out a calendar-type application that needs to schedule many notifications with custom repetition. I have a couple questions about this library.

1: Does this library still queue notifications after the app has been killed? e.g. do they persist if I queue the notification then kill the app and restart it?

2: Is there an easy way to do custom repeats? For example, if i want something to trigger on monday, tuesday, wednesday each week, is there an easy way to do that?

Thank you!

podfile install issue

I have an issue installing this from the master branch.

When i run 'pod install' on the app with the line
pod 'DLLocalNotifications', '~>0.06'
in my podfile, I get the following line of code

content.sound = (notification.soundName == nil) ? UNNotificationSound.default() : UNNotificationSound.init(named: notification.soundName!)

However, I noticed that this is replaced by

content.sound = notification.soundName == "" ? UNNotificationSound.default : UNNotificationSound.init(named: UNNotificationSoundName(rawValue: notification.soundName))

in the actual code. Why would the pod install of mine have the wrong line of code in it?

Help me! Support required

I have 3 local notifications need to be repeated daily from (9am to 6pm with frequency of 3 hrs), I used repeatsFromToDate() but it didn't work.

Note:- There are 3 LocalNotification with the different startTime& endTime & user can stop/start any of these at anytime.

I need to repeat it 3-4 times a day till the user turns off the notification (ie., 10AM, 1PM, 4PM, 7PM today, tomorrow... ) - this is for notification1, similarly the app has 2 similar notifications (Notification2 might trigger at 9AM, 12PM, 3PM, 6PM today, tomorrow... Notification3- 4PM, 10PM today, tomorrow...). How to repeat them daily between these time intervals? Again user can't change the frequency, he could change the start & end time for each notifications or turn off.

Warning in XCode 15.0.1

Hello
i've got 2 warning when try to compile with XCode 15.0.1
'archiveRootObject(_:toFile:)' was deprecated in iOS 12.0: Use +archivedDataWithRootObject:requiringSecureCoding:error: and -writeToURL:options:error: instead
and

'unarchiveObject(withFile:)' was deprecated in iOS 12.0: Use +unarchivedObjectOfClass:fromData:error: instead
Do you plan to fix it ?
Thanks in advance

Not showing Action Button

Im trying to show action buttons with the notification

` func dailyNotification(){

    let firstNotification = DLNotification(identifier: "firstNotification", alertTitle: "Notificaiton Alert", alertBody: "You have successfully created a notification", date: Date(), repeats: .Minute)
    
    // You can now change the repeat interval here
    firstNotification.repeatInterval = .Minute
    
    // You can add a launch image name
    firstNotification.launchImageName = "logo_ad.jpg"
    
    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])
    scheduler.scheduleNotification(notification: firstNotification)
    firstNotification.category = "standingReminder"
}`

any reason why this isnt working

thank you

repeat interval minute is not working

when i schedule notifications with from date and to date with repeat interval minute, it is not start firing notification at from date instead it start immediately.

Crash when set Date to nil

Crash at:

var newComponents = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second ], from: notification.fireDate!)

by following code

let notification = DLNotification(identifier: "", alertTitle: "", alertBody: "", date: nil, repeats: .none, soundName: "")
let scheduler = DLNotificationScheduler()
scheduler.scheduleNotification(notification: notification)
scheduler.scheduleAllNotifications()

Identifier was made private

I noticed that the identifier field in DLNotification was made private in the latest merge from master. Is it possible to make it public again? Some of my functionality depends on having the identifier.

if i can change interval to less than 10 seconds than notification not work on specific time

i want to fire notification between specific time but interval is 2/3 seconds not 10/15 seconds so i do following changes but it will not work , not fire notification on perfect start time time.

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

Support ios 8+

Could be added support for handling ios9 and ios10 in different way with the same API?

unexpectedly found nil while unwrapping an Optional value

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])

getting the following error
fatal error: unexpectedly found nil while unwrapping an Optional value
2017-03-12 14:24:09.727084 fatal error: unexpectedly found nil while unwrapping an Optional value

any suggestions please

How to schedule a notification that will repeat with some frequency after specific time passes

I don't see support for scheduling such kind of notification i.e. that repeats only when a specific time passes. The problem is that the schedule fires immediately without waiting for the exact time although repeats correctly.

e.g. here is the code for scheduling a repeating notification after 10 minutes. This doesn't wait for the 10 minutes - fires immediately in the next minute from now.

    let triggerDate = Date().addingTimeInterval(600)
    let firstNotification = DLNotification(identifier: "firstNotification", alertTitle: "Notification Alert",                        alertBody: "You have successfully created a notification", date: triggerDate, repeats: .Minute)
    
    let scheduler = DLNotificationScheduler()
    scheduler.scheduleNotification(notification: firstNotification)

here is another block of code for a repeating notification that will fire daily after 3 days.

    let triggerDate = Date().addingTimeInterval(3*24*60*60)
    let firstNotification = DLNotification(identifier: "firstNotification", alertTitle: "Notification Alert", alertBody: "You have successfully created a notification", date: triggerDate, repeats: .Daily)
    
    let scheduler = DLNotificationScheduler()
    scheduler.scheduleNotification(notification: firstNotification)`

This also doesn't wait for the 3 days but fires immediately on the next day.

The main problem in both is that it ignores the time till which it should wait to start firing the notification. If anybody has understood the problem, will you take some time to figure out what's wrong. I will be really thankful.

firstNotification.launchImageName not working

Hi,

I would like to add an image on the localnotification but i've got this error:
'launchImageName' is inaccessible due to 'internal' protection level

Can you help me to fix it please ?

Thanks in advance

Hourly schedule doesn't working

I use .hourly schedule and when I getPendingNotificationRequests, says dd-mm-yyyy 00:00:00.
Seems that It's scheduled for midnight.
Why?

notification

Is it possible to detect push-notification arrival?

Fire Notification Daily but After a certain date

I want to set a repeat Local notification from date. For Example:

StartDate: 26-July-2022

Todays Date: 23-July-2022

I am stuck here. I want to set a repeat Local notification from date.

Please have a look to my Notification function:

func scheduleLocalNotification(date: Date) {
        var calendar = Calendar.current
        calendar.timeZone = TimeZone.current

        let content = UNMutableNotificationContent()
        // Configure Notification Content
        content.title = "REMINDER For Yoga"
        content.body = "Hi! Take ready for Daily Yoga Class."

        // Set Category Identifier
        content.categoryIdentifier =  "Yoga_872"
        var components = calendar.dateComponents([.hour, .minute], from: date)

        let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: true)
       
        // Create Notification Request
        let identifier = "Yoga_Class(222)"

        let notificationRequest = UNNotificationRequest(identifier: identifier, content: content, trigger: trigger)

        // Add Request to User Notification Center
        UNUserNotificationCenter.current().add(notificationRequest) { (error) in
            if let error = error {
                print("Add Notification Request Error:  (\(error), \(error.localizedDescription))")
            }           
        }

    }

This function fire notification from Today. I want to this from 26th July 2022.

userInfo

Unable to add userInfo data into the notification.

Support required

After scheduling multiple notifications using the method scheduler.repeatsFromToDate (repeats between start & end time) , i cant stop a particular notification.

Requirement:-1. Start multiple notifications(one at a time) with the changeable start time, end time & range.
2. stop a particular notification.

Could you help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.