package Ġcom . dsc vit . f em helper . repository Ċ Ċ import Ġcom . dsc vit . f em helper . db . Ch ats Dao Ċ import Ġcom . dsc vit . f em helper . model . chat . Message Ċ import Ġcom . dsc vit . f em helper . model . login . Login Request Ċ import Ġcom . dsc vit . f em helper . model . register notification . Register Notification Request Ċ import Ġcom . dsc vit . f em helper . model . requests . Request Ċ import Ġcom . dsc vit . f em helper . model . send alert . Send Alert Request Ċ import Ġcom . dsc vit . f em helper . model . signup . Signup Request Ċ import Ġcom . dsc vit . f em helper . network . ApiClient Ċ Ċ class ĠApp Repository ( private Ġval ĠapiClient : ĠApi Client , Ġprivate Ġval Ġch ats Dao : ĠCh ats Dao ) Ġ: ĠBase Repo () Ġ{ ĊĠĠĠ Ġfun Ġsign Up User ( signup Request : ĠSign up Request ) Ġ= Ġmake Request Ġ{ ĊĠĠĠĠĠĠĠ ĠapiClient . sign Up User ( signup Request ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsign In User ( login Request : ĠLogin Request ) Ġ= Ġmake Request Ġ{ ĊĠĠĠĠĠĠĠ ĠapiClient . signIn User ( login Request ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġregister Device ( register Notification Request : ĠRegister Notification Request ) Ġ= Ġmake Request Ġ{ ĊĠĠĠĠĠĠĠ ĠapiClient . register Device ( register Notification Request ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġupdate Device Details ( register Notification Request : ĠRegister Notification Request ) Ġ= ĊĠĠĠĠĠĠĠ Ġmake Request Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠapiClient . update Device Details ( register Notification Request ) ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġsend Alert ( send Alert Request : ĠSend Alert Request ) Ġ= Ġmake Request Ġ{ ĊĠĠĠĠĠĠĠ ĠapiClient . send Alert ( send Alert Request ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġlog Out () Ġ= Ġmake Request Ġ{ ĊĠĠĠĠĠĠĠ ĠapiClient . log Out () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġget Alerts () Ġ= Ġmake Request Ġ{ ĊĠĠĠĠĠĠĠ ĠapiClient . get Alerts () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġview Chat Rooms () Ġ= Ġmake Request And Save Ġ( ĊĠĠĠĠĠĠĠ Ġdatabase Query Ġ= Ġ{ Ġch ats Dao . getAll Chat Rooms () Ġ}, ĊĠĠĠĠĠĠĠ Ġnetwork Call Ġ= Ġ{ ĠapiClient . view Chat Rooms () Ġ}, ĊĠĠĠĠĠĠĠ Ġsave Call Result Ġ= Ġ{ Ġch ats Dao . insert Chat Rooms ( it . chat Rooms ) Ġ} ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfun Ġget Messages ( chat Room Id : ĠInt ) Ġ= Ġmake Request And Save ( ĊĠĠĠĠĠĠĠ Ġdatabase Query Ġ= Ġ{ Ġch ats Dao . load Messages By Chat Room Id ( chat Room Id ) Ġ}, ĊĠĠĠĠĠĠĠ Ġnetwork Call Ġ= Ġ{ ĠapiClient . get Messages ( chat Room Id ) Ġ}, ĊĠĠĠĠĠĠĠ Ġsave Call Result Ġ= Ġ{ Ġch ats Dao . insert Messages ( it . messages ) Ġ} ĊĠĠĠ Ġ) ĊĊĠĠĠ Ġfun ĠgetAll Requests () Ġ= Ġch ats Dao . getAll Requests () ĊĊĠĠĠ Ġsuspend Ġfun Ġinsert Message ( message : ĠMessage ) Ġ= Ġch ats Dao . insert Message ( message ) ĊĊĠĠĠ Ġsuspend Ġfun Ġupsert Request ( request : ĠRequest ) Ġ= Ġch ats Dao . upsert Request ( request ) ĊĊĠĠĠ Ġsuspend Ġfun Ġrequest Is Done ( id : ĠInt ) Ġ= Ġch ats Dao . request Is Done ( id ) ĊĊĠĠĠ Ġsuspend Ġfun Ġdelete Chat Rooms () Ġ= Ġch ats Dao . delete Chat Rooms () ĊĊĠĠĠ Ġsuspend Ġfun Ġdelete Messages () Ġ= Ġch ats Dao . delete Messages () ĊĊĠĠĠ Ġsuspend Ġfun Ġdelete Requests () Ġ= Ġch ats Dao . delete Requests () Ċ Ċ }