package Ġio . fo k us Ċ Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . app . Pending Intent Ċ import Ġandroid . content . Intent Ċ import Ġandroidx . core . app . Notification Compat Ċ import Ġcom . ones ign al . Notification Ext ender Service Ċ import Ġcom . ones ign al . Notification Opened Receiver Ċ import Ġcom . ones ign al . OS Notification Received Result Ċ import Ġorg . json . JSONArray Ċ import Ġorg . json . JSONObject Ċ import Ġjava . util .* ĊĊ Ċ class ĠOne Signal Notification Service Ġ: ĠNotification Ext ender Service () Ġ{ Ċ ĉ override Ġfun Ġon Notification Processing ( notification : ĠOS Notification Received Result ): ĠBoolean Ġ{ Ċĉ ĉ val Ġpayload Ġ= Ġnotification . payload Ċĉ ĉ if Ġ( payload . additional Data . has (" buttons ")) Ġ{ Ċĉĉ ĉ add Localized Buttons ( JSONArray ( payload . additional Data . opt String (" buttons "))) Ċĉĉ ĉ return Ġtrue Ċĉ ĉ } Ċĉ ĉ return Ġfalse Ċ ĉ } ĊĊ ĉ private Ġfun Ġadd Localized Buttons ( buttons : ĠJSONArray ) Ġ{ Ċĉ ĉ val Ġoverride Settings Ġ= ĠOverride Settings () Ċĉ ĉ override Settings . ext ender Ġ= ĠNotification Compat . Ext ender ( Ċĉĉ ĉ fun ( builder : ĠNotification Compat . Builder ): ĠNotification Compat . Builder Ġ{ Ċĉĉĉ ĉ val Ġlang Ġ= ĠLocale . getDefault (). language Ċĉĉĉ ĉ for Ġ( i Ġin Ġ 0 Ġuntil Ġbuttons . length ()) Ġ{ Ċĉĉĉĉ ĉ val Ġbutton Ġ= Ġbuttons . opt ( i ) Ġas ĠJSONObject Ċĉĉĉĉ ĉ val Ġid Ġ= Ġbutton . opt String (" id ") Ċĉĉĉĉ ĉ @ Suppress Lint (" Restricted Api ") Ċĉĉĉĉ ĉ val Ġaction Ġ= Ġbuilder . m Actions . find Ġ{ Ġit . title . toString () Ġ== Ġid Ġ} Ġ?: Ġcontinue ĊĊĉĉĉĉ ĉ val Ġtext Ġ= ĠJSONObject ( button . opt String (" text ")) Ċĉĉĉĉ ĉ var Ġbutton Text Ġ= Ġtext . opt String ( lang , Ġnull ) Ċĉĉĉĉ ĉ if Ġ( button Text Ġ== Ġnull ) Ċĉĉĉĉĉ ĉ button Text Ġ= Ġtext . opt String (" en ") Ċĉĉĉĉ ĉ action ?. title Ġ= Ġbutton Text ; Ċĉĉĉ ĉ } Ċĉĉĉ ĉ return Ġbuilder ; Ċĉĉ ĉ } Ċĉ ĉ ) Ċĉ ĉ display Notification ( override Settings ) Ċ ĉ } Ċ } Ċ