package Ġcom . ck . dev . ti pt ap . data Ċ Ċ import Ġcom . ck . dev . ti pt ap . data . entity . Best Scores Ċ import Ġcom . ck . dev . ti pt ap . data . entity . Games Ċ import Ġtim ber . log . Tim ber Ċ Ċ class ĠApp Database Helper Impl ( private Ġval Ġapp Db : ĠApp Database ) Ġ: ĠApp Database Helper Ġ{ ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġget Game Data ByName ( game Name : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). get Game Data ByName ( game Name ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġinsert Game ( game Name : ĠGames ) Ġ= Ġapp Db . games Dao (). insert Game ( game Name ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġupdate Game Level ( game Name : ĠString , Ġcurrent Level : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). update Current Level ( game Name , Ġcurrent Level ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġget Completed Levels ( game Name : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). get Completed Game List ( game Name ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġget High Score ( game Name : ĠString , Ġlevel Num : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). get High Score ( game Name , Ġlevel Num ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġinsert Best Score ( best Scores : ĠBest Scores ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). insert High Score ( best Scores ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġupdate Best Score ( best Scores : ĠBest Scores ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). update High Score ( best Scores . game Name , best Scores . current Level , best Scores . best Scores !! ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġget High Score ForAll Levels ( game Name : ĠString )= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). get High Score ForAll Levels ( game Name ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġupdate Best Score For Infinite Game ( game Name : ĠString , grid Size : Int , score : Int ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). update High Score For Infinite ( game Name , grid Size , score ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġupdate Lon gest Play ed For Infinite Game ( game Name : ĠString , grid Size : Int , longest Play ed : Long ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). update Lon gest Play ed For Infinite ( game Name , longest Play ed , grid Size ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġget High Score For Infinite ( game Name : ĠString , grid Size : Int ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). get Best Score For Infinite ( game Name , grid Size ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġupdate Total Game Play ed ( game Name : ĠString ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). update Total Games Play ed ( game Name ) ĊĊĠĠĠ Ġoverride Ġsuspend Ġfun Ġupdate Total Time Play ed ( game Name : ĠString , Ġtotal Time : ĠLong ) Ġ= ĊĠĠĠĠĠĠĠ Ġapp Db . games Dao (). update Total Time Play ed ( game Name , Ġtotal Time ) ĊĊĠĠĠ Ġfun Ġexecute Db Query ( success Msg : String Ġ= Ġ"", error Msg : String Ġ= Ġ"", query : Ġ() Ġ-> ĠUnit ) Ġ{ ĊĠĠĠĠĠĠĠ Ġtry Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġquery () ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTim ber . i (" successfully Ġexecuted Ġdb Ġquery ") ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTim ber . i ( success Msg ) ĊĠĠĠĠĠĠĠ Ġ} Ġcatch Ġ( ex : ĠException ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTim ber . e ( ex , Ġ" exception Ġin Ġexecuting Ġdb Ġquery ") ĊĠĠĠĠĠĠĠĠĠĠĠ ĠTim ber . i ( error Msg ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ Ċ }