package Ġde . ch rist ine co enen . code . z app . app . medi at he k . controller Ċ Ċ import Ġandroid . annotation . Suppress Lint Ċ import Ġandroid . content . Broadcast Receiver Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġde . ch rist ine co enen . code . z app . app . medi at he k . ui . detail . Med iat he k Detail Activity Ċ import Ġde . ch rist ine co enen . code . z app . models . shows . Pers isted Med iat he k Show Ċ import Ġde . ch rist ine co enen . code . z app . repositories . Med iat he k Repository Ċ import Ġkotlinx . coroutines . Global Scope Ċ import Ġkotlinx . coroutines . flow . first Ċ import Ġkotlinx . coroutines . launch Ċ import Ġorg . k oin . core . component . K oin Component Ċ import Ġorg . k oin . core . component . inject Ċ Ċ class ĠDownload Receiver Ġ: ĠBroadcast Receiver (), ĠK oin Component Ġ{ ĊĊ ĉ comp anion Ġobject Ġ{ ĊĊĉ ĉ private Ġconst Ġval ĠACTION _ NOTIFICATION _ CLICK ED Ġ= Ċĉĉ ĉ " de . ch rist ine co enen . code . z app . NOTIFICATION _ CLICK ED " Ċĉ ĉ private Ġconst Ġval ĠEX TRA _ DOWNLOAD _ ID Ġ= Ġ" EXTRA _ DOWNLOAD _ ID " ĊĊĉ ĉ fun Ġget Notification Clicked Intent ( context : ĠContext ?, Ġdownload Id : ĠInt ): ĠIntent Ġ{ Ċĉĉ ĉ return ĠIntent ( context , ĠDownload Receiver :: class . java ). apply Ġ{ Ċĉĉĉ ĉ action Ġ= ĠACTION _ NOTIFICATION _ CLICK ED Ċĉĉĉ ĉ putExtra ( EXTRA _ DOWNLOAD _ ID , Ġdownload Id ) Ċĉĉ ĉ } Ċĉ ĉ } ĊĊ ĉ } ĊĊ ĉ private Ġval Ġmedi at he k Repository : ĠMed iat he k Repository Ġby Ġinject () ĊĊ ĉ @ Suppress Lint (" Check Result ") Ċ ĉ override Ġfun Ġon Receive ( context : ĠContext , Ġintent : ĠIntent ) Ġ{ Ċĉ ĉ if Ġ( ACTION _ NOTIFICATION _ CLICK ED Ġ!= Ġintent . action ) Ġ{ Ċĉĉ ĉ return Ċĉ ĉ } ĊĊĉ ĉ val Ġdownload Id Ġ= Ġintent . getInt Extra ( EXTRA _ DOWNLOAD _ ID , Ġ 0 ) ĊĊĉ ĉ Global Scope . launch Ġ{ Ċĉĉ ĉ val Ġpersisted Show Ġ= Ġmedi at he k Repository Ċĉĉĉ ĉ . get Pers isted Show By Download Id ( download Id ) Ċĉĉĉ ĉ . first () ĊĊĉĉ ĉ on Show Loaded ( context , Ġpersisted Show ) Ċĉ ĉ } Ċ ĉ } ĊĊ ĉ private Ġfun Ġon Show Loaded ( context : ĠContext , Ġpersisted Med iat he k Show : ĠPers isted Med iat he k Show ) Ġ{ Ċĉ ĉ // Ġlaunch ĠMed iat he k Detail Activity Ċĉ ĉ val Ġdetail Intent Ġ= ĠMed iat he k Detail Activity Ċĉĉ ĉ . getStart Intent ( context , Ġpersisted Med iat he k Show . medi at he k Show ) Ċĉĉ ĉ . apply Ġ{ Ċĉĉĉ ĉ add Flags ( Intent . FLAG _ ACTIVITY _ CLEAR _ TOP ) Ċĉĉĉ ĉ add Flags ( Intent . FLAG _ ACTIVITY _ NEW _ TASK ) Ċĉĉ ĉ } ĊĊĉ ĉ context . startActivity ( detail Intent ) Ċ ĉ } Ċ } Ċ