Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications for android #675

Open
NCrashed opened this issue Sep 28, 2020 · 0 comments
Open

Notifications for android #675

NCrashed opened this issue Sep 28, 2020 · 0 comments
Assignees
Labels
android enhancement New feature or request

Comments

@NCrashed
Copy link
Contributor

Provide reflex API to create system notification about event.

newtype ChannelId = ChannelId { unChannelId :: Int }

data NotificationPriority = PriorityMin | PriorityLow | PriorityDefault | PriorityHigh 

data NotificationCategory = CategoryAlarm | CategoryCall | CategoryEmail | CategoryError | CategoryEvent | CategoryMessage | CategoryNavigation | CategoryProgress | CategoryPromo | CategoryRecommendation | CategoryReminder | CategoryService | CategorySocial | CategoryStatus | CategorySystem | CategoryTransport

data NotificationVisibility = VisibilitySecret | VisibilityDefault | VisibilityPublic

-- Follows Android API where priority and importance are different types
data ChannelImportance = ImportanceMin | ImportanceLow | ImportanceDefault | ImportanceHigh  

data NotificationChannel = {
  notchanTitle :: !Text 
, notchanDescr :: !Text 
, notchanImportance :: !ChannelImportance
}

-- Reference to the pictures in our bundle
type ResourceName = Text

data Notification m = Notification {
  notificationTitle      :: !Text 
, notificationText       :: !Text 
, notificationChannel    :: !ChannelId 
, notificationIcon       :: !ResourceName
, notificationPriority   :: !NotificationPriority
, notificationCategory   :: !(Maybe NotificationCategory)
, notificationVisibility :: !NotificationVisibility
, notificationAction     :: !(m ()) -- ^ Widget to switch to on tap on the notification
}

registerChannel :: Event t NotificationChannel -> m (Event t ChannelId)
postNotification :: Event t (Notification m) -> m (Event t ())

Reference https://developer.android.com/training/notify-user/build-notification

Additional task:

  • Make it as separate library
@NCrashed NCrashed added enhancement New feature or request android labels Sep 28, 2020
@LeMarwin LeMarwin self-assigned this Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants