From 4f9deba52e3b8acffe4f1b9bb8292cdc303ea0f1 Mon Sep 17 00:00:00 2001 From: Ossai Nwachukwu Date: Fri, 13 May 2022 13:38:12 +0100 Subject: [PATCH 01/41] initial translation for somoli --- app/src/main/res/values-so/strings.xml | 683 +++++++++++++++++++++++++ 1 file changed, 683 insertions(+) create mode 100644 app/src/main/res/values-so/strings.xml diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml new file mode 100644 index 000000000..4f11ee6ae --- /dev/null +++ b/app/src/main/res/values-so/strings.xml @@ -0,0 +1,683 @@ + + + e3b51457136ad623213ade89a42a288f + 4B6DDdYFw55PmVPTwr8Ski + Stax + https://stax.me/pay?%1$s + %1$s-%2$d-%3$s-%4$d + https://www.usehover.com + https://www.usehover.com/api + /channels?bookmarked=true + /stax_users + + /set_referee + https://stax.onelink.me/nR0j/fb15b3f2 + http://play.google.com/store/apps/details?id=com.hover.stax&showAllReviews=true + https://stax.nolt.io/ + https://416e906b.sibforms.com/serve/MUIEAAS88NDe6oTn7nl8YrIqgutsJ_GgyCYRWVsZ-S54quVNmBhvpsu70WpNXrZd-n6H5r8m1ZRfuTl8ckiQrB4sLIdNSx0Y_DFZ7_hQGCDv9PG6N0ncsHwWW3OYsMlPMHgQSR6OZf8xK8HC-NA3p3T71Pv1Coy_n9oiDRwIu7HCryUfDtfHr11mXSQ5S3JwcOd8cN7FL1ewDRqu + 82efeb23b6d38509989f592c8f4b21c2 + /get_bounty_results?device_id=%1$s + 1098235122453-5u1hct3brr4t626317k9fgjkkfdmsbvs.apps.googleusercontent.com + https://docs.usehover.com/staxpolicy + app.hover.stax + + channels-staging.json + channels-prod.json + \@joinstax + + Ardaa + Hadhaaga iyo dhaqdhaqaaqa + Hadhaaga + + Lacag hel + + Ku xidh koonto + Iibso waqtiga hawada + Dir lacag + Dalab cusub + Hagaajin + Macluumaadka koontada + Macluumaadka dhaqdhaqaaqa + Macluumaadka jadwalka + Macluumaadka dalabka + Macluumaadka xawilaadda + + Dooro Luuqad + + am + en + fr + sw + so + + + Sax + Burin + Xafid + Kaguur + Siiwad + Dir + Hagaaji + Laabo + Tibjaabo + Dhamaad + Ku gal koontada Google + + + Dhaqdhaqaaji lacagahaaga walwal la\'aann + Sawirka Stax + Ammaano. Dagdagsiimo. Huffanaan + Ku dirso lacagahaaga oo ku iibso waqtiga hawada oo dhamaan koontooyinkaaga hal meel + Ku xidh koontada hadda + + + + Stax wuxuu u shaqeeyaa qaab offline ah + Dir lacag + Dalbo lacag + Iibso waqtiga hawada + Ku gal koontada google si aad u hesho dhamaan adeegyadeena + Ku gal koontada Google + + Lacagahaaga kuxawil ammaano iyo dagdagsiimo. Khidmad la\'aan. + Ka hel lacagaha asxaaptaada iyo macaamiishaada si fudud adoo isticmaalaya link. + U iibi waqtiga hawada naftaada iyo asxaabtaada. + Ku isticmaal Stax khad iyo khad la\'aanba, Goor walba. Goor kasta. + + Isticmaal Stax diwaan galin la\'aan + Markaad sii wadato, waxaad ogashahay dhamaan shuruucda adeegga Stax. + Ka eeg shuruucda adeegga sida aan u isticmaalno xogtaada. + + + Salaan, kusoo dhawow Stax. + Haddaad Stax kucusbtahay Stax laga yaaba inaad su\'aal qabto, Noo oggolow inaan kugu caawinno cadeynta qaar. Xulo ikhtiyaarka kugu haboon adiga. + Stax ma anaa laygu talagalay? + Horey u ogtahay wax ku saabsan Stax? + Iska dhaaf + + Kusoo dhawoow Stax! + Kusoo dhawow bulshada Stax. Hadda laga bilaabo waxaad tahay Staxxer. Halkan waxaa loogu talagalay dhowr waxyaabood oo aad ku farxi karto Stax. + Woohoo! Waxaad si sax ah u tahay cidda aan raadineynay! + + Garabkaagaan taagannahay! + Waa kuwan dhowr waxyaabood oo aad ku farxi karto Stax. + Fududaynta USSD-ga + Looma baahna inaad xasuusatto boqolaal USSD kode oo isku daris. Annagaa hawusha kuu qabanayna. + Si buuxda u xakamee lacagtaada + Maaree oo ka bixi dhammaan bangiyadaada iyo xisaabaadka lacagta mobilada adoo isticmaalaya Stax. + Fudaydin horaan leh + Waxaan ka faa\'iidaysanay Android oo lagu dhisay nakhshad aamin ah si aan xogtaada u ilaalino mar walba. + Booqo Stax + + Stax wax khidmad ah may goosattaa? + Maxay Stax qabataa? + + Si loo garto haddii Stax laguugu talagalay kadooro kuwan hoose adi ku qeexayya + Waxaan adeegsaday USSD wakhti hore? + Waxaan haystaa wax ka badan hal bangi ama koonto lacageed? + Waxaan damiyaa xogteyda mobilada marwalba?ilkaaga? + Kuwan midkoodna ima khuseyso + Stax kuma dalaco khidmad dheeraad ah. Mararka qaarkood bangigaaga ama bixiyaha lacagta moobilka ayaa kugu dalaci khidmadaha wax kala iibsiga.\n\nStax waxa ay la socotaa inta lacag ay kugu soo dalacayaan + Stax waxay isticmaashaa tignoolajiyada USSD si ay kuugu suurtagasho inaad wax kala soocdo offline. Stax, waxaad ka hubin kartaa hadhaaga koontadaada, diri kartaa lacag, iibsan kartaa wakhtiga hawada, lacag ku xawili karta akoonnada gaarka ah, waxaad ka maamuli kartaa xisaabo maaliyadeed oo badan (bangi iyo lacagta mobaylada) hal app.\n\nWaxa kale oo aad samayn kartaa xidhiidho ay dadka kale ee Stax wataa awoodaan u isticmaal in aan lacag kuu soo diro. + + Kabood tababbarka + + + Kusoo dhawoow + Dir lacag + Iibso waqtiga hawada + Codso lacag + Biil bixin + + + Hadhaaga + Fadlan u jeedso xogta si aad u xajiso adeegyada. + Fadlan gali SIM si laguu taxo adeegyadaad isticmaasho. + Waa iaad doorattaa adeeg. + Majiro + Kuxidh koonto + Dooro koonto si loogu xidho. + + Koonta kale ku xidh + + Koonto kale kudarso + Taariikh + Wax dhaqdhaqaaqa malihid. Dir lacag ama iibso waqtiga hawada si aad u bilowdo. + Dhaqdhaqaaqa mustaqbalka + Xawilaaddu way hirgashay. Waxaa la sugayaa xaqiijin. + Cusboonaysii hadhaagaaga + Cusboonaysii hadhaayaasha + Cusboonaysii + Koonto gasho si\'aad u xaqiijiso hadhaagaaga + + Fiiri hadhaaga + Sax! koontada ugu horaysa waad gashatay. Hadda hadhaagaaga waad fiirin kartaa adoo isticmaalayya Stax. + Sax! Koontada si sax ah ayaa loogu xidhay. Hadda hadhaagaaga waad fiirin kartaa adoo isticmaalayya Stax. + Sax! Koontada si sax ah ayaa loogu xidhay. Hadda hadhaagaaga waad fiirin kartaa adoo isticmaalayya Stax. + + Dhawaan + Khad majiro + Koontada muhiimka ah + Koontada kale + + + koontooyinkaaga + Kudar koonto kale + Ku xidhiidh Stax koontooyinkaaga + + Raadi + %1$s " inuunan ku jirin Stax wali ama macluumaad qaldan aad galisay.
Isku day inaad wax kale raadiso]]>
+ Koontadaada lama helin? + Na ogaysii + + Gali magaca adeegga maliyadeed + Gali koodhka gaaban + Na ogaysii + Gali magaca adeega maaliyadeed + Gali koodhka gaaban ee saxda ah + Waad mahadsantahay + Inta dhiman shirkadda ayaa xaqiijin doonto adeegan si dhawaan loo shaaciyo + + Naanays + xafiday + Lanbarka koontada + Gali magac cusub + + + Magaca sharciyaysan + Koontadee? + Waxaad haystaa kabadan hal %1$s koonto. Fadlan dooro adeegga aad isticmaalayso %2$s. + Waxaa lasoo dajinayyaa idaacadaha, fadlan sug + + Koonto samays aan dhamaystirnayn + Koontadaada %1$s samayskiisu si sax ah uuma dhamaystirna. Waxaad u baahan inaan koontada soo jiidno intaadan ka dhamaan. Fadlan hadhaaga xaqiiji si aad u dhamaystirto samayka koontada. + + + Fassaxa waa loo baahan yahay. + Noo ogolow fasaxa taleefanka iyo fariimaha. + Si aad u hesho dhamaan koontooyinka iyo dabagalka dhaqdhaqaaqa koontooyinkaas, U ogolow Stax fasaxa taleefanka iyo farimmaha. + Fasaxyadan waxay Stax u ogalaanayaan garaaciodda USSD-ga iyo inuu maamulo iswaydaarsiga si uu kuu tuso wax qabadka xawilaadda. + Si uu kuugu fudaydiyo xaqiijinta hadhaaga, xawilaadda lacagta iyo iibsashada waqtiga hawada, Stax wuxuu u baahanayahay ogalaanshaha display and accessibility permission + + + Waxaan u baahannahay ogalaanshaha phone permissions si loo abuuro ID-ga caawimaadka + ogalaanshaha SIM-ka + Hal shay oo ugu dambeeya… + Stax wuxuu u baahanayahay 2 ogalaansho oo ah %1$s. + Isticmaal USSD + Iibso waqtiga hawada + Xaqiiji hadhaaga + Dir lacag + U dir lacag + Lacag xawil + Stax wuxuu u baahan yahay ogalaanshaha accessibility permission si uu %1$s + Talaabada 1aad ee 2da: Display permission + Talaabada 2aad of 2da: Accessibility permission + Itus hagaajinta + Itus hagaajinta marlabaad + + + Xaqiiji %1$s hadhaaga + Iiibsashada waqtiga hawada + Xawilaadda lacagta + Soo jiidashada koontooyinka + La xidhiidhka adeegyada USSD-ga… + Wax kala iibsiga wuu dhamaaday + + + Guulaystay + La sugayo + Guuldaraystay + Adeeggan USSD-ga + Lagama helin wax warcelina %1$s. + Waxay u eegtahay inuu %1$s istaagay warcelintu iyadoo socotta. + Lanbar sireed khalda. %1$s waxaan ku waydiinaynaa inaad fadlan marlabaad lanbar sireedkaaga aad xaqiijiso ood ku celiso + %1$s Wuxuu leeyahay inuu hadhaagaagu kugu si aad u dhamaystirto kala iibsigan. + %1$s Wuxuu leeyahay inaad haysan koonto sii aad adeeggan u isticmaasho. + Mid ka mid ah wax gelintaada ayaa ahaa mid aan sax ahayn, eeg faahfaahinta si aad u aragto waxa khaldamay. + Shabakaddaadu waxay soo celisay khalad, fadlan isku day mar kale. + Cillad aan la ogayn. + Wax jawaab ah kama helin %1$s. Uma maleyneyno in macaamilkaani uu shaqeeyay. Fadlan isku day mar kale + Waxaan ka helnay jawaab qayb keliya %1$s. Uma maleyneyno in macaamilkaani uu shaqeeyay. Fadlan isku day mar kale + Mid ka mid ah wax gelintaada ayaa ahaa mid aan sax ahayn, eeg faahfaahinta fadhiga hoose si aad u aragto waxa khaldamay. Hubi in lacag kasta, lambarada telefoonka, ama lambarrada akoonnada ay sax yihiin. Hoos ka eeg faahfaahinta kulanka. + Shabakaddaadu waxay soo celisay khalad, fadlan isku day mar kale. Haddii ay tani wax badan dhacdo fadlan la xidhiidh bixiyahaaga shabakada ama adeega lacagta si aad uga cabato. + Khalad aan la garanayn, eeg faahfaahinta hoose si aad u ogaato waxa khaldamay Fadlan isku day mar kale + Khalad kayimi socodsiinta ficilkan, Fadlan isku day mar kale + + + Tus horumarka cusub adiga oo leexinaya switch ON Shaashada xigta]]> + Shid Accessibility in the next screen si uu USSD-gu u shaqeeyo]]> + Fur hagaajinta + Talaabada xigta, taabo daarida + Ogolow display over other apps + Hagaajinta + Dami + Accessibility + Adeegga + Ogolow Accessibility + Ku xidho lacagta mobaylka iyo adeegyada isgaadhsiinta adoo ku hadlaya magacaaga + Tan waxa loo isticmaalaa in lagu akhriyo oo lala falgalo liiska USSD-ga si loo bixiyo khibrad la fududeeyey oo la heli karo. + Deegaanka gacanta ayaa lagu buuxiyaa. Kulankaan waa la duubi doonaa + Kala iibsigu wuu socdaa + Kala iibsigu wuu dhamaaday + + + Kudarso kooonto si\'aad u wadato\'. + Lacagtaada hal meel kala tix raac. Lacagahaagu waligood kaama baxayaan oo iskumana laaq mayaan + Shaqo wanaagsan! + Hadda ku dar xisaabaadkaaga kale si aad hal meel ugu arki karto dhammaan baaqyadaada gaarka ah. + + + Wareegayaa, wax yar sug + Cadadka + Koontooyinka + Koontadan kama gadan kartid wakhtiga hawada. Fadlan door akoon ka duwan + Lambarka telefoonka + Lambarka koontada + Waa in aad u ogolaato xiriiriyaha akhriska ah si ay lambar uga doortaan buugga ciwaanka. + Dhib baa ka dhacday doorashada lambarka. Fadlan isku day mar kale. + Fadlan gali lambarka loo diraha. + Fadlan gali taleefan lambar. + Fadlan gali lambarka koontada. + Fadlan gali cadad saxsan. + Fadlan doooro adeeg. + Fadlan dooro shabakadda loo diraha. + Fadlan xaqiiji inuu adeegga aad doorattay uu wax diri karo %1$s + Adeeggan looma isticmaali karo si %1$s. + Fadlan sax khaladaadka ku calaamadaysan casaanka. + Naf-ahaantay + Qof-kale + Shabakadan + ku %1$s + Sharaxaada + Waa maxay codsigaagu? + Ku + Ka + U dir lacag + U gad waqtiga hawada + Ka bixi + Tan waxa kaliya oo loo isticmaali karaa in lacag loogu xawilo akoonkaaga. + Tan waxa kaliya oo lagu iibsan karaa wakhtiga hawada ee akoonkaaga. + + Dir lacag hadda + Waqtiga hawada iibso hadda + You can review this info in the next step. + %1$d xiriirada + + %1$s Fiiri hadhaaga + %1$s U dir waqtiga hawada %2$s + %1$s U dir lacag %2$s + Ka qaado lacag %1$s + Koontooyinka laga soo jiiday %1$s + Biil %1$s bixinta + Fadhiga USSD ayaa la duubay %1$s + Ku iibso waqtiga hawada %1$s uu hel %2$s + + ku iibso %1$s wakhtiga hawada oo hel %2$s for %3$s + Dir %1$s ka %2$s illa %3$s kor %4$s + Xawil %1$s ka %2$s illa %3$s + Bixi %1$s Ka %2$s illa %3$s + + Fadlan gali wax sax ah %1$s + + + Dalbo lacag + Koontada + Gali + Tani waa meesha aad rabto inaad ka hesho lacagta la codsado + tusaale. lambarka telefoonkaaga lacagta gacanta ama lambarka xisaabta bangiga + Codsi u dir + Intee lacag ah? + Cadadka (ikhtiyaar) + Ku + + Qof kale ku dar + Si naxariis leh ii stax garee %1$s marka ugu horeysa ee kugu habboon. %2$s %3$s + %1$s + Xasuus: \"%1$s\" + Xafid codsiga? + Waa inaad bixisa ogolaanshaha SMS-ka la akhriyay si uu Stax kuugu sheego marka codsiga la diro ama la fuliyo. + Waxay u egtahay inaadan dirin codsigaaga Si kastaba ma jeclaan lahayd laxafido codsigan? + Codsigaaga waa la xafidsay. + Codsigaaga waa la qorsheeyay Waxaa lagu xasuusin doonaa inaad fariin u dirto %1$s + Rcodsi ku wajahan %1$s + Koonto + Fadlan gali taleefan lambar + Fadlan geli akoonka ama lambarka taleefanka aad rabto inaad lacagta ku hesho + Fadlan door akoon ama ku dar mid cusub si aad lacagtaada u hesho + SMS + WhatsApp + koobiyee linkiga + Linkiga waa la koobiyeeyay + Wadaag linkiga codsiga + Malabaad wadaag linkiga codsiga + Fadlan naanays cusub gali. + Fadlan gali lambar koonto cusub. + Fadlan dooro koonto. + + + Dhawaan dir + Taariikh + Hal mar kabadan dir + Intee jeer? + Dhamaadka taariikhda + Dhamaad taariikh (ikhtiyaar ah) + Imisa jeer? (ikhtiyaar ah) + Imasa jeer? + Xawilaadda waa la qorsheeyay. Waan ku xasuusinaynaa si aad u xawisho %1$s + + Maalin walba + Todobaad walba + 2dii todobaad mar + Bil walba + + + 0daily + 1weekly + 2biweekly + 3monthly + + Jadwalka + + + Isticmaalaha waa la qorsheeyay + Tus ogaysiisyada si aad u samayso wareejinta iyo codsiyada aad qorshaysay. + Waa xiligii lacagta la xawili lahaa %1$s ayadoo laysticmaalayo Stax. + Xawill hadda + Waa waqtigii loo diri lahaa codsi lacageed %1$s ayadoo laysticmaalayo Stax. + Dir codsiga + Waa waqtigii aad ku iibsan lahayd waqtiga hawada Stax. + Iibso waqtiga hawada. + + + Waxaa lasugayaa xaqiijinta + Kalfadhiga USSD waa dhammaaday, laakiin weli maanu helin xaqiijin SMS ah. + Hadhaaga + Lacagta bishan kaa baxday + Lacagta bishan kusoo gashay + Guud ahaan khidmadahan aad bixisay %1$s sanadkan + Kala iibsiga + Koontada qaataha + ID-ga kala iibsiga. + ID-ga STax + fariimaha. + Daalaco dhamaan macluumaadka + Hadhaaga cusub %1$s + + + Tirtir dhamaan dhaqdhaqaaqa mustaqbalka. + Tirtir dhaqdhaqaaqa. + Tani waxay tirtiri doontaa wax kala iibsiga mustaqbalka. Waxaad dib u qabsan kartaa wax kala iibsiga wakhti kasta. + Dhaqdhaqaaqa waa la tirtiray. + Tirtir dalabka + Tirtir dalabka + Tani waxay burin doontaa codsigan. Waxaad dib uga codsan kartaa qof lacag wakhti kasta. + Dalabka waa la tirtiray + + + Doorashada + Wadaag + Wadaag Stax + Horta, fadlan gal + Eeg macluumaadka gudbinta + Gudbinta xafidan + La koobiyey + Stax app + Wadaag appka iyada oo loo-maro + Fiiri barnaamijkan https://play.google.com/store/apps/details?id=com.hover.stax + Ku xir koontadaada + + Cillad ayaa qabsattay markii laysku dayay in lagu galo koontada Google. Fadlan markale tijaabi. + Koodhkaaga: + Koodhka agentiga + Markaad isticmaalayso Stax App, waxaad akhriday siyaasaddayada sirnimada oo aad ogolaatay shuruudaha adeegga. Guji si aad u aqriso + Xaqiiji Kabixitaanka + Kabixitaanka waa lagu guulaystay + "Miyaad hubtaa inaad kabaxdo?" + + Magacaaga buuxa gali + Taleefan lambarkaaga gali + Geli koodka gudbinta ee wakiilka Stax ee ku diwaangaliyay. + Fadlan geli koodka gudbinta. + Fadlan geli kood tixraac sax ah. + Fadlan geli magac sax ah + Fadlan geli lambar taleefan oo sax ah. + Fadlan noqo online si aad u kaydsato koodka gudbinta + Adigu ma tixraacin kartid naftaada. + Fadlan gal online si aad u hesho koodka tixraaca. + Fadlan isku day mar kale dhowr ilbiriqsi ka dib + + Amniga + Stax waxa uu buuxiyey shuruudaha 740.17(b)(3) (i) kala soocida amniga ee Xafiiska Warshadaha iyo Amniga ee Maraykanka. Software-kani waxa uu HTTPS u isticmaalayaa xidhiidhka serverka; Symmetric key RSA sir si ku meel gaar ah loogu kaydiyo aqoonsiga isticmaalaha qalabkooda iyaga oo isticmaalaya Android Keyystore; iyo koodka qarinta iyadoo la isticmaalayo DRM. + Koontada asalka ah + Maamul Koontada + Ku xafid Stax + Ka saar %1$s Hadda + Ka saar akoontiga + Waxaad akoonkaaga ku dari kartaa Stax markasta aad doontid. + Lambar sireedka waala masaxay + Xafid lambarsireedka + Hagaaji lambarsireedka + Lambar sireed + Ka saar koontada + Koontada si guul leh ayaa meesha looga saaray + Lambar sireedka waa la xafiday + Luuqadda + Nooca App-ka: %1$s\nVersion code:%2$s\nDevice ID: %3$s + Dhammaan magacyada alaabooyinka, sumadaha, iyo sumadaha ganacsiga waa hanti ay leeyihiin milkiilayaashooda. Isticmaalku ma tilmaamayo ku-xidhnaanshiyaha. + + + Baro + Tilmaamo iyo in ka badan oo ku saabsan Stax + http://joinstax.medium.com/ + + Nala soo xidhiidh + Twitter + http://twitter.com/joinstax + Hel wararka Stax + + FAQs + Codso sifada Stax + Caawimaadka iimaylka + help@stax.me + https://help@stax.me + Stax support id - %1$s + Dir iimayl adoo isticmaalaya… + + Koonto + Ka bax + Waxaad ku gashay sidii %1$s + + + Ku xaqiiji Stax + Ku cadee farahaaga + Xaqiijinta waa fashilantay + + + Dhismahan Stax wuu dhacay \n\n Soo deji dhismihii ugu dambeeyay si aad u sii wadato isticmaalka Stax. + Soo deji nooc cusub + Cusboonaysiintaadu waa soo dejinaysaa \n\n Guji badhanka hoose si aad u uninstall u saarto noocaan. Marka soo dejintaadu dhammaato taabo ogeysiinta si aad u rakibto nooca cusub. + Ka saar + Cusboonaysiinta Stax + Soo dejinta + + + %1$s ka hor + %1$s laga bilaabo hadda + Daqiiqad kayar + Kudhawaad daqiiqad + %1$d daqiiqado + Ku dhawaad saacad + Kudhawaad %1$d saacado + Maalin + %1$d Cisho + Kudhawaad bil + %1$d Bilood + Kudhawaad sanad + %1$d sanado + + + Soo jiid si\'aad u cusboonaysiiso hadhaaga + Siidaa si aad u cusboonaysiiso hadhaaga + Cusboonaysiinta hadhaaga… + Cusboonaysiinta hadhaagu way dhamaattay + Cusboonaysiintii ugu dambaysay + + + Fadliga + 💸 HEL LACAG! Khariidaynta USSD + Stax waxay ku siin doontaa USD $5 - $50 si aad ugu dhex marto socodka USSD. + Billow + 🗺 Khariidaynta isku socodka USSD + Ku Soo Dhawoow Khariidaynta Lacagta. Stax waxa uu rabaa in uu USSD u fududeeyo qof walba. Si loogu geeyo Stax dad badan oo ku nool wadamo badan, Waxaan u baahanahay in aan khariidayno USSD kasta oo caalami ah. Ku biir Stax sida Khariidadaha Lacagta oo ka hel $5 - $20 USD wax kala beddelasho kasta oo USSD ah oo aad si guul leh u khariidayso. Liiska USSD-ga ee aan wali u baahanahay (faa\'iidooyin) ayaa ku taxan bogga xiga. Waxaan ku darnaa faa\'iidooyin cusub marar badan! + 1.Ku soo gal akoonkaaga Google.\n2. ka hel abaalmarin furan mid ka mid ah akoonnada lacagta bangigaaga ama mobilkaaga.\n3. Buuxi USSD-ga kala iibsiga lagu tilmaamay fa\'iidada, sida xaqiijita hadhaaga ama iibsiga waqtiga hawada.\n 4. Xaqiiji kala iibsiga USSD-ga. Isku day haddi ay fashilantay ama ay dhamaystiri waydo\n5. Stax ayaa dib u eegi doona soo gudbintaada, taasoo qaadan karta 7–10 maalmood. \n6. Waxa mushahar lagu siinayaa dhamaadka usbuuca walba. + U iibi waqtiga hawada qof kasta %1$s + U iibi waqtiga hawada qof kale %1$s + Lacag u dir qof kale %1$s + Qof kale lacag u dir %1$s + on %1$s + in %1$s on %2$s + U dir lacag %1$s koontadaada + U dir lacag kasta %1$s koontadaada + Biil bixin %1$s + from %1$s + Lacag kaste u dir %1$s + Ganacsi walba + + Xaqiiji hadhaaga + Xaqiiji hadhaagaaga + Iimayl + Fadlan gali iimayl sax ah + Xiriirayya, Fadlan sug… + Fadlan xaqiiji inuu khad shaqaynayya kuugu jiro + Fadlan markale tijaabi. Haddii ay tani sii socoto, fadlan nagalasoo xidhiidh ussd@stax.me. + Waxaan xaqiijinaynaa dhaqdhaqaaqa. Hadduu guulaysto, Naga filo inaan mushaarkaaga ku siino muddo 10 cisho gudaheed. + Dhamaad + our requirements and is no longer available]]> + our requirements. Please try again]]> + SOCODKA LA HELI KARO + %1$s - %2$s - $%3$d + Si aad u dalbato USD $%1$d, %2$s.\n\n Isla marka aad dhammayso, waxaanu kuu soo diri doonaa iimayl si aad u ururiso macluumaadka lacag bixinta. Waxa lagu siin doonaa 7–10 maalmood oo shaqo gudahood + Billow khariidaynta USSD-ga + Waxaa la xaqiijinyaa socdaalkaaga +
If you have questions, please email us at ussd@stax.me ]]>
+ Socdaalku wuu dhamaaday + Waxaan hubinnay socodka waxayna u egtahay mid wanaagsan! Waa inaad ku haysataa iimaylka sanduuqaaga boostada oo wata macluumaadka lacag bixinta. + Socdaal kale billow + Socdaalka waa la duubay + USD $%1$d + Dooro dal + Ku raadi magac dal + Raadinaya, fadlan sug… + Dal + Fadlan daar internetka si aad u hesho adeegyada iyo wadamada. + %1$s %2$s + 🌎 Dalalkoo dhan + SIM sax ah gali + Fadlan kaarka SIM ka %1$s ka geli taleefankaaga oo isku day mar kale. + Markale tijaabi. + Gudbi socdaalka + Abaalmarinta ayaa loo gudbiyay si guul leh + Luuqad + aAbaalmarin + Wax aAbaalmarin ah lama hayo Fadlan mar kale hubi hadhow + + Maktabadda USSD + Hel koodhka gaaban ee USSD + Koodhka gaaban + Wac %1$s + Wac + + Internedka waa loobaahan yahay. + Waxaad u baahan tahay khadka internedka si aad u khariidayso isu socodka USSD. Fadlan isku day markale + Tijaabi markale + Khalad aan la garanayn, fadlan isku day mar kale. Haddii ciladdu sii socoto, fadlan xidh abka oo dib u bilow. + + Fadlan dooro ugu yaraan hal koonto oo aad Stax ku darto + + + SIM, SMS, Accessibility & Overlay + Muxuu Stax u weydiistaa ogolaanshahan? + Halkan ku dhufo si aad u ogaato + La soco wararka ugu danbeeyay ee Stax ee billaha ah. + Taabo si aad hadda u akhrido + Ma rabtaa qoraallo gaar ah oo Stax? + Imika iska diiwaan geli liiska iimaylka + Nala dhis! Kudar/Codee codso ama cillad ka warbixi. + Hadda fikir ka dhiibo + Boodhka calaamadda Stax + Ma doonaysaa in aad lacag hesho si aad Stax uga dhigto mid ka sii fiican? + Isku dar daraasadka cilmi baarista maanta + + https://joinstax.medium.com/phone-permissions-on-stax-a0ec82533570 + https://joinstax.medium.com/ + https://stax.nolt.io/ + https://joinstax.typeform.com/to/JiloPnVy + + + Hadda waxaad ku jirtaa habka tijaabada. + Habka tijaabada waa laga baxay. + Ku dhawaad! + Habka tijaabada ayaa ku hawlan + + Suaalaha badanka lawaydiiyo + Still have questions?

Email stax support ]]> + Soodejinaya… + Lama soo saari karo FAQ, fadlan isku day mar kale + Habkani waxa u baahan yahay khadka internedka, fadlan isku day mar kale + + Qaab khadla\'aan + + Stax waxay ii soo diri kartaa iimaylo mustaqbalka. + Iimayl macmiil lagama helin aaladda + Fadlan awood u geli ogolaanshaha wacitaanka si aad u garaacdo koodka USSD. + + + Fariin + Isku-dubarid + + + Saxeexaagga + Ficilka jawaabta caadiga ah + + + Isku-dubarid iimaylka xilliyo + Soo deji lifaaqyada soo socda + Si toos ah u soo deji lifaaqyada iimaylada soo socda + + Soo deji lifaaqyada kaliya marka gacanta lagu codsado + + garaac USSD + + Naga raali noqo, xidhiidhinta adeeggan wuu xun yahay. + + + Talooyinka fayoobid maliyadeed + Wadaag + Wadaag talooyin maliyadeed + Sii wad akhriska + + + Lanbar ganacsi + Xafid biil bixinta + Gali lanbar ganacsi + Naanays + Goorwalba bixi qiimo isleeg + Gali lanbar ganacsi + Tirtir + Dooro calaamad + Lanbarka koontada: %1$s + Biil bixinta waa la tirtiray + Tirtir biil bixinta + Maad hubtaa in la tirtito %1$s? + Fadlan gali lanbar ganacsi oo sax ah + Biil bixinta waa la xafiday + Fadlan gali magac sax ah + Caan ah + Hadda bixi + Cusboonaysii biil bixinta + Maad hubtaa inaad cusboonaysiin rabto %1$s? + Biilbixinta waa la cusboonaysiiyay + Cusboonaysii + + Hadda maaha + + + \ No newline at end of file From 999aa30665975ee7be66f0840e54de8de308c0af Mon Sep 17 00:00:00 2001 From: kutalek Date: Wed, 8 Jun 2022 12:37:03 -0700 Subject: [PATCH 02/41] nothing really --- app/build.gradle | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index a7c8e1856..e25c52837 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -122,6 +122,7 @@ dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) // Google + implementation "androidx.core:core-ktx:1.8.0" implementation 'androidx.appcompat:appcompat:1.4.2' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' implementation 'androidx.vectordrawable:vectordrawable:1.1.0' @@ -141,14 +142,26 @@ dependencies { implementation 'androidx.preference:preference-ktx:1.2.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' + def roomVersion = "2.4.2" + implementation "androidx.room:room-ktx:$roomVersion" + implementation "androidx.room:room-runtime:$roomVersion" + kapt "androidx.room:room-compiler:$roomVersion" + androidTestImplementation "androidx.room:room-testing:$roomVersion" + //compose implementation "androidx.compose.ui:ui:$compose_version" implementation "androidx.compose.material:material:$compose_version" implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" implementation "androidx.compose.material:material-icons-extended:$compose_version" + androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" + debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" //logging implementation 'com.jakewharton.timber:timber:4.7.1' + implementation 'com.uxcam:uxcam:3.3.7@aar' + implementation 'com.amplitude:android-sdk:2.23.2' + implementation 'com.appsflyer:af-android-sdk:6.2.3' + implementation 'com.android.installreferrer:installreferrer:2.2' // Firebase implementation platform('com.google.firebase:firebase-bom:28.4.0') @@ -166,24 +179,13 @@ dependencies { implementation 'com.google.android.gms:play-services-auth:20.2.0' implementation 'com.google.firebase:firebase-auth-ktx' - implementation 'com.amplitude:android-sdk:2.23.2' + //other implementation "com.squareup.okhttp3:okhttp:4.9.3" implementation "com.googlecode.libphonenumber:libphonenumber:8.12.9" implementation "com.github.YarikSOffice:lingver:1.3.0" - implementation 'com.appsflyer:af-android-sdk:6.2.3' - implementation 'com.android.installreferrer:installreferrer:2.2' - implementation 'com.github.bumptech.glide:glide:4.13.0' kapt 'com.github.bumptech.glide:compiler:4.13.0' - def roomVersion = "2.4.2" - implementation "androidx.room:room-ktx:$roomVersion" - implementation "androidx.room:room-runtime:$roomVersion" - kapt "androidx.room:room-compiler:$roomVersion" - androidTestImplementation "androidx.room:room-testing:$roomVersion" - - implementation "androidx.core:core-ktx:1.8.0" - //di def koin_version= "3.1.5" implementation "io.insert-koin:koin-android:$koin_version" @@ -194,20 +196,11 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' // Hover SDK - debugImplementation project(":hover.sdk") def sdk_version = "2.0.0-stax-1.11.0-pro" - - // UXCam - implementation 'com.uxcam:uxcam:3.3.7@aar' - releaseImplementation "com.hover:android-sdk:$sdk_version" - + debugImplementation project(":hover.sdk") debugImplementation 'com.android.volley:volley:1.2.1' debugImplementation 'com.google.android.gms:play-services-analytics:18.0.1' debugImplementation 'com.squareup.picasso:picasso:2.71828' debugImplementation 'io.sentry:sentry-android:4.3.0' - - //compose - androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" - debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" } \ No newline at end of file From 7d83b180c9751a13894b302f839a1bd7a41ccc23 Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Wed, 15 Jun 2022 10:26:13 +0300 Subject: [PATCH 03/41] upgrade to Koin 3.2 --- app/build.gradle | 14 ++-- .../java/com/hover/stax/database/Modules.kt | 70 ++++++++++--------- 2 files changed, 43 insertions(+), 41 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 14a0ef8d0..3625a9764 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -148,7 +148,7 @@ dependencies { implementation "androidx.compose.material:material-icons-extended:$compose_version" //logging - implementation 'com.jakewharton.timber:timber:4.7.1' + implementation 'com.jakewharton.timber:timber:5.0.1' // Firebase implementation platform('com.google.firebase:firebase-bom:28.4.0') @@ -166,15 +166,15 @@ dependencies { implementation 'com.google.android.gms:play-services-auth:20.2.0' implementation 'com.google.firebase:firebase-auth-ktx' - implementation 'com.amplitude:android-sdk:2.23.2' + implementation 'com.amplitude:android-sdk:3.35.1' implementation "com.squareup.okhttp3:okhttp:4.9.3" - implementation "com.googlecode.libphonenumber:libphonenumber:8.12.9" + implementation "com.googlecode.libphonenumber:libphonenumber:8.12.50" implementation "com.github.YarikSOffice:lingver:1.3.0" - implementation 'com.appsflyer:af-android-sdk:6.2.3' + implementation 'com.appsflyer:af-android-sdk:6.6.1' implementation 'com.android.installreferrer:installreferrer:2.2' - implementation 'com.github.bumptech.glide:glide:4.13.0' - kapt 'com.github.bumptech.glide:compiler:4.13.0' + implementation 'com.github.bumptech.glide:glide:4.13.2' + kapt 'com.github.bumptech.glide:compiler:4.13.2' def roomVersion = "2.4.2" implementation "androidx.room:room-ktx:$roomVersion" @@ -185,7 +185,7 @@ dependencies { implementation "androidx.core:core-ktx:1.8.0" //di - def koin_version= "3.1.5" + def koin_version= "3.2.0" implementation "io.insert-koin:koin-android:$koin_version" // Tests diff --git a/app/src/main/java/com/hover/stax/database/Modules.kt b/app/src/main/java/com/hover/stax/database/Modules.kt index 21e0daa9a..1de13a906 100644 --- a/app/src/main/java/com/hover/stax/database/Modules.kt +++ b/app/src/main/java/com/hover/stax/database/Modules.kt @@ -35,50 +35,52 @@ import com.hover.stax.transactions.TransactionRepo import com.hover.stax.transfers.TransferViewModel import com.hover.stax.user.UserRepo import org.koin.androidx.viewmodel.dsl.viewModel +import org.koin.androidx.viewmodel.dsl.viewModelOf +import org.koin.core.module.dsl.singleOf import org.koin.dsl.module val appModule = module { - viewModel { FaqViewModel() } - viewModel { ActionSelectViewModel(get()) } - viewModel { ChannelsViewModel(get(), get(), get(), get(), get()) } - viewModel { AccountsViewModel(get(), get(), get(), get()) } - viewModel { AccountDetailViewModel(get(), get(), get(), get(), get()) } - viewModel { NewRequestViewModel(get(), get(), get(), get(), get()) } - viewModel { TransferViewModel(get(), get(), get(), get()) } - viewModel { ScheduleDetailViewModel(get(), get(), get()) } - viewModel { BalancesViewModel(get(), get(), get()) } - viewModel { TransactionHistoryViewModel(get(), get()) } - viewModel { BannerViewModel(get(), get()) } - viewModel { FutureViewModel(get(), get(), get()) } - viewModel { LoginViewModel(get(), get(), get())} - viewModel { TransactionDetailsViewModel(get(), get(), get(), get(), get(), get(), get(), get()) } - viewModel { LanguageViewModel(get()) } - viewModel { BountyViewModel(get(), get(), get(), get()) } - viewModel { FinancialTipsViewModel(get()) } - viewModel { PaybillViewModel(get(), get(), get(), get(), get(), get()) } - viewModel { MerchantViewModel(get(), get(), get(), get()) } - viewModel { RequestDetailViewModel(get(), get(), get()) } - viewModel { BonusViewModel(get(), get()) } + viewModelOf(::FaqViewModel) + viewModelOf(::ActionSelectViewModel) + viewModelOf(::ChannelsViewModel) + viewModelOf(::AccountsViewModel) + viewModelOf(::AccountDetailViewModel) + viewModelOf(::NewRequestViewModel) + viewModelOf(::TransferViewModel) + viewModelOf(::ScheduleDetailViewModel) + viewModelOf(::BalancesViewModel) + viewModelOf(::TransactionHistoryViewModel) + viewModelOf(::BannerViewModel) + viewModelOf(::FutureViewModel) + viewModelOf(::LoginViewModel) + viewModelOf(::TransactionDetailsViewModel) + viewModelOf(::LanguageViewModel) + viewModelOf(::BountyViewModel) + viewModelOf(::FinancialTipsViewModel) + viewModelOf(::PaybillViewModel) + viewModelOf(::MerchantViewModel) + viewModelOf(::RequestDetailViewModel) + viewModelOf(::BonusViewModel) } val dataModule = module(createdAtStart = true) { single { AppDatabase.getInstance(get()) } single { HoverRoomDatabase.getInstance(get()) } - single { TransactionRepo(get()) } - single { ChannelRepo(get(), get()) } - single { ActionRepo(get()) } - single { ContactRepo(get()) } - single { AccountRepo(get()) } - single { RequestRepo(get()) } - single { ScheduleRepo(get()) } - single { PaybillRepo(get()) } - single { MerchantRepo(get()) } - single { UserRepo(get()) } - single { BonusRepo(get()) } - single { ParserRepo(get()) } + singleOf(::TransactionRepo) + singleOf(::ChannelRepo) + singleOf(::ActionRepo) + singleOf(::ContactRepo) + singleOf(::AccountRepo) + singleOf(::RequestRepo) + singleOf(::ScheduleRepo) + singleOf(::PaybillRepo) + singleOf(::MerchantRepo) + singleOf(::UserRepo) + singleOf(::BonusRepo) + singleOf(::ParserRepo) } val networkModule = module { - single { LoginNetworking(get()) } + singleOf(::LoginNetworking) } \ No newline at end of file From 59629961a84f167a16342ca78c5bc42367367935 Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Wed, 15 Jun 2022 15:49:16 +0300 Subject: [PATCH 04/41] minor refactors to modules, tested new package structure with bonuses --- .../com/hover/stax/ApplicationInstance.kt | 6 +- .../main/java/com/hover/stax/data/Resource.kt | 7 +++ .../data/repository/BonusRepositoryImpl.kt | 58 +++++++++++++++++++ .../hover/stax/{database => di}/Modules.kt | 30 +++++++++- .../stax/domain/repository/BonusRepository.kt | 17 ++++++ .../stax/domain/use_case/FetchBonusUseCase.kt | 10 ++++ .../stax/domain/use_case/GetBonusesUseCase.kt | 41 +++++++++++++ .../java/com/hover/stax/home/HomeFragment.kt | 15 ++++- .../hover/stax/presentation/home/HomeState.kt | 9 +++ .../stax/presentation/home/HomeViewModel.kt | 34 +++++++++++ 10 files changed, 219 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/com/hover/stax/data/Resource.kt create mode 100644 app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt rename app/src/main/java/com/hover/stax/{database => di}/Modules.kt (79%) create mode 100644 app/src/main/java/com/hover/stax/domain/repository/BonusRepository.kt create mode 100644 app/src/main/java/com/hover/stax/domain/use_case/FetchBonusUseCase.kt create mode 100644 app/src/main/java/com/hover/stax/domain/use_case/GetBonusesUseCase.kt create mode 100644 app/src/main/java/com/hover/stax/presentation/home/HomeState.kt create mode 100644 app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt diff --git a/app/src/main/java/com/hover/stax/ApplicationInstance.kt b/app/src/main/java/com/hover/stax/ApplicationInstance.kt index 27790fb57..4e6540656 100644 --- a/app/src/main/java/com/hover/stax/ApplicationInstance.kt +++ b/app/src/main/java/com/hover/stax/ApplicationInstance.kt @@ -8,9 +8,7 @@ import com.appsflyer.AppsFlyerProperties import com.google.firebase.FirebaseApp import com.google.firebase.crashlytics.FirebaseCrashlytics import com.hover.sdk.api.Hover -import com.hover.stax.database.appModule -import com.hover.stax.database.dataModule -import com.hover.stax.database.networkModule +import com.hover.stax.di.* import com.hover.stax.utils.network.NetworkMonitor import com.uxcam.UXCam import com.yariksoffice.lingver.Lingver @@ -47,7 +45,7 @@ class ApplicationInstance : Application() { private fun initDI() { startKoin { androidContext(this@ApplicationInstance) - modules(listOf(appModule, dataModule, networkModule)) + modules(listOf(appModule, dataModule, networkModule, repositories, useCases)) } } diff --git a/app/src/main/java/com/hover/stax/data/Resource.kt b/app/src/main/java/com/hover/stax/data/Resource.kt new file mode 100644 index 000000000..e956dc52e --- /dev/null +++ b/app/src/main/java/com/hover/stax/data/Resource.kt @@ -0,0 +1,7 @@ +package com.hover.stax.data + +sealed class Resource(val data: T? = null, val message: String? = null) { + class Success(data: T) : Resource(data) + class Error(message: String, data: T? = null) : Resource(data, message) + class Loading(data: T? = null) : Resource(data) +} diff --git a/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt b/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt new file mode 100644 index 000000000..14dea82cb --- /dev/null +++ b/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt @@ -0,0 +1,58 @@ +package com.hover.stax.data.repository + +import com.google.firebase.firestore.ktx.firestore +import com.google.firebase.firestore.ktx.firestoreSettings +import com.google.firebase.ktx.Firebase +import com.hover.stax.bonus.Bonus +import com.hover.stax.bonus.BonusRepo +import com.hover.stax.domain.repository.BonusRepository +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import timber.log.Timber + +class BonusRepositoryImpl(private val bonusRepo: BonusRepo, private val coroutineDispatcher: CoroutineDispatcher) : BonusRepository { + + private val settings = firestoreSettings { isPersistenceEnabled = true } + private val db = Firebase.firestore.also { it.firestoreSettings = settings } + + override suspend fun fetchBonuses() { + withContext(coroutineDispatcher) { + db.collection("bonuses") + .get() + .addOnSuccessListener { snapshot -> + val results = snapshot.map { document -> + Bonus( + document.data["user_channel"].toString().toInt(), document.data["purchase_channel"].toString().toInt(), + document.data["bonus_percent"].toString().toDouble(), document.data["message"].toString() + ) + } + + Timber.e("Saved ${results.size} bonuses") + launch { + saveBonuses(results) + } + } + .addOnFailureListener { + Timber.e("Error fetching bonuses: ${it.localizedMessage}") + } + } + } + + override suspend fun getBonusList(): Flow> { + return bonusRepo.bonuses + } + + override suspend fun saveBonuses(bonusList: List) { + return bonusRepo.save(bonusList) + } + + override suspend fun getBonusByPurchaseChannel(channelId: Int): Bonus? { + return bonusRepo.getBonusByPurchaseChannel(channelId) + } + + override suspend fun getBonusByUserChannel(channelId: Int): Bonus? { + return bonusRepo.getBonusByUserChannel(channelId) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/database/Modules.kt b/app/src/main/java/com/hover/stax/di/Modules.kt similarity index 79% rename from app/src/main/java/com/hover/stax/database/Modules.kt rename to app/src/main/java/com/hover/stax/di/Modules.kt index 1de13a906..f2cfd8350 100644 --- a/app/src/main/java/com/hover/stax/database/Modules.kt +++ b/app/src/main/java/com/hover/stax/di/Modules.kt @@ -1,8 +1,9 @@ -package com.hover.stax.database +package com.hover.stax.di import com.hover.sdk.database.HoverRoomDatabase import com.hover.stax.accounts.AccountDetailViewModel import com.hover.stax.accounts.AccountRepo +import com.hover.stax.accounts.AccountsViewModel import com.hover.stax.actions.ActionRepo import com.hover.stax.actions.ActionSelectViewModel import com.hover.stax.addChannels.ChannelsViewModel @@ -11,8 +12,13 @@ import com.hover.stax.bonus.BonusRepo import com.hover.stax.bonus.BonusViewModel import com.hover.stax.bounties.BountyViewModel import com.hover.stax.channels.ChannelRepo -import com.hover.stax.accounts.AccountsViewModel import com.hover.stax.contacts.ContactRepo +import com.hover.stax.data.repository.BonusRepositoryImpl +import com.hover.stax.database.AppDatabase +import com.hover.stax.database.ParserRepo +import com.hover.stax.domain.repository.BonusRepository +import com.hover.stax.domain.use_case.FetchBonusUseCase +import com.hover.stax.domain.use_case.GetBonusesUseCase import com.hover.stax.faq.FaqViewModel import com.hover.stax.financialTips.FinancialTipsViewModel import com.hover.stax.futureTransactions.FutureViewModel @@ -24,6 +30,7 @@ import com.hover.stax.merchants.MerchantRepo import com.hover.stax.merchants.MerchantViewModel import com.hover.stax.paybill.PaybillRepo import com.hover.stax.paybill.PaybillViewModel +import com.hover.stax.presentation.home.HomeViewModel import com.hover.stax.requests.NewRequestViewModel import com.hover.stax.requests.RequestDetailViewModel import com.hover.stax.requests.RequestRepo @@ -34,9 +41,11 @@ import com.hover.stax.transactions.TransactionHistoryViewModel import com.hover.stax.transactions.TransactionRepo import com.hover.stax.transfers.TransferViewModel import com.hover.stax.user.UserRepo -import org.koin.androidx.viewmodel.dsl.viewModel +import kotlinx.coroutines.Dispatchers import org.koin.androidx.viewmodel.dsl.viewModelOf +import org.koin.core.module.dsl.factoryOf import org.koin.core.module.dsl.singleOf +import org.koin.core.qualifier.named import org.koin.dsl.module val appModule = module { @@ -61,6 +70,8 @@ val appModule = module { viewModelOf(::MerchantViewModel) viewModelOf(::RequestDetailViewModel) viewModelOf(::BonusViewModel) + + viewModelOf(::HomeViewModel) } val dataModule = module(createdAtStart = true) { @@ -83,4 +94,17 @@ val dataModule = module(createdAtStart = true) { val networkModule = module { singleOf(::LoginNetworking) +} + +val repositories = module { + single(named("CoroutineDispatcher")) { + Dispatchers.IO + } + + single { BonusRepositoryImpl(get(), get(named("CoroutineDispatcher"))) } +} + +val useCases = module { + factoryOf(::GetBonusesUseCase) + factoryOf(::FetchBonusUseCase) } \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/repository/BonusRepository.kt b/app/src/main/java/com/hover/stax/domain/repository/BonusRepository.kt new file mode 100644 index 000000000..34d2f07aa --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/repository/BonusRepository.kt @@ -0,0 +1,17 @@ +package com.hover.stax.domain.repository + +import com.hover.stax.bonus.Bonus +import kotlinx.coroutines.flow.Flow + +interface BonusRepository { + + suspend fun fetchBonuses() + + suspend fun getBonusList(): Flow> + + suspend fun saveBonuses(bonusList: List) + + suspend fun getBonusByPurchaseChannel(channelId: Int): Bonus? + + suspend fun getBonusByUserChannel(channelId: Int): Bonus? +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/use_case/FetchBonusUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/FetchBonusUseCase.kt new file mode 100644 index 000000000..4c92ff885 --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/use_case/FetchBonusUseCase.kt @@ -0,0 +1,10 @@ +package com.hover.stax.domain.use_case + +import com.hover.stax.domain.repository.BonusRepository + +class FetchBonusUseCase(private val repository: BonusRepository) { + + suspend operator fun invoke() { + repository.fetchBonuses() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/use_case/GetBonusesUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/GetBonusesUseCase.kt new file mode 100644 index 000000000..a00c87b4b --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/use_case/GetBonusesUseCase.kt @@ -0,0 +1,41 @@ +package com.hover.stax.domain.use_case + +import com.hover.stax.bonus.Bonus +import com.hover.stax.data.Resource +import com.hover.stax.domain.repository.BonusRepository +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.collect +import kotlinx.coroutines.flow.flow +import timber.log.Timber + +class GetBonusesUseCase(private val repository: BonusRepository) { + + fun getBonusList(): Flow>> = flow { + emit(Resource.Loading()) + repository.getBonusList().collect { + emit(Resource.Success(it)) + } + } + + fun getBonusByPurchaseChannel(channelId: Int): Flow> = flow { + emit(Resource.Loading()) + + val bonus = repository.getBonusByPurchaseChannel(channelId) + + if(bonus != null) + emit(Resource.Success(bonus)) + else + emit(Resource.Error("Bonus not found")) + } + + fun getBonusByUserChannel(channelId: Int): Flow> = flow { + emit(Resource.Loading()) + + val bonus = repository.getBonusByUserChannel(channelId) + + if(bonus != null) + emit(Resource.Success(bonus)) + else + emit(Resource.Error("Bonus not found")) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/home/HomeFragment.kt b/app/src/main/java/com/hover/stax/home/HomeFragment.kt index 03ad83c06..3e5856920 100644 --- a/app/src/main/java/com/hover/stax/home/HomeFragment.kt +++ b/app/src/main/java/com/hover/stax/home/HomeFragment.kt @@ -15,9 +15,12 @@ import com.hover.stax.R import com.hover.stax.addChannels.ChannelsViewModel import com.hover.stax.bonus.Bonus import com.hover.stax.bonus.BonusViewModel +import com.hover.stax.data.Resource import com.hover.stax.databinding.FragmentHomeBinding import com.hover.stax.financialTips.FinancialTip import com.hover.stax.financialTips.FinancialTipsViewModel +import com.hover.stax.presentation.home.HomeState +import com.hover.stax.presentation.home.HomeViewModel import com.hover.stax.utils.AnalyticsUtil import com.hover.stax.utils.NavUtil import com.hover.stax.utils.collectLatestLifecycleFlow @@ -37,6 +40,8 @@ class HomeFragment : Fragment() { private val bonusViewModel: BonusViewModel by sharedViewModel() private val channelsViewModel: ChannelsViewModel by sharedViewModel() + private val homeViewModel: HomeViewModel by viewModel() + override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { AnalyticsUtil.logAnalyticsEvent(getString(R.string.visit_screen, getString(R.string.visit_home)), requireContext()) _binding = FragmentHomeBinding.inflate(inflater, container, false) @@ -47,7 +52,15 @@ class HomeFragment : Fragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - bonusViewModel.fetchBonuses() + homeViewModel.getBonusList() + collectLatestLifecycleFlow(homeViewModel.bonusList) { + when(it){ + is HomeState.Loading -> Timber.e("Loading bonuses") + is HomeState.BonusList -> Timber.e("Found ${it.bonuses.size} bonuses") + is HomeState.Error -> Timber.e(it.message) + } + } + setupBanner() binding.airtime.setOnClickListener { navigateTo(getTransferDirection(HoverAction.AIRTIME)) } diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt new file mode 100644 index 000000000..5356cdffd --- /dev/null +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt @@ -0,0 +1,9 @@ +package com.hover.stax.presentation.home + +import com.hover.stax.bonus.Bonus + +sealed class HomeState { + object Loading : HomeState() + data class BonusList(val bonuses: List) : HomeState() + data class Error(val message: String) : HomeState() +} diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt new file mode 100644 index 000000000..689537001 --- /dev/null +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt @@ -0,0 +1,34 @@ +package com.hover.stax.presentation.home + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.hover.stax.data.Resource +import com.hover.stax.domain.use_case.FetchBonusUseCase +import com.hover.stax.domain.use_case.GetBonusesUseCase +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.launch + +class HomeViewModel(private val getBonusesUseCase: GetBonusesUseCase, private val fetchBonusUseCase: FetchBonusUseCase) : ViewModel() { + + private val _bonusList = MutableStateFlow(HomeState.BonusList(emptyList())) + val bonusList = _bonusList.asStateFlow() + + init { + fetchBonuses() + } + + private fun fetchBonuses() = viewModelScope.launch { + fetchBonusUseCase.invoke() + } + + fun getBonusList() = getBonusesUseCase.getBonusList().onEach { result -> + when (result) { + is Resource.Loading -> _bonusList.value = HomeState.Loading + is Resource.Success -> _bonusList.value = HomeState.BonusList(result.data!!) + is Resource.Error -> _bonusList.value = HomeState.Error("No bonuses found") + } + }.launchIn(viewModelScope) +} \ No newline at end of file From b76c1dd9ec1771ba82097b82bb3976670a30bf1e Mon Sep 17 00:00:00 2001 From: Ossai Nwachukwu Date: Wed, 15 Jun 2022 14:53:11 +0100 Subject: [PATCH 05/41] Added om lang and updated for so reference --- app/src/main/res/values-am/strings.xml | 4 + app/src/main/res/values-fr/strings.xml | 4 + app/src/main/res/values-om/strings.xml | 683 +++++++++++++++++++++++++ app/src/main/res/values-so/strings.xml | 1 + app/src/main/res/values-sw/strings.xml | 4 + app/src/main/res/values/strings.xml | 2 + 6 files changed, 698 insertions(+) create mode 100644 app/src/main/res/values-om/strings.xml diff --git a/app/src/main/res/values-am/strings.xml b/app/src/main/res/values-am/strings.xml index bf6b24f33..dd740d0ed 100644 --- a/app/src/main/res/values-am/strings.xml +++ b/app/src/main/res/values-am/strings.xml @@ -13,6 +13,10 @@ + ሶማሌ + + ኦሮምኛ + እሺ diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 8f8e3f9be..ad197fc76 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -40,6 +40,10 @@ sw + so + + om + D\'accord diff --git a/app/src/main/res/values-om/strings.xml b/app/src/main/res/values-om/strings.xml new file mode 100644 index 000000000..50a5ec3c3 --- /dev/null +++ b/app/src/main/res/values-om/strings.xml @@ -0,0 +1,683 @@ + + + e3b51457136ad623213ade89a42a288f + 4B6DDdYFw55PmVPTwr8Ski + Stax + https://stax.me/pay?%1$s + %1$s-%2$d-%3$s-%4$d + https://www.usehover.com + https://www.usehover.com/api + /channels?bookmarked=true + /stax_users + + /set_referee + https://stax.onelink.me/nR0j/fb15b3f2 + http://play.google.com/store/apps/details?id=com.hover.stax&showAllReviews=true + https://stax.nolt.io/ + https://416e906b.sibforms.com/serve/MUIEAAS88NDe6oTn7nl8YrIqgutsJ_GgyCYRWVsZ-S54quVNmBhvpsu70WpNXrZd-n6H5r8m1ZRfuTl8ckiQrB4sLIdNSx0Y_DFZ7_hQGCDv9PG6N0ncsHwWW3OYsMlPMHgQSR6OZf8xK8HC-NA3p3T71Pv1Coy_n9oiDRwIu7HCryUfDtfHr11mXSQ5S3JwcOd8cN7FL1ewDRqu + 82efeb23b6d38509989f592c8f4b21c2 + /get_bounty_results?device_id=%1$s + 1098235122453-5u1hct3brr4t626317k9fgjkkfdmsbvs.apps.googleusercontent.com + https://docs.usehover.com/staxpolicy + app.hover.stax + + channels-staging.json + channels-prod.json + \@joinstax + + Mana + Madaallii fi seenaa + Madaallii + + Kaffaltii Argachuu + + Akkaawuntii tokko walitti hidhu + Yeroo qilleensaa bitachuu + Dabarsuu + Gaaffii Haaraa + Sajoolee + Bal\'ina Herregaa + Bal\'ina Daldalaa + Bal\'ina Sagantaa + Bal\'inaan Gaaffii + Bal\'ina Jijjiirraa + + Choose a language + + am + en + fr + sw + so + om + + + TOLE + Haquu + Qusachuu + Dhiisuu + Itti fufuu + Erguu + Gulaaluu + Dugda + Qormaata + Raawwatame + Google tiin galmaa\'i + + + Dhiphina malee maallaqa sochoosuu + dugduubee Stax + Nageenya eegamaa. Ariifataa. Mijataa + Maallaqa erguu fi herrega baankii fi momo qabdu fayyadamuun yeroo qilleensaa offline bitadhaa + Amma akkaawuntii keessan walitti hidhaa + + + + Stax sarara ala hojjeta + Maallaqa ergaa + Maallaqa gaafadhaa + Yeroo qilleensaa bitachuu + Muuxannoo Stax guutuu argachuuf Google waliin itti fufaa + Google waliin itti fufaa + + Maallaqa haala nageenya qabuu fi salphaatti dabarsuu. Kaffaltii dabalataa hin kaffalamu. + Link salphaa ta\'een maamiltootaa fi hiriyoota irraa saffisaan kaffaltii argadhaa. + Yeroo qilleensaa sekondii muraasa keessatti siifi namoota jaallattuuf guuti. + Stax interneetii waliin ykn osoo hin qabaatin fayyadamaa. Yeroo kamiyyuu. Bakka kamittuu. + + Stax osoo hin seenin fayyadami + Itti fufuudhaan, Haala tajaajila Stax irratti walii galtee jirta. + Imaammata Dhuunfaa keenya keessatti akkaataa daataa keessan itti fayyadamnu ilaali. + + + Akkam, baga nagaan gara Stax dhuftan. + Yoo Stax irratti haaraa taate gaaffii tokko tokko qabaachuu dandeessa, tokko tokko qulqulleessuuf haa gargaarru. Filannoo baay\'ee siif ta\'u filadhu. + Stax anaaf ta\'aa? + Waa\'ee stax duraan beektu? + Irra darbuu + + Gara Stax baga nagaan dhuftan! + Gara Hawaasa Stax baga nagaan dhuftan. Ati akka ofiisaatti Staxxer dha. Kunoo wantoota tokko lama waa\'ee Stax si gammachiisu. + Woohoo! Ati sirriitti nama barbaadaa turredha! + + Si uwwifnee jirra! + Waa\'ee Stax irratti wantoota si gammachiisan tokko lama kunooti. + USSD kan ofumaan hojjetu + Walnyaatinsa koodii USSD dhibbaan lakkaa\'aman yaadachuun hin barbaachisu. Isiniif lakkoofnee jirra. + Maallaqa kee guutummaatti to\'adhu + Baankii fi herrega maallaqa moobaayilaa keessan hunda irraa Stax irraa bulchuu fi baasuu. + Dizaayiniin nageenya qaba + Odeeffannoo keessan yeroo hunda nageenya akka qabaatu gochuuf dizaayinoota nageenyaa Android\'n ijaaraman fayyadamne. + Stax qoradhu + + Stax kaffaltii ni kaffalaa? + Stax maal hojjeta? + + Stax siif ta\'uu isaa adda baasuuf hamma siif ibsu filadhu + Yeroo darbe USSD fayyadameeraa? + Herrega baankii ykn Mobile Money tokkoo ol qabaa? + Daataa moobaayila koo yeroo baayyee nan cufa? + Kanneen keessaa tokkollee hin hojjetu + Stax kaffaltii dabalataa si hin kaffalu. Yeroo tokko tokko baankii ykn dhiyeessaan maallaqa moobaayilaa kee daldala raawwachuu keetiin kaffaltii si irraa kaffala.\n\nStax maallaqa meeqa akka si irraa kaffalan hordofa. + Stax teknooloojii USSD fayyadamuun sarara ala daldala akka dandeessan taasisa. Stax waliin, hafnaan herrega keessanii ilaaluu, maallaqa erguu, yeroo qilleensaa bitachuu, herrega ofii keessaa maallaqa dabarsuu, herrega faayinaansii (baankii fi maallaqa moobaayilaa) hedduu appii tokko irraa to\'achuu dandeessu.\n\nAkkasumas hidhannoo namoonni Stax qaban biroo danda\'an uumuu dandeessu qarshii siif erguuf itti fayyadami. + + Barnoota darbi + + + Baga nagaan dhuftan + Maallaqa ergaa + Yeroo qilleensaa bitadhaa + Maallaqa gaafadhaa + Kaffaltii kaffalaa + + + Madaallii + Mee tajaajila fe\'uuf daataa ibsi. + Maaloo filannoowwan calaluuf SIM deeggarame galchi. + Tajaajila tokko filachuu qabda. + Akkaawuntii hin dabalamne + Akkaawuntii walitti hidhu + Akkaawuntii walitti hidhu filadhu. + + Akkaawuntii biraa walitti hidhu + + Akkaawuntii biraa itti dabali + Seenaa + Ammallee seenaa hin qabdu. Maallaqa ergi ykn yeroo qilleensaa bitadhaa jalqabuuf. + Daldala Fuulduraa + Daldala ergame. Mirkaneessa eegaa jira. + Madaallii kee haaromsi + Madaallii kee haaromsi + Haaromsaa + Hafnaan keessan ilaaluuf herrega itti dabalaa. + + Hafnaan isaa ilaali + Gaarii! Akkaawuntii kee isa jalqabaa itti dabalte. Amma madaallii keessan Stax irratti ilaaluu dandeessu. + Gaarii! Account milkaa\'inaan dabalame. Amma madaallii keessan Stax irratti ilaaluu dandeessu. + Gaarii! Akkaawuntii milkaa\'inaan dabalame. Amma madaallii keessan Stax irratti ilaaluu dandeessu. + + Booda + Walitti dhufeenya hin qabu + Akkaawuntii keessan isa guddaa + Akkaawuntii keessan kan biraa + + + Akkaawuntii keessan + Akkaawuntii itti dabali + Akkaawuntii gara Stax tti dabaluu + + Barbaaduu + %1$s " ammallee Stax irratti hin tarreeffamne ykn galmee isaa sirrii hin taane.
Waan biraa barbaaduuf yaali.]]>
+ Dhaabbata faayinaansii keessan argachuu hin dandeenyee? + Asirratti nu beeksisaa + + Maqaa maallaqa baankii/mobaayilaa galchi + Koodii gabaabaa galchi + Nu Beeksisaa + Maqaa dhaabbata faayinaansii galchi + Koodii gabaabaa sirrii galchi + Galatoomaa + Gareen Stax gamaaggamuu fi yeroo dhiyootti tajaajila kana dabaluudhaaf sirrii akka argatu mirkanaa\'aa + + Maqaa ijoollee + Fayye + Lakkoofsa herregaa + Maqaa haaraa galchi + + + Maqaa ofiisaa + Akkaawuntii kam? + Herrega %1$s tokkoo ol qabda. Maaloo isa kam fayyadamuu akka barbaaddu gara %2$s filadhu. + Chaanaalii galchaa jiru, mee eegaa + + Saagi herregaa guutuu hin taane + Herregni kee %1$s guutummaatti hin qindaa\'in. Itti fufuu keessan dura akkaawuntii keessan fiduu qabna. Maaloo qixeessuu xumuruuf madaallii isaa ilaaluu hojjedhu. + + + Hayyama barbaachisa + Hayyama bilbilaa fi ergaa gabaabaa nuuf kennaa. + Akkaawuntii adda addaa keessan hunda argachuu fi daldala akkaawuntii sana irratti raawwatamu adda baasuuf, Stax bilbilaa fi ergaa gabaabaa keessan akka fayyadamu hayyamaa. + Hayyamni kun Stax koodii USSD bakka bu\'ee akka bilbiluu fi haguuggii adeemsa daldalaa sitti agarsiisu akka uumu hayyamu. + Dandeettii hafnaan kee ilaaluu, maallaqa dabarsuu ykn yeroo qilleensaa bitachuu siif kennuudhaaf, Stax hayyama agarsiisaa fi dhaqqabummaa kee barbaada + + + ID deeggarsa keessan uumuuf hayyama bilbilaa nu barbaachisa + Hayyama SIM kenni + Wanti dhumaa tokko… + Stax hayyama 2 gara %1$s barbaada. + USSD fayyadamaa + yeroo qilleensaa bitachuu + madaallii isaa ilaaluu + maallaqa ergaa + maallaqa erguu gara + maallaqa sochoosuu + Stax hayyama dhaqqabummaa gara %1$s barbaada + Tarkaanfii 1ffaa 2ffaa: Hayyama agarsiisi + Tarkaanfii 2ffaa 2ffaa: Hayyama dhaqqabummaa + Sajoo agarsiisi + Sajoo irra deebi\'ii agarsiisi + + + Hafnaan %1$s sakatta\'aa jira + Yeroo qilleensaa bitachuu + Maallaqa dabarsuu + Herrega fiduu + Tajaajila USSD waliin walqunnamsiisuu… + Daldalli xumurame + + + Milkaa\'e + Eeggataa kan jiru + Hin milkoofne + tajaajila USSD kana + %1$s irraa deebii hin qabu. + %1$s karaa gartokkee deebii kennuu dhaabe fakkaata. + Dogoggora PIN. %1$s maaloo PIN kee ilaaliitii irra deebitee yaali akka si gaafatu. + %1$s hafnaan kee daldala kana xumuruuf baay\'ee gadi aanaadha jedha. + %1$s tajaajila kanaaf hin galmoofne jedha. + Galteen kee tokko sirrii hin turre, maaltu akka dogoggora ta\'e ilaaluuf bal\'inaan ilaali. + Neetworkiin kee dogongora deebise, maaloo irra deebi\'ii yaali. + Dogoggora hin beekamne. + %1$s irraa deebii hin arganne. Daldalli kun waan hojjete hin fakkaatu. Mee irra deebi\'ii yaali. + %1$s irraa deebii gartokkee qofa arganne. Daldalli kun waan hojjete hin fakkaatu. Mee irra deebi\'ii yaali. + Galtee kee keessaa tokko sirrii hin turre, maaltu akka dogoggora ta\'e ilaaluuf ibsa turtii armaan gadii ilaali. Maallaqni, lakkoofsi bilbilaa ykn lakkoofsi herregaa kamiyyuu sirrii ta’uu isaa mirkaneessi. Bal'ina walgahii armaan gadii ilaali. + Neetworkiin kee dogongora deebise, maaloo irra deebi\'ii yaali. Yoo kun baay\'ee ta\'e maaloo dhiyeessaa networkii ykn tajaajila maallaqaa keessan qunnamuun komii dhiheessaa. + Dogoggora hin beekamne, maaltu akka dogoggora ta\'e baruuf bal\'inaan armaan gadii ilaali. Mee irra deebi'ii yaali. + Dogoggora tarkaanfii fiigicha. Mee irra deebi\'ii yaali. + + + Fooyya\'iinsa adeemsaa garagalchuudhaan agarsiisi switch ON iskiriinii itti aanu keessatti.
]]> + Dhaqqabummaa banaa
in the iskiriinii itti aanu walgahii USSD fiiguuf]]> + Sajoo banaa + Itti aansuudhaan, switch ON jedhu tuqi + Appilikeeshiniiwwan biroo irratti agarsiisuu hayyami + Sajoolee + Dhaamsuu + Dhaqqabummaa + Tajaajila + Dhaqqabummaa dandeessisi + Bakka bu\'uun tajaajila Mobile Money fi Telecom waliin wal qunnamaa + Kunis muuxannoo salphaa fi dhaqqabamaa ta\'e kennuudhaaf menu USSD dubbisuu fi waliin walqunnamuuf fayyadama. + Naannoo harkaan socho\'aa jira. Kutaan kun ni waraabama. + Daldala gochuu + Daldalli xumurame + + + Jalqabuuf account itti dabali. + Maallaqa keessan hunda bakka tokkotti hordofaa. Maallaqni kee gonkumaa akkaawuntii ykn mix kee keessaa hin bahu. + Hojii guddaa! + Amma herrega keessan kanneen biroo itti dabalaa akka hafnaan adda addaa keessan hunda bakka tokkotti ilaaluu dandeessu. + + + Buusujirra, yeroo tokko + Hamma + Herrega + Akkaawuntii kun buy airtime hin deeggaru. Maaloo akkaawuntii adda ta\'e filadhu. + lakkoofsa bilbilaa quunnamtii + Lakkoofsa herregaa quunnamtii + Kitaaba teessoo kee keessaa lakkoofsa filachuuf hayyama quunnamtii dubbisaniif kennuu qabda. + Quunnamtii keessan filachuu irratti rakkoon mudateera. Mee irra deebi\'ii yaali. + Mee lakkoofsa fudhataa galchi. + Mee lakkoofsa bilbilaa galchaa. + Mee lakkoofsa herregaa galchaa. + Mee maallaqa sirrii ta\'e galchi. + Mee tajaajila tokko filadhaa. + Maaloo networkii fudhataa filadhu. + Maaloo filannoo kee gara %1$s erguu akka danda\'u mirkaneessi + Tajaajilli kun %1$s\'f fayyadamuun hin danda\'amu. + Mee dogongora diimaan agarsiifame sirreessaa. + Ofuma kiyya + Nama biraa + network irratti + Gara %1$s tti + Ibsa + Gaaffiin keessan maali? + Gara + Irraa + Maallaqa erguu gara… + Yeroo qilleensaa bitadhaa + Irraa kaffalaa + Kunis maallaqa gara herrega ofii keessaniitti sochoosuuf qofa fayyadamuu dandeessu. + Kunis yeroo qilleensaa herrega mataa keessaniif bitachuuf qofa fayyadamuu dandeessu. + + Amma maallaqa ergaa + Yeroo qilleensaa amma bitadhaa + Odeeffannoo kana tarkaanfii itti aanu keessatti ilaaluu dandeessu. + %1$d quunnamtii + + %1$s madaallii sakatta\'i + %1$s yeroo qilleensaa gara %2$s erga + %1$s maallaqa gara %2$s ergu + %1$s irraa maallaqa argate + herrega %1$s irraa fide + kaffaltii %1$s kaffalu + Kutaa USSD %1$s irratti galmaa\'e + Yeroo qilleensaa %1$s waliin %2$s bitadhu + + yeroo qilleensaa %1$s %2$s waliin %3$s bitadhu + %1$s %2$s irraa gara %3$s %4$s irratti ergi + %1$s %2$s irraa gara %3$s sochoosi + %1$s %2$s irraa gara %3$s kaffali + + Maaloo %1$s sirrii galchi + + + Maallaqa gaafadhaa + Gara herrega + Keessa kaa\'i + Kunis bakka maallaqa gaafatame itti argachuu barbaaddanidha + fkn. lakkoofsa bilbilaa maallaqa moobaayilaa ykn lakkoofsa herrega baankii keessanii + Gaaffii ergi gara + How much money? + Hanga (Filannoo) + Gara + + Nama biraa itti dabali + Gaarummaadhaan yeroo dafee siif mijatutti %1$s naaf stax godhii. %2$s %3$s ta\'a + %1$s + Yaadannoo: \"%1$s\" + Gaaffii qusachuu? + Stax gaaffiin yoom akka ergamu ykn guutame akka beekuuf hayyama ergaa gabaabaa dubbisaa kennuu qabda. + Gaaffii keessan waan hin ergine fakkaata. Haala kamiinuu qusachuu barbaadduu? + Gaaffiin keessan qusatameera. + Gaaffiin keessan beellama qabamee jira. %1$s irratti ergaa akka ergitu si yaadachiifama + Gaaffii gara %1$s + Herrega + Mee lakkoofsa bilbilaa galchaa. + Maaloo herrega ykn lakkoofsa bilbilaa maallaqa itti argachuu barbaaddan galchaa + Maaloo maallaqa keessan argachuuf account filadhaa ykn haaraa itti dabalaa + SMS + WhatsApp + Koppii gochuu linkii + Linkiin waraabame + Link gaaffii share gochuu + Link gaaffii share godhaa ammas + Mee maqaa ijoollee haaraa galchi + Mee lakkoofsa herregaa haaraa galchi + Mee akkaawuntii filadhu. + + + Booda ergaa + Guyyaa + Yeroo tokkoo ol ergaa + Yeroo hammam hammamiitti? + Guyyaa xumuraa + Guyyaa xumuraa (dirqama kan hinta\'in). + Yeroo meeqa? (dirqama kan hinta\'in) + Yeroo meeqa? + Jijjiirraan beellamame. %1$s irratti jijjiirraa akka gootan isin yaadachiifna + + Guyyaa hunda + Torban torbaniin + Torban 2tti tokko + Ji'a ji'aan + + + 0daily + 1weekly + 2biweekly + 3monthly + + Sagantaa + + + Fayyadamaa sagantaa qabate + Jijjiirraa fi gaaffii siin beellamame gochuuf beeksisa agarsiisi. + Yeroon maallaqa %1$s Stax waliin dabarsuu amma. + Amma jijjiirraa + Yeroon gaaffii maallaqaa gara %1$s Stax waliin erguu amma. + Gaaffii ergaa + Yeroon isaa yeroo qilleensa Stax waliin bitachuudha. + Yeroo qilleensaa bitadhaa + + + Mirkaneessa eegaa jira + Kutaan USSD xumurameera, garuu hanga ammaatti ergaa gabaabaa mirkaneessaa hin arganne. + Madaallii + Maallaqni ji\'a kana keessa ba'e + Maallaqa baatii kana keessa + Kaffaltii bara kana %1$s kaffalame + Daldala + Herrega fudhataa + ID daldalaa + ID Istaaksii + Ergaawwan + Bal\'ina isaa guutuu ilaalaa + Hafnaan haaraa %1$s + + + Daldala gara fuula duraatti taasifamu haquu + Daldala haquu + Kunis daldala gara fuula duraatti taasifamu ni haqa. Yeroo barbaaddetti daldala irra deebitee saganteessuu dandeessa. + Daldalli gara fuula duraatti taasifamu haqame. + Gaaffii haquu + Gaaffii haquu + Kunis gaaffii kana ni haqa. Yeroo barbaaddetti nama tokko irraa maallaqa irra deebitee gaafachuu dandeessa. + Gaaffiin haqame. + + + Filannoowwan + Qooduu + Stax waliif qoodaa + Jalqaba maaloo galmaa\'aa + Odeeffannoo rifaralaa ilaali + Rifaralaa qusatame + Koppii ta\'e + Appii Stax jedhamu + Share app karaa… + App kana ilaalaa https://play.google.com/store/apps/details?id=com.hover.stax + Akkaawuntii keessan walitti hidhaa + + Yeroo Google seentan dogongorri uumameera. Mee irra deebi\'ii yaali. + Koodii keessan: + Koodii bakka bu\'aa\'s + Stax App fayyadamuun, imaammata dhuunfaa keenya dubbistee haala tajaajilaa irratti walii galteetta. Dubbisuuf cuqaasaa + Ba\'uu Mirkaneessi + Logout milkaa\'eera + "Ba'uu akka barbaaddu mirkaneeffatteettaa?" + + Maqaa keessan guutuu galchaa + Lakkoofsa bilbilaa keessan galchaa + Koodii rifaralaa bakka bu\'aa Stax kan si onboard godhe galchi. + Mee koodii rifaralaa galchaa. + Maaloo koodii rifaralaa sirrii ta\'e galchaa. + Maaloo maqaa sirrii galchi. + Mee lakkoofsa bilbilaa sirrii ta\'e galchaa. + Mee koodii rifaralaa qusachuuf toora interneetii seena. + ifii refer gochuu hin dandeessu. + Koodii rifaralaa keessan argachuuf toora interneetii seena. + Mee sekondii muraasa booda irra deebi\'ii yaali + + Nageenya + Stax ulaagaa 740.17(b)(3) (i) ramaddii nageenyaa Biiroo Industirii fi Nageenyaa Yunaayitid Isteetis kan guute dha. Softiweeriin kun qunnamtii sarvariidhaaf HTTPS fayyadama; symmetric key RSA encryption yeroodhaaf mirkaneessitoota fayyadamaa meeshaa mataa isaanii irratti Android Keystore fayyadamuun kuusuudhaaf; fi DRM fayyadamuun koodii obfuscation. + Herrega durtii + Herrega Bulchuu + Stax waliin nageenya qaba + %1$s amma haqi + Herrega irraa haquu + Yeroo barbaaddetti akkaawuntii kee ammas Stax irratti dabaluu dandeessa. + PIN milkaa\'inaan haqameera + PIN qusachuu + PIN gulaali + PIN + Herrega irraa balleessi + Account milkaa\'inaan haqameera + Pin fayye + Afaan + Gosa appii: %1$s\nKoodii gosa:%2$s\nID meeshaa: %3$s + Maqaaleen oomishaalee, maqaawwan daldalaa, fi mallattoon daldalaa hundi qabeenya abbootii qabeenyaa isaaniiti. Fayyadamni walitti hidhamiinsa hin agarsiisu. + + Barachuu + Features Fi Kanneen Biroo on Stax + http://joinstax.medium.com/ + + Qunnamaa + Twitter + http://twitter.com/joinstax + Odeeffannoo haaraa Stax fudhadhaa + + Gaaffii fi deebii + Stax keessatti amala tokko gaafadhu + Email deeggarsa + help@stax.me + https://help@stax.me + Stax deeggarsa id - %1$s + Poostaa erguu fayyadamuun… + + Herrega + Ba\'i + Akka %1$s tti seene + + + Stax waliin mirkaneessi + Quba keetiin mirkaneessi + Mirkaneessuun hin milkoofne + + + Ijaarsi Stax kun yeroon isaa darbeera. \n\nIjaarsa haaraa buufadhu Stax fayyadamuu itti fufuuf. + Version haaraa buufadhaa + Update keessan download ta\'aa jira. \n\nGosa kana haquuf qaree armaan gadii cuqaasi. Erga buufanni keessan xumuramee booda beeksisa sana tuquun version haaraa sana install godhaa. + Uninstall gochuu + stax update gochuu + Buufachaa jira + + + %1$s dura + %1$s amma irraa eegalee + daqiiqaa tokkoo gadi + gara daqiiqaa tokkootti + %1$d daqiiqaa + gara sa’aatii tokkootti + gara %1$d sa\'aatii + guyyaa tokkotti + %1$d guyyoota + gara ji’a tokkootti + Ji\'oota %1$d + gara waggaa tokkootti + %1$d waggaa + + + Madaallii haaromsuuf swipe gochuu + Madaallii haaromsuuf gadhiisi + Madaallii haaromsaa… + Madaallii haaromsaa xumurame + yeroo dhumaaf haaromfame: + + + Badhaasa + 💸 KAFFALTII ARGADHAA! KAARTAA DHANGALA'AA USSD + Stax dhangala\'aa USSD keessa darbuuf USD $5 - $50 siif kaffala. + Jalqabi + 🗺 KAARTAA DHANGALA\'AA USSD + Gara Money Mapper baga nagaan dhuftan. Stax USSD nama hundaaf salphisuu barbaada. Stax biyyoota hedduu keessatti namoota hedduutti fiduuf, menu USSD hunda akka addunyaatti kaartaan kaa\'uu qabna. Stax akka Money Mapper tti makamaa fi daldala USSD milkaa\'inaan kaartaa gootan hundaaf $5 - $20 USD argadhaa. Menuuwwan USSD ammallee nu barbaachisan (bounties) fuula itti aanu irratti tarreeffamaniiru. Yeroo baayyee badhaasa haaraa itti daballa! + 1. Herrega Google keetiin seeni.\n2. Herrega baankii ykn maallaqa mobaayilaa kee kamiifuu badhaasa banaa barbaadi.\n3. Daldala USSD badhaasa irratti ibsame, akka Hafnaan Sakatta'uu ykn Yeroo Qilleensaa Bituu.\n 4. Bal’ina daldalaa irra deebi’ii ilaali. Yoo kufe ykn guutuu hin taane irra deebi'ii yaali.\n5. Stax ergaawwan kee ni ilaala, kunis guyyoota 7–10 fudhachuu danda'a. \n6. Dhuma torbanitti kaffaltii argatta + Yeroo qilleensaa nama kamiifuu %1$s bitadhaa + Nama biraatiif yeroo qilleensaa bitadhu %1$s + Nama biraatti maallaqa ergaa %1$s + Maallaqa kamiyyuu nama kamiifuu %1$s ergi + irra %1$s + %1$s keessatti %2$s irratti + Maallaqa gara herrega %1$s keetii sochoosi + Hamma kamiyyuu gara herrega %1$s mataa keetii ergi + Kaffaltii%1$s kaffali + irraa %1$s + Maallaqa kamiyyuu gara %1$s + daldala kamiyyuu + + Hafnaan isaa ilaali + Hafnaan kee ilaali + Email + Maaloo teessoo imeelii sirrii ta\'e galchi + Walqunnamsiisaa jira, mee eegaa… + Maaloo interneetii daataa qabaachuu keessan mirkaneessaa + Mee irra deebi\'ii yaali. Yoo kun itti fufe, gaarummaadhaan ussd@stax.me irratti nu qunnamaa. + Daldala keessan mirkaneessaa jirra. Yoo milkaa’e guyyoota hojii 10 keessatti kaffaltiin akka kaffalamu eegaa. + Raawwatame + our requirements and is no longer available]]> + our requirements. Please try again]]> + DHANGALA\'AA ARGAMU + %1$s - %2$s - $%3$d + USD $%1$d, %2$s himachuuf.\n\nAkkuma xumurtaniin, odeeffannoo kaffaltiidhaaf walitti qabuuf email isiniif ergina. Guyyoota hojii 7–10 keessatti kaffaltiin siif kaffalama + Dhangala\'aa USSD jalqabi + Dhangala\'aa kee sakatta'uu +
If you have questions, please email us at ussd@stax.me ]]>
+ DHANGALA\'AA HOJJETAME + Dhangala\'aa isaa ilaallee gaarii fakkaata! Inbox keessan keessatti email odeeffannoo kaffaltii qabu qabaachuu qabdu. + Dhangala’aa biraa keessa darbi + DHANGALA\'AA GALMEESSE + USD $%1$d + Biyya filadhu + Biyyaadhaan calaqqisi + Siibaasuu jira, ega keessan … + Biyya + Mee tajaajila fi biyyoota fe\'uuf daataa ibsi. + %1$s %2$s + 🌎 Biyyoota hunda + SIM sirrii galchi + Maaloo meeshaa kee keessatti SIM kaardii %1$s irraa galchiiti irra deebi\'ii yaali. + Irra deebi\'ii yaali + Dhangala\'aa galchaa + Bounty milkaa\'inaan galche + Afaan + Badhaasa + Bounties hin jiru. Mee booda irra deebi\'aa ilaalaa. + + Mana Kitaabaa USSD + Koodii gabaabaa USSD barbaadi + Koodii gabaabaa + Bilbilaa %1$s + Bilbilaa + + Interneetii barbaachisa + Dhangala\'aa USSD kaartaan gochuuf data ykn Wifi connection si barbaachisa. Mee wal qunnamaa irra deebi\'aa yaalaa. + Ammas yaali + Dogoggora hin beekamne, maaloo irra deebi\'ii yaali. Yoo dogongorri itti fufe maaloo appicha cufaatii irra deebi'aa jalqabsiisaa. + + Maaloo yoo xiqqaate akkaawuntii tokko filachuun Stax irratti dabaluu dandeessu + + + SIM, SMS, Accessibility & Overlay + Stax maaliif hayyama kana gaafata? + Kana baruuf as tuqi + Stax Monthly Roundup isa haaraa qabadhaa + Amma dubbisuuf tuqi + Stax gist adda ta\'e barbaadduu? + Amma tarree ergaa keenyaa subscribe godhaa + Nu waliin ijaaraa! Gaaffii amala dabaluu/olkaa\'uu ykn dogongora gabaasuu. + Amma yaada kennaa + Mallattoo baanarii Stax + Stax daran fooyyessuuf kaffaltii argachuu barbaadduu? + Har\'a qorannoo qorannoof galmaa'aa + + https://joinstax.medium.com/phone-permissions-on-stax-a0ec82533570 + https://joinstax.medium.com/ + https://stax.nolt.io/ + https://joinstax.typeform.com/to/JiloPnVy + + + Amma haala qormaataa keessa jirta. + Haalli qormaataa hanqifame. + Achitti jechuun ni danda\'ama! + Haala qormaataa bobba\'eera + + Gaaffiiwwan yeroo baay’ee gaafataman + Still have questions?

Email stax support ]]> + Fe\'amaa jira… + FAQ fe\'uu hin dandeenye, maaloo irra deebi\'ii yaali + Amalli kun interneetii barbaada, maaloo irra deebi\'aa yaalaa + + Toora ala hojjechuu + + Stax gara fuulduraatti email naaf erguu danda\'a. + Maamiltoonni email meeshaa irratti hin argamne. + Mee koodii USSD bilbiluuf hayyama bilbilaa dandeessisi. + + + Ergaawwan + Walsimsiisaa + + + Mallattoo keessan + Tarkaanfii deebii durtii + + + Yeroo yeroon email walsimsiisaa + Dabalata dhufan buufadhaa + Imeelii dhufaniif dabalataan ofumaan buufadhu + + Dabalata yeroo harkaan gaafatamu qofa buufadhu + + USSD jedhaa bilbilaa + + Dhiifama, ida\'amuun tajaajilaa kun cabee jira. + + + Gorsa Fayyaa Faayinaansii + Qooduu + Gorsa Faayinaansii Share godhaa + Read more + + + Lakkoofsa daldalaa + Bilbila kana qusadhaa + Lakkoofsa daldalaa galchi + Maqaa ijoollee + Yeroo hunda maallaqa wal fakkaatu kaffali + Lakkoofsa daldalaa galchi + Haquu + Asxaa filadhu + Lakk herregaa: %1$s + Paybill milkaa\'inaan haqameera + Kaffaltii Kaffaltii Haquu + Haquu akka barbaaddu mirkaneeffatteettaa %1$s? + Maaloo lakkoofsa daldalaa sirrii ta\'e galchaa + Paybill milkaa\'inaan qusate + Maaloo maqaa sirrii galchi + Beekamaa + Amma kaffali + Kaffaltii Kaffaltii Haaraa + Update gochuu akka barbaaddu mirkaneeffatteettaa %1$s? + Paybill milkaa\'inaan haaromfame + Odeeffannoo dhiyeenyaa + + Amma miti + + + \ No newline at end of file diff --git a/app/src/main/res/values-so/strings.xml b/app/src/main/res/values-so/strings.xml index 4f11ee6ae..90d701eab 100644 --- a/app/src/main/res/values-so/strings.xml +++ b/app/src/main/res/values-so/strings.xml @@ -49,6 +49,7 @@ fr sw so + om Sax diff --git a/app/src/main/res/values-sw/strings.xml b/app/src/main/res/values-sw/strings.xml index d319b26a5..3bc4b8cd3 100644 --- a/app/src/main/res/values-sw/strings.xml +++ b/app/src/main/res/values-sw/strings.xml @@ -40,6 +40,10 @@ sw + so + + om + SAWA diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 796bc9e56..fce08c3f8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -47,6 +47,8 @@ en fr sw + so + om OK From 197a6a77b077e2d31d860b8525dd04de2219f0d9 Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Wed, 15 Jun 2022 16:56:59 +0300 Subject: [PATCH 06/41] completes bonus restructure --- .../hover/stax/accounts/AccountsViewModel.kt | 3 +- .../stax/addChannels/ChannelsViewModel.kt | 3 +- .../com/hover/stax/bonus/BonusViewModel.kt | 6 +- .../com/hover/stax/channels/ChannelDao.kt | 3 + .../com/hover/stax/channels/ChannelRepo.kt | 2 + .../stax/{bonus => data/local}/BonusDao.kt | 7 ++- .../stax/{bonus => data/local}/BonusRepo.kt | 7 ++- .../data/repository/BonusRepositoryImpl.kt | 56 +++++++++++++++++-- .../com/hover/stax/database/AppDatabase.kt | 4 +- .../main/java/com/hover/stax/di/Modules.kt | 8 +-- .../stax/{bonus => domain/model}/Bonus.kt | 2 +- .../stax/domain/repository/BonusRepository.kt | 5 +- .../use_case/{ => bonus}/FetchBonusUseCase.kt | 2 +- .../use_case/{ => bonus}/GetBonusesUseCase.kt | 6 +- .../java/com/hover/stax/home/HomeFragment.kt | 4 +- .../hover/stax/presentation/home/HomeState.kt | 2 +- .../stax/presentation/home/HomeViewModel.kt | 4 +- .../TransactionDetailsViewModel.kt | 2 +- 18 files changed, 87 insertions(+), 39 deletions(-) rename app/src/main/java/com/hover/stax/{bonus => data/local}/BonusDao.kt (83%) rename app/src/main/java/com/hover/stax/{bonus => data/local}/BonusRepo.kt (57%) rename app/src/main/java/com/hover/stax/{bonus => domain/model}/Bonus.kt (93%) rename app/src/main/java/com/hover/stax/domain/use_case/{ => bonus}/FetchBonusUseCase.kt (81%) rename app/src/main/java/com/hover/stax/domain/use_case/{ => bonus}/GetBonusesUseCase.kt (91%) diff --git a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt index 9e5d7089e..f9ed87783 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt @@ -9,14 +9,13 @@ import androidx.lifecycle.viewModelScope import com.hover.sdk.actions.HoverAction import com.hover.stax.R import com.hover.stax.actions.ActionRepo -import com.hover.stax.bonus.BonusRepo +import com.hover.stax.data.local.BonusRepo import com.hover.stax.schedules.Schedule import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch -import timber.log.Timber class AccountsViewModel(application: Application, val repo: AccountRepo, val actionRepo: ActionRepo, private val bonusRepo: BonusRepo) : AndroidViewModel(application), AccountDropdown.HighlightListener { diff --git a/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt b/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt index 124b99e79..66deab324 100644 --- a/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt +++ b/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt @@ -17,7 +17,7 @@ import com.hover.stax.accounts.Account import com.hover.stax.accounts.AccountRepo import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.actions.ActionRepo -import com.hover.stax.bonus.BonusRepo +import com.hover.stax.data.local.BonusRepo import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo import com.hover.stax.countries.CountryAdapter @@ -32,7 +32,6 @@ import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.launch import org.json.JSONObject -import timber.log.Timber class ChannelsViewModel(application: Application, val repo: ChannelRepo, val accountRepo: AccountRepo, val actionRepo: ActionRepo, private val bonusRepo: BonusRepo) : AndroidViewModel(application), PushNotificationTopicsInterface { diff --git a/app/src/main/java/com/hover/stax/bonus/BonusViewModel.kt b/app/src/main/java/com/hover/stax/bonus/BonusViewModel.kt index 4b64c454f..a7d7c40b0 100644 --- a/app/src/main/java/com/hover/stax/bonus/BonusViewModel.kt +++ b/app/src/main/java/com/hover/stax/bonus/BonusViewModel.kt @@ -7,6 +7,8 @@ import com.google.firebase.firestore.ktx.firestoreSettings import com.google.firebase.ktx.Firebase import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo +import com.hover.stax.data.local.BonusRepo +import com.hover.stax.domain.model.Bonus import com.hover.stax.utils.toHni import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow @@ -62,10 +64,6 @@ class BonusViewModel(val repo: BonusRepo, private val channelRepo: ChannelRepo) _bonusList.value = if (showBonuses) toSave else emptyList() } - fun getBonusByPurchaseChannel(channelId: Int): Bonus? = repo.getBonusByPurchaseChannel(channelId) - - fun getBonusByUserChannel(channelId: Int): Bonus? = repo.getBonusByUserChannel(channelId) - /** * Extract the hnis from the bonus channels and compare with current sim hnis. * Return true if user has a valid sim diff --git a/app/src/main/java/com/hover/stax/channels/ChannelDao.kt b/app/src/main/java/com/hover/stax/channels/ChannelDao.kt index 4dc408904..f66ed4ef4 100644 --- a/app/src/main/java/com/hover/stax/channels/ChannelDao.kt +++ b/app/src/main/java/com/hover/stax/channels/ChannelDao.kt @@ -19,6 +19,9 @@ interface ChannelDao { @Query("SELECT * FROM channels WHERE id IN (:channel_ids) ORDER BY name ASC") fun getChannelsByIds(channel_ids: List): List + @Query("SELECT * FROM channels WHERE id IN (:channel_ids) ORDER BY name ASC") + suspend fun getChannelsByIdsAsync(channel_ids: List): List + @Query("SELECT * FROM channels WHERE id IN (:channel_ids) ORDER BY name ASC") fun getChannels(channel_ids: IntArray): LiveData> diff --git a/app/src/main/java/com/hover/stax/channels/ChannelRepo.kt b/app/src/main/java/com/hover/stax/channels/ChannelRepo.kt index f1a410f9e..1516509b3 100644 --- a/app/src/main/java/com/hover/stax/channels/ChannelRepo.kt +++ b/app/src/main/java/com/hover/stax/channels/ChannelRepo.kt @@ -31,6 +31,8 @@ class ChannelRepo(db: AppDatabase, sdkDb: HoverRoomDatabase) { fun getChannelsByIds(ids: List): List = channelDao.getChannelsByIds(ids) + suspend fun getChannelsByIdsAsync(ids: List): List = channelDao.getChannelsByIds(ids) + fun getChannelsByCountry(channelIds: IntArray, countryCode: String): LiveData> { return channelDao.getChannels(countryCode.uppercase(), channelIds) } diff --git a/app/src/main/java/com/hover/stax/bonus/BonusDao.kt b/app/src/main/java/com/hover/stax/data/local/BonusDao.kt similarity index 83% rename from app/src/main/java/com/hover/stax/bonus/BonusDao.kt rename to app/src/main/java/com/hover/stax/data/local/BonusDao.kt index f8c63891b..8074394b5 100644 --- a/app/src/main/java/com/hover/stax/bonus/BonusDao.kt +++ b/app/src/main/java/com/hover/stax/data/local/BonusDao.kt @@ -1,6 +1,7 @@ -package com.hover.stax.bonus +package com.hover.stax.data.local import androidx.room.* +import com.hover.stax.domain.model.Bonus import kotlinx.coroutines.flow.Flow @Dao @@ -10,10 +11,10 @@ interface BonusDao { val bonuses: Flow> @Query("SELECT * FROM bonuses WHERE purchase_channel = :purchaseChannelId") - fun getBonusByPurchaseChannel(purchaseChannelId: Int): Bonus? + suspend fun getBonusByPurchaseChannel(purchaseChannelId: Int): Bonus? @Query("SELECT * FROM bonuses WHERE user_channel = :userChannelId") - fun getBonusByUserChannel(userChannelId: Int): Bonus? + suspend fun getBonusByUserChannel(userChannelId: Int): Bonus? @Query("SELECT * FROM bonuses WHERE purchase_channel IN (:purchaseChannelIds) AND user_channel in (:userChannelIds)") fun getBonuses(purchaseChannelIds: List, userChannelIds: List): List diff --git a/app/src/main/java/com/hover/stax/bonus/BonusRepo.kt b/app/src/main/java/com/hover/stax/data/local/BonusRepo.kt similarity index 57% rename from app/src/main/java/com/hover/stax/bonus/BonusRepo.kt rename to app/src/main/java/com/hover/stax/data/local/BonusRepo.kt index d2e01ff5e..446c5740b 100644 --- a/app/src/main/java/com/hover/stax/bonus/BonusRepo.kt +++ b/app/src/main/java/com/hover/stax/data/local/BonusRepo.kt @@ -1,6 +1,7 @@ -package com.hover.stax.bonus +package com.hover.stax.data.local import com.hover.stax.database.AppDatabase +import com.hover.stax.domain.model.Bonus class BonusRepo(val db: AppDatabase) { @@ -12,9 +13,9 @@ class BonusRepo(val db: AppDatabase) { fun save(bonuses: List) = dao.insertAll(bonuses) - fun getBonusByPurchaseChannel(purchaseChannelId: Int): Bonus? = dao.getBonusByPurchaseChannel(purchaseChannelId) + suspend fun getBonusByPurchaseChannel(purchaseChannelId: Int): Bonus? = dao.getBonusByPurchaseChannel(purchaseChannelId) - fun getBonusByUserChannel(userChannelId: Int): Bonus? = dao.getBonusByUserChannel(userChannelId) + suspend fun getBonusByUserChannel(userChannelId: Int): Bonus? = dao.getBonusByUserChannel(userChannelId) fun delete(bonus: Bonus) = dao.delete(bonus) diff --git a/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt b/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt index 14dea82cb..c86cdfbf5 100644 --- a/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt +++ b/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt @@ -3,16 +3,22 @@ package com.hover.stax.data.repository import com.google.firebase.firestore.ktx.firestore import com.google.firebase.firestore.ktx.firestoreSettings import com.google.firebase.ktx.Firebase -import com.hover.stax.bonus.Bonus -import com.hover.stax.bonus.BonusRepo +import com.hover.stax.domain.model.Bonus +import com.hover.stax.channels.Channel +import com.hover.stax.channels.ChannelRepo +import com.hover.stax.data.local.BonusRepo import com.hover.stax.domain.repository.BonusRepository +import com.hover.stax.utils.toHni import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.channelFlow +import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import timber.log.Timber -class BonusRepositoryImpl(private val bonusRepo: BonusRepo, private val coroutineDispatcher: CoroutineDispatcher) : BonusRepository { +class BonusRepositoryImpl(private val bonusRepo: BonusRepo, private val channelRepo: ChannelRepo, private val coroutineDispatcher: CoroutineDispatcher) : BonusRepository { private val settings = firestoreSettings { isPersistenceEnabled = true } private val db = Firebase.firestore.also { it.firestoreSettings = settings } @@ -31,7 +37,7 @@ class BonusRepositoryImpl(private val bonusRepo: BonusRepo, private val coroutin Timber.e("Saved ${results.size} bonuses") launch { - saveBonuses(results) + filterResults(results) } } .addOnFailureListener { @@ -40,8 +46,23 @@ class BonusRepositoryImpl(private val bonusRepo: BonusRepo, private val coroutin } } - override suspend fun getBonusList(): Flow> { - return bonusRepo.bonuses + @OptIn(ExperimentalCoroutinesApi::class) + override suspend fun getBonusList(): Flow> = channelFlow { + val simHnis = channelRepo.presentSims.map { it.osReportedHni } + + bonusRepo.bonuses.collect { + withContext(coroutineDispatcher) { + launch { + val bonusChannels = getBonusChannels(it) + val showBonuses = hasValidSim(simHnis, bonusChannels) + + if (showBonuses) + send(it) + else + send(emptyList()) + } + } + } } override suspend fun saveBonuses(bonusList: List) { @@ -55,4 +76,27 @@ class BonusRepositoryImpl(private val bonusRepo: BonusRepo, private val coroutin override suspend fun getBonusByUserChannel(channelId: Int): Bonus? { return bonusRepo.getBonusByUserChannel(channelId) } + + private suspend fun filterResults(bonuses: List) = withContext(coroutineDispatcher) { + launch { + val bonusChannels = getBonusChannels(bonuses) + + val toSave = bonuses.filter { bonusChannels.map { channel -> channel.id }.contains(it.purchaseChannel) } + bonusRepo.updateBonuses(toSave) + } + } + + private fun hasValidSim(simHnis: List, bonusChannels: List): Boolean { + val hniList = mutableSetOf() + bonusChannels.forEach { channel -> + channel.hniList.split(",").forEach { + if (simHnis.contains(it.toHni())) + hniList.add(it.toHni()) + } + } + + return hniList.isNotEmpty() + } + + override suspend fun getBonusChannels(bonusList: List): List = channelRepo.getChannelsByIdsAsync(bonusList.map { it.purchaseChannel }) } \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/database/AppDatabase.kt b/app/src/main/java/com/hover/stax/database/AppDatabase.kt index 5223c5a5e..d42890c72 100644 --- a/app/src/main/java/com/hover/stax/database/AppDatabase.kt +++ b/app/src/main/java/com/hover/stax/database/AppDatabase.kt @@ -8,8 +8,8 @@ import androidx.room.RoomDatabase import androidx.room.migration.Migration import com.hover.stax.accounts.Account import com.hover.stax.accounts.AccountDao -import com.hover.stax.bonus.Bonus -import com.hover.stax.bonus.BonusDao +import com.hover.stax.domain.model.Bonus +import com.hover.stax.data.local.BonusDao import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelDao import com.hover.stax.contacts.ContactDao diff --git a/app/src/main/java/com/hover/stax/di/Modules.kt b/app/src/main/java/com/hover/stax/di/Modules.kt index f2cfd8350..d38c97fc8 100644 --- a/app/src/main/java/com/hover/stax/di/Modules.kt +++ b/app/src/main/java/com/hover/stax/di/Modules.kt @@ -8,7 +8,7 @@ import com.hover.stax.actions.ActionRepo import com.hover.stax.actions.ActionSelectViewModel import com.hover.stax.addChannels.ChannelsViewModel import com.hover.stax.balances.BalancesViewModel -import com.hover.stax.bonus.BonusRepo +import com.hover.stax.data.local.BonusRepo import com.hover.stax.bonus.BonusViewModel import com.hover.stax.bounties.BountyViewModel import com.hover.stax.channels.ChannelRepo @@ -17,8 +17,8 @@ import com.hover.stax.data.repository.BonusRepositoryImpl import com.hover.stax.database.AppDatabase import com.hover.stax.database.ParserRepo import com.hover.stax.domain.repository.BonusRepository -import com.hover.stax.domain.use_case.FetchBonusUseCase -import com.hover.stax.domain.use_case.GetBonusesUseCase +import com.hover.stax.domain.use_case.bonus.FetchBonusUseCase +import com.hover.stax.domain.use_case.bonus.GetBonusesUseCase import com.hover.stax.faq.FaqViewModel import com.hover.stax.financialTips.FinancialTipsViewModel import com.hover.stax.futureTransactions.FutureViewModel @@ -101,7 +101,7 @@ val repositories = module { Dispatchers.IO } - single { BonusRepositoryImpl(get(), get(named("CoroutineDispatcher"))) } + single { BonusRepositoryImpl(get(), get(), get(named("CoroutineDispatcher"))) } } val useCases = module { diff --git a/app/src/main/java/com/hover/stax/bonus/Bonus.kt b/app/src/main/java/com/hover/stax/domain/model/Bonus.kt similarity index 93% rename from app/src/main/java/com/hover/stax/bonus/Bonus.kt rename to app/src/main/java/com/hover/stax/domain/model/Bonus.kt index adef25845..5f0837080 100644 --- a/app/src/main/java/com/hover/stax/bonus/Bonus.kt +++ b/app/src/main/java/com/hover/stax/domain/model/Bonus.kt @@ -1,4 +1,4 @@ -package com.hover.stax.bonus +package com.hover.stax.domain.model import androidx.room.ColumnInfo import androidx.room.Entity diff --git a/app/src/main/java/com/hover/stax/domain/repository/BonusRepository.kt b/app/src/main/java/com/hover/stax/domain/repository/BonusRepository.kt index 34d2f07aa..8c39f989c 100644 --- a/app/src/main/java/com/hover/stax/domain/repository/BonusRepository.kt +++ b/app/src/main/java/com/hover/stax/domain/repository/BonusRepository.kt @@ -1,6 +1,7 @@ package com.hover.stax.domain.repository -import com.hover.stax.bonus.Bonus +import com.hover.stax.domain.model.Bonus +import com.hover.stax.channels.Channel import kotlinx.coroutines.flow.Flow interface BonusRepository { @@ -11,6 +12,8 @@ interface BonusRepository { suspend fun saveBonuses(bonusList: List) + suspend fun getBonusChannels(bonusList: List): List + suspend fun getBonusByPurchaseChannel(channelId: Int): Bonus? suspend fun getBonusByUserChannel(channelId: Int): Bonus? diff --git a/app/src/main/java/com/hover/stax/domain/use_case/FetchBonusUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/bonus/FetchBonusUseCase.kt similarity index 81% rename from app/src/main/java/com/hover/stax/domain/use_case/FetchBonusUseCase.kt rename to app/src/main/java/com/hover/stax/domain/use_case/bonus/FetchBonusUseCase.kt index 4c92ff885..23c5a7fda 100644 --- a/app/src/main/java/com/hover/stax/domain/use_case/FetchBonusUseCase.kt +++ b/app/src/main/java/com/hover/stax/domain/use_case/bonus/FetchBonusUseCase.kt @@ -1,4 +1,4 @@ -package com.hover.stax.domain.use_case +package com.hover.stax.domain.use_case.bonus import com.hover.stax.domain.repository.BonusRepository diff --git a/app/src/main/java/com/hover/stax/domain/use_case/GetBonusesUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt similarity index 91% rename from app/src/main/java/com/hover/stax/domain/use_case/GetBonusesUseCase.kt rename to app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt index a00c87b4b..ff0c4f689 100644 --- a/app/src/main/java/com/hover/stax/domain/use_case/GetBonusesUseCase.kt +++ b/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt @@ -1,17 +1,17 @@ -package com.hover.stax.domain.use_case +package com.hover.stax.domain.use_case.bonus -import com.hover.stax.bonus.Bonus +import com.hover.stax.domain.model.Bonus import com.hover.stax.data.Resource import com.hover.stax.domain.repository.BonusRepository import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.flow -import timber.log.Timber class GetBonusesUseCase(private val repository: BonusRepository) { fun getBonusList(): Flow>> = flow { emit(Resource.Loading()) + repository.getBonusList().collect { emit(Resource.Success(it)) } diff --git a/app/src/main/java/com/hover/stax/home/HomeFragment.kt b/app/src/main/java/com/hover/stax/home/HomeFragment.kt index 3e5856920..913712b54 100644 --- a/app/src/main/java/com/hover/stax/home/HomeFragment.kt +++ b/app/src/main/java/com/hover/stax/home/HomeFragment.kt @@ -5,7 +5,6 @@ import android.text.method.LinkMovementMethod import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Toast import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope import androidx.navigation.NavDirections @@ -13,9 +12,8 @@ import androidx.navigation.fragment.findNavController import com.hover.sdk.actions.HoverAction import com.hover.stax.R import com.hover.stax.addChannels.ChannelsViewModel -import com.hover.stax.bonus.Bonus +import com.hover.stax.domain.model.Bonus import com.hover.stax.bonus.BonusViewModel -import com.hover.stax.data.Resource import com.hover.stax.databinding.FragmentHomeBinding import com.hover.stax.financialTips.FinancialTip import com.hover.stax.financialTips.FinancialTipsViewModel diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt index 5356cdffd..62c2a584e 100644 --- a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt @@ -1,6 +1,6 @@ package com.hover.stax.presentation.home -import com.hover.stax.bonus.Bonus +import com.hover.stax.domain.model.Bonus sealed class HomeState { object Loading : HomeState() diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt index 689537001..b1cc8e42e 100644 --- a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt @@ -3,8 +3,8 @@ package com.hover.stax.presentation.home import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hover.stax.data.Resource -import com.hover.stax.domain.use_case.FetchBonusUseCase -import com.hover.stax.domain.use_case.GetBonusesUseCase +import com.hover.stax.domain.use_case.bonus.FetchBonusUseCase +import com.hover.stax.domain.use_case.bonus.GetBonusesUseCase import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.launchIn diff --git a/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt b/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt index a80628085..f55a35b28 100644 --- a/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt +++ b/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt @@ -9,7 +9,7 @@ import com.hover.sdk.transactions.Transaction import com.hover.stax.accounts.Account import com.hover.stax.accounts.AccountRepo import com.hover.stax.actions.ActionRepo -import com.hover.stax.bonus.BonusRepo +import com.hover.stax.data.local.BonusRepo import com.hover.stax.contacts.ContactRepo import com.hover.stax.contacts.StaxContact import com.hover.stax.database.ParserRepo From 77cbf054c6255793c68f9168a6bd64dd5b347944 Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Thu, 16 Jun 2022 11:35:26 +0300 Subject: [PATCH 07/41] finished accounts restructure --- .../stax/accounts/AccountDetailViewModel.kt | 1 + .../hover/stax/accounts/AccountsViewModel.kt | 3 +- .../stax/addChannels/ChannelsViewModel.kt | 4 +- .../hover/stax/balances/BalancesFragment.kt | 13 ++- .../hover/stax/balances/BalancesViewModel.kt | 2 +- .../com/hover/stax/bonus/BonusViewModel.kt | 2 +- .../{ => data/local}/accounts/AccountDao.kt | 10 ++- .../{ => data/local}/accounts/AccountRepo.kt | 9 ++- .../stax/data/local/{ => bonus}/BonusDao.kt | 2 +- .../stax/data/local/{ => bonus}/BonusRepo.kt | 2 +- .../data/repository/AccountRepositoryImpl.kt | 80 +++++++++++++++++++ .../data/repository/BonusRepositoryImpl.kt | 2 +- .../com/hover/stax/database/AppDatabase.kt | 4 +- .../main/java/com/hover/stax/di/Modules.kt | 16 +++- .../domain/repository/AccountRepository.kt | 14 ++++ .../accounts/CreateAccountsUseCase.kt | 11 +++ .../use_case/accounts/GetAccountsUseCase.kt | 12 +++ .../accounts/SetDefaultAccountUseCase.kt | 11 +++ .../use_case/bonus/GetBonusesUseCase.kt | 8 +- .../java/com/hover/stax/home/HomeFragment.kt | 45 +++++------ .../java/com/hover/stax/home/MainActivity.kt | 3 + .../hover/stax/hover/TransactionReceiver.kt | 6 +- .../hover/stax/inapp_banner/BannerUtils.kt | 3 +- .../hover/stax/paybill/PaybillViewModel.kt | 2 +- .../hover/stax/presentation/home/HomeState.kt | 10 +-- .../stax/presentation/home/HomeViewModel.kt | 34 +++++--- .../stax/requests/NewRequestViewModel.kt | 2 +- .../stax/requests/RequestDetailViewModel.kt | 5 +- .../TransactionDetailsViewModel.kt | 4 +- 29 files changed, 238 insertions(+), 82 deletions(-) rename app/src/main/java/com/hover/stax/{ => data/local}/accounts/AccountDao.kt (85%) rename app/src/main/java/com/hover/stax/{ => data/local}/accounts/AccountRepo.kt (84%) rename app/src/main/java/com/hover/stax/data/local/{ => bonus}/BonusDao.kt (96%) rename app/src/main/java/com/hover/stax/data/local/{ => bonus}/BonusRepo.kt (94%) create mode 100644 app/src/main/java/com/hover/stax/data/repository/AccountRepositoryImpl.kt create mode 100644 app/src/main/java/com/hover/stax/domain/repository/AccountRepository.kt create mode 100644 app/src/main/java/com/hover/stax/domain/use_case/accounts/CreateAccountsUseCase.kt create mode 100644 app/src/main/java/com/hover/stax/domain/use_case/accounts/GetAccountsUseCase.kt create mode 100644 app/src/main/java/com/hover/stax/domain/use_case/accounts/SetDefaultAccountUseCase.kt diff --git a/app/src/main/java/com/hover/stax/accounts/AccountDetailViewModel.kt b/app/src/main/java/com/hover/stax/accounts/AccountDetailViewModel.kt index 8c741dc8c..645f4ae9f 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountDetailViewModel.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountDetailViewModel.kt @@ -6,6 +6,7 @@ import com.hover.sdk.actions.HoverAction import com.hover.stax.actions.ActionRepo import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.transactions.StaxTransaction import com.hover.stax.transactions.TransactionHistory import com.hover.stax.transactions.TransactionRepo diff --git a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt index f9ed87783..4bb2e28a3 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt @@ -9,7 +9,8 @@ import androidx.lifecycle.viewModelScope import com.hover.sdk.actions.HoverAction import com.hover.stax.R import com.hover.stax.actions.ActionRepo -import com.hover.stax.data.local.BonusRepo +import com.hover.stax.data.local.accounts.AccountRepo +import com.hover.stax.data.local.bonus.BonusRepo import com.hover.stax.schedules.Schedule import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt b/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt index 66deab324..fbfbb8d5b 100644 --- a/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt +++ b/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt @@ -14,10 +14,10 @@ import com.hover.sdk.api.Hover import com.hover.sdk.sims.SimInfo import com.hover.stax.R import com.hover.stax.accounts.Account -import com.hover.stax.accounts.AccountRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.actions.ActionRepo -import com.hover.stax.data.local.BonusRepo +import com.hover.stax.data.local.bonus.BonusRepo import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo import com.hover.stax.countries.CountryAdapter diff --git a/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt b/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt index 0cb9dbdcc..ebad0d834 100644 --- a/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt +++ b/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt @@ -21,6 +21,7 @@ import com.hover.stax.databinding.FragmentBalanceBinding import com.hover.stax.home.HomeFragmentDirections import com.hover.stax.home.MainActivity import com.hover.stax.hover.AbstractHoverCallerActivity +import com.hover.stax.presentation.home.HomeViewModel import com.hover.stax.utils.AnalyticsUtil import com.hover.stax.utils.UIHelper import com.hover.stax.utils.collectLatestLifecycleFlow @@ -43,6 +44,9 @@ class BalancesFragment : Fragment(), BalanceAdapter.BalanceListener { private val accountsViewModel: AccountsViewModel by sharedViewModel() private val balancesViewModel: BalancesViewModel by sharedViewModel() private val channelsViewModel: ChannelsViewModel by sharedViewModel() + + private val homeViewModel: HomeViewModel by sharedViewModel() + private lateinit var cardStackAdapter: BalanceCardStackAdapter override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { @@ -63,10 +67,15 @@ class BalancesFragment : Fragment(), BalanceAdapter.BalanceListener { balancesViewModel.showBalances.observe(viewLifecycleOwner) { showBalanceCards(it) } - balancesViewModel.accounts.observe(viewLifecycleOwner) { - updateAccounts(ArrayList(it)) + collectLatestLifecycleFlow(homeViewModel.homeState) { + if (it.accounts.isNotEmpty()) + updateAccounts(ArrayList(it.accounts)) } +// balancesViewModel.accounts.observe(viewLifecycleOwner) { +// updateAccounts(ArrayList(it)) +// } + collectLatestLifecycleFlow(balancesViewModel.balanceAction) { attemptCallHover(balancesViewModel.userRequestedBalanceAccount.value, it) } diff --git a/app/src/main/java/com/hover/stax/balances/BalancesViewModel.kt b/app/src/main/java/com/hover/stax/balances/BalancesViewModel.kt index a23c18c1d..eb23bc790 100644 --- a/app/src/main/java/com/hover/stax/balances/BalancesViewModel.kt +++ b/app/src/main/java/com/hover/stax/balances/BalancesViewModel.kt @@ -7,7 +7,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import com.hover.sdk.actions.HoverAction import com.hover.stax.accounts.Account -import com.hover.stax.accounts.AccountRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.actions.ActionRepo import com.hover.stax.utils.Utils diff --git a/app/src/main/java/com/hover/stax/bonus/BonusViewModel.kt b/app/src/main/java/com/hover/stax/bonus/BonusViewModel.kt index a7d7c40b0..c626318b9 100644 --- a/app/src/main/java/com/hover/stax/bonus/BonusViewModel.kt +++ b/app/src/main/java/com/hover/stax/bonus/BonusViewModel.kt @@ -7,7 +7,7 @@ import com.google.firebase.firestore.ktx.firestoreSettings import com.google.firebase.ktx.Firebase import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo -import com.hover.stax.data.local.BonusRepo +import com.hover.stax.data.local.bonus.BonusRepo import com.hover.stax.domain.model.Bonus import com.hover.stax.utils.toHni import kotlinx.coroutines.Dispatchers diff --git a/app/src/main/java/com/hover/stax/accounts/AccountDao.kt b/app/src/main/java/com/hover/stax/data/local/accounts/AccountDao.kt similarity index 85% rename from app/src/main/java/com/hover/stax/accounts/AccountDao.kt rename to app/src/main/java/com/hover/stax/data/local/accounts/AccountDao.kt index 425aba355..b1dbe599d 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountDao.kt +++ b/app/src/main/java/com/hover/stax/data/local/accounts/AccountDao.kt @@ -1,7 +1,8 @@ -package com.hover.stax.accounts +package com.hover.stax.data.local.accounts import androidx.lifecycle.LiveData import androidx.room.* +import com.hover.stax.accounts.Account import kotlinx.coroutines.flow.Flow @Dao @@ -37,11 +38,14 @@ interface AccountDao { @Query("SELECT * FROM accounts where isDefault = 1") fun getDefaultAccount(): Account? + @Query("SELECT * FROM accounts where isDefault = 1") + suspend fun getDefaultAccountAsync(): Account? + @Query("SELECT COUNT(id) FROM accounts") fun getDataCount(): Int @Insert(onConflict = OnConflictStrategy.IGNORE) - fun insertAll(accounts: List): List + suspend fun insertAll(accounts: List): List @Insert(onConflict = OnConflictStrategy.REPLACE) fun insert(account: Account) @@ -50,7 +54,7 @@ interface AccountDao { fun update(account: Account?) @Update - fun updateAll(accounts: List) + suspend fun updateAll(accounts: List) @Delete fun delete(account: Account) diff --git a/app/src/main/java/com/hover/stax/accounts/AccountRepo.kt b/app/src/main/java/com/hover/stax/data/local/accounts/AccountRepo.kt similarity index 84% rename from app/src/main/java/com/hover/stax/accounts/AccountRepo.kt rename to app/src/main/java/com/hover/stax/data/local/accounts/AccountRepo.kt index 1621abe3f..58a51cd6b 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountRepo.kt +++ b/app/src/main/java/com/hover/stax/data/local/accounts/AccountRepo.kt @@ -1,6 +1,7 @@ -package com.hover.stax.accounts +package com.hover.stax.data.local.accounts import androidx.lifecycle.LiveData +import com.hover.stax.accounts.Account import com.hover.stax.database.AppDatabase import com.hover.stax.utils.AnalyticsUtil import kotlinx.coroutines.flow.Flow @@ -18,6 +19,8 @@ class AccountRepo(db: AppDatabase) { fun getDefaultAccount(): Account? = accountDao.getDefaultAccount() + suspend fun getDefaultAccountAsync(): Account? = accountDao.getDefaultAccountAsync() + fun getAccount(id: Int): Account? = accountDao.getAccount(id) fun getLiveAccount(id: Int?): LiveData = accountDao.getLiveAccount(id) @@ -44,10 +47,12 @@ class AccountRepo(db: AppDatabase) { fun insert(account: Account) = accountDao.insert(account) - fun insert(accounts: List): List = accountDao.insertAll(accounts) + suspend fun insert(accounts: List): List = accountDao.insertAll(accounts) fun update(account: Account?) = account?.let { accountDao.update(it) } + suspend fun update(accounts: List) = accountDao.updateAll(accounts) + fun delete(account: Account) = accountDao.delete(account) fun deleteAccount(channelId: Int, name: String) { diff --git a/app/src/main/java/com/hover/stax/data/local/BonusDao.kt b/app/src/main/java/com/hover/stax/data/local/bonus/BonusDao.kt similarity index 96% rename from app/src/main/java/com/hover/stax/data/local/BonusDao.kt rename to app/src/main/java/com/hover/stax/data/local/bonus/BonusDao.kt index 8074394b5..86508212c 100644 --- a/app/src/main/java/com/hover/stax/data/local/BonusDao.kt +++ b/app/src/main/java/com/hover/stax/data/local/bonus/BonusDao.kt @@ -1,4 +1,4 @@ -package com.hover.stax.data.local +package com.hover.stax.data.local.bonus import androidx.room.* import com.hover.stax.domain.model.Bonus diff --git a/app/src/main/java/com/hover/stax/data/local/BonusRepo.kt b/app/src/main/java/com/hover/stax/data/local/bonus/BonusRepo.kt similarity index 94% rename from app/src/main/java/com/hover/stax/data/local/BonusRepo.kt rename to app/src/main/java/com/hover/stax/data/local/bonus/BonusRepo.kt index 446c5740b..fc0c0e5a2 100644 --- a/app/src/main/java/com/hover/stax/data/local/BonusRepo.kt +++ b/app/src/main/java/com/hover/stax/data/local/bonus/BonusRepo.kt @@ -1,4 +1,4 @@ -package com.hover.stax.data.local +package com.hover.stax.data.local.bonus import com.hover.stax.database.AppDatabase import com.hover.stax.domain.model.Bonus diff --git a/app/src/main/java/com/hover/stax/data/repository/AccountRepositoryImpl.kt b/app/src/main/java/com/hover/stax/data/repository/AccountRepositoryImpl.kt new file mode 100644 index 000000000..fb01c700a --- /dev/null +++ b/app/src/main/java/com/hover/stax/data/repository/AccountRepositoryImpl.kt @@ -0,0 +1,80 @@ +package com.hover.stax.data.repository + +import android.content.Context +import com.hover.sdk.actions.HoverAction +import com.hover.sdk.api.ActionApi +import com.hover.stax.R +import com.hover.stax.accounts.Account +import com.hover.stax.accounts.PLACEHOLDER +import com.hover.stax.actions.ActionRepo +import com.hover.stax.channels.Channel +import com.hover.stax.channels.ChannelRepo +import com.hover.stax.data.local.accounts.AccountRepo +import com.hover.stax.domain.repository.AccountRepository +import com.hover.stax.notifications.PushNotificationTopicsInterface +import com.hover.stax.utils.AnalyticsUtil +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.collect +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import org.json.JSONObject +import org.koin.core.component.KoinComponent +import org.koin.core.component.inject + +class AccountRepositoryImpl(val accountRepo: AccountRepo, val channelRepo: ChannelRepo, val actionRepo: ActionRepo, private val coroutineDispatcher: CoroutineDispatcher) : AccountRepository, PushNotificationTopicsInterface, KoinComponent { + + private val context: Context by inject() + + override suspend fun fetchAccounts(): Flow> { + return accountRepo.getAccounts() + } + + override suspend fun createAccounts(channels: List): List { + val defaultAccount = accountRepo.getDefaultAccountAsync() + + val accounts = channels.mapIndexed { index, channel -> + val accountName: String = if (getFetchAccountAction(channel.id) == null) channel.name else PLACEHOLDER //placeholder alias for easier identification later + Account( + accountName, channel.name, channel.logoUrl, channel.accountNo, channel.id, channel.countryAlpha2, + channel.id, channel.primaryColorHex, channel.secondaryColorHex, defaultAccount == null && index == 0 + ) + }.onEach { + logChoice(it) + ActionApi.scheduleActionConfigUpdate(it.countryAlpha2, 24, context) + } + + channels.onEach { it.selected = true }.also { channelRepo.update(it) } + return accountRepo.insert(accounts) + } + + override suspend fun setDefaultAccount(account: Account) { + fetchAccounts().collect { accounts -> + val current = accounts.firstOrNull{ it.isDefault }?.also { + it.isDefault = false + } + + val defaultAccount = accounts.first { it.id == account.id }.also { it.isDefault = true } + + withContext(coroutineDispatcher) { + launch { + accountRepo.update(listOf(current!!, defaultAccount)) + } + } + } + } + + private fun getFetchAccountAction(channelId: Int): HoverAction? = actionRepo.getActions(channelId, HoverAction.FETCH_ACCOUNTS).firstOrNull() + + private fun logChoice(account: Account) { + joinChannelGroup(account.channelId, context) + val args = JSONObject() + + try { + args.put(context.getString(R.string.added_channel_id), account.channelId) + } catch (ignored: Exception) { + } + + AnalyticsUtil.logAnalyticsEvent(context.getString(R.string.new_channel_selected), args, context) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt b/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt index c86cdfbf5..667babe6e 100644 --- a/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt +++ b/app/src/main/java/com/hover/stax/data/repository/BonusRepositoryImpl.kt @@ -6,7 +6,7 @@ import com.google.firebase.ktx.Firebase import com.hover.stax.domain.model.Bonus import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo -import com.hover.stax.data.local.BonusRepo +import com.hover.stax.data.local.bonus.BonusRepo import com.hover.stax.domain.repository.BonusRepository import com.hover.stax.utils.toHni import kotlinx.coroutines.CoroutineDispatcher diff --git a/app/src/main/java/com/hover/stax/database/AppDatabase.kt b/app/src/main/java/com/hover/stax/database/AppDatabase.kt index d42890c72..ccf265926 100644 --- a/app/src/main/java/com/hover/stax/database/AppDatabase.kt +++ b/app/src/main/java/com/hover/stax/database/AppDatabase.kt @@ -7,9 +7,9 @@ import androidx.room.Room import androidx.room.RoomDatabase import androidx.room.migration.Migration import com.hover.stax.accounts.Account -import com.hover.stax.accounts.AccountDao +import com.hover.stax.data.local.accounts.AccountDao import com.hover.stax.domain.model.Bonus -import com.hover.stax.data.local.BonusDao +import com.hover.stax.data.local.bonus.BonusDao import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelDao import com.hover.stax.contacts.ContactDao diff --git a/app/src/main/java/com/hover/stax/di/Modules.kt b/app/src/main/java/com/hover/stax/di/Modules.kt index d38c97fc8..6e9762c4c 100644 --- a/app/src/main/java/com/hover/stax/di/Modules.kt +++ b/app/src/main/java/com/hover/stax/di/Modules.kt @@ -2,21 +2,26 @@ package com.hover.stax.di import com.hover.sdk.database.HoverRoomDatabase import com.hover.stax.accounts.AccountDetailViewModel -import com.hover.stax.accounts.AccountRepo import com.hover.stax.accounts.AccountsViewModel import com.hover.stax.actions.ActionRepo import com.hover.stax.actions.ActionSelectViewModel import com.hover.stax.addChannels.ChannelsViewModel import com.hover.stax.balances.BalancesViewModel -import com.hover.stax.data.local.BonusRepo import com.hover.stax.bonus.BonusViewModel import com.hover.stax.bounties.BountyViewModel import com.hover.stax.channels.ChannelRepo import com.hover.stax.contacts.ContactRepo +import com.hover.stax.data.local.accounts.AccountRepo +import com.hover.stax.data.local.bonus.BonusRepo +import com.hover.stax.data.repository.AccountRepositoryImpl import com.hover.stax.data.repository.BonusRepositoryImpl import com.hover.stax.database.AppDatabase import com.hover.stax.database.ParserRepo +import com.hover.stax.domain.repository.AccountRepository import com.hover.stax.domain.repository.BonusRepository +import com.hover.stax.domain.use_case.accounts.CreateAccountsUseCase +import com.hover.stax.domain.use_case.accounts.GetAccountsUseCase +import com.hover.stax.domain.use_case.accounts.SetDefaultAccountUseCase import com.hover.stax.domain.use_case.bonus.FetchBonusUseCase import com.hover.stax.domain.use_case.bonus.GetBonusesUseCase import com.hover.stax.faq.FaqViewModel @@ -102,9 +107,16 @@ val repositories = module { } single { BonusRepositoryImpl(get(), get(), get(named("CoroutineDispatcher"))) } + single { AccountRepositoryImpl(get(), get(), get(), get(named("CoroutineDispatcher"))) } } val useCases = module { factoryOf(::GetBonusesUseCase) factoryOf(::FetchBonusUseCase) + + factoryOf(::GetAccountsUseCase) + factoryOf(::SetDefaultAccountUseCase) + factoryOf(::CreateAccountsUseCase) + + } \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/repository/AccountRepository.kt b/app/src/main/java/com/hover/stax/domain/repository/AccountRepository.kt new file mode 100644 index 000000000..680b8b57a --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/repository/AccountRepository.kt @@ -0,0 +1,14 @@ +package com.hover.stax.domain.repository + +import com.hover.stax.accounts.Account +import com.hover.stax.channels.Channel +import kotlinx.coroutines.flow.Flow + +interface AccountRepository { + + suspend fun fetchAccounts(): Flow> + + suspend fun createAccounts(channels: List): List + + suspend fun setDefaultAccount(account: Account) +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/use_case/accounts/CreateAccountsUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/accounts/CreateAccountsUseCase.kt new file mode 100644 index 000000000..ba435cdd7 --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/use_case/accounts/CreateAccountsUseCase.kt @@ -0,0 +1,11 @@ +package com.hover.stax.domain.use_case.accounts + +import com.hover.stax.channels.Channel +import com.hover.stax.domain.repository.AccountRepository + +class CreateAccountsUseCase(private val accountsRepository: AccountRepository) { + + suspend operator fun invoke(channels: List): List { + return accountsRepository.createAccounts(channels) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/use_case/accounts/GetAccountsUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/accounts/GetAccountsUseCase.kt new file mode 100644 index 000000000..39f5c2ed3 --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/use_case/accounts/GetAccountsUseCase.kt @@ -0,0 +1,12 @@ +package com.hover.stax.domain.use_case.accounts + +import com.hover.stax.accounts.Account +import com.hover.stax.domain.repository.AccountRepository +import kotlinx.coroutines.flow.Flow + +class GetAccountsUseCase(private val accountsRepository: AccountRepository) { + + suspend operator fun invoke(): Flow> { + return accountsRepository.fetchAccounts() + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/use_case/accounts/SetDefaultAccountUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/accounts/SetDefaultAccountUseCase.kt new file mode 100644 index 000000000..49274d616 --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/use_case/accounts/SetDefaultAccountUseCase.kt @@ -0,0 +1,11 @@ +package com.hover.stax.domain.use_case.accounts + +import com.hover.stax.accounts.Account +import com.hover.stax.domain.repository.AccountRepository + +class SetDefaultAccountUseCase(private val accountsRepository: AccountRepository) { + + suspend operator fun invoke(account: Account) { + accountsRepository.setDefaultAccount(account) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt index ff0c4f689..84bb8816a 100644 --- a/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt +++ b/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt @@ -9,12 +9,8 @@ import kotlinx.coroutines.flow.flow class GetBonusesUseCase(private val repository: BonusRepository) { - fun getBonusList(): Flow>> = flow { - emit(Resource.Loading()) - - repository.getBonusList().collect { - emit(Resource.Success(it)) - } + suspend fun getBonusList(): Flow> { + return repository.getBonusList() } fun getBonusByPurchaseChannel(channelId: Int): Flow> = flow { diff --git a/app/src/main/java/com/hover/stax/home/HomeFragment.kt b/app/src/main/java/com/hover/stax/home/HomeFragment.kt index 913712b54..e0f501e8e 100644 --- a/app/src/main/java/com/hover/stax/home/HomeFragment.kt +++ b/app/src/main/java/com/hover/stax/home/HomeFragment.kt @@ -38,7 +38,7 @@ class HomeFragment : Fragment() { private val bonusViewModel: BonusViewModel by sharedViewModel() private val channelsViewModel: ChannelsViewModel by sharedViewModel() - private val homeViewModel: HomeViewModel by viewModel() + private val homeViewModel: HomeViewModel by sharedViewModel() override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { AnalyticsUtil.logAnalyticsEvent(getString(R.string.visit_screen, getString(R.string.visit_home)), requireContext()) @@ -51,15 +51,12 @@ class HomeFragment : Fragment() { super.onViewCreated(view, savedInstanceState) homeViewModel.getBonusList() - collectLatestLifecycleFlow(homeViewModel.bonusList) { - when(it){ - is HomeState.Loading -> Timber.e("Loading bonuses") - is HomeState.BonusList -> Timber.e("Found ${it.bonuses.size} bonuses") - is HomeState.Error -> Timber.e(it.message) - } - } + homeViewModel.getAccounts() - setupBanner() + collectLatestLifecycleFlow(homeViewModel.homeState) { + if(it.bonuses.isNotEmpty()) + showBonuses(it.bonuses) + } binding.airtime.setOnClickListener { navigateTo(getTransferDirection(HoverAction.AIRTIME)) } binding.transfer.setOnClickListener { navigateTo(getTransferDirection(HoverAction.P2P)) } @@ -88,24 +85,20 @@ class HomeFragment : Fragment() { } } - private fun setupBanner() { - bonusViewModel.getBonusList() - - collectLatestLifecycleFlow(bonusViewModel.bonuses) { bonusList -> - if (bonusList.isNotEmpty()) { - with(binding.bonusCard) { - message.text = bonusList.first().message - learnMore.movementMethod = LinkMovementMethod.getInstance() - } - binding.bonusCard.apply { - cardBonus.visibility = View.VISIBLE - cta.setOnClickListener { - AnalyticsUtil.logAnalyticsEvent(getString(R.string.clicked_bonus_airtime_banner), requireActivity()) - validateAccounts(bonusList.first()) - } + private fun showBonuses(bonusList: List){ + if (bonusList.isNotEmpty()) { + with(binding.bonusCard) { + message.text = bonusList.first().message + learnMore.movementMethod = LinkMovementMethod.getInstance() + } + binding.bonusCard.apply { + cardBonus.visibility = View.VISIBLE + cta.setOnClickListener { + AnalyticsUtil.logAnalyticsEvent(getString(R.string.clicked_bonus_airtime_banner), requireActivity()) + validateAccounts(bonusList.first()) } - } else binding.bonusCard.cardBonus.visibility = View.GONE - } + } + } else binding.bonusCard.cardBonus.visibility = View.GONE } private fun setKeVisibility() { diff --git a/app/src/main/java/com/hover/stax/home/MainActivity.kt b/app/src/main/java/com/hover/stax/home/MainActivity.kt index e1fc0c589..78b953b11 100644 --- a/app/src/main/java/com/hover/stax/home/MainActivity.kt +++ b/app/src/main/java/com/hover/stax/home/MainActivity.kt @@ -14,6 +14,7 @@ import com.hover.stax.databinding.ActivityMainBinding import com.hover.stax.financialTips.FinancialTipsFragment import com.hover.stax.login.AbstractGoogleAuthActivity import com.hover.stax.notifications.PushNotificationTopicsInterface +import com.hover.stax.presentation.home.HomeViewModel import com.hover.stax.requests.NewRequestViewModel import com.hover.stax.requests.REQUEST_LINK import com.hover.stax.requests.RequestSenderInterface @@ -35,6 +36,8 @@ class MainActivity : AbstractGoogleAuthActivity(), BiometricChecker.AuthListener private val historyViewModel: TransactionHistoryViewModel by viewModel() private val bonusViewModel: BonusViewModel by viewModel() + private val homeViewModel: HomeViewModel by viewModel() + private lateinit var binding: ActivityMainBinding override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/com/hover/stax/hover/TransactionReceiver.kt b/app/src/main/java/com/hover/stax/hover/TransactionReceiver.kt index bba16efb0..ff78a5c42 100644 --- a/app/src/main/java/com/hover/stax/hover/TransactionReceiver.kt +++ b/app/src/main/java/com/hover/stax/hover/TransactionReceiver.kt @@ -7,7 +7,7 @@ import com.hover.sdk.actions.HoverAction import com.hover.sdk.transactions.TransactionContract import com.hover.stax.accounts.ACCOUNT_ID import com.hover.stax.accounts.Account -import com.hover.stax.accounts.AccountRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.actions.ActionRepo import com.hover.stax.channels.Channel @@ -117,14 +117,14 @@ class TransactionReceiver : BroadcastReceiver(), KoinComponent { } private fun getBizNo(intent: Intent): String? { - val inExtras = intent.getSerializableExtra(TransactionContract.COLUMN_INPUT_EXTRAS) as java.util.HashMap? + val inExtras = intent.getSerializableExtra(TransactionContract.COLUMN_INPUT_EXTRAS) as HashMap? if (inExtras != null && inExtras.containsKey(BUSINESS_NO)) return inExtras[BUSINESS_NO] else return null } private fun getBizName(intent: Intent): String? { - val outExtras = intent.getSerializableExtra(TransactionContract.COLUMN_PARSED_VARIABLES) as java.util.HashMap? + val outExtras = intent.getSerializableExtra(TransactionContract.COLUMN_PARSED_VARIABLES) as HashMap? if (outExtras != null && outExtras.containsKey(BUSINESS_NAME)) return outExtras[BUSINESS_NAME]?.replace(".", "") // MPESA adds a gramatically incorrect period which isn't easily fixable with a regex else return null diff --git a/app/src/main/java/com/hover/stax/inapp_banner/BannerUtils.kt b/app/src/main/java/com/hover/stax/inapp_banner/BannerUtils.kt index 3e429ae22..01fed00a6 100644 --- a/app/src/main/java/com/hover/stax/inapp_banner/BannerUtils.kt +++ b/app/src/main/java/com/hover/stax/inapp_banner/BannerUtils.kt @@ -2,8 +2,7 @@ package com.hover.stax.inapp_banner import android.content.Context import com.hover.sdk.permissions.PermissionHelper -import com.hover.stax.accounts.AccountRepo -import com.hover.stax.schedules.ScheduleRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.utils.DateUtils import com.hover.stax.utils.Utils import kotlinx.coroutines.* diff --git a/app/src/main/java/com/hover/stax/paybill/PaybillViewModel.kt b/app/src/main/java/com/hover/stax/paybill/PaybillViewModel.kt index 1d139d81b..34c2ea0f4 100644 --- a/app/src/main/java/com/hover/stax/paybill/PaybillViewModel.kt +++ b/app/src/main/java/com/hover/stax/paybill/PaybillViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.viewModelScope import com.hover.sdk.actions.HoverAction import com.hover.stax.R import com.hover.stax.accounts.Account -import com.hover.stax.accounts.AccountRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.actions.ActionRepo import com.hover.stax.contacts.ContactRepo import com.hover.stax.schedules.ScheduleRepo diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt index 62c2a584e..fab4b30f6 100644 --- a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt @@ -1,9 +1,9 @@ package com.hover.stax.presentation.home +import com.hover.stax.accounts.Account import com.hover.stax.domain.model.Bonus -sealed class HomeState { - object Loading : HomeState() - data class BonusList(val bonuses: List) : HomeState() - data class Error(val message: String) : HomeState() -} +data class HomeState ( + val bonuses: List = emptyList(), + val accounts: List = emptyList() +) diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt index b1cc8e42e..a0463ce68 100644 --- a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt @@ -2,33 +2,41 @@ package com.hover.stax.presentation.home import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hover.stax.data.Resource +import com.hover.stax.domain.use_case.accounts.GetAccountsUseCase import com.hover.stax.domain.use_case.bonus.FetchBonusUseCase import com.hover.stax.domain.use_case.bonus.GetBonusesUseCase import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.launchIn -import kotlinx.coroutines.flow.onEach +import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch +import timber.log.Timber -class HomeViewModel(private val getBonusesUseCase: GetBonusesUseCase, private val fetchBonusUseCase: FetchBonusUseCase) : ViewModel() { +class HomeViewModel( + private val getBonusesUseCase: GetBonusesUseCase, + private val fetchBonusUseCase: FetchBonusUseCase, + private val getAccountsUseCase: GetAccountsUseCase +) : ViewModel() { - private val _bonusList = MutableStateFlow(HomeState.BonusList(emptyList())) - val bonusList = _bonusList.asStateFlow() + private val _homeState = MutableStateFlow(HomeState()) + val homeState = _homeState.asStateFlow() init { fetchBonuses() } private fun fetchBonuses() = viewModelScope.launch { - fetchBonusUseCase.invoke() + fetchBonusUseCase() } - fun getBonusList() = getBonusesUseCase.getBonusList().onEach { result -> - when (result) { - is Resource.Loading -> _bonusList.value = HomeState.Loading - is Resource.Success -> _bonusList.value = HomeState.BonusList(result.data!!) - is Resource.Error -> _bonusList.value = HomeState.Error("No bonuses found") + fun getBonusList() = viewModelScope.launch { + getBonusesUseCase.getBonusList().collect { + _homeState.value = _homeState.value.copy(bonuses = it) } - }.launchIn(viewModelScope) + } + + fun getAccounts() = viewModelScope.launch { + getAccountsUseCase().collect { + _homeState.value = _homeState.value.copy(accounts = it) + } + } } \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/requests/NewRequestViewModel.kt b/app/src/main/java/com/hover/stax/requests/NewRequestViewModel.kt index 5f4ea5d3c..56344cf63 100644 --- a/app/src/main/java/com/hover/stax/requests/NewRequestViewModel.kt +++ b/app/src/main/java/com/hover/stax/requests/NewRequestViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import com.hover.stax.R import com.hover.stax.accounts.Account -import com.hover.stax.accounts.AccountRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.contacts.ContactRepo import com.hover.stax.contacts.StaxContact diff --git a/app/src/main/java/com/hover/stax/requests/RequestDetailViewModel.kt b/app/src/main/java/com/hover/stax/requests/RequestDetailViewModel.kt index 4acc20fdf..e3a60ba3f 100644 --- a/app/src/main/java/com/hover/stax/requests/RequestDetailViewModel.kt +++ b/app/src/main/java/com/hover/stax/requests/RequestDetailViewModel.kt @@ -2,12 +2,9 @@ package com.hover.stax.requests import androidx.lifecycle.* import com.hover.stax.accounts.Account -import com.hover.stax.accounts.AccountRepo -import com.hover.stax.channels.Channel -import com.hover.stax.channels.ChannelRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.contacts.ContactRepo import com.hover.stax.contacts.StaxContact -import com.hover.stax.schedules.ScheduleRepo import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch diff --git a/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt b/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt index f55a35b28..8a5d6cbd7 100644 --- a/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt +++ b/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt @@ -7,9 +7,9 @@ import com.hover.sdk.api.Hover import com.hover.sdk.api.Hover.getSMSMessageByUUID import com.hover.sdk.transactions.Transaction import com.hover.stax.accounts.Account -import com.hover.stax.accounts.AccountRepo +import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.actions.ActionRepo -import com.hover.stax.data.local.BonusRepo +import com.hover.stax.data.local.bonus.BonusRepo import com.hover.stax.contacts.ContactRepo import com.hover.stax.contacts.StaxContact import com.hover.stax.database.ParserRepo From 66cf975dbe072200cd59bf6b8c9cdd2aad6d0aa1 Mon Sep 17 00:00:00 2001 From: Ossai Nwachukwu Date: Fri, 17 Jun 2022 10:34:34 +0100 Subject: [PATCH 08/41] update om strings file to escape chars --- app/src/main/res/values-om/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values-om/strings.xml b/app/src/main/res/values-om/strings.xml index 50a5ec3c3..461c6ec48 100644 --- a/app/src/main/res/values-om/strings.xml +++ b/app/src/main/res/values-om/strings.xml @@ -367,7 +367,7 @@ Guyyaa hunda Torban torbaniin Torban 2tti tokko - Ji'a ji'aan + Ji\'a ji\'aan 0daily From 68cce5342d446437be12b7e5deaf56d508de5e43 Mon Sep 17 00:00:00 2001 From: Ossai Nwachukwu Date: Fri, 17 Jun 2022 11:17:56 +0100 Subject: [PATCH 09/41] updated om string file to excape chars --- app/src/main/res/values-om/strings.xml | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/src/main/res/values-om/strings.xml b/app/src/main/res/values-om/strings.xml index 461c6ec48..8c4bd92c5 100644 --- a/app/src/main/res/values-om/strings.xml +++ b/app/src/main/res/values-om/strings.xml @@ -238,9 +238,9 @@ Dogoggora hin beekamne. %1$s irraa deebii hin arganne. Daldalli kun waan hojjete hin fakkaatu. Mee irra deebi\'ii yaali. %1$s irraa deebii gartokkee qofa arganne. Daldalli kun waan hojjete hin fakkaatu. Mee irra deebi\'ii yaali. - Galtee kee keessaa tokko sirrii hin turre, maaltu akka dogoggora ta\'e ilaaluuf ibsa turtii armaan gadii ilaali. Maallaqni, lakkoofsi bilbilaa ykn lakkoofsi herregaa kamiyyuu sirrii ta’uu isaa mirkaneessi. Bal'ina walgahii armaan gadii ilaali. + Galtee kee keessaa tokko sirrii hin turre, maaltu akka dogoggora ta\'e ilaaluuf ibsa turtii armaan gadii ilaali. Maallaqni, lakkoofsi bilbilaa ykn lakkoofsi herregaa kamiyyuu sirrii ta\'uu isaa mirkaneessi. Bal\'ina walgahii armaan gadii ilaali. Neetworkiin kee dogongora deebise, maaloo irra deebi\'ii yaali. Yoo kun baay\'ee ta\'e maaloo dhiyeessaa networkii ykn tajaajila maallaqaa keessan qunnamuun komii dhiheessaa. - Dogoggora hin beekamne, maaltu akka dogoggora ta\'e baruuf bal\'inaan armaan gadii ilaali. Mee irra deebi'ii yaali. + Dogoggora hin beekamne, maaltu akka dogoggora ta\'e baruuf bal\'inaan armaan gadii ilaali. Mee irra deebi\'ii yaali. Dogoggora tarkaanfii fiigicha. Mee irra deebi\'ii yaali. @@ -391,7 +391,7 @@ Mirkaneessa eegaa jira Kutaan USSD xumurameera, garuu hanga ammaatti ergaa gabaabaa mirkaneessaa hin arganne. Madaallii - Maallaqni ji\'a kana keessa ba'e + Maallaqni ji\'a kana keessa ba\'e Maallaqa baatii kana keessa Kaffaltii bara kana %1$s kaffalame Daldala @@ -431,7 +431,7 @@ Stax App fayyadamuun, imaammata dhuunfaa keenya dubbistee haala tajaajilaa irratti walii galteetta. Dubbisuuf cuqaasaa Ba\'uu Mirkaneessi Logout milkaa\'eera - "Ba'uu akka barbaaddu mirkaneeffatteettaa?" + "Ba\'uu akka barbaaddu mirkaneeffatteettaa?" Maqaa keessan guutuu galchaa Lakkoofsa bilbilaa keessan galchaa @@ -504,11 +504,11 @@ daqiiqaa tokkoo gadi gara daqiiqaa tokkootti %1$d daqiiqaa - gara sa’aatii tokkootti + gara sa\'aatii tokkootti gara %1$d sa\'aatii guyyaa tokkotti %1$d guyyoota - gara ji’a tokkootti + gara ji\'a tokkootti Ji\'oota %1$d gara waggaa tokkootti %1$d waggaa @@ -522,12 +522,12 @@ Badhaasa - 💸 KAFFALTII ARGADHAA! KAARTAA DHANGALA'AA USSD + 💸 KAFFALTII ARGADHAA! KAARTAA DHANGALA\'AA USSD Stax dhangala\'aa USSD keessa darbuuf USD $5 - $50 siif kaffala. Jalqabi 🗺 KAARTAA DHANGALA\'AA USSD Gara Money Mapper baga nagaan dhuftan. Stax USSD nama hundaaf salphisuu barbaada. Stax biyyoota hedduu keessatti namoota hedduutti fiduuf, menu USSD hunda akka addunyaatti kaartaan kaa\'uu qabna. Stax akka Money Mapper tti makamaa fi daldala USSD milkaa\'inaan kaartaa gootan hundaaf $5 - $20 USD argadhaa. Menuuwwan USSD ammallee nu barbaachisan (bounties) fuula itti aanu irratti tarreeffamaniiru. Yeroo baayyee badhaasa haaraa itti daballa! - 1. Herrega Google keetiin seeni.\n2. Herrega baankii ykn maallaqa mobaayilaa kee kamiifuu badhaasa banaa barbaadi.\n3. Daldala USSD badhaasa irratti ibsame, akka Hafnaan Sakatta'uu ykn Yeroo Qilleensaa Bituu.\n 4. Bal’ina daldalaa irra deebi’ii ilaali. Yoo kufe ykn guutuu hin taane irra deebi'ii yaali.\n5. Stax ergaawwan kee ni ilaala, kunis guyyoota 7–10 fudhachuu danda'a. \n6. Dhuma torbanitti kaffaltii argatta + 1. Herrega Google keetiin seeni.\n2. Herrega baankii ykn maallaqa mobaayilaa kee kamiifuu badhaasa banaa barbaadi.\n3. Daldala USSD badhaasa irratti ibsame, akka Hafnaan Sakatta\'uu ykn Yeroo Qilleensaa Bituu.\n 4. Bal\'ina daldalaa irra deebi\'ii ilaali. Yoo kufe ykn guutuu hin taane irra deebi\'ii yaali.\n5. Stax ergaawwan kee ni ilaala, kunis guyyoota 7–10 fudhachuu danda\'a. \n6. Dhuma torbanitti kaffaltii argatta Yeroo qilleensaa nama kamiifuu %1$s bitadhaa Nama biraatiif yeroo qilleensaa bitadhu %1$s Nama biraatti maallaqa ergaa %1$s @@ -548,7 +548,7 @@ Walqunnamsiisaa jira, mee eegaa… Maaloo interneetii daataa qabaachuu keessan mirkaneessaa Mee irra deebi\'ii yaali. Yoo kun itti fufe, gaarummaadhaan ussd@stax.me irratti nu qunnamaa. - Daldala keessan mirkaneessaa jirra. Yoo milkaa’e guyyoota hojii 10 keessatti kaffaltiin akka kaffalamu eegaa. + Daldala keessan mirkaneessaa jirra. Yoo milkaa\'e guyyoota hojii 10 keessatti kaffaltiin akka kaffalamu eegaa. Raawwatame our requirements and is no longer available]]> our requirements. Please try again]]> @@ -556,11 +556,11 @@ %1$s - %2$s - $%3$d USD $%1$d, %2$s himachuuf.\n\nAkkuma xumurtaniin, odeeffannoo kaffaltiidhaaf walitti qabuuf email isiniif ergina. Guyyoota hojii 7–10 keessatti kaffaltiin siif kaffalama Dhangala\'aa USSD jalqabi - Dhangala\'aa kee sakatta'uu + Dhangala\'aa kee sakatta\'uu
If you have questions, please email us at ussd@stax.me ]]>
DHANGALA\'AA HOJJETAME Dhangala\'aa isaa ilaallee gaarii fakkaata! Inbox keessan keessatti email odeeffannoo kaffaltii qabu qabaachuu qabdu. - Dhangala’aa biraa keessa darbi + Dhangala\'aa biraa keessa darbi DHANGALA\'AA GALMEESSE USD $%1$d Biyya filadhu @@ -588,7 +588,7 @@ Interneetii barbaachisa Dhangala\'aa USSD kaartaan gochuuf data ykn Wifi connection si barbaachisa. Mee wal qunnamaa irra deebi\'aa yaalaa. Ammas yaali - Dogoggora hin beekamne, maaloo irra deebi\'ii yaali. Yoo dogongorri itti fufe maaloo appicha cufaatii irra deebi'aa jalqabsiisaa. + Dogoggora hin beekamne, maaloo irra deebi\'ii yaali. Yoo dogongorri itti fufe maaloo appicha cufaatii irra deebi\'aa jalqabsiisaa. Maaloo yoo xiqqaate akkaawuntii tokko filachuun Stax irratti dabaluu dandeessu @@ -604,7 +604,7 @@ Amma yaada kennaa Mallattoo baanarii Stax Stax daran fooyyessuuf kaffaltii argachuu barbaadduu? - Har\'a qorannoo qorannoof galmaa'aa + Har\'a qorannoo qorannoof galmaa\'aa https://joinstax.medium.com/phone-permissions-on-stax-a0ec82533570 https://joinstax.medium.com/ @@ -617,7 +617,7 @@ Achitti jechuun ni danda\'ama! Haala qormaataa bobba\'eera - Gaaffiiwwan yeroo baay’ee gaafataman + Gaaffiiwwan yeroo baay\'ee gaafataman Still have questions?

Email stax support ]]> Fe\'amaa jira… FAQ fe\'uu hin dandeenye, maaloo irra deebi\'ii yaali From f6d0e2f1efe3b2fad9b72d32d8f04118a5abc27c Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Mon, 20 Jun 2022 12:21:09 +0300 Subject: [PATCH 10/41] moves Account model to domain package --- .../stax/accounts/AccountDetailFragment.kt | 2 + .../stax/accounts/AccountDetailViewModel.kt | 1 + .../hover/stax/accounts/AccountDropdown.kt | 2 +- .../stax/accounts/AccountDropdownAdapter.kt | 4 +- .../hover/stax/accounts/AccountsAdapter.kt | 1 + .../hover/stax/accounts/AccountsViewModel.kt | 2 + .../stax/accounts/ChannelWithAccounts.kt | 1 + .../stax/actions/ActionSelectViewModel.kt | 2 +- .../stax/addChannels/AddChannelsFragment.kt | 6 +- .../stax/addChannels/ChannelsViewModel.kt | 4 +- .../com/hover/stax/balances/BalanceAdapter.kt | 9 ++- .../stax/balances/BalanceCardStackAdapter.kt | 2 +- .../hover/stax/balances/BalancesFragment.kt | 4 +- .../hover/stax/balances/BalancesViewModel.kt | 6 +- .../stax/data/local/accounts/AccountDao.kt | 2 +- .../stax/data/local/accounts/AccountRepo.kt | 2 +- .../data/repository/AccountRepositoryImpl.kt | 6 +- .../com/hover/stax/database/AppDatabase.kt | 2 +- .../{accounts => domain/model}/Account.kt | 2 +- .../domain/repository/AccountRepository.kt | 2 +- .../use_case/accounts/GetAccountsUseCase.kt | 2 +- .../accounts/SetDefaultAccountUseCase.kt | 2 +- .../stax/hover/AbstractHoverCallerActivity.kt | 2 +- .../java/com/hover/stax/hover/HoverSession.kt | 6 +- .../hover/stax/hover/TransactionReceiver.kt | 6 +- .../java/com/hover/stax/merchants/Merchant.kt | 2 +- .../hover/stax/merchants/MerchantViewModel.kt | 2 +- .../java/com/hover/stax/paybill/PayBill.kt | 2 +- .../hover/stax/paybill/PaybillViewModel.kt | 2 +- .../hover/stax/presentation/home/HomeState.kt | 2 +- .../hover/stax/requests/NewRequestFragment.kt | 2 +- .../stax/requests/NewRequestViewModel.kt | 4 +- .../java/com/hover/stax/requests/Request.kt | 71 +++++++++++-------- .../stax/requests/RequestDetailViewModel.kt | 2 +- .../stax/requests/RequestSenderInterface.kt | 2 +- .../hover/stax/settings/SettingsFragment.kt | 2 +- .../TransactionDetailsFragment.kt | 2 +- .../TransactionDetailsViewModel.kt | 2 +- .../stax/transactions/StaxTransaction.kt | 2 +- .../stax/transactions/TransactionRepo.kt | 5 +- .../stax/transfers/AbstractFormFragment.kt | 2 +- .../java/com/hover/stax/utils/UIHelper.kt | 3 - gradle.properties | 2 + 43 files changed, 101 insertions(+), 90 deletions(-) rename app/src/main/java/com/hover/stax/{accounts => domain/model}/Account.kt (98%) diff --git a/app/src/main/java/com/hover/stax/accounts/AccountDetailFragment.kt b/app/src/main/java/com/hover/stax/accounts/AccountDetailFragment.kt index 57def3f3f..7184611d8 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountDetailFragment.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountDetailFragment.kt @@ -18,6 +18,8 @@ import com.hover.stax.R import com.hover.stax.balances.BalanceAdapter import com.hover.stax.balances.BalancesViewModel import com.hover.stax.databinding.FragmentAccountBinding +import com.hover.stax.domain.model.Account +import com.hover.stax.domain.model.PLACEHOLDER import com.hover.stax.futureTransactions.FutureViewModel import com.hover.stax.futureTransactions.RequestsAdapter import com.hover.stax.futureTransactions.ScheduledAdapter diff --git a/app/src/main/java/com/hover/stax/accounts/AccountDetailViewModel.kt b/app/src/main/java/com/hover/stax/accounts/AccountDetailViewModel.kt index 645f4ae9f..33bc90eb5 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountDetailViewModel.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountDetailViewModel.kt @@ -7,6 +7,7 @@ import com.hover.stax.actions.ActionRepo import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo import com.hover.stax.data.local.accounts.AccountRepo +import com.hover.stax.domain.model.Account import com.hover.stax.transactions.StaxTransaction import com.hover.stax.transactions.TransactionHistory import com.hover.stax.transactions.TransactionRepo diff --git a/app/src/main/java/com/hover/stax/accounts/AccountDropdown.kt b/app/src/main/java/com/hover/stax/accounts/AccountDropdown.kt index 367c4dc10..b1dfe2a99 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountDropdown.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountDropdown.kt @@ -13,11 +13,11 @@ import com.bumptech.glide.request.transition.Transition import com.hover.sdk.actions.HoverAction import com.hover.stax.R import com.hover.stax.actions.ActionSelect +import com.hover.stax.domain.model.Account import com.hover.stax.utils.UIHelper import com.hover.stax.views.StaxDropdownLayout import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch -import timber.log.Timber class AccountDropdown(context: Context, attributeSet: AttributeSet) : StaxDropdownLayout(context, attributeSet) { diff --git a/app/src/main/java/com/hover/stax/accounts/AccountDropdownAdapter.kt b/app/src/main/java/com/hover/stax/accounts/AccountDropdownAdapter.kt index fd1ad54b7..b8f596750 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountDropdownAdapter.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountDropdownAdapter.kt @@ -7,7 +7,7 @@ import android.view.ViewGroup import android.widget.ArrayAdapter import com.hover.stax.R import com.hover.stax.databinding.StaxSpinnerItemWithLogoBinding -import com.hover.stax.utils.UIHelper +import com.hover.stax.domain.model.Account import com.hover.stax.utils.UIHelper.loadImage class AccountDropdownAdapter(val accounts: List, context: Context) : ArrayAdapter(context, 0, accounts) { @@ -41,7 +41,7 @@ class AccountDropdownAdapter(val accounts: List, context: Context) : Ar fun setAccount(account: Account) { binding.serviceItemNameId.text = account.alias - if(account.logoUrl.isEmpty()) + if (account.logoUrl.isEmpty()) binding.serviceItemImageId.loadImage(binding.root.context, R.drawable.ic_add) else binding.serviceItemImageId.loadImage(binding.root.context, account.logoUrl) diff --git a/app/src/main/java/com/hover/stax/accounts/AccountsAdapter.kt b/app/src/main/java/com/hover/stax/accounts/AccountsAdapter.kt index 515c20188..4476d10ec 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountsAdapter.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountsAdapter.kt @@ -5,6 +5,7 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.hover.stax.databinding.StaxSpinnerItemWithLogoBinding import com.hover.stax.R +import com.hover.stax.domain.model.Account import com.hover.stax.utils.GlideApp class AccountsAdapter(var accounts: List) : RecyclerView.Adapter() { diff --git a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt index 4bb2e28a3..276af99ef 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt @@ -11,6 +11,8 @@ import com.hover.stax.R import com.hover.stax.actions.ActionRepo import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.data.local.bonus.BonusRepo +import com.hover.stax.domain.model.Account +import com.hover.stax.domain.model.PLACEHOLDER import com.hover.stax.schedules.Schedule import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/java/com/hover/stax/accounts/ChannelWithAccounts.kt b/app/src/main/java/com/hover/stax/accounts/ChannelWithAccounts.kt index da85c4758..fe40325e3 100644 --- a/app/src/main/java/com/hover/stax/accounts/ChannelWithAccounts.kt +++ b/app/src/main/java/com/hover/stax/accounts/ChannelWithAccounts.kt @@ -3,6 +3,7 @@ package com.hover.stax.accounts import androidx.room.Embedded import androidx.room.Relation import com.hover.stax.channels.Channel +import com.hover.stax.domain.model.Account data class ChannelWithAccounts( @Embedded diff --git a/app/src/main/java/com/hover/stax/actions/ActionSelectViewModel.kt b/app/src/main/java/com/hover/stax/actions/ActionSelectViewModel.kt index 03779542c..6063905b2 100644 --- a/app/src/main/java/com/hover/stax/actions/ActionSelectViewModel.kt +++ b/app/src/main/java/com/hover/stax/actions/ActionSelectViewModel.kt @@ -5,10 +5,10 @@ import android.content.Context import androidx.lifecycle.AndroidViewModel import androidx.lifecycle.MediatorLiveData import androidx.lifecycle.MutableLiveData -import com.hover.stax.accounts.ACCOUNT_NAME import com.hover.sdk.actions.HoverAction import com.hover.sdk.actions.HoverAction.* import com.hover.stax.R +import com.hover.stax.domain.model.ACCOUNT_NAME import java.util.LinkedHashMap const val RECIPIENT_INSTITUTION = "recipientInstitution" diff --git a/app/src/main/java/com/hover/stax/addChannels/AddChannelsFragment.kt b/app/src/main/java/com/hover/stax/addChannels/AddChannelsFragment.kt index 405a495fa..25016afcb 100644 --- a/app/src/main/java/com/hover/stax/addChannels/AddChannelsFragment.kt +++ b/app/src/main/java/com/hover/stax/addChannels/AddChannelsFragment.kt @@ -9,10 +9,8 @@ import android.view.View import android.view.View.GONE import android.view.View.VISIBLE import android.view.ViewGroup -import android.widget.Toast import androidx.core.text.HtmlCompat import androidx.fragment.app.Fragment -import androidx.lifecycle.lifecycleScope import androidx.navigation.fragment.findNavController import androidx.recyclerview.selection.SelectionPredicates import androidx.recyclerview.selection.SelectionTracker @@ -20,7 +18,7 @@ import androidx.recyclerview.selection.StorageStrategy import androidx.work.ExistingWorkPolicy import androidx.work.WorkManager import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.accounts.AccountsAdapter import com.hover.stax.bonus.BonusViewModel import com.hover.stax.channels.Channel @@ -32,9 +30,7 @@ import com.hover.stax.utils.UIHelper import com.hover.stax.utils.Utils import com.hover.stax.views.RequestServiceDialog import com.hover.stax.views.StaxDialog -import kotlinx.coroutines.flow.collect import org.koin.androidx.viewmodel.ext.android.sharedViewModel -import org.koin.androidx.viewmodel.ext.android.viewModel import timber.log.Timber const val CHANNELS_REFRESHED = "has_refreshed_channels" diff --git a/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt b/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt index fbfbb8d5b..d9a932969 100644 --- a/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt +++ b/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt @@ -13,14 +13,14 @@ import com.hover.sdk.api.ActionApi import com.hover.sdk.api.Hover import com.hover.sdk.sims.SimInfo import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.data.local.accounts.AccountRepo -import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.actions.ActionRepo import com.hover.stax.data.local.bonus.BonusRepo import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo import com.hover.stax.countries.CountryAdapter +import com.hover.stax.domain.model.PLACEHOLDER import com.hover.stax.notifications.PushNotificationTopicsInterface import com.hover.stax.utils.AnalyticsUtil import com.hover.stax.utils.Utils diff --git a/app/src/main/java/com/hover/stax/balances/BalanceAdapter.kt b/app/src/main/java/com/hover/stax/balances/BalanceAdapter.kt index b8376c00b..0e1e548c5 100644 --- a/app/src/main/java/com/hover/stax/balances/BalanceAdapter.kt +++ b/app/src/main/java/com/hover/stax/balances/BalanceAdapter.kt @@ -7,13 +7,12 @@ import androidx.core.content.ContextCompat import androidx.core.graphics.drawable.DrawableCompat import androidx.recyclerview.widget.RecyclerView import com.hover.stax.R -import com.hover.stax.accounts.Account -import com.hover.stax.accounts.DUMMY import com.hover.stax.databinding.BalanceItemBinding +import com.hover.stax.domain.model.Account +import com.hover.stax.domain.model.DUMMY import com.hover.stax.utils.DateUtils import com.hover.stax.utils.UIHelper import com.hover.stax.utils.Utils -import timber.log.Timber class BalanceAdapter(val accounts: List, val balanceListener: BalanceListener?) : RecyclerView.Adapter() { @@ -73,8 +72,8 @@ class BalanceAdapter(val accounts: List, val balanceListener: BalanceLi } setColors( - holder, UIHelper.getColor(account.primaryColorHex, true, holder.itemView.context), - UIHelper.getColor(account.secondaryColorHex, false, holder.itemView.context) + holder, UIHelper.getColor(account.primaryColorHex, true, holder.itemView.context), + UIHelper.getColor(account.secondaryColorHex, false, holder.itemView.context) ) if (account.id == DUMMY) { diff --git a/app/src/main/java/com/hover/stax/balances/BalanceCardStackAdapter.kt b/app/src/main/java/com/hover/stax/balances/BalanceCardStackAdapter.kt index 6edb92d0e..c8ba83eae 100644 --- a/app/src/main/java/com/hover/stax/balances/BalanceCardStackAdapter.kt +++ b/app/src/main/java/com/hover/stax/balances/BalanceCardStackAdapter.kt @@ -2,7 +2,7 @@ package com.hover.stax.balances import android.content.Context import android.view.ViewGroup -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.databinding.StackBalanceCardBinding import com.hover.stax.utils.UIHelper import com.hover.stax.views.staxcardstack.StaxCardStackAdapter diff --git a/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt b/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt index ebad0d834..8310e8839 100644 --- a/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt +++ b/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt @@ -13,11 +13,11 @@ import androidx.recyclerview.widget.RecyclerView import com.hover.sdk.actions.HoverAction import com.hover.stax.MainNavigationDirections import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.accounts.AccountsViewModel -import com.hover.stax.accounts.DUMMY import com.hover.stax.addChannels.ChannelsViewModel import com.hover.stax.databinding.FragmentBalanceBinding +import com.hover.stax.domain.model.DUMMY import com.hover.stax.home.HomeFragmentDirections import com.hover.stax.home.MainActivity import com.hover.stax.hover.AbstractHoverCallerActivity diff --git a/app/src/main/java/com/hover/stax/balances/BalancesViewModel.kt b/app/src/main/java/com/hover/stax/balances/BalancesViewModel.kt index eb23bc790..c768ce8cc 100644 --- a/app/src/main/java/com/hover/stax/balances/BalancesViewModel.kt +++ b/app/src/main/java/com/hover/stax/balances/BalancesViewModel.kt @@ -6,10 +6,10 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import com.hover.sdk.actions.HoverAction -import com.hover.stax.accounts.Account -import com.hover.stax.data.local.accounts.AccountRepo -import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.actions.ActionRepo +import com.hover.stax.data.local.accounts.AccountRepo +import com.hover.stax.domain.model.Account +import com.hover.stax.domain.model.PLACEHOLDER import com.hover.stax.utils.Utils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.MutableSharedFlow diff --git a/app/src/main/java/com/hover/stax/data/local/accounts/AccountDao.kt b/app/src/main/java/com/hover/stax/data/local/accounts/AccountDao.kt index b1dbe599d..a485db63d 100644 --- a/app/src/main/java/com/hover/stax/data/local/accounts/AccountDao.kt +++ b/app/src/main/java/com/hover/stax/data/local/accounts/AccountDao.kt @@ -2,7 +2,7 @@ package com.hover.stax.data.local.accounts import androidx.lifecycle.LiveData import androidx.room.* -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import kotlinx.coroutines.flow.Flow @Dao diff --git a/app/src/main/java/com/hover/stax/data/local/accounts/AccountRepo.kt b/app/src/main/java/com/hover/stax/data/local/accounts/AccountRepo.kt index 58a51cd6b..4ca0b91bd 100644 --- a/app/src/main/java/com/hover/stax/data/local/accounts/AccountRepo.kt +++ b/app/src/main/java/com/hover/stax/data/local/accounts/AccountRepo.kt @@ -1,8 +1,8 @@ package com.hover.stax.data.local.accounts import androidx.lifecycle.LiveData -import com.hover.stax.accounts.Account import com.hover.stax.database.AppDatabase +import com.hover.stax.domain.model.Account import com.hover.stax.utils.AnalyticsUtil import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hover/stax/data/repository/AccountRepositoryImpl.kt b/app/src/main/java/com/hover/stax/data/repository/AccountRepositoryImpl.kt index fb01c700a..aa54fe174 100644 --- a/app/src/main/java/com/hover/stax/data/repository/AccountRepositoryImpl.kt +++ b/app/src/main/java/com/hover/stax/data/repository/AccountRepositoryImpl.kt @@ -4,12 +4,12 @@ import android.content.Context import com.hover.sdk.actions.HoverAction import com.hover.sdk.api.ActionApi import com.hover.stax.R -import com.hover.stax.accounts.Account -import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.actions.ActionRepo import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo import com.hover.stax.data.local.accounts.AccountRepo +import com.hover.stax.domain.model.Account +import com.hover.stax.domain.model.PLACEHOLDER import com.hover.stax.domain.repository.AccountRepository import com.hover.stax.notifications.PushNotificationTopicsInterface import com.hover.stax.utils.AnalyticsUtil @@ -50,7 +50,7 @@ class AccountRepositoryImpl(val accountRepo: AccountRepo, val channelRepo: Chann override suspend fun setDefaultAccount(account: Account) { fetchAccounts().collect { accounts -> - val current = accounts.firstOrNull{ it.isDefault }?.also { + val current = accounts.firstOrNull { it.isDefault }?.also { it.isDefault = false } diff --git a/app/src/main/java/com/hover/stax/database/AppDatabase.kt b/app/src/main/java/com/hover/stax/database/AppDatabase.kt index ccf265926..a3d441afc 100644 --- a/app/src/main/java/com/hover/stax/database/AppDatabase.kt +++ b/app/src/main/java/com/hover/stax/database/AppDatabase.kt @@ -6,7 +6,6 @@ import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase import androidx.room.migration.Migration -import com.hover.stax.accounts.Account import com.hover.stax.data.local.accounts.AccountDao import com.hover.stax.domain.model.Bonus import com.hover.stax.data.local.bonus.BonusDao @@ -14,6 +13,7 @@ import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelDao import com.hover.stax.contacts.ContactDao import com.hover.stax.contacts.StaxContact +import com.hover.stax.domain.model.Account import com.hover.stax.merchants.Merchant import com.hover.stax.merchants.MerchantDao import com.hover.stax.paybill.Paybill diff --git a/app/src/main/java/com/hover/stax/accounts/Account.kt b/app/src/main/java/com/hover/stax/domain/model/Account.kt similarity index 98% rename from app/src/main/java/com/hover/stax/accounts/Account.kt rename to app/src/main/java/com/hover/stax/domain/model/Account.kt index 9c6670637..fbfae10a9 100644 --- a/app/src/main/java/com/hover/stax/accounts/Account.kt +++ b/app/src/main/java/com/hover/stax/domain/model/Account.kt @@ -1,4 +1,4 @@ -package com.hover.stax.accounts +package com.hover.stax.domain.model import androidx.room.* import com.hover.stax.channels.Channel diff --git a/app/src/main/java/com/hover/stax/domain/repository/AccountRepository.kt b/app/src/main/java/com/hover/stax/domain/repository/AccountRepository.kt index 680b8b57a..8982d31ed 100644 --- a/app/src/main/java/com/hover/stax/domain/repository/AccountRepository.kt +++ b/app/src/main/java/com/hover/stax/domain/repository/AccountRepository.kt @@ -1,6 +1,6 @@ package com.hover.stax.domain.repository -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.channels.Channel import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hover/stax/domain/use_case/accounts/GetAccountsUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/accounts/GetAccountsUseCase.kt index 39f5c2ed3..b8918215a 100644 --- a/app/src/main/java/com/hover/stax/domain/use_case/accounts/GetAccountsUseCase.kt +++ b/app/src/main/java/com/hover/stax/domain/use_case/accounts/GetAccountsUseCase.kt @@ -1,6 +1,6 @@ package com.hover.stax.domain.use_case.accounts -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.domain.repository.AccountRepository import kotlinx.coroutines.flow.Flow diff --git a/app/src/main/java/com/hover/stax/domain/use_case/accounts/SetDefaultAccountUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/accounts/SetDefaultAccountUseCase.kt index 49274d616..1c2b91651 100644 --- a/app/src/main/java/com/hover/stax/domain/use_case/accounts/SetDefaultAccountUseCase.kt +++ b/app/src/main/java/com/hover/stax/domain/use_case/accounts/SetDefaultAccountUseCase.kt @@ -1,6 +1,6 @@ package com.hover.stax.domain.use_case.accounts -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.domain.repository.AccountRepository class SetDefaultAccountUseCase(private val accountsRepository: AccountRepository) { diff --git a/app/src/main/java/com/hover/stax/hover/AbstractHoverCallerActivity.kt b/app/src/main/java/com/hover/stax/hover/AbstractHoverCallerActivity.kt index d38e99c42..a3c2efaa5 100644 --- a/app/src/main/java/com/hover/stax/hover/AbstractHoverCallerActivity.kt +++ b/app/src/main/java/com/hover/stax/hover/AbstractHoverCallerActivity.kt @@ -7,7 +7,7 @@ import com.hover.sdk.actions.HoverAction import com.hover.sdk.api.HoverParameters import com.hover.sdk.transactions.TransactionContract import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.balances.BalancesViewModel import com.hover.stax.home.NavHelper import com.hover.stax.notifications.PushNotificationTopicsInterface diff --git a/app/src/main/java/com/hover/stax/hover/HoverSession.kt b/app/src/main/java/com/hover/stax/hover/HoverSession.kt index b8529eed2..1af575f88 100644 --- a/app/src/main/java/com/hover/stax/hover/HoverSession.kt +++ b/app/src/main/java/com/hover/stax/hover/HoverSession.kt @@ -7,10 +7,10 @@ import com.hover.sdk.actions.HoverAction import com.hover.sdk.api.Hover import com.hover.sdk.api.HoverParameters import com.hover.stax.R -import com.hover.stax.accounts.ACCOUNT_ID -import com.hover.stax.accounts.ACCOUNT_NAME -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.contacts.PhoneHelper +import com.hover.stax.domain.model.ACCOUNT_ID +import com.hover.stax.domain.model.ACCOUNT_NAME import com.hover.stax.settings.TEST_MODE import com.hover.stax.utils.AnalyticsUtil import com.hover.stax.utils.Utils diff --git a/app/src/main/java/com/hover/stax/hover/TransactionReceiver.kt b/app/src/main/java/com/hover/stax/hover/TransactionReceiver.kt index ff78a5c42..626c7c71f 100644 --- a/app/src/main/java/com/hover/stax/hover/TransactionReceiver.kt +++ b/app/src/main/java/com/hover/stax/hover/TransactionReceiver.kt @@ -5,15 +5,15 @@ import android.content.Context import android.content.Intent import com.hover.sdk.actions.HoverAction import com.hover.sdk.transactions.TransactionContract -import com.hover.stax.accounts.ACCOUNT_ID -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.data.local.accounts.AccountRepo -import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.actions.ActionRepo import com.hover.stax.channels.Channel import com.hover.stax.channels.ChannelRepo import com.hover.stax.contacts.ContactRepo import com.hover.stax.contacts.StaxContact +import com.hover.stax.domain.model.ACCOUNT_ID +import com.hover.stax.domain.model.PLACEHOLDER import com.hover.stax.merchants.MerchantRepo import com.hover.stax.paybill.BUSINESS_NAME import com.hover.stax.paybill.BUSINESS_NO diff --git a/app/src/main/java/com/hover/stax/merchants/Merchant.kt b/app/src/main/java/com/hover/stax/merchants/Merchant.kt index 6ecb117d2..80d2ea709 100644 --- a/app/src/main/java/com/hover/stax/merchants/Merchant.kt +++ b/app/src/main/java/com/hover/stax/merchants/Merchant.kt @@ -1,7 +1,7 @@ package com.hover.stax.merchants import androidx.room.* -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.channels.Channel import javax.annotation.Nullable diff --git a/app/src/main/java/com/hover/stax/merchants/MerchantViewModel.kt b/app/src/main/java/com/hover/stax/merchants/MerchantViewModel.kt index b8649e8e2..a18392aa8 100644 --- a/app/src/main/java/com/hover/stax/merchants/MerchantViewModel.kt +++ b/app/src/main/java/com/hover/stax/merchants/MerchantViewModel.kt @@ -6,7 +6,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import com.hover.sdk.actions.HoverAction import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.contacts.ContactRepo import com.hover.stax.paybill.BUSINESS_NO import com.hover.stax.schedules.ScheduleRepo diff --git a/app/src/main/java/com/hover/stax/paybill/PayBill.kt b/app/src/main/java/com/hover/stax/paybill/PayBill.kt index 2bec40dcc..6b5af0afb 100644 --- a/app/src/main/java/com/hover/stax/paybill/PayBill.kt +++ b/app/src/main/java/com/hover/stax/paybill/PayBill.kt @@ -2,8 +2,8 @@ package com.hover.stax.paybill import androidx.room.* import com.hover.sdk.actions.HoverAction -import com.hover.stax.accounts.Account import com.hover.stax.channels.Channel +import com.hover.stax.domain.model.Account import javax.annotation.Nullable const val BUSINESS_NO = "businessNo" diff --git a/app/src/main/java/com/hover/stax/paybill/PaybillViewModel.kt b/app/src/main/java/com/hover/stax/paybill/PaybillViewModel.kt index 34c2ea0f4..31708e303 100644 --- a/app/src/main/java/com/hover/stax/paybill/PaybillViewModel.kt +++ b/app/src/main/java/com/hover/stax/paybill/PaybillViewModel.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import com.hover.sdk.actions.HoverAction import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.actions.ActionRepo import com.hover.stax.contacts.ContactRepo diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt index fab4b30f6..a906994c9 100644 --- a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt @@ -1,6 +1,6 @@ package com.hover.stax.presentation.home -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.domain.model.Bonus data class HomeState ( diff --git a/app/src/main/java/com/hover/stax/requests/NewRequestFragment.kt b/app/src/main/java/com/hover/stax/requests/NewRequestFragment.kt index 6b9106e73..ba3e95390 100644 --- a/app/src/main/java/com/hover/stax/requests/NewRequestFragment.kt +++ b/app/src/main/java/com/hover/stax/requests/NewRequestFragment.kt @@ -13,7 +13,7 @@ import androidx.annotation.CallSuper import androidx.lifecycle.Observer import androidx.navigation.fragment.findNavController import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.contacts.ContactInput import com.hover.stax.contacts.StaxContact import com.hover.stax.databinding.FragmentRequestBinding diff --git a/app/src/main/java/com/hover/stax/requests/NewRequestViewModel.kt b/app/src/main/java/com/hover/stax/requests/NewRequestViewModel.kt index 56344cf63..d3e880a17 100644 --- a/app/src/main/java/com/hover/stax/requests/NewRequestViewModel.kt +++ b/app/src/main/java/com/hover/stax/requests/NewRequestViewModel.kt @@ -5,11 +5,11 @@ import androidx.lifecycle.MediatorLiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.viewModelScope import com.hover.stax.R -import com.hover.stax.accounts.Account import com.hover.stax.data.local.accounts.AccountRepo -import com.hover.stax.accounts.PLACEHOLDER import com.hover.stax.contacts.ContactRepo import com.hover.stax.contacts.StaxContact +import com.hover.stax.domain.model.Account +import com.hover.stax.domain.model.PLACEHOLDER import com.hover.stax.schedules.ScheduleRepo import com.hover.stax.schedules.Schedule import com.hover.stax.transfers.AbstractFormViewModel diff --git a/app/src/main/java/com/hover/stax/requests/Request.kt b/app/src/main/java/com/hover/stax/requests/Request.kt index 6f6363b34..3467a302a 100644 --- a/app/src/main/java/com/hover/stax/requests/Request.kt +++ b/app/src/main/java/com/hover/stax/requests/Request.kt @@ -1,17 +1,15 @@ package com.hover.stax.requests import android.content.Context - import android.text.TextUtils import androidx.room.ColumnInfo import androidx.room.Entity import androidx.room.Ignore import androidx.room.PrimaryKey import com.hover.stax.R -import com.hover.stax.accounts.Account -import com.hover.stax.channels.Channel import com.hover.stax.contacts.PhoneHelper import com.hover.stax.contacts.StaxContact +import com.hover.stax.domain.model.Account import com.hover.stax.utils.DateUtils.now import com.hover.stax.utils.Utils.formatAmount import com.hover.stax.utils.paymentLinkCryptography.Base64 @@ -60,7 +58,7 @@ class Request { constructor() @Ignore - constructor(amount: String?, note: String?, requester_number: String? , requester_institution_id:Int ) { + constructor(amount: String?, note: String?, requester_number: String?, requester_institution_id: Int) { this.amount = amount this.note = note this.requester_number = requester_number @@ -108,13 +106,16 @@ class Request { fun generateWhatsappRecipientString(contacts: List, account: Account?): String { val phones = StringBuilder() - if(contacts.isNotEmpty()) { + if (contacts.isNotEmpty()) { for (r in contacts.indices) { if (phones.isNotEmpty()) phones.append(",") - contacts[r].let{ + contacts[r].let { phones.append( - PhoneHelper.getInternationalNumberNoPlus(it.accountNumber, - account?.countryAlpha2 ?: Lingver.getInstance().getLocale().country)) + PhoneHelper.getInternationalNumberNoPlus( + it.accountNumber, + account?.countryAlpha2 ?: Lingver.getInstance().getLocale().country + ) + ) } } } @@ -122,12 +123,16 @@ class Request { } fun generateMessage(c: Context): String { - val amountString = if (amount != null) c.getString(R.string.sms_amount_detail, - formatAmount(amount!!)) + val amountString = if (amount != null) c.getString( + R.string.sms_amount_detail, + formatAmount(amount!!) + ) else "" val noteString = - if (note != null && !TextUtils.isEmpty(note)) c.getString(R.string.sms_note_detail, - note) + if (note != null && !TextUtils.isEmpty(note)) c.getString( + R.string.sms_note_detail, + note + ) else " " val paymentLink = generateStaxLink(c) return c.getString(R.string.sms_request_template, amountString, noteString, paymentLink) @@ -136,11 +141,13 @@ class Request { private fun generateStaxLink(c: Context): String { val amountNoFormat = if (!amount.isNullOrEmpty()) amount else "0.00" val requesterNumber = requester_number!!.replace("+", "") - val params = c.getString(R.string.payment_url_end, + val params = c.getString( + R.string.payment_url_end, amountNoFormat, requester_institution_id, requesterNumber, - now()) + now() + ) Timber.i("encrypting from: %s", params) val encryptedString = encryptBijective(params, c) Timber.i("link: %s", c.resources.getString(R.string.payment_root_url, encryptedString)) @@ -180,22 +187,26 @@ class Request { .setCharsetName("UTF8").setIterationCount(65536).setKey("ves€Z€xs€aBKgh") .setDigestAlgorithm("SHA1").setSalt("A secured salt").setBase64Mode(Base64.DEFAULT) .setAlgorithm("AES/CBC/PKCS5Padding").setSecureRandomAlgorithm("SHA1PRNG") - .setSecretKeyType("PBKDF2WithHmacSHA1").setIv(byteArrayOf(29, - 88, - -79, - -101, - -108, - -38, - -126, - 90, - 52, - 101, - -35, - 114, - 12, - -48, - -66, - -30)) + .setSecretKeyType("PBKDF2WithHmacSHA1").setIv( + byteArrayOf( + 29, + 88, + -79, + -101, + -108, + -38, + -126, + 90, + 52, + 101, + -35, + 114, + 12, + -48, + -66, + -30 + ) + ) fun decryptBijective(value: String, c: Context): String { val valueChar = value.toCharArray() diff --git a/app/src/main/java/com/hover/stax/requests/RequestDetailViewModel.kt b/app/src/main/java/com/hover/stax/requests/RequestDetailViewModel.kt index e3a60ba3f..ca4b46079 100644 --- a/app/src/main/java/com/hover/stax/requests/RequestDetailViewModel.kt +++ b/app/src/main/java/com/hover/stax/requests/RequestDetailViewModel.kt @@ -1,7 +1,7 @@ package com.hover.stax.requests import androidx.lifecycle.* -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.contacts.ContactRepo import com.hover.stax.contacts.StaxContact diff --git a/app/src/main/java/com/hover/stax/requests/RequestSenderInterface.kt b/app/src/main/java/com/hover/stax/requests/RequestSenderInterface.kt index e8d896f4f..afc0419e4 100644 --- a/app/src/main/java/com/hover/stax/requests/RequestSenderInterface.kt +++ b/app/src/main/java/com/hover/stax/requests/RequestSenderInterface.kt @@ -11,7 +11,7 @@ import android.view.View import android.widget.TextView import androidx.core.content.ContextCompat import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.contacts.StaxContact import com.hover.stax.utils.AnalyticsUtil.logAnalyticsEvent import com.hover.stax.utils.UIHelper.flashMessage diff --git a/app/src/main/java/com/hover/stax/settings/SettingsFragment.kt b/app/src/main/java/com/hover/stax/settings/SettingsFragment.kt index 6c944f26e..0171d4fa9 100644 --- a/app/src/main/java/com/hover/stax/settings/SettingsFragment.kt +++ b/app/src/main/java/com/hover/stax/settings/SettingsFragment.kt @@ -13,7 +13,7 @@ import androidx.navigation.fragment.findNavController import com.hover.sdk.api.Hover import com.hover.stax.BuildConfig import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.accounts.AccountsViewModel import com.hover.stax.databinding.FragmentSettingsBinding import com.hover.stax.languages.LanguageViewModel diff --git a/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsFragment.kt b/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsFragment.kt index fbdb4f2f0..05de7644c 100644 --- a/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsFragment.kt +++ b/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsFragment.kt @@ -20,7 +20,7 @@ import com.hover.sdk.api.Hover import com.hover.sdk.transactions.Transaction import com.hover.stax.ApplicationInstance import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.contacts.StaxContact import com.hover.stax.databinding.FragmentTransactionBinding import com.hover.stax.home.MainActivity diff --git a/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt b/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt index 8a5d6cbd7..b698d7e55 100644 --- a/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt +++ b/app/src/main/java/com/hover/stax/transactionDetails/TransactionDetailsViewModel.kt @@ -6,7 +6,7 @@ import com.hover.sdk.actions.HoverAction import com.hover.sdk.api.Hover import com.hover.sdk.api.Hover.getSMSMessageByUUID import com.hover.sdk.transactions.Transaction -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.actions.ActionRepo import com.hover.stax.data.local.bonus.BonusRepo diff --git a/app/src/main/java/com/hover/stax/transactions/StaxTransaction.kt b/app/src/main/java/com/hover/stax/transactions/StaxTransaction.kt index eda249b7f..2b55ed37d 100644 --- a/app/src/main/java/com/hover/stax/transactions/StaxTransaction.kt +++ b/app/src/main/java/com/hover/stax/transactions/StaxTransaction.kt @@ -15,7 +15,7 @@ import timber.log.Timber import com.hover.stax.R import com.hover.sdk.api.HoverParameters import com.hover.sdk.transactions.Transaction -import com.hover.stax.accounts.ACCOUNT_ID +import com.hover.stax.domain.model.ACCOUNT_ID import com.hover.stax.paybill.BUSINESS_NO import com.hover.stax.utils.Utils import java.util.HashMap diff --git a/app/src/main/java/com/hover/stax/transactions/TransactionRepo.kt b/app/src/main/java/com/hover/stax/transactions/TransactionRepo.kt index d636ba2c7..d070d7667 100644 --- a/app/src/main/java/com/hover/stax/transactions/TransactionRepo.kt +++ b/app/src/main/java/com/hover/stax/transactions/TransactionRepo.kt @@ -5,12 +5,11 @@ import android.content.Context import android.content.Intent import androidx.lifecycle.LiveData import com.hover.sdk.actions.HoverAction -import com.hover.sdk.database.HoverRoomDatabase import com.hover.sdk.transactions.TransactionContract import com.hover.stax.R -import com.hover.stax.accounts.Account import com.hover.stax.contacts.StaxContact import com.hover.stax.database.AppDatabase +import com.hover.stax.domain.model.Account import com.hover.stax.utils.AnalyticsUtil import com.hover.stax.utils.DateUtils import kotlinx.coroutines.flow.Flow @@ -28,7 +27,7 @@ class TransactionRepo(db: AppDatabase) { val transactionsForAppReview: LiveData>? get() = transactionDao.transactionsForAppReview - val allNonBountyTransactions : LiveData> + val allNonBountyTransactions: LiveData> get() = transactionDao.nonBountyTransactions @SuppressLint("DefaultLocale") diff --git a/app/src/main/java/com/hover/stax/transfers/AbstractFormFragment.kt b/app/src/main/java/com/hover/stax/transfers/AbstractFormFragment.kt index d044fd84d..d7aaae2e3 100644 --- a/app/src/main/java/com/hover/stax/transfers/AbstractFormFragment.kt +++ b/app/src/main/java/com/hover/stax/transfers/AbstractFormFragment.kt @@ -17,7 +17,7 @@ import androidx.navigation.NavDirections import androidx.navigation.fragment.findNavController import com.hover.sdk.actions.HoverAction import com.hover.stax.R -import com.hover.stax.accounts.Account +import com.hover.stax.domain.model.Account import com.hover.stax.accounts.AccountDropdown import com.hover.stax.accounts.AccountsViewModel import com.hover.stax.actions.ActionSelectViewModel diff --git a/app/src/main/java/com/hover/stax/utils/UIHelper.kt b/app/src/main/java/com/hover/stax/utils/UIHelper.kt index 7103f6226..3d1b61ba5 100644 --- a/app/src/main/java/com/hover/stax/utils/UIHelper.kt +++ b/app/src/main/java/com/hover/stax/utils/UIHelper.kt @@ -9,7 +9,6 @@ import android.os.Build import android.text.SpannableString import android.text.style.UnderlineSpan import android.view.View -import android.view.WindowInsetsController import android.widget.ImageButton import android.widget.ImageView import android.widget.TextView @@ -24,9 +23,7 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.bumptech.glide.request.target.CustomTarget import com.google.android.material.snackbar.Snackbar import com.hover.stax.R -import com.hover.stax.accounts.Account import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch import timber.log.Timber diff --git a/gradle.properties b/gradle.properties index 50f4b3a19..4e95c5711 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,3 +18,5 @@ org.gradle.jvmargs=-Xmx2048M -Dkotlin.daemon.jvm.options\="-Xmx2048M" -XX\:+UseP android.useAndroidX=true android.enableJetifier=true org.gradle.vfs.watch=true +org.gradle.unsafe.configuration-cache=true + From f05a38bda3518fdcea05479f2608f1677f1d27ba Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Mon, 20 Jun 2022 13:43:24 +0300 Subject: [PATCH 11/41] completes homeviewmodel setup and refactors necessary for screen --- .../repository/FinancialTipsRepositoryImpl.kt | 56 +++++++++++++++++++ .../main/java/com/hover/stax/di/Modules.kt | 6 +- .../hover/stax/domain/model/FinancialTip.kt | 13 +++++ .../repository/FinancialTipsRepository.kt | 9 +++ .../use_case/bonus/FetchBonusUseCase.kt | 5 +- .../use_case/bonus/GetBonusesUseCase.kt | 4 +- .../use_case/financial_tips/GetTipsUseCase.kt | 11 ++++ .../financialTips/FinancialTipsAdapter.kt | 1 + .../financialTips/FinancialTipsFragment.kt | 1 + .../financialTips/FinancialTipsViewModel.kt | 3 +- .../java/com/hover/stax/home/HomeFragment.kt | 23 ++++---- .../hover/stax/presentation/home/HomeState.kt | 4 +- .../stax/presentation/home/HomeViewModel.kt | 12 +++- 13 files changed, 123 insertions(+), 25 deletions(-) create mode 100644 app/src/main/java/com/hover/stax/data/repository/FinancialTipsRepositoryImpl.kt create mode 100644 app/src/main/java/com/hover/stax/domain/model/FinancialTip.kt create mode 100644 app/src/main/java/com/hover/stax/domain/repository/FinancialTipsRepository.kt create mode 100644 app/src/main/java/com/hover/stax/domain/use_case/financial_tips/GetTipsUseCase.kt diff --git a/app/src/main/java/com/hover/stax/data/repository/FinancialTipsRepositoryImpl.kt b/app/src/main/java/com/hover/stax/data/repository/FinancialTipsRepositoryImpl.kt new file mode 100644 index 000000000..454c7ad6c --- /dev/null +++ b/app/src/main/java/com/hover/stax/data/repository/FinancialTipsRepositoryImpl.kt @@ -0,0 +1,56 @@ +package com.hover.stax.data.repository + +import android.content.Context +import com.google.firebase.Timestamp +import com.google.firebase.firestore.Query +import com.google.firebase.firestore.ktx.firestore +import com.google.firebase.firestore.ktx.firestoreSettings +import com.google.firebase.ktx.Firebase +import com.hover.stax.R +import com.hover.stax.domain.model.FinancialTip +import com.hover.stax.domain.repository.FinancialTipsRepository +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.channelFlow +import kotlinx.coroutines.launch +import kotlinx.coroutines.withContext +import timber.log.Timber + +@OptIn(ExperimentalCoroutinesApi::class) +class FinancialTipsRepositoryImpl(val context: Context, private val coroutineDispatcher: CoroutineDispatcher) : FinancialTipsRepository { + + val db = Firebase.firestore + val settings = firestoreSettings { isPersistenceEnabled = true } + + override suspend fun fetchTips(): Flow> = channelFlow { + withContext(coroutineDispatcher) { + val timestamp = Timestamp.now() + + db.collection(context.getString(R.string.tips_table)) + .orderBy("date", Query.Direction.DESCENDING) + .whereLessThanOrEqualTo("date", timestamp.toDate()) + .limit(20) + .get() + .addOnSuccessListener { snapshot -> + val financialTip = snapshot.map { document -> + FinancialTip( + document.id, document.data["title"].toString(), document.data["content"].toString(), + document.data["snippet"].toString(), document.getDate("date"), document.data["share copy"].toString(), + document.data["deep link"].toString() + ) + } + + launch { + send(financialTip.filterNot { it.date == null }.sortedByDescending { it.date!!.time }) + } + } + .addOnFailureListener { + Timber.e("Error fetching wellness tips: ${it.localizedMessage}") + launch { + send(emptyList()) + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/di/Modules.kt b/app/src/main/java/com/hover/stax/di/Modules.kt index 6e9762c4c..eb1254243 100644 --- a/app/src/main/java/com/hover/stax/di/Modules.kt +++ b/app/src/main/java/com/hover/stax/di/Modules.kt @@ -15,15 +15,18 @@ import com.hover.stax.data.local.accounts.AccountRepo import com.hover.stax.data.local.bonus.BonusRepo import com.hover.stax.data.repository.AccountRepositoryImpl import com.hover.stax.data.repository.BonusRepositoryImpl +import com.hover.stax.data.repository.FinancialTipsRepositoryImpl import com.hover.stax.database.AppDatabase import com.hover.stax.database.ParserRepo import com.hover.stax.domain.repository.AccountRepository import com.hover.stax.domain.repository.BonusRepository +import com.hover.stax.domain.repository.FinancialTipsRepository import com.hover.stax.domain.use_case.accounts.CreateAccountsUseCase import com.hover.stax.domain.use_case.accounts.GetAccountsUseCase import com.hover.stax.domain.use_case.accounts.SetDefaultAccountUseCase import com.hover.stax.domain.use_case.bonus.FetchBonusUseCase import com.hover.stax.domain.use_case.bonus.GetBonusesUseCase +import com.hover.stax.domain.use_case.financial_tips.GetTipsUseCase import com.hover.stax.faq.FaqViewModel import com.hover.stax.financialTips.FinancialTipsViewModel import com.hover.stax.futureTransactions.FutureViewModel @@ -108,6 +111,7 @@ val repositories = module { single { BonusRepositoryImpl(get(), get(), get(named("CoroutineDispatcher"))) } single { AccountRepositoryImpl(get(), get(), get(), get(named("CoroutineDispatcher"))) } + single { FinancialTipsRepositoryImpl(get(), get(named("CoroutineDispatcher")))} } val useCases = module { @@ -118,5 +122,5 @@ val useCases = module { factoryOf(::SetDefaultAccountUseCase) factoryOf(::CreateAccountsUseCase) - + factoryOf(::GetTipsUseCase) } \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/model/FinancialTip.kt b/app/src/main/java/com/hover/stax/domain/model/FinancialTip.kt new file mode 100644 index 000000000..f8e0e459d --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/model/FinancialTip.kt @@ -0,0 +1,13 @@ +package com.hover.stax.domain.model + +import java.util.* + +data class FinancialTip( + val id: String, + val title: String, + val content: String, + val snippet: String, + val date: Date?, + val shareCopy: String?, + val deepLink: String? +) diff --git a/app/src/main/java/com/hover/stax/domain/repository/FinancialTipsRepository.kt b/app/src/main/java/com/hover/stax/domain/repository/FinancialTipsRepository.kt new file mode 100644 index 000000000..4e6fd8115 --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/repository/FinancialTipsRepository.kt @@ -0,0 +1,9 @@ +package com.hover.stax.domain.repository + +import com.hover.stax.domain.model.FinancialTip +import kotlinx.coroutines.flow.Flow + +interface FinancialTipsRepository { + + suspend fun fetchTips(): Flow> +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/use_case/bonus/FetchBonusUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/bonus/FetchBonusUseCase.kt index 23c5a7fda..7c2e58cc0 100644 --- a/app/src/main/java/com/hover/stax/domain/use_case/bonus/FetchBonusUseCase.kt +++ b/app/src/main/java/com/hover/stax/domain/use_case/bonus/FetchBonusUseCase.kt @@ -4,7 +4,6 @@ import com.hover.stax.domain.repository.BonusRepository class FetchBonusUseCase(private val repository: BonusRepository) { - suspend operator fun invoke() { - repository.fetchBonuses() - } + suspend operator fun invoke() = repository.fetchBonuses() + } \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt index 84bb8816a..29be7f2d3 100644 --- a/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt +++ b/app/src/main/java/com/hover/stax/domain/use_case/bonus/GetBonusesUseCase.kt @@ -9,9 +9,7 @@ import kotlinx.coroutines.flow.flow class GetBonusesUseCase(private val repository: BonusRepository) { - suspend fun getBonusList(): Flow> { - return repository.getBonusList() - } + suspend operator fun invoke(): Flow> = repository.getBonusList() fun getBonusByPurchaseChannel(channelId: Int): Flow> = flow { emit(Resource.Loading()) diff --git a/app/src/main/java/com/hover/stax/domain/use_case/financial_tips/GetTipsUseCase.kt b/app/src/main/java/com/hover/stax/domain/use_case/financial_tips/GetTipsUseCase.kt new file mode 100644 index 000000000..fd3ccd74c --- /dev/null +++ b/app/src/main/java/com/hover/stax/domain/use_case/financial_tips/GetTipsUseCase.kt @@ -0,0 +1,11 @@ +package com.hover.stax.domain.use_case.financial_tips + +import com.hover.stax.domain.model.FinancialTip +import com.hover.stax.domain.repository.FinancialTipsRepository +import kotlinx.coroutines.flow.Flow + +class GetTipsUseCase(private val financialTipsRepository: FinancialTipsRepository) { + + suspend operator fun invoke() : Flow> = financialTipsRepository.fetchTips() + +} \ No newline at end of file diff --git a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsAdapter.kt b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsAdapter.kt index 127cb91ef..59ac6238b 100644 --- a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsAdapter.kt +++ b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsAdapter.kt @@ -4,6 +4,7 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import com.hover.stax.databinding.ItemWellnessTipsBinding +import com.hover.stax.domain.model.FinancialTip import com.hover.stax.utils.DateUtils class FinancialTipsAdapter(private val tips: List, val selectListener: SelectListener) : RecyclerView.Adapter() { diff --git a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsFragment.kt b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsFragment.kt index a1a83f9db..9ad4ddecb 100644 --- a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsFragment.kt +++ b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsFragment.kt @@ -12,6 +12,7 @@ import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.navArgs import com.hover.stax.R import com.hover.stax.databinding.FragmentWellnessBinding +import com.hover.stax.domain.model.FinancialTip import com.hover.stax.utils.AnalyticsUtil import com.hover.stax.utils.UIHelper import com.hover.stax.utils.collectLatestLifecycleFlow diff --git a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsViewModel.kt b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsViewModel.kt index 38fa6a0c5..14f7b981c 100644 --- a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsViewModel.kt +++ b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsViewModel.kt @@ -9,14 +9,13 @@ import com.google.firebase.firestore.ktx.firestore import com.google.firebase.firestore.ktx.firestoreSettings import com.google.firebase.ktx.Firebase import com.hover.stax.R +import com.hover.stax.domain.model.FinancialTip import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch import timber.log.Timber import java.util.* -data class FinancialTip(val id: String, val title: String, val content: String, val snippet: String, val date: Date?, val shareCopy: String?, val deepLink: String?) - class FinancialTipsViewModel(val application: Application) : ViewModel() { val db = Firebase.firestore diff --git a/app/src/main/java/com/hover/stax/home/HomeFragment.kt b/app/src/main/java/com/hover/stax/home/HomeFragment.kt index e0f501e8e..51b5dd594 100644 --- a/app/src/main/java/com/hover/stax/home/HomeFragment.kt +++ b/app/src/main/java/com/hover/stax/home/HomeFragment.kt @@ -12,12 +12,10 @@ import androidx.navigation.fragment.findNavController import com.hover.sdk.actions.HoverAction import com.hover.stax.R import com.hover.stax.addChannels.ChannelsViewModel -import com.hover.stax.domain.model.Bonus import com.hover.stax.bonus.BonusViewModel import com.hover.stax.databinding.FragmentHomeBinding -import com.hover.stax.financialTips.FinancialTip -import com.hover.stax.financialTips.FinancialTipsViewModel -import com.hover.stax.presentation.home.HomeState +import com.hover.stax.domain.model.Bonus +import com.hover.stax.domain.model.FinancialTip import com.hover.stax.presentation.home.HomeViewModel import com.hover.stax.utils.AnalyticsUtil import com.hover.stax.utils.NavUtil @@ -25,7 +23,6 @@ import com.hover.stax.utils.collectLatestLifecycleFlow import com.hover.stax.utils.network.NetworkMonitor import kotlinx.coroutines.flow.collect import org.koin.androidx.viewmodel.ext.android.sharedViewModel -import org.koin.androidx.viewmodel.ext.android.viewModel import timber.log.Timber @@ -34,7 +31,6 @@ class HomeFragment : Fragment() { private var _binding: FragmentHomeBinding? = null private val binding get() = _binding!! - private val wellnessViewModel: FinancialTipsViewModel by viewModel() private val bonusViewModel: BonusViewModel by sharedViewModel() private val channelsViewModel: ChannelsViewModel by sharedViewModel() @@ -52,10 +48,11 @@ class HomeFragment : Fragment() { homeViewModel.getBonusList() homeViewModel.getAccounts() + homeViewModel.getFinancialTips() collectLatestLifecycleFlow(homeViewModel.homeState) { - if(it.bonuses.isNotEmpty()) - showBonuses(it.bonuses) + showBonuses(it.bonuses) + setUpWellnessTips(it.financialTips) } binding.airtime.setOnClickListener { navigateTo(getTransferDirection(HoverAction.AIRTIME)) } @@ -68,7 +65,6 @@ class HomeFragment : Fragment() { updateOfflineIndicator(it) } - setUpWellnessTips() setKeVisibility() lifecycleScope.launchWhenStarted { @@ -85,7 +81,7 @@ class HomeFragment : Fragment() { } } - private fun showBonuses(bonusList: List){ + private fun showBonuses(bonusList: List) { if (bonusList.isNotEmpty()) { with(binding.bonusCard) { message.text = bonusList.first().message @@ -117,9 +113,10 @@ class HomeFragment : Fragment() { binding.offlineBadge.visibility = if (isConnected) View.GONE else View.VISIBLE } - private fun setUpWellnessTips() = collectLatestLifecycleFlow(wellnessViewModel.tips) { - if (it.isNotEmpty()) - showTip(it.first()) + private fun setUpWellnessTips(tips: List) { + Timber.e("Found ${tips.size} tips") + if (tips.isNotEmpty()) + showTip(tips.first()) else binding.wellnessCard.tipsCard.visibility = View.GONE } diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt index a906994c9..22deaa4b3 100644 --- a/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeState.kt @@ -2,8 +2,10 @@ package com.hover.stax.presentation.home import com.hover.stax.domain.model.Account import com.hover.stax.domain.model.Bonus +import com.hover.stax.domain.model.FinancialTip data class HomeState ( val bonuses: List = emptyList(), - val accounts: List = emptyList() + val accounts: List = emptyList(), + val financialTips: List = emptyList() ) diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt index a0463ce68..9273b5a00 100644 --- a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt @@ -5,6 +5,7 @@ import androidx.lifecycle.viewModelScope import com.hover.stax.domain.use_case.accounts.GetAccountsUseCase import com.hover.stax.domain.use_case.bonus.FetchBonusUseCase import com.hover.stax.domain.use_case.bonus.GetBonusesUseCase +import com.hover.stax.domain.use_case.financial_tips.GetTipsUseCase import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.collect @@ -14,7 +15,8 @@ import timber.log.Timber class HomeViewModel( private val getBonusesUseCase: GetBonusesUseCase, private val fetchBonusUseCase: FetchBonusUseCase, - private val getAccountsUseCase: GetAccountsUseCase + private val getAccountsUseCase: GetAccountsUseCase, + private val getTipsUseCase: GetTipsUseCase ) : ViewModel() { private val _homeState = MutableStateFlow(HomeState()) @@ -29,7 +31,7 @@ class HomeViewModel( } fun getBonusList() = viewModelScope.launch { - getBonusesUseCase.getBonusList().collect { + getBonusesUseCase().collect { _homeState.value = _homeState.value.copy(bonuses = it) } } @@ -39,4 +41,10 @@ class HomeViewModel( _homeState.value = _homeState.value.copy(accounts = it) } } + + fun getFinancialTips() = viewModelScope.launch { + getTipsUseCase().collect { + _homeState.value = homeState.value.copy(financialTips = it) + } + } } \ No newline at end of file From aaff1f8d3fc5f047e99496c266d32f797e01729c Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Mon, 20 Jun 2022 14:06:40 +0300 Subject: [PATCH 12/41] moves FinancialTipsFragment to new viewmodel implementation --- .../main/java/com/hover/stax/di/Modules.kt | 2 +- .../financialTips/FinancialTipsFragment.kt | 17 ++++-- .../financialTips/FinancialTipsViewModel.kt | 54 ------------------- .../financial_tips/FinancialTipsState.kt | 7 +++ .../financial_tips/FinancialTipsViewModel.kt | 21 ++++++++ app/src/main/res/layout/fragment_wellness.xml | 25 ++++++--- app/src/main/res/values/strings.xml | 1 + 7 files changed, 61 insertions(+), 66 deletions(-) delete mode 100644 app/src/main/java/com/hover/stax/financialTips/FinancialTipsViewModel.kt create mode 100644 app/src/main/java/com/hover/stax/presentation/financial_tips/FinancialTipsState.kt create mode 100644 app/src/main/java/com/hover/stax/presentation/financial_tips/FinancialTipsViewModel.kt diff --git a/app/src/main/java/com/hover/stax/di/Modules.kt b/app/src/main/java/com/hover/stax/di/Modules.kt index eb1254243..f971e5ede 100644 --- a/app/src/main/java/com/hover/stax/di/Modules.kt +++ b/app/src/main/java/com/hover/stax/di/Modules.kt @@ -28,7 +28,7 @@ import com.hover.stax.domain.use_case.bonus.FetchBonusUseCase import com.hover.stax.domain.use_case.bonus.GetBonusesUseCase import com.hover.stax.domain.use_case.financial_tips.GetTipsUseCase import com.hover.stax.faq.FaqViewModel -import com.hover.stax.financialTips.FinancialTipsViewModel +import com.hover.stax.presentation.financial_tips.FinancialTipsViewModel import com.hover.stax.futureTransactions.FutureViewModel import com.hover.stax.inapp_banner.BannerViewModel import com.hover.stax.languages.LanguageViewModel diff --git a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsFragment.kt b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsFragment.kt index 9ad4ddecb..e24de3e3d 100644 --- a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsFragment.kt +++ b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsFragment.kt @@ -13,6 +13,7 @@ import androidx.navigation.fragment.navArgs import com.hover.stax.R import com.hover.stax.databinding.FragmentWellnessBinding import com.hover.stax.domain.model.FinancialTip +import com.hover.stax.presentation.financial_tips.FinancialTipsViewModel import com.hover.stax.utils.AnalyticsUtil import com.hover.stax.utils.UIHelper import com.hover.stax.utils.collectLatestLifecycleFlow @@ -44,11 +45,19 @@ class FinancialTipsFragment : Fragment(), FinancialTipsAdapter.SelectListener { startObserver() } - private fun startObserver() = collectLatestLifecycleFlow(viewModel.tips) { - showFinancialTips(it, args.tipId) + private fun startObserver() = collectLatestLifecycleFlow(viewModel.tipsState) { + if (it.tips.isEmpty()) { + binding.empty.visibility = View.VISIBLE + binding.financialTips.visibility = View.GONE + binding.financialTipsDetail.visibility = View.GONE + } else + showFinancialTips(it.tips, args.tipId) } private fun showFinancialTips(tips: List, id: String? = null) { + binding.empty.visibility = View.GONE + binding.financialTips.visibility = View.VISIBLE + if (id != null) { tips.firstOrNull { it.id == id }?.let { onTipSelected(it, true) } } else { @@ -144,8 +153,8 @@ class FinancialTipsFragment : Fragment(), FinancialTipsAdapter.SelectListener { binding.financialTipsDetail.visibility = View.GONE binding.tipsCard.visibility = View.VISIBLE - if (viewModel.tips.value.isNotEmpty()) - showFinancialTips(viewModel.tips.value, null) + if (viewModel.tipsState.value.tips.isNotEmpty()) + showFinancialTips(viewModel.tipsState.value.tips, null) } override fun onDestroyView() { diff --git a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsViewModel.kt b/app/src/main/java/com/hover/stax/financialTips/FinancialTipsViewModel.kt deleted file mode 100644 index 14f7b981c..000000000 --- a/app/src/main/java/com/hover/stax/financialTips/FinancialTipsViewModel.kt +++ /dev/null @@ -1,54 +0,0 @@ -package com.hover.stax.financialTips - -import android.app.Application -import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import com.google.firebase.Timestamp -import com.google.firebase.firestore.Query -import com.google.firebase.firestore.ktx.firestore -import com.google.firebase.firestore.ktx.firestoreSettings -import com.google.firebase.ktx.Firebase -import com.hover.stax.R -import com.hover.stax.domain.model.FinancialTip -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.launch -import timber.log.Timber -import java.util.* - -class FinancialTipsViewModel(val application: Application) : ViewModel() { - - val db = Firebase.firestore - val settings = firestoreSettings { isPersistenceEnabled = true } - - private val _tips = MutableStateFlow>(emptyList()) - val tips: StateFlow> = _tips - - init { - db.firestoreSettings = settings - } - - fun getTips() = viewModelScope.launch { - val timestamp = Timestamp.now() - - db.collection(application.getString(R.string.tips_table)) - .orderBy("date", Query.Direction.DESCENDING) - .whereLessThanOrEqualTo("date", timestamp.toDate()) - .limit(20) - .get() - .addOnSuccessListener { snapshot -> - val financialTip = snapshot.map { document -> - FinancialTip( - document.id, document.data["title"].toString(), document.data["content"].toString(), - document.data["snippet"].toString(), document.getDate("date"), document.data["share copy"].toString(), - document.data["deep link"].toString() - ) - } - - _tips.value = financialTip.filterNot { it.date == null }.sortedByDescending { it.date!!.time } - } - .addOnFailureListener { - Timber.e("Error fetching wellness tips: ${it.localizedMessage}") - } - } -} diff --git a/app/src/main/java/com/hover/stax/presentation/financial_tips/FinancialTipsState.kt b/app/src/main/java/com/hover/stax/presentation/financial_tips/FinancialTipsState.kt new file mode 100644 index 000000000..904ab6cb9 --- /dev/null +++ b/app/src/main/java/com/hover/stax/presentation/financial_tips/FinancialTipsState.kt @@ -0,0 +1,7 @@ +package com.hover.stax.presentation.financial_tips + +import com.hover.stax.domain.model.FinancialTip + +data class FinancialTipsState( + val tips: List = emptyList() +) diff --git a/app/src/main/java/com/hover/stax/presentation/financial_tips/FinancialTipsViewModel.kt b/app/src/main/java/com/hover/stax/presentation/financial_tips/FinancialTipsViewModel.kt new file mode 100644 index 000000000..0962a2b4d --- /dev/null +++ b/app/src/main/java/com/hover/stax/presentation/financial_tips/FinancialTipsViewModel.kt @@ -0,0 +1,21 @@ +package com.hover.stax.presentation.financial_tips + +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.hover.stax.domain.use_case.financial_tips.GetTipsUseCase +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.collect +import kotlinx.coroutines.launch + +class FinancialTipsViewModel(private val getTipsUseCase: GetTipsUseCase) : ViewModel() { + + private val _tips = MutableStateFlow(FinancialTipsState()) + val tipsState = _tips.asStateFlow() + + fun getTips() = viewModelScope.launch { + getTipsUseCase().collect { + _tips.value = _tips.value.copy(tips = it) + } + } +} diff --git a/app/src/main/res/layout/fragment_wellness.xml b/app/src/main/res/layout/fragment_wellness.xml index d4e78de37..9601d4d05 100644 --- a/app/src/main/res/layout/fragment_wellness.xml +++ b/app/src/main/res/layout/fragment_wellness.xml @@ -10,19 +10,19 @@ android:layout_height="match_parent"> + tools:text="@string/financial_wellness_tips" /> + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3997b3f85..f864cdaa0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -771,6 +771,7 @@ I just checked my balance with Stax app and the best part is - it works offline. Check it out - %1$s I just transferred money with Stax app and the best part is - it works offline. Check it out - %1$s Submit + No tips available. From 79b36354d6d8a2370bbb711f8b67c3c0ab2cfae2 Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Mon, 20 Jun 2022 14:28:24 +0300 Subject: [PATCH 13/41] minor edits --- .../stax/merchants/MerchantArrayAdapter.kt | 20 +++++++++---------- .../hover/stax/merchants/MerchantViewModel.kt | 2 +- .../stax/presentation/home/HomeViewModel.kt | 1 - .../stax/transfers/AbstractFormViewModel.kt | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/com/hover/stax/merchants/MerchantArrayAdapter.kt b/app/src/main/java/com/hover/stax/merchants/MerchantArrayAdapter.kt index bbc0e67ee..4cc3d7728 100644 --- a/app/src/main/java/com/hover/stax/merchants/MerchantArrayAdapter.kt +++ b/app/src/main/java/com/hover/stax/merchants/MerchantArrayAdapter.kt @@ -14,22 +14,22 @@ class MerchantArrayAdapter(context: Context, val allMerchants: List): var filteredMerchants: MutableList? = ArrayList(allMerchants) override fun getView(position: Int, v: View?, parent: ViewGroup): View { - var v = v + var view = v val holder: ViewHolder - if (v == null) { + if (view == null) { val binding: StaxSpinner2lineBinding = StaxSpinner2lineBinding.inflate(LayoutInflater.from(parent.context), parent, false) - v = binding.getRoot() + view = binding.root holder = ViewHolder(binding) - v.tag = holder + view.tag = holder } else { - holder = v.tag as ViewHolder + holder = view.tag as ViewHolder } val m = filteredMerchants!![position] holder.title.text = m.shortName() holder.subtitle.text = m.tillNo holder.subtitle.visibility = if (m.hasName()) View.VISIBLE else View.GONE - return v + return view } override fun getFilter(): Filter { @@ -38,9 +38,9 @@ class MerchantArrayAdapter(context: Context, val allMerchants: List): val filterResults = FilterResults() val filtered: MutableList = ArrayList() if (constraint != null) { - for (merchant in allMerchants!!) { - if (merchant.toString().replace(" ".toRegex(), "").toLowerCase() - .contains(constraint.toString().toLowerCase()) + for (merchant in allMerchants) { + if (merchant.toString().replace(" ".toRegex(), "").lowercase() + .contains(constraint.toString().lowercase()) ) { filtered.add(merchant) } @@ -62,7 +62,7 @@ class MerchantArrayAdapter(context: Context, val allMerchants: List): notifyDataSetChanged() } else if (constraint.isNullOrEmpty()) { // no filter, add entire original list back in - filteredMerchants!!.addAll(allMerchants!!) + filteredMerchants!!.addAll(allMerchants) notifyDataSetInvalidated() } } diff --git a/app/src/main/java/com/hover/stax/merchants/MerchantViewModel.kt b/app/src/main/java/com/hover/stax/merchants/MerchantViewModel.kt index a18392aa8..7443f25cd 100644 --- a/app/src/main/java/com/hover/stax/merchants/MerchantViewModel.kt +++ b/app/src/main/java/com/hover/stax/merchants/MerchantViewModel.kt @@ -15,7 +15,7 @@ import com.hover.stax.utils.DateUtils import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -class MerchantViewModel(application: Application, contactRepo: ContactRepo, val merchantRepo: MerchantRepo, scheduleRepo: ScheduleRepo) : AbstractFormViewModel(application, contactRepo, scheduleRepo) { +class MerchantViewModel(application: Application, contactRepo: ContactRepo, private val merchantRepo: MerchantRepo, scheduleRepo: ScheduleRepo) : AbstractFormViewModel(application, contactRepo, scheduleRepo) { val amount = MutableLiveData() val merchant = MutableLiveData() diff --git a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt index 9273b5a00..7fb3c9de5 100644 --- a/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt +++ b/app/src/main/java/com/hover/stax/presentation/home/HomeViewModel.kt @@ -10,7 +10,6 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.collect import kotlinx.coroutines.launch -import timber.log.Timber class HomeViewModel( private val getBonusesUseCase: GetBonusesUseCase, diff --git a/app/src/main/java/com/hover/stax/transfers/AbstractFormViewModel.kt b/app/src/main/java/com/hover/stax/transfers/AbstractFormViewModel.kt index 41aae8159..6ba1e3a45 100644 --- a/app/src/main/java/com/hover/stax/transfers/AbstractFormViewModel.kt +++ b/app/src/main/java/com/hover/stax/transfers/AbstractFormViewModel.kt @@ -15,7 +15,7 @@ import com.hover.stax.schedules.ScheduleRepo import com.hover.stax.schedules.Schedule import com.hover.stax.utils.AnalyticsUtil -abstract class AbstractFormViewModel(application: Application, val contactRepo: ContactRepo, val scheduleRepo: ScheduleRepo) : AndroidViewModel(application) { +abstract class AbstractFormViewModel(application: Application, val contactRepo: ContactRepo, private val scheduleRepo: ScheduleRepo) : AndroidViewModel(application) { var recentContacts: LiveData> = MutableLiveData() val schedule = MutableLiveData() From e9e3a6ffd241ef3c39384392f0f74827f2c5585a Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Thu, 23 Jun 2022 16:30:34 +0300 Subject: [PATCH 14/41] fixes recurrent bugs --- .../main/java/com/hover/stax/accounts/AccountsViewModel.kt | 2 +- .../java/com/hover/stax/addChannels/AddChannelsFragment.kt | 2 +- .../java/com/hover/stax/requests/RequestSenderInterface.kt | 4 ++-- app/src/main/res/values/strings.xml | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt index e5a230abc..7b9ea9d1c 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt @@ -123,7 +123,7 @@ class AccountsViewModel(application: Application, val repo: AccountRepo, val act activeAccount.value = accounts.value.firstOrNull { it.isDefault } } - fun setDefaultAccount(account: Account) { + fun setDefaultAccount(account: Account) = viewModelScope.launch(Dispatchers.IO) { if (accounts.value.isNotEmpty()) { val accts = accounts.value //remove current default account diff --git a/app/src/main/java/com/hover/stax/addChannels/AddChannelsFragment.kt b/app/src/main/java/com/hover/stax/addChannels/AddChannelsFragment.kt index 9c9893f37..0a687a11d 100644 --- a/app/src/main/java/com/hover/stax/addChannels/AddChannelsFragment.kt +++ b/app/src/main/java/com/hover/stax/addChannels/AddChannelsFragment.kt @@ -183,7 +183,7 @@ class AddChannelsFragment : Fragment(), ChannelsAdapter.SelectListener, CountryA } private fun showEmptyState() { - val content = resources.getString(R.string.no_accounts_found_desc, channelsViewModel.filterQuery.value!!) + val content = resources.getString(R.string.no_accounts_found_desc, channelsViewModel.filterQuery.value ?: getString(R.string.empty_channel_placeholder)) binding.emptyState.noAccountFoundDesc.apply { text = HtmlCompat.fromHtml(content, HtmlCompat.FROM_HTML_MODE_LEGACY) movementMethod = LinkMovementMethod.getInstance() diff --git a/app/src/main/java/com/hover/stax/requests/RequestSenderInterface.kt b/app/src/main/java/com/hover/stax/requests/RequestSenderInterface.kt index 86eaf32ee..a6f5fe25e 100644 --- a/app/src/main/java/com/hover/stax/requests/RequestSenderInterface.kt +++ b/app/src/main/java/com/hover/stax/requests/RequestSenderInterface.kt @@ -30,12 +30,12 @@ interface RequestSenderInterface : SmsSentObserver.SmsSentListener { fun sendWhatsapp(requestViewModel: NewRequestViewModel, activity: Activity) { requestViewModel.saveRequest() - sendWhatsapp(requestViewModel.formulatedRequest.value, listOf(requestViewModel.requestee.value), requestViewModel.activeAccount.value, requestViewModel.getApplication()) + sendWhatsapp(requestViewModel.formulatedRequest.value, listOf(requestViewModel.requestee.value), requestViewModel.activeAccount.value, activity) } fun copyShareLink(view: View, requestViewModel: NewRequestViewModel, activity: Activity) { requestViewModel.saveRequest() - copyShareLink(requestViewModel.formulatedRequest.value, view.findViewById(R.id.copylink_share_selection), requestViewModel.getApplication()) + copyShareLink(requestViewModel.formulatedRequest.value, view.findViewById(R.id.copylink_share_selection), activity) } override fun onSmsSendEvent(sent: Boolean) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3997b3f85..3324b5fd5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -772,5 +772,7 @@ I just transferred money with Stax app and the best part is - it works offline. Check it out - %1$s Submit + the service + From ed06a4dc10b71f83ac53f80c3d526622cbed9e66 Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Thu, 23 Jun 2022 16:58:31 +0300 Subject: [PATCH 15/41] bumps version code --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 24df6153a..0ea59058c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -45,8 +45,8 @@ android { applicationId "com.hover.stax" minSdk 21 targetSdk 31 - versionCode 150 - versionName "1.11.11" + versionCode 151 + versionName "1.11.12" vectorDrawables.useSupportLibrary = true multiDexEnabled true From 6ede27fa84e4a79c96132bc2518ba7b210cfb5ae Mon Sep 17 00:00:00 2001 From: Oluwatobi Akinpelu Date: Mon, 20 Jun 2022 15:38:27 +0100 Subject: [PATCH 16/41] complete updating design elements --- .idea/misc.xml | 68 ++++++++++--------- .../stax/addChannels/ChannelsViewModel.kt | 1 + .../hover/stax/balances/BalancesFragment.kt | 4 +- .../java/com/hover/stax/views/StaxCardView.kt | 12 ++-- .../main/res/layout/card_wellness_tips.xml | 32 ++++----- app/src/main/res/layout/fragment_settings.xml | 19 ++++++ app/src/main/res/layout/item_divider.xml | 6 ++ app/src/main/res/layout/stax_card_view.xml | 4 +- .../main/res/layout/transaction_list_item.xml | 2 +- app/src/main/res/values/colors.xml | 26 +++---- 10 files changed, 99 insertions(+), 75 deletions(-) create mode 100644 app/src/main/res/layout/item_divider.xml diff --git a/.idea/misc.xml b/.idea/misc.xml index b25673e89..9cb766769 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -10,31 +10,50 @@ + + + + + + + + + - - + + - + - + - - + + + + + + + + + + + + @@ -53,6 +72,7 @@ + @@ -80,7 +100,6 @@ - @@ -90,7 +109,7 @@ - + @@ -99,8 +118,9 @@ - + + @@ -108,19 +128,13 @@ - - - - - - - - + + @@ -145,11 +159,11 @@ - + @@ -165,23 +179,15 @@ - - + + - - + + -<<<<<<< HEAD - - -======= -<<<<<<< HEAD -======= ->>>>>>> development ->>>>>>> development @@ -212,7 +218,7 @@ - + diff --git a/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt b/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt index d9a932969..d7f2fa33e 100644 --- a/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt +++ b/app/src/main/java/com/hover/stax/addChannels/ChannelsViewModel.kt @@ -77,6 +77,7 @@ class ChannelsViewModel(application: Application, val repo: ChannelRepo, val acc } private fun loadSims() { + viewModelScope.launch(Dispatchers.IO) { sims.postValue(repo.presentSims) } simReceiver?.let { diff --git a/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt b/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt index 37f2141ae..c218180cd 100644 --- a/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt +++ b/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt @@ -215,8 +215,8 @@ class BalancesFragment : Fragment(), BalanceAdapter.BalanceListener { } companion object { - const val GREEN_BG = "#46E6CC" - const val BLUE_BG = "#04CCFC" + const val GREEN_BG = "#45E5CB" + const val BLUE_BG = "#2376F3" const val STACK_OVERLAY_GAP = 10 const val ROTATE_UPSIDE_DOWN = 180f diff --git a/app/src/main/java/com/hover/stax/views/StaxCardView.kt b/app/src/main/java/com/hover/stax/views/StaxCardView.kt index 8175604d3..5034cfe9d 100644 --- a/app/src/main/java/com/hover/stax/views/StaxCardView.kt +++ b/app/src/main/java/com/hover/stax/views/StaxCardView.kt @@ -34,16 +34,16 @@ open class StaxCardView(context: Context, attrs: AttributeSet) : FrameLayout(con useContextBackPress = a.getBoolean(R.styleable.StaxCardView_defaultBackPress, true) backDrawable = a.getResourceId(R.styleable.StaxCardView_backRes, 0) bgColor = a.getColor(R.styleable.StaxCardView_staxCardColor, ContextCompat.getColor(context, R.color.colorPrimary)) - isFlatView = a.getBoolean(R.styleable.StaxCardView_isFlatView, false) + isFlatView = a.getBoolean(R.styleable.StaxCardView_isFlatView, true) } finally { a.recycle() } } - fun makeFlatView() { + private fun makeFlatView() { val zero = 0 - binding.cardViewHeader.cardElevation = zero.toFloat() - binding.cardViewHeader.radius = zero.toFloat() + binding.cardView.cardElevation = zero.toFloat() + //binding.cardView.radius = zero.toFloat() removeCardMargin() } @@ -115,7 +115,7 @@ open class StaxCardView(context: Context, attrs: AttributeSet) : FrameLayout(con private fun removeCardMargin() { val params = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT) params.setMargins(0, 0, 0, 0) - binding.cardViewHeader.layoutParams = params + binding.cardView.layoutParams = params } override fun addView(child: View, index: Int, params: ViewGroup.LayoutParams) { @@ -135,7 +135,7 @@ open class StaxCardView(context: Context, attrs: AttributeSet) : FrameLayout(con } fun updateState(icon: Int, backgroundColor: Int, title: Int) { - binding.cardViewHeader.apply { + binding.cardView.apply { setBackButtonVisibility(View.VISIBLE) setIcon(icon) setTitle(title) diff --git a/app/src/main/res/layout/card_wellness_tips.xml b/app/src/main/res/layout/card_wellness_tips.xml index de24ceb93..a8899d91f 100644 --- a/app/src/main/res/layout/card_wellness_tips.xml +++ b/app/src/main/res/layout/card_wellness_tips.xml @@ -51,29 +51,21 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/title" tools:text="This is test content" /> - - + android:drawablePadding="@dimen/margin_3" + app:fontFamily="@font/brutalista_medium" + android:gravity="start" + android:text="@string/read_more" + android:textColor="@color/brightBlue" + android:textSize="@dimen/text_16" + android:layout_marginTop="@dimen/margin_13" /> + + - - diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index de913ccd2..437fe2568 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -16,43 +16,62 @@ android:id="@+id/share_card" layout="@layout/settings_card_share" /> + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/stax_card_view.xml b/app/src/main/res/layout/stax_card_view.xml index b642b79df..1529b440a 100644 --- a/app/src/main/res/layout/stax_card_view.xml +++ b/app/src/main/res/layout/stax_card_view.xml @@ -1,13 +1,13 @@ diff --git a/app/src/main/res/layout/transaction_list_item.xml b/app/src/main/res/layout/transaction_list_item.xml index 8f08b2175..15ee55e20 100644 --- a/app/src/main/res/layout/transaction_list_item.xml +++ b/app/src/main/res/layout/transaction_list_item.xml @@ -11,7 +11,7 @@ android:id="@+id/li_header" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/cardViewColor" + android:background="@color/colorPrimaryDark" android:paddingHorizontal="@dimen/margin_10" android:paddingVertical="@dimen/margin_16" android:textColor="@color/grey" diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 081c9f16e..deafe687c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,10 +1,10 @@ - #292E35 - #1E232A - #39CBFC - #2AAFDC - #292E35 + #292B2C + #000A1A + #0091E3 + #01659E + #292E34 #1D2735 #5A120D #3A3E45 @@ -18,11 +18,11 @@ #3F444A #77000000 #1E232AA3 - #05EB8F - #1878F9 - #FFCA32 + #24B314 + #0091E3 + #FFB447 #342C34 - #FF0028 + #F32345 #343734 #2A3932 #3F434A @@ -30,10 +30,10 @@ #CDE5FE #EDF9FF - #45E6CE - #00CCFF - #BFF2FF - #2F364A + #1E2329 + #1E2329 + #1E2329 + #F1F1F4 @color/offWhite From 42e725c61a5a3c823bd69449e42896030b7b0190 Mon Sep 17 00:00:00 2001 From: Oluwatobi Akinpelu Date: Mon, 20 Jun 2022 15:42:01 +0100 Subject: [PATCH 17/41] remove unused codes --- app/src/main/java/com/hover/stax/views/StaxCardView.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/com/hover/stax/views/StaxCardView.kt b/app/src/main/java/com/hover/stax/views/StaxCardView.kt index 5034cfe9d..063b5df06 100644 --- a/app/src/main/java/com/hover/stax/views/StaxCardView.kt +++ b/app/src/main/java/com/hover/stax/views/StaxCardView.kt @@ -43,7 +43,6 @@ open class StaxCardView(context: Context, attrs: AttributeSet) : FrameLayout(con private fun makeFlatView() { val zero = 0 binding.cardView.cardElevation = zero.toFloat() - //binding.cardView.radius = zero.toFloat() removeCardMargin() } From 99ab6343ae88d04c0106ba87149a541c23fafe0c Mon Sep 17 00:00:00 2001 From: Oluwatobi Akinpelu Date: Mon, 20 Jun 2022 15:50:48 +0100 Subject: [PATCH 18/41] add colors to compose --- app/src/main/java/com/hover/stax/ui/theme/Color.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/hover/stax/ui/theme/Color.kt b/app/src/main/java/com/hover/stax/ui/theme/Color.kt index 7b00f4a9f..dbb45c9ae 100644 --- a/app/src/main/java/com/hover/stax/ui/theme/Color.kt +++ b/app/src/main/java/com/hover/stax/ui/theme/Color.kt @@ -2,11 +2,11 @@ package com.hover.stax.ui.theme import androidx.compose.ui.graphics.Color -val ColorPrimary = Color(0xFF292E35) -val ColorPrimaryDark = Color(0xFF1E232A) -val BrightBlue = Color(0xFF39CBFC) -val BrightBluePressed = Color(0xFF2AAFDC) +val ColorPrimary = Color(0xFF292B2C) +val ColorPrimaryDark = Color(0xFF000A1A) +val BrightBlue = Color(0xFF0091E3) +val BrightBluePressed = Color(0xFF01659E) val OffWhite = Color(0xFFF1F1F4) val CardViewColor = Color(0xFF292E35) -val StaxStateRed = Color(0xFFFF0028) +val StaxStateRed = Color(0xFFF32345) val DarkGray = Color(0xFF777777) From d852429b9f2f92f160f1aa717d1c327b37fecfcb Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Mon, 27 Jun 2022 17:19:22 +0300 Subject: [PATCH 19/41] flattens all cards --- .idea/misc.xml | 2 +- .../hover/stax/balances/BalancesFragment.kt | 5 -- .../java/com/hover/stax/home/HomeFragment.kt | 2 +- .../staxcardstack/StaxCardStackView.java | 4 +- app/src/main/res/drawable/button_bg_grey.xml | 2 +- app/src/main/res/layout/balance_item.xml | 2 +- app/src/main/res/layout/card_bonuses.xml | 4 +- .../main/res/layout/card_wellness_tips.xml | 29 +++--- app/src/main/res/layout/fragment_balance.xml | 3 +- app/src/main/res/layout/fragment_home.xml | 88 +++++++++---------- .../main/res/layout/home_card_balances.xml | 3 +- .../main/res/layout/in_app_banner_layout.xml | 4 +- .../main/res/layout/item_wellness_tips.xml | 2 +- .../main/res/layout/stack_balance_card.xml | 4 +- app/src/main/res/layout/stax_card_view.xml | 4 +- app/src/main/res/values/colors.xml | 4 + app/src/main/res/values/themes.xml | 8 +- 17 files changed, 83 insertions(+), 87 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 9cb766769..b9286ae3a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -218,7 +218,7 @@ - + diff --git a/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt b/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt index c218180cd..dbb7e681b 100644 --- a/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt +++ b/app/src/main/java/com/hover/stax/balances/BalancesFragment.kt @@ -68,14 +68,9 @@ class BalancesFragment : Fragment(), BalanceAdapter.BalanceListener { balancesViewModel.showBalances.observe(viewLifecycleOwner) { showBalanceCards(it) } collectLatestLifecycleFlow(homeViewModel.homeState) { - if (it.accounts.isNotEmpty()) updateAccounts(ArrayList(it.accounts)) } -// balancesViewModel.accounts.observe(viewLifecycleOwner) { -// updateAccounts(ArrayList(it)) -// } - collectLatestLifecycleFlow(balancesViewModel.balanceAction) { attemptCallHover(balancesViewModel.userRequestedBalanceAccount.value, it) } diff --git a/app/src/main/java/com/hover/stax/home/HomeFragment.kt b/app/src/main/java/com/hover/stax/home/HomeFragment.kt index 51b5dd594..999d6edd7 100644 --- a/app/src/main/java/com/hover/stax/home/HomeFragment.kt +++ b/app/src/main/java/com/hover/stax/home/HomeFragment.kt @@ -134,7 +134,7 @@ class HomeFragment : Fragment() { NavUtil.navigate(findNavController(), HomeFragmentDirections.actionNavigationHomeToWellnessFragment(tip.id)) } - readMoreLayout.setOnClickListener { + readmore.setOnClickListener { NavUtil.navigate(findNavController(), HomeFragmentDirections.actionNavigationHomeToWellnessFragment(null)) } } diff --git a/app/src/main/java/com/hover/stax/views/staxcardstack/StaxCardStackView.java b/app/src/main/java/com/hover/stax/views/staxcardstack/StaxCardStackView.java index 8d03b7e82..f566f0afb 100755 --- a/app/src/main/java/com/hover/stax/views/staxcardstack/StaxCardStackView.java +++ b/app/src/main/java/com/hover/stax/views/staxcardstack/StaxCardStackView.java @@ -109,10 +109,8 @@ private void layoutChild() { childTop += lp.topMargin; if (i != 0) { childTop -= mOverlapGaps * 2; - child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight); - } else { - child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight); } + child.layout(childLeft, childTop, childLeft + childWidth, childTop + childHeight); childTop += lp.mHeaderHeight; } } diff --git a/app/src/main/res/drawable/button_bg_grey.xml b/app/src/main/res/drawable/button_bg_grey.xml index 46deb499b..64cc2d951 100644 --- a/app/src/main/res/drawable/button_bg_grey.xml +++ b/app/src/main/res/drawable/button_bg_grey.xml @@ -9,7 +9,7 @@ - + diff --git a/app/src/main/res/layout/balance_item.xml b/app/src/main/res/layout/balance_item.xml index 862d61d87..94c278827 100644 --- a/app/src/main/res/layout/balance_item.xml +++ b/app/src/main/res/layout/balance_item.xml @@ -10,7 +10,7 @@ android:paddingEnd="0dp" app:cardBackgroundColor="@color/cardViewColor" app:cardCornerRadius="@dimen/radius" - app:cardElevation="8dp" + app:cardPreventCornerOverlap="false"> + app:cardCornerRadius="@dimen/radius"> + app:cardElevation="0dp"> @@ -30,11 +30,11 @@ android:id="@+id/title" android:layout_width="match_parent" android:layout_height="wrap_content" - app:fontFamily="@font/brutalista_medium" - android:gravity="start" android:layout_marginBottom="@dimen/margin_8" + android:gravity="start" android:textColor="@color/banner_text" android:textSize="20sp" + app:fontFamily="@font/brutalista_medium" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" tools:text="This is a test title" /> @@ -53,20 +53,19 @@ tools:text="This is test content" /> + android:id="@+id/readmore" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="@dimen/margin_13" + android:drawablePadding="@dimen/margin_3" + android:gravity="start" + android:text="@string/read_more" + android:textColor="@color/brightBlue" + android:textSize="@dimen/text_16" + app:fontFamily="@font/brutalista_medium" /> - diff --git a/app/src/main/res/layout/fragment_balance.xml b/app/src/main/res/layout/fragment_balance.xml index 3c9d7f27b..91148486d 100644 --- a/app/src/main/res/layout/fragment_balance.xml +++ b/app/src/main/res/layout/fragment_balance.xml @@ -29,9 +29,10 @@ android:layout_marginBottom="@dimen/margin_13" android:animateLayoutChanges="false" android:visibility="gone" + app:cardElevation="0dp" app:cardBackgroundColor="@color/cardViewColor" app:cardCornerRadius="@dimen/radius" - app:cardElevation="8dp"> + > @@ -77,7 +77,7 @@ android:animateLayoutChanges="false" app:cardBackgroundColor="@color/cardViewColor" app:cardCornerRadius="@dimen/radius" - app:cardElevation="8dp" + app:cardElevation="0dp" app:layout_constraintTop_toBottomOf="@id/wellnessCard"> - - + android:layout_marginHorizontal="@dimen/margin_13" + android:layout_marginTop="@dimen/margin_13" + android:layout_marginBottom="@dimen/margin_34" + android:animateLayoutChanges="false" + android:clipToPadding="true" + android:visibility="gone" + app:cardElevation="0dp" + app:cardBackgroundColor="@color/cardViewColor" + app:cardCornerRadius="@dimen/radius" + app:layout_constraintTop_toBottomOf="@id/airtime"> + + - - + android:layout_marginHorizontal="@dimen/margin_13" + android:layout_marginTop="@dimen/margin_13" + android:layout_marginBottom="@dimen/margin_34" + android:animateLayoutChanges="false" + android:clipToPadding="true" + android:visibility="visible" + app:cardBackgroundColor="@color/cardViewColor" + app:cardCornerRadius="@dimen/radius" + app:cardElevation="0dp" + app:layout_constraintTop_toBottomOf="@id/paybill"> + + @@ -43,7 +43,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="2dp" - app:cardElevation="0dp" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/balance_header_card" diff --git a/app/src/main/res/layout/in_app_banner_layout.xml b/app/src/main/res/layout/in_app_banner_layout.xml index 03505945a..de2d6518f 100644 --- a/app/src/main/res/layout/in_app_banner_layout.xml +++ b/app/src/main/res/layout/in_app_banner_layout.xml @@ -11,8 +11,8 @@ android:layout_margin="@dimen/margin_13" android:animateLayoutChanges="false" android:clipToPadding="true" - app:cardCornerRadius="@dimen/radius" - app:cardElevation="@dimen/margin_8"> + app:cardElevation="0dp" + app:cardCornerRadius="@dimen/radius"> diff --git a/app/src/main/res/layout/stack_balance_card.xml b/app/src/main/res/layout/stack_balance_card.xml index a9c4ae543..85de4b910 100644 --- a/app/src/main/res/layout/stack_balance_card.xml +++ b/app/src/main/res/layout/stack_balance_card.xml @@ -4,8 +4,8 @@ android:id="@+id/stack_card" android:layout_width="match_parent" android:layout_height="wrap_content" - app:cardCornerRadius="5dp" - app:cardElevation="8dp"> + app:cardElevation="0dp" + app:cardCornerRadius="5dp"> + app:cardCornerRadius="@dimen/radius"> #292B2C #000A1A + + #1E2329 + #292E34 + #0091E3 #01659E #292E34 diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index a70f47cbb..f04cebaff 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -30,7 +30,7 @@ @color/brightBlue @color/cardViewColor - @color/cardViewColor + @color/colorSurface @color/offWhite @color/darkGrey @color/stax_state_red @@ -41,9 +41,9 @@ @color/grey false - @color/colorPrimaryDark - @color/colorPrimaryDark - @color/colorPrimaryDark + @color/colorBackground + @color/colorBackground + @color/colorBackground true @color/offWhite From 7ab49f34a188f13a85187a7bc7b5d106f29ede5a Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Mon, 27 Jun 2022 17:54:09 +0300 Subject: [PATCH 20/41] changes nav bar background color, changes to settings --- app/src/main/res/layout/activity_main.xml | 5 ++-- app/src/main/res/layout/fragment_settings.xml | 13 ++--------- .../res/layout/settings_card_bounties.xml | 23 +++++++++++-------- app/src/main/res/layout/stax_nav_view.xml | 1 + app/src/main/res/values/styles.xml | 4 ++-- 5 files changed, 20 insertions(+), 26 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index bb6f0fbca..b615bf043 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,7 +1,6 @@ - diff --git a/app/src/main/res/layout/fragment_settings.xml b/app/src/main/res/layout/fragment_settings.xml index 437fe2568..bf3f88431 100644 --- a/app/src/main/res/layout/fragment_settings.xml +++ b/app/src/main/res/layout/fragment_settings.xml @@ -16,55 +16,46 @@ android:id="@+id/share_card" layout="@layout/settings_card_share" /> - - - + android:id="@+id/permission_card" + layout="@layout/settings_card_permissions" /> - - - - - - - + android:orientation="vertical" + android:paddingVertical="@dimen/margin_8"> - + - + \ No newline at end of file diff --git a/app/src/main/res/layout/stax_nav_view.xml b/app/src/main/res/layout/stax_nav_view.xml index 84b25af78..e9f76b4c4 100644 --- a/app/src/main/res/layout/stax_nav_view.xml +++ b/app/src/main/res/layout/stax_nav_view.xml @@ -22,6 +22,7 @@ app:itemTextAppearanceInactive="@style/BottomNavViewText" app:itemTextColor="@drawable/selector_icon_tint" app:labelVisibilityMode="labeled" + app:backgroundTint="@color/colorBackground" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 666c21340..e4dcee14b 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -45,7 +45,7 @@ @@ -55,7 +55,7 @@ 5dp @color/colorPrimaryDark @color/brightBlue - 1dp + @dimen/text_16 false false From bb1291cae5fe5c42bab6807f509eb3acf1ca58aa Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Mon, 27 Jun 2022 18:03:19 +0300 Subject: [PATCH 21/41] changes button text on settings to highlight headings, fixed splash theme color --- .../hover/stax/accounts/AccountsViewModel.kt | 2 +- .../main/res/layout/settings_account_card.xml | 2 +- .../res/layout/settings_card_language.xml | 27 +++++------ .../main/res/layout/settings_card_learn.xml | 13 +++++- .../main/res/layout/settings_card_meta.xml | 6 +-- .../res/layout/settings_card_permissions.xml | 2 +- .../main/res/layout/settings_card_share.xml | 6 ++- .../main/res/layout/settings_card_support.xml | 5 ++ .../res/layout/settings_security_card.xml | 46 +++++++++---------- app/src/main/res/values/themes.xml | 2 +- 10 files changed, 64 insertions(+), 47 deletions(-) diff --git a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt index 6b434973d..055b0b4d7 100644 --- a/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt +++ b/app/src/main/java/com/hover/stax/accounts/AccountsViewModel.kt @@ -125,7 +125,7 @@ class AccountsViewModel(application: Application, val repo: AccountRepo, val act activeAccount.value = accounts.value.firstOrNull { it.isDefault } } - fun setDefaultAccount(account: Account) { + fun setDefaultAccount(account: Account) = viewModelScope.launch(Dispatchers.IO) { if (accounts.value.isNotEmpty()) { val accts = accounts.value //remove current default account diff --git a/app/src/main/res/layout/settings_account_card.xml b/app/src/main/res/layout/settings_account_card.xml index 12eb0f9f1..6df14c434 100644 --- a/app/src/main/res/layout/settings_account_card.xml +++ b/app/src/main/res/layout/settings_account_card.xml @@ -27,8 +27,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginHorizontal="@dimen/margin_10" + android:textColor="@color/grey" android:text="@string/logged_in_as" - android:textColor="@color/darkGrey" android:textSize="@dimen/text_13" /> diff --git a/app/src/main/res/layout/settings_card_language.xml b/app/src/main/res/layout/settings_card_language.xml index 7e7f5e7ba..98745213c 100644 --- a/app/src/main/res/layout/settings_card_language.xml +++ b/app/src/main/res/layout/settings_card_language.xml @@ -1,18 +1,19 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:title="@string/language_cardhead"> - + \ No newline at end of file diff --git a/app/src/main/res/layout/settings_card_learn.xml b/app/src/main/res/layout/settings_card_learn.xml index 59949899e..e37270fb7 100644 --- a/app/src/main/res/layout/settings_card_learn.xml +++ b/app/src/main/res/layout/settings_card_learn.xml @@ -16,17 +16,26 @@ android:layout_height="wrap_content" android:background="?selectableItemBackground" android:text="@string/financial_wellness_tips" - android:padding="@dimen/margin_13" + android:paddingStart="@dimen/margin_13" + android:paddingEnd="@dimen/margin_13" + android:paddingTop="@dimen/margin_16" + android:textColor="@color/grey" + android:paddingBottom="@dimen/margin_16" android:textSize="@dimen/text_16" /> \ No newline at end of file diff --git a/app/src/main/res/layout/settings_card_meta.xml b/app/src/main/res/layout/settings_card_meta.xml index c69297937..1a115bb1c 100644 --- a/app/src/main/res/layout/settings_card_meta.xml +++ b/app/src/main/res/layout/settings_card_meta.xml @@ -27,13 +27,13 @@ android:labelFor="@id/defaultAccountSpinner" android:hint="@string/defaultacct_label"> - @@ -47,6 +47,6 @@ android:checked="true" android:padding="@dimen/margin_10" android:text="@string/test_mode_enabled" - android:textColor="@color/offWhite" + android:textColor="@color/grey" android:textSize="@dimen/text_16" /> \ No newline at end of file diff --git a/app/src/main/res/layout/settings_card_permissions.xml b/app/src/main/res/layout/settings_card_permissions.xml index 5274d891b..1ae3a520b 100644 --- a/app/src/main/res/layout/settings_card_permissions.xml +++ b/app/src/main/res/layout/settings_card_permissions.xml @@ -14,7 +14,7 @@ android:background="?selectableItemBackground" android:paddingVertical="@dimen/margin_13" android:text="@string/manage_permissions_title" - android:textColor="@color/offWhite" + android:textColor="@color/grey" android:textSize="@dimen/text_16" /> \ No newline at end of file diff --git a/app/src/main/res/layout/settings_card_share.xml b/app/src/main/res/layout/settings_card_share.xml index bee7fc384..84cbf8a62 100644 --- a/app/src/main/res/layout/settings_card_share.xml +++ b/app/src/main/res/layout/settings_card_share.xml @@ -9,13 +9,15 @@ android:id="@+id/share_text" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="@dimen/margin_10" - android:paddingEnd="@dimen/margin_10" android:background="?attr/selectableItemBackground" android:paddingVertical="@dimen/margin_21" + android:paddingStart="@dimen/margin_10" + android:paddingEnd="@dimen/margin_10" android:text="@string/share_stax" + android:textColor="@color/grey" android:textSize="@dimen/text_16" app:drawableEndCompat="@drawable/ic_share" + app:drawableTint="@color/grey" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/layout/settings_card_support.xml b/app/src/main/res/layout/settings_card_support.xml index 2a5dff723..55d35ad35 100644 --- a/app/src/main/res/layout/settings_card_support.xml +++ b/app/src/main/res/layout/settings_card_support.xml @@ -16,6 +16,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?selectableItemBackground" + android:textColor="@color/grey" android:padding="@dimen/margin_10" android:text="@string/FAQs" android:textSize="@dimen/text_16" /> @@ -26,6 +27,7 @@ android:layout_height="wrap_content" android:background="?selectableItemBackground" android:padding="@dimen/margin_10" + android:textColor="@color/grey" android:text="@string/request_feature" android:textSize="@dimen/text_16" app:drawableEndCompat="@drawable/ic_baseline_open_in_new_24" /> @@ -38,6 +40,7 @@ android:padding="@dimen/margin_10" android:text="@string/twitter" android:textSize="@dimen/text_16" + android:textColor="@color/grey" app:drawableEndCompat="@drawable/ic_baseline_open_in_new_24" /> @@ -61,6 +65,7 @@ android:layout_height="wrap_content" android:layout_toStartOf="@id/marketingOptIn" android:padding="@dimen/margin_10" + android:textColor="@color/grey" android:text="@string/receive_stax_updates" android:textSize="@dimen/text_16" /> diff --git a/app/src/main/res/layout/settings_security_card.xml b/app/src/main/res/layout/settings_security_card.xml index ff0933cb8..17972534c 100644 --- a/app/src/main/res/layout/settings_security_card.xml +++ b/app/src/main/res/layout/settings_security_card.xml @@ -1,29 +1,29 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="wrap_content" + app:title="@string/security_cardhead"> - + - + \ No newline at end of file diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index f04cebaff..48ebede12 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -7,7 +7,7 @@ From 574f66f9aa1ba97163d267bcbc2354b1d9ab1d23 Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Tue, 28 Jun 2022 13:07:25 +0300 Subject: [PATCH 24/41] fixes to transaction history --- .idea/misc.xml | 4 ++++ .../transactions/TransactionHistoryFragment.kt | 1 + app/src/main/res/layout/stax_card_view.xml | 3 +-- .../main/res/layout/transaction_list_item.xml | 16 +++++++++------- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index b9286ae3a..7cd816bd8 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -25,9 +25,11 @@ + + @@ -126,6 +128,7 @@ + @@ -159,6 +162,7 @@ + diff --git a/app/src/main/java/com/hover/stax/transactions/TransactionHistoryFragment.kt b/app/src/main/java/com/hover/stax/transactions/TransactionHistoryFragment.kt index 4a5a7ddf0..c107b2601 100644 --- a/app/src/main/java/com/hover/stax/transactions/TransactionHistoryFragment.kt +++ b/app/src/main/java/com/hover/stax/transactions/TransactionHistoryFragment.kt @@ -6,6 +6,7 @@ import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import androidx.navigation.fragment.findNavController +import androidx.recyclerview.widget.DividerItemDecoration import com.hover.stax.R import com.hover.stax.databinding.TransactionCardHistoryBinding import com.hover.stax.utils.AnalyticsUtil diff --git a/app/src/main/res/layout/stax_card_view.xml b/app/src/main/res/layout/stax_card_view.xml index 0004e651a..64ab8da05 100644 --- a/app/src/main/res/layout/stax_card_view.xml +++ b/app/src/main/res/layout/stax_card_view.xml @@ -8,7 +8,7 @@ android:layout_marginHorizontal="@dimen/margin_13" android:layout_marginTop="@dimen/margin_5" android:layout_marginBottom="@dimen/margin_21" - app:cardBackgroundColor="@color/transparent" + app:cardBackgroundColor="@android:color/transparent" app:cardCornerRadius="@dimen/radius"> @@ -26,7 +25,6 @@ android:background="?attr/selectableItemBackground" android:gravity="center_vertical" android:orientation="horizontal" - android:paddingHorizontal="@dimen/margin_10" android:paddingTop="@dimen/margin_10" android:paddingBottom="@dimen/margin_13"> @@ -37,7 +35,8 @@ android:layout_marginEnd="@dimen/margin_13" android:layout_weight="1" android:gravity="center_vertical" - android:orientation="vertical"> + android:orientation="vertical" + android:paddingHorizontal="@dimen/margin_13"> @@ -55,6 +56,7 @@ android:layout_marginTop="@dimen/margin_5" android:drawablePadding="@dimen/margin_5" android:fontFamily="@font/brutalista_regular" + android:gravity="center_vertical" android:text="@string/pending_callout" android:textColor="@color/offWhite" android:textSize="@dimen/text_13" @@ -69,9 +71,9 @@ android:fontFamily="@font/brutalista_regular" android:gravity="center_vertical|end" android:minWidth="@dimen/margin_89" - tools:text="10 KES" android:textColor="@color/white" - android:textSize="@dimen/text_21" /> + android:textSize="@dimen/text_21" + tools:text="10 KES" /> \ No newline at end of file From 182619a696982a9b097c4512df8e4308b1d87664 Mon Sep 17 00:00:00 2001 From: Alex Kombo Date: Tue, 28 Jun 2022 13:25:45 +0300 Subject: [PATCH 25/41] completes styling updates --- .idea/misc.xml | 2 + .../main/res/layout/fragment_add_channels.xml | 1 + app/src/main/res/layout/fragment_library.xml | 1 + app/src/main/res/layout/fragment_merchant.xml | 89 +++---- app/src/main/res/layout/fragment_paybill.xml | 33 +-- app/src/main/res/layout/fragment_request.xml | 1 + app/src/main/res/layout/fragment_settings.xml | 1 + app/src/main/res/layout/fragment_transfer.xml | 1 + app/src/main/res/layout/fragment_wellness.xml | 1 + app/src/main/res/layout/paybill_card_save.xml | 101 ++++---- app/src/main/res/layout/stax_card_view.xml | 2 +- .../main/res/layout/transfer_card_edit.xml | 52 ++--- .../main/res/layout/transfer_card_summary.xml | 221 +++++++++--------- 13 files changed, 261 insertions(+), 245 deletions(-) diff --git a/.idea/misc.xml b/.idea/misc.xml index 7cd816bd8..f00877825 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -102,6 +102,7 @@ + @@ -136,6 +137,7 @@ + diff --git a/app/src/main/res/layout/fragment_add_channels.xml b/app/src/main/res/layout/fragment_add_channels.xml index 0b95b5113..401af8004 100644 --- a/app/src/main/res/layout/fragment_add_channels.xml +++ b/app/src/main/res/layout/fragment_add_channels.xml @@ -8,6 +8,7 @@ android:id="@+id/scrollView" android:layout_width="match_parent" android:layout_height="0dp" + android:paddingHorizontal="@dimen/margin_5" android:layout_marginBottom="@dimen/margin_13" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index 436eeb5fe..503b003cd 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -7,6 +7,7 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layout_marginTop="@dimen/margin_13" + tools:context=".merchants.MerchantFragment"> - + - + - + - + -