/* Ċ Ġ* ĠCopyright Ġ 2 0 1 9 ĠTransfer Wise ĠLtd . Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . transfer wise . b anks Ċ Ċ import Ġandroid . content . Context Ċ import Ġandroid . content . Intent Ċ import Ġandroid . net . Uri Ċ import Ġandroid . os . Bundle Ċ import Ġandroidx . annotation . Style Res Ċ import Ġandroidx . appcompat . app . AppCompatActivity Ċ import Ġandroidx . lifecycle . Observer Ċ import Ġandroidx . lifecycle . ViewModel Provider Ċ import Ġandroidx . navigation . Nav Directions Ċ import Ġandroidx . navigation . find Nav Controller Ċ import Ġcom . transfer wise . b anks . International Transfer Activity . Companion . create Intent Ċ import Ġcom . transfer wise . b anks . account . Check Account Fragment Args Ċ import Ġcom . transfer wise . b anks . account . connect . Connect Account Fragment Directions Ċ import Ġcom . transfer wise . b anks . account . login . Login Constants Ċ import Ġcom . transfer wise . b anks . account . login . Login Constants . DE E PL INK _ PARAM _ CODE Ċ import Ġcom . transfer wise . b anks . quote . Anonymous Quote Fragment Directions Ċ import Ġcom . transfer wise . b anks . quote . Quote Fragment Directions Ċ import Ġcom . transfer wise . b anks . quote . currency . Anonymous Select Currency Fragment Directions Ċ import Ġcom . transfer wise . b anks . recipients . Get Recipients Fragment Directions Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . Done Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Anonymous Quote Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Anonymous Select Currency Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Confirmation Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Connect Account Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Create Recipient Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Extra Details Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Login Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Payment Sent Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Quote Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Recipients Ċ import Ġcom . transfer wise . b anks . shared . Navigation Action . To Select Currency Ċ import Ġcom . transfer wise . b anks . shared . Quote Description Ċ import Ġcom . transfer wise . b anks . shared . Shared ViewModel Ċ import Ġcom . transfer wise . b anks . shared . Shared ViewModel Factory Ċ import Ġcom . transfer wise . b anks . transfer . confirmation . Confirmation Fragment Directions Ċ Ċ /** Ċ Ġ* ĠThe Ġ[ International Transfer Activity ] Ġhandles Ġthe Ġfull Ġinternational Ġpayments Ġflow . ĠStart Ġthis Ċ Ġ* Ġclass Ġusing Ġa Ġdirect Ġexplicit Ġintent Ġor Ġuse Ġ[ create Intent ] Ġto Ġpass Ġin Ġextra Ġconfiguration . Ċ Ġ*/ Ċ class ĠInternational Transfer Activity Ġ: ĠAppCompatActivity () Ġ{ ĊĊĠĠĠ Ġinternal Ġlateinit Ġvar ĠviewModel : ĠShared ViewModel ĊĊĠĠĠ Ġoverride Ġfun ĠonCreate ( savedInstanceState : ĠBundle ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . onCreate ( savedInstanceState ) ĊĠĠĠĠĠĠĠ Ġset Theme ( theme ) ĊĠĠĠĠĠĠĠ ĠsetContentView ( R . layout . activity _ international _ transfer ) ĊĊĠĠĠĠĠĠĠ ĠviewModel Ġ= ĠViewModel Provider ( this , ĠShared ViewModel Factory ( backend Configuration )). get ( Shared ViewModel :: class . java ) ĊĊĠĠĠĠĠĠĠ Ġval Ġstart Args Ġ= ĠCheck Account Fragment Args ( customer Id , Ġquote ). to Bundle () ĊĠĠĠĠĠĠĠ Ġfind Nav Controller ( R . id . fragment _ navigation _ host ). set Graph ( R . navigation . international _ transfer _ graph , Ġstart Args ) ĊĊĠĠĠĠĠĠĠ ĠviewModel . navigation Action . observe ( this , ĠObserver (:: navigate )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate ( action : ĠNavigation Action ) Ġ= Ġwhen Ġ( action ) Ġ{ ĊĠĠĠĠĠĠĠ Ġis ĠTo Login Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġstore Quote For Handle Login Deep Link ( action ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠstartActivity ( Intent ( Intent . ACTION _ VIEW , ĠUri . parse ( action . url ))) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Anonymous Quote Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Anonymous Select Currency Fragment Directions . to Anonymous Quote ( action . customer Id , Ġaction . quote )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Anonymous Select Currency Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Anonymous Quote Fragment Directions . to Anonymous Select Currency ( action . customer Id , Ġaction . quote )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Connect Account Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Anonymous Quote Fragment Directions . to Connect Account ( action . customer Id , Ġaction . quote )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Quote Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Connect Account Fragment Directions . to Quote ( action . customer Id , Ġaction . quote )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Select Currency Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Quote Fragment Directions . to Select Currency ( action . customer Id , Ġaction . quote )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Create Recipient Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Get Recipients Fragment Directions . to Create Recipient ( action . customer Id , Ġaction . quote Id , Ġaction . target Currency )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Recipients Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Quote Fragment Directions . to Get Recipients ( action . customer Id , Ġaction . quote Id , Ġaction . target Currency )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Extra Details Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Get Recipients Fragment Directions . to Extra Details ( action . customer Id , Ġaction . transfer Summary )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Confirmation Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Get Recipients Fragment Directions . to Confirmation ( action . customer Id , Ġaction . transfer Summary , Ġaction . details )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠTo Payment Sent Ġ-> Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Confirmation Fragment Directions . to Payment Sent ( action . amount , Ġaction . currency , Ġaction . recipient )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġis ĠDone Ġ-> Ġfinish () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠHandle Ġthe Ġdee plink Ġresult Ġof Ġa Ġuser Ġlogin . ĠThis Ġisn 't Ġhandled Ġby Ġthe Ġnavigation Ġlibrary Ġas Ġthat ĊĠĠĠĠ Ġ* Ġlibrary Ġwill Ġalways Ġclear Ġthe Ġback Ġstack . ĠThis Ġimplementation Ġhowever Ġkeeps Ġthe Ġback Ġstack Ġint act . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġoverride Ġfun Ġon New Intent ( intent : ĠIntent ?) Ġ{ ĊĠĠĠĠĠĠĠ Ġsuper . on New Intent ( intent ) ĊĠĠĠĠĠĠĠ Ġif Ġ( intent ?. scheme Ġ== ĠLogin Constants . DE E PL INK _ SCHEME ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġcode Ġ= Ġintent . data !!. getQuery Parameter ( DE E PL INK _ PARAM _ CODE ) Ġ?: Ġ" invalid " ĊĠĠĠĠĠĠĠĠĠĠĠ Ġnavigate ( Connect Account Fragment Directions . to Handle Login ( customer Id , Ġquote , Ġcode )) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġprivate Ġfun Ġnavigate ( direction : ĠNav Directions ) Ġ= Ġfind Nav Controller ( R . id . fragment _ navigation _ host ). navigate ( direction ) ĊĊĠĠĠ Ġ/** ĊĠĠĠĠ Ġ* ĠTo Ġkeep Ġthe Ġreference Ġimplementation Ġsimple , Ġthere Ġis Ġno Ġcache / storage . ĠTherefore Ġstore Ġthe Ġcurrent ĊĠĠĠĠ Ġ* Ġconfiguration Ġin Ġthe Ġactivity Ġintent , Ġso Ġit Ġcan Ġbe Ġrestored Ġafter Ġthe Ġdee plink Ġresult . ĊĠĠĠĠ Ġ*/ ĊĠĠĠ Ġprivate Ġfun Ġstore Quote For Handle Login Deep Link ( it : ĠTo Login ) Ġ= Ġintent . putExtra ( QUOTE _ DESCRIPTION , Ġit . quote ) ĊĊĠĠĠ Ġprivate Ġval Ġbackend Configuration Ġget () Ġ= Ġintent . get Parcelable Extra < Backend Configuration >( BACKEND _ CONFIGURATION ) ĊĠĠĠ Ġprivate Ġval Ġcustomer Id Ġget () Ġ= Ġintent . getInt Extra ( CUSTOMER _ ID , Ġ- 1 ) ĊĠĠĠ Ġprivate Ġval Ġquote Ġget () Ġ= Ġintent . get Parcelable Extra < Quote Description >( QUOTE _ DESCRIPTION ) ĊĠĠĠ Ġprivate Ġval Ġtheme : ĠInt Ġget () Ġ= Ġintent . getInt Extra ( THEME , ĠR . style . B anks Theme ) ĊĊĠĠĠ Ġcompanion Ġobject Ġ{ ĊĊĠĠĠĠĠĠĠ Ġfun Ġcreate Intent ( ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcontext : ĠContext , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġbackend Configuration : ĠBackend Configuration , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġcustomer Id : ĠInt , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġsource Currency : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġtarget Currency : ĠString , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġquote Amount : ĠInt , ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ@ Style Res Ġtheme : ĠInt Ġ= ĠR . style . B anks Theme ĊĠĠĠĠĠĠĠ Ġ) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ ĠIntent ( context , ĠInternational Transfer Activity :: class . java ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput Extra ( BACKEND _ CONFIGURATION , Ġbackend Configuration ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput Extra ( CUSTOMER _ ID , Ġcustomer Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput Extra ( QUOTE _ DESCRIPTION , ĠQuote Description . Fixed Source ( quote Amount . toFloat (), Ġsource Currency , Ġtarget Currency )) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġput Extra ( THEME , Ġtheme ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠBACK END _ CONFIGURATION Ġ= Ġ" backend Configuration " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠCUSTOM ER _ ID Ġ= Ġ" customer Id " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠQU OTE _ DESCRIPTION Ġ= Ġ" quote Description " ĊĠĠĠĠĠĠĠ Ġprivate Ġconst Ġval ĠTHE ME Ġ= Ġ" theme " ĊĠĠĠ Ġ} Ċ } Ċ