Sub BigText_Notification(m As helloMessage)
Dim n As NB6
Dim cs As CSBuilder
Dim nm As Notification
If lastNotification = 0 Then
lastNotification = DateTime.now
End If
n.Initialize("atlas_hello_message", Application.LabelName, "DEFAULT").SmallIcon(notifyIcon).BadgeIconType("SMALL")
' // setcustom sound
If mod_core_consts.APPSET.notification_content <> "" Then
n.SetDefaults(False,True,True)
Dim uri As Uri
uri.Parse(mod_core_consts.APPSET.notification_content)
n.CustomSound(uri)
Else
' // use default sound
n.SetDefaults(True,True,True)
End If
n.OnlyAlertOnce(False)
n.AutoCancel(True)
mod_core_consts.APPSET.profile.notification_message_id = m.msgID
' // is this the messages thread we are viewing
If mod_core_consts.APPSET.profile.current_message_store_view = m.fromID Then
CallSubDelayed(MessagingItems,"insert_last_message")
Else
Dim p As Phone
' // 6+
If p.SdkVersion >= 23 Then
' // setup notification
If m.msgText.Length > 30 Then
' // long message
n.BigTextStyle(m.fromName, cs.Initialize.BackgroundColor(Colors.white).Append("Expand").PopAll, m.msgText)
svc_service.nNewMessage = n.Build(m.fromName, m.msgText.SubString2(0,29) & "...", m.msgID , MessagingItems)
Else
' // short message
svc_service.nNewMessage = n.Build(m.fromName, m.msgText, m.msgID, MessagingItems)
End If
Else
' // 5.1.1-
nm.Initialize
nm.AutoCancel = True
nm.Icon = "ic_chat_bubble_outline_white_24dp"
nm.Number = svc_service.nNewMessageID
' // this will include the messageId so the MessageItems Activity can insert the newest message via the intent handler
nm.SetInfo2(m.fromName, m.msgText,m.msgID, MessagingItems)
' // show notification
svc_service.nNewMessage = nm
End If
' // notify
CallSubDelayed(svc_service,"new_message_notification")
End If
End Sub