kunass2 / foregroundnotification Goto Github PK
View Code? Open in Web Editor NEWPresent your custom iOS 10 notification when app is in foreground mode.
License: MIT License
Present your custom iOS 10 notification when app is in foreground mode.
License: MIT License
The didSet
of BSForegroundNotificationView
's userInfo
isn't exhaustive in the way it fills its UILabel
's texts.
When alert
is a simple String value and there's no body, it will update the titleLabel
, but leave the subtitleTextView
showing a Lorem Ipsum
message
Are you planning on making this compatible with Swift 3.0?
How can i trigger when user tab the notification, and the button action?
adding pod "BSForegroundNotification" to podfile retrieves older 1.9.1 not a newer 2.0 version.
Is there a method to call when the app is in a foreground and is there a way for notifications not to show when the app is in use?
On screen notifications should be limited to 1 at a time. Currently they just pile on top of each other which is not ideal. Instead, notifications should be added to a queue, which would be responsible for presenting the next notification from the queue once the previous one has been dismissed. Doing this fixes:
UIStatusBar
hide/unhiding bug. Currently once the first notification disappears, the status bar is unhidden.... even if a new notification is already on screen.Hi, do u know if is a problem use this in a project object-c ?
Best
Hi,
I have added "pod 'BSForegroundNotification'" in my podfile and tried to execute "pod update". Getting error
Analyzing dependencies
[!] Unable to satisfy the following requirements:
BSForegroundNotification
required by Podfile
Thanks,
KSD
Problem
When attempting to "send" user inputted text for a notification uses .TextInput
actions, it's too easy to accidentally dismiss the notification rather than triggering application(application:, handleActionWithIdentifier:, forRemoteNotification:, withResponseInfo: , completionHandler:
If the notification is accidentally closed, the user has lost all of his inputted text and there is no way to recover it... it's a waste of time for the user + the user will believe that it has worked properly. This is really the biggest issue here... I discovered this the hard way. It's essentially a false positive.
Solution
Increase the the size of the "send" button so that tapping anywhere near the "send" text will trigger the expected chain of events rather than closing the notification.
Hi there.
I am struggling with displaying push notifications sent from my Firebase console in my app. It obviously shows when my phone screen is locked, but I can't seem to get this working. I honestly have to say that I am also a bit confused, and I would really appreciate if any could help me with this.
This is some of my code in appDelegate.swift:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let token = FIRInstanceID.instanceID().token()
FIRMessaging.messaging().appDidReceiveMessage(userInfo)
print(token)
print("MessageID : \(userInfo["gcm_message_id"])")
print(userInfo)
}
It's in here I have put the code for the foreground push notification as well. So it looks like this:
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let token = FIRInstanceID.instanceID().token()
FIRMessaging.messaging().appDidReceiveMessage(userInfo)
print(token)
print("MessageID : \(userInfo["gcm_message_id"])")
print(userInfo)
let notification = BSForegroundNotification(userInfo: userInfo)
BSForegroundNotification.systemSoundID = 1004
notification.delegate = self
notification.presentNotification()
}
However, this does not seem to work. Any ideas on how I would solve this?
I tested out a long notification and the subtitle text for some reason stayed 1 line. When I finally pulled down, it showed all the text. I tried calling the presentView function in presentNotification and that fixed the problem, but I'm not sure why this is happening.
In my AppDelegate I have the following code:
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
let state = application.applicationState
if state == .Active {
let notification = BSForegroundNotification(userInfo: userInfo)
notification.delegate = self
notification.presentNotification()
}
}
For some reason, the notification is not being presented. Is it not meant for use in AppDelegate?
I have tried to use local BSForegroundNotification to get local push notification. But when I touched the notification, no reaction. I use this code:
_
func application (application: UIApplication, handleActionWithIdentifier identifier: String ?, forLocalNotification notification: UILocalNotification, completionHandler: () -> Void)
_
in my AppDelegate, but it still did not happen anything.
What should I do?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.