path
stringlengths
4
280
owner
stringlengths
2
39
repo_id
int64
21.1k
879M
is_fork
bool
2 classes
languages_distribution
stringlengths
13
1.95k
content
stringlengths
7
482k
issues
int64
0
13.9k
main_language
stringclasses
121 values
forks
stringlengths
1
5
stars
int64
0
111k
commit_sha
stringlengths
40
40
size
int64
7
482k
name
stringlengths
1
100
license
stringclasses
93 values
src/main/kotlin/com/shobande/menufactory/menu/Menu.kt
shobande-femi
239,626,185
false
null
package com.shobande.menufactory.menu import com.shobande.menufactory.exceptions.CannotResolveNextState import com.shobande.menufactory.exceptions.ReservedStateName import com.shobande.menufactory.exceptions.StateNotFound import com.shobande.menufactory.gateway.Gateway import com.shobande.menufactory.gateway.wrappers.AfricasTalking import com.shobande.menufactory.session.Session import com.shobande.menufactory.session.wrappers.InMemorySession import com.shobande.menufactory.state.State import com.shobande.menufactory.state.StateHandler import com.shobande.menufactory.state.StateRunner import com.shobande.menufactory.state.StateTransitions /** * The USSD Menu * * @param name name our the USSD application * @param gateway specifies the gateway to be used. [AfricasTalking] by default * @param session implementation of [Session] for storing and retrieving information for the current session * * @property states map of state names to state objects */ @MenuMarker class Menu(val name: String, val gateway: Gateway = AfricasTalking, val session: Session = InMemorySession()) { private val states = mutableMapOf<String, State>() companion object { /** * Menu Factory */ suspend fun menu( name: String, gateway: Gateway = AfricasTalking, session: Session = InMemorySession(), init: suspend Menu.() -> Unit ): Menu { val menu = Menu(name, gateway = gateway, session = session) menu.init() return menu } } /** * Registers a state on the USSD menu * * @param name state's name * @param handler state's handler. The handler houses logic for running a state and handling the state's transitions * * @return the registered state */ private suspend fun initState(name: String, handler: suspend StateHandler.() -> Unit): State { val state = State(name, initStateHandler(name, handler)) states[state.name] = state return state } /** * Initialize a state's handler. * The handler houses logic for running a state and handling the state's transitions * * @param name name of the state owning the handler * @param init state's handler lambda */ private suspend fun initStateHandler(name:String, init: suspend StateHandler.() -> Unit): StateHandler { val stateHandler = StateHandler(name, StateRunner(gateway), StateTransitions(name)) stateHandler.init() return stateHandler } /** * Registers a state on the USSD menu * * @param name state's name * @param handler state's handler. The handler houses logic for running a state and handling the state's transitions * * @return the registered state */ suspend fun state(name: String, handler: suspend StateHandler.() -> Unit): State { if (name == session.startStateName) throw ReservedStateName("state name $name is reserved for internal use only") return initState(name, handler) } /** * Registers the start state on the USSD menu * * @param handler state's handler. The handler houses logic for running a state and handling the state's transitions * * @return the registered state */ suspend fun startState(handler: suspend StateHandler.() -> Unit) = initState(session.startStateName, handler) /** * Fetches the user's last visited state from the session. * If no previous state is found for the [sessionId], the start state is returned * * @param sessionId UUID representing the user's current session * * @return the last visited State or start state */ private fun previousState(sessionId: String): State { val previousStateName = session.getPreviousStateName(sessionId) return states[previousStateName] ?: throw StateNotFound("Cannot find state with name: $previousStateName") } /** * This is the entry point for the USSD menu. Requests from gateways are processed here. * Firstly, the request is marshalled to the format specified by the chosen [gateway] * Then the session ID is used to fetch the user's last visited state. * The transitions defined in the handler of the last visited state is used to determine the next state. * * At the start of a user session, there is not previous state, hence the start state is returned as the previous state. * The start state then tries to handle the transition, but since the user input would be an empty string * or the ussd code (depending on the gateway), no matching transition would be found (as long as you have not * defined a transition on the start state that matches the user input provided by the gateway). * Hence, it will transition to the default next state. If the default next state has not been overridden, * the state will default to itself. * This may seem like an overkill, and it may be worth considering some circuit breaker pattern where on start of * ussd session, if the user input is an empty string or the ussd code, then return the start state. * At the moment, I have chosen not to do this because different gateways may have different values set as the input * on start of the ussd session. Some gateways use an empty string, some use the ussd code, others even use the ussd * code without the leading asterisk (*). The options are endless. * * @param request request sent to the USSD app * @param responder lambda used to send a response to the gateway */ suspend fun handle(request: Any, responder: suspend (result: Any) -> Any) { val transformedRequest = gateway.transform(request) session.start(transformedRequest.sessionId) val previousState = previousState(transformedRequest.sessionId) val currentState = states[previousState.handler.stateTransitions.nextState(transformedRequest)] ?: throw CannotResolveNextState("${previousState.name} state cannot resolve next state for input ${transformedRequest.message}") val result = currentState.handler.handle(transformedRequest, session) // it is a final state if the state runner returned an `end`. Then the session for that sessionId is cleared if (result.finalState) session.end(transformedRequest.sessionId) responder(result.result) } /** * Redirect to another state * * @param stateName target state's name * * @return target [State] object */ fun goTo(stateName: String): State { return states[stateName] ?: throw StateNotFound("Cannot find state with name: $stateName") } /** * Redirect to start state * * @return start [State] object */ fun goToStart() = goTo(session.startStateName) }
0
Kotlin
0
3
b0305c134e065352ff2d5d31c3016bef1de4ac06
6,901
menufactory
MIT License
assignments/01/src/test/kotlin/io/rybalkinsd/kotlinbootcamp/assignments/UtilTest.kt
rybalkinsd
143,287,871
false
null
package io.rybalkinsd.kotlinbootcamp.assignments import junit.framework.TestCase.assertEquals import org.junit.Ignore import org.junit.Test @Ignore class UtilTest { @Test fun `max # the only element is exactly max element`() { assertEquals(42, max(listOf(42))) } @Test fun `max # small list with unique elements`() { assertEquals(3, max(listOf(1, 2, 3))) } @Test fun `max # small list with duplicates`() { assertEquals(2, max(listOf(2, 2, 0))) } @Test fun `max # medium size list`() { val values = listOf(3262, 3989, 4825, 3751, 147, 2376, 2866, 1192, 2259, 905, 4810, 2481, 4243, 3907, 2958, 4061, 2410, 2253, 273, 3932, 4479, 4771, 1858, 3329, 3427, 3341, 3890, 3283, 1469, 2793, 292, 2371, 772, 1207, 2101, 985, 4615, 2290, 1147, 1659, 4000, 2958, 2010, 876, 2272, 242, 185, 3452, 2132, 4820, 3756, 577, 740, 731, 4066, 2666, 2316, 1445, 1430, 892, 2100, 2981, 2883, 2331, 3010, 2936, 4520, 727, 4727, 2501, 1619, 592, 1791, 3590, 122, 2599, 4450, 3256, 2148, 4306, 4448, 995, 1894, 1956, 4609, 4462, 1282, 4103, 2785, 1890, 2834, 3262, 2843, 761, 4610, 4220, 2685, 2155, 3379, 1555, 4521, 1429, 916, 4562, 203, 3502, 395, 2470, 3910, 1271, 4650, 3059, 4114, 3071, 2676, 1527, 264, 2008, 2070, 1843, 1158, 1042, 2314, 3119, 2709, 4857, 4439, 737, 663, 1381, 1733, 4770, 3399, 4902, 1644, 869, 2833, 2698, 4180, 1716, 952, 2885, 3558, 3657, 902, 1204, 346, 1431, 1102, 14, 4650, 2418, 221, 4575, 1052, 4913, 3671, 4730, 973, 3134, 1070, 1682, 4144, 3416, 2494, 3757, 341, 2822, 4187, 2021, 3823, 3751, 2500, 2109, 4262, 4282, 729, 2893, 683, 4487, 1150, 2162, 194, 1825, 1100, 1165, 617, 3033, 3589, 966, 2071, 2616, 2958, 997, 3760, 3312, 4577, 988, 3325, 472, 367, 4108) assertEquals(4913, max(values)) } @Test fun `sum # empty list`() { assertEquals(0L, sum(emptyList())) } @Test fun `sum # sum of list with one element is exactly this element`() { assertEquals(42L, sum(listOf(42))) } @Test fun `sum # small list with unique elements `() { assertEquals(2L, sum(listOf(1, -2, 3))) } @Test fun `sum # small list with duplicates`() { assertEquals(-2L, sum(listOf(-1, 0, -1))) } @Test fun `sum # medium size list`() { val values = listOf(-1474724389, 682594446, -1908752577, -1529308579, 2077283217, 2082453684, -1393301062, 770907957, -1236598274, 2095271857, -740944851, 690100578, 1205967523, 1882042738, -373000365, -202439561, -1040081538, 1588841659, 685998530, 2019352469, -1800807521, 142414883, 1321799336, -2004537327, -942379270, -404489374, -957557834, -399504812, -1822467201, -1228241713, -2032321957, -563526397, -994726553, 1984668451, -884205515, -996984225, -2084853551, -1367706750, -28706108, 899267565, 93707916, 1967952828, -1321338272, 888020056, 1829517878, 1239226575, -611104660, -65047658, 717708677, 940173744, 150269132, -1787788982, -457712412, 1346732618, 310601363, 603902313, 1490825537, -728538426, -1661524991, -1121646817, -40668379, -1639600371, 1298007468, 754741747, -839372028, 74891914, 1448173820, 2004898089, -861928746, -912147404, 996488667, -1827182233, 936477926, 1802061515, -144143443, -831598438, 688657385, 986456417, -820369026, -858057702, -1277601711, 1224420379, 880024954, -1608311541, 1855086307, -570622664, 434358177, -2031454458, 1481049222, -2037956014, -940876870, 1646714105, 311413598, -29986332, -1106964856, 1416048715, -2113966823, 1188073740, -529571269, -512737725, -848642424, 348656017, 1661814313, -1642727510, -393037711, -1728050138, -1392771651, 1165885102, -215631453, 1478712047, 875299503, 878882568, -1496689079, -1259055035, -613853579, -1698954143, 1463240835, -1659681354, 856880889, -1968831759, -75409870, 857055055, -1802999157, -1364031895, -1056882669, -1381441764, 357537560, 1280219923, -2084499953, 102724847, -530294628, 381797686, -2021569328, -1854998944, 1967557332, -1362109762, 341577879, -1718433003, 1685223992, -798207204, 1679085900, 1656150339, 1530589224, -1653067413, 646018006, 1539438196, 482037349, 141683923, -311814996, 890249354, -2046071358, -1634665678, 157612, 648594179, 138818586, 1010622968, 1962459435, 1094552702, 1720653188, 459927890, 1564744780, 1862441085, -1068370747, 392433034, 849064597, 54063467, 1941706502, -2026755411, 1746401471, -581914911, -1725686074, 625172077, -1020914484, 924333092, 1493320209, -1161778103, 871637343, -121482510, 981020657, -1393758230, 905799, -1444587907, -2088543963, -1112634928, -851030436, -667862345, -1797287920, -738938323, 528831118, -1547988016, -1106037772, 526685713, 651883066, 1638132220, -1199088801, 1926800070, -576812865, 1220251001, -550915611, -184638595, -711806895, 2097686224, 1498479886, -603482839, 676418060, -1364687014, 120618130, -1960422230, -1746918580, -1021870587, -1155229245, 885558062, 1769940027, -1925139368, -1864983990, -582517548, 466088875, -1650993228, 1490831893, -444293743, 323882021, 1604489947, -1605119856, -306180009, 1398619713, -2106975306, -682941166, 355824755, -2072708041, -2058266286, 835049113, 753771830, -319534410, -283580885, -1121248582, 435834839, -1286378764, 1906995885, -1575921710, 926581655, 830837253, 249121783, -134504831, 1192599590, 1341014384, 1088293601, -252656039, 1418479173, -1594157825, -2127581376, 1830494673, -2032849236, 908859863, 431795048, 1713044863, 1303776045, 560071367, -1951751182, -1247453562, -1121528296, 451595748, -1679038530, -693390260, 1590703073, 2067443541, 493216827, -1428131472, 98290432, 1472746858, 978590181, -2093498373, 1201124888, 710990323, 1866945807, -1740454700, 2145154139, -1699154737, -908513566, 1781999225, -1120469972, 1078346690, -1205331291, -1084503316, 2093929477, 130333580, -1129282754, -173080342, -887466598, 830051894, 1616624887, 1495894114, -1695449282, 210129582, 2061881221, 507850277, 45217670, -306996842, 1548180550, 1738862297, -2060638421, -1102767272, 148972746, 2032653619, -1270641356, -1897612419, -637864555, 2039416676, -744574636, 482647359, -1258292959, 695384019, -852666224, 1090315612, 972994345, -104272627, -853811164, -48020180, -711769052, 1492931833, 1648157351, -1050172683, 1606837519, -1027565744, -1737192595, -1318947970, -1194022033, -1347101877, 1593523244, -92890911, -1032008298, 1975284893, -1032689439, -1166943579, -928727260, 1006693283, 1292946932, -868988148, 1259949520, -2062560039, -606509926, -203936344, -1943779736, 1639590800, -1457342086, 156840756, -118397418, -142466083, 1491765650, -1319952736, -1585800220, -1329616940, -993277604, 207431533, 2050514561, -1435307018, -903120340, 940092731, 39524933, -146798873, -946671141, 232722591, 1646197618, 1065670755, -59475798, -702298822, -434399044, 2133298035, -83795617, -1831014138, 1787118090, -237432869, -1937309772, -1661588237, 1550710654, 693888726, 809115889, -562677070, 997215411, 1176895236, 11463383, 1794753487, 1276034117, 78633891, -1212857152, 1345484293, -2034880619, -399344899, -1993330941, -2075455283, -654655795, 297316385, 369142941, -49924040, -493753055, 260039637, 511910669, 1903632638, 1442702680, 535785674, 1520981118, -1634702891, -1307477366, 1949110033, -761178069, 1035384327, -844304085, 331875021, -1062718210, 692706622, -1768958905, 878445098, -790297990, 1995490466, -551789809, 1890059917, 168408027, -140430043, 1504518803, 161774861, -1237520004, -2095168739, 585514960, -1259894240, -628185993, 2101156626, -76091923, -715303783, -1581836142, -135706663, -1924047679, -247100463, 797694041, -488716831, -1800248424, -641295068, -1683773562, -1566476340, 1252727863, 142232735, -178962519, -1063333823, 159033884, -312564489, -1210928380, -673200897, 1663480329, 785478332, -1528981065, 1769889590, 480593347, -1796489523, -1515295460, 1936948497, 198395927, -1795818482, -966019724, -528050025, 1352568093, 939842648, 926150082, -1435326541, -361022784, -1537605455, 814170615, -1661965936, 649080189, -1826424644, -972256434, 1921496362, -1166121622, -689683086, -595644679, -1207001822, -1176256647, 562385682, 1145684733, -891913007, -1325826307, -20079018, 875273561, -51101026, 1727228781, 2020767975, 881176942, -1542288492, -1228110232, -958914287, -825401446, -1760467922, 788176377, 1956651194, -1150674139, 2124464757, 257048347, 1313482640, -1389557152, -901771956, -958870401, -1446259583, 2061501707, 383665418, 1255849356, 123150960, 660313335, 872128841, -780645978, -1144099804, -311829268, -1595492355, 1950024626, 1776302980, -390690356, -1833139769, -1754584614, 666130433, -2039860745, 645123979, 1090760077, -1615411118, -1995323663, -172882625, -1433389111, -1968915609, -229049022, -1833947642, -1406095972, 181046423, -1943482723, -2074821251, 1219623143, -1549707493, 1881766468, -652766637, -882632347, 1760414911, -759584854, -1031074273, -61750805, 610878422, 1667403609, 1841190509, -553777680, 1679372397, -756330986, 1398412057, -284107952, -452428604, -324286910, -157663776, -1784449972, -1856408327, 1071756162, -1050880205, -1654016555, 886979078, -1932471134, -1230597042, 1007046153, 1003548653, 580997046, -1048847735, 531312381, -752608463, -1803701118, -1258447890, 436236733, -596188792, -928759525, -1180767990, 141026704, -1874845235, 1765100749, 188828680, -1907110016, -897673413, 1455619391, 307446011, -322200040, -1200915496, 1984211413, 401432442, -1834904209, -2087690706, 1095930197, -6289039, 126400357, 796401216, -155925044, -1972587722, 829058092, -432126532, 1687843506, -92071718, 189771530, -1799409812, -1552096948, 1611396289, 539607900, -597773838, -83632303, 433064821, 637711837, -578666060, -1216910384, -232546122, 534654504, 1043774996, 950324816, -697587243, 1779913851, -1823908380, -1462010824, 655577409, -24064067, 715026201, -435654543, -1944215710, 1339563969, 1258806718, 1849481545, -1326949211, 346937292, -1417103830, -296271718, 896696535, -998736556, -116255116, 592745003, 97108919, -515895542, 1100563239, 2000725077, 1986536133, 1227651098, 2100155186, 1746151145, 1736667232, -127831119, -592304350, -1018684335, 115228687, -122248001, 558342034, -490389260, -523582434, -814553602, -626833695, -782760737, -217747348, -434235855, -862526939, -466093151, -1743358333, 317514929, -530211488, 1723590261, -179933463, 729702949, 1547355889, 1262599334, 958645173, 433805712, -980660659, -219916753, 1650176100, 740537744, -375784978, 1796119713, 2139286253, -1151961629, 1423280267, -2036963767, -1114158574, 23394606, -972082808, -435724399, 499449080, 1116380921, 1476737199, -362240346, 277817337, -974256642, -1699968736, 625868123, 1445264057, 2116119202, 1081314182, -1162889908, -1901489289, 2003560899, 1780460427, 1393736262, -1698282587, -266490956, -1057406835, 1362910950, -498857543, 1926052741, 704695697, -2075930753, 1960989765, -209940857, -651965321, 797790017, -1100062139, 596148238, 1209432175, 207201174, -1015032649, 1160627576, 618351531, -1906945585, -176929423, 1520082542, -1218960298, -868117761, 462223150, -1103837847, -1092336444, -1317068249, 1638855401, -433101704, 263824106, -1414969197, -1267259794, 889524799, -1478018289, -1577333629, 1666799661, 1864768322, -485926461, 1378657804, -711326640, 1818991459, 1860702480, -115302848, -1822394608, 1441016745, -1469362961, -1540866932, 706721860, -1365825470, -883475715, 2069079649, -1872094150, 1143460555, -2026178194, 2100450583, -1171485238, 856806605, -198786751, 1513997837, 2022434215, 1842144906, -648151115, -1602451180, -1989156104, -1229087238, -1030941957, 417157389, -1217619673, 112568848, 1951505964, -576722224, 74737399, -1121583551, 442476668, 907820623, 1305070300, 1212789318, -1484981328, -157958661, 2001315974, -893871585, -1523616307, -187963291, -1667509314, 2101140059, 1704083985, -371277784, -1050610570, -2018050922, -1466880729, -769106425, 189929498, -292534205, 1040746645, -501546671, 1538753580, 603153323, -1556393608, 2118468236, -1780376049, 956268853, -1560768909, 848579666, -1884816350, -2085970713, 1743001829, 1946566261, 1822422032, -2041868756, 1994802521, 1987911529, 1845312101, -1240665641, -1610014910, -1601896477, 1428449125, 1645621352, 88157159, 518403261, -1356827368, -163044211, -66393956, -469316836, 1755941545, 1715414506, 1470462002, 2041354964, 645703920, 2391068, -649710672, -1729914102, 564726861, -956989957, 1361580610, -2115871462, -596551753, -779689697, -770368399, -1224683077, 1739316500, -621871707, 406281876, -1737245599, 862885578, 174721587, 2128744069, -1665042206, 1837672085, 410489912, 517658776, -1710557348, -1240175205, -48187272, -1430878263, 9310805, -1014328899, -1538596921, -2007270092, -1519082718, 1299153967, 687014932, 1626319561, 274069645, -197501622, 2070528425, -1029765825, 1275499441, -1481825888, 1231599792, -2063425207, 1319915305, 1606665296, 1969095416, -390074361, -741649303, -1998554468, 1557316089, 410701503, 1331856235, -818858824, -660731627, -341025332, -1452003187, -1733079068, 82159648, -291777835, 264395961, 1710740924, -16606686, -1932150206, 508808134, 18603214, 1819745371, 1347509228, 1221172509, 764272237, -1803505274, -298109165, 350440095, -613280316, 1840289121, -27866732, -1006030394, 1946500141, 1318675565, -631695781, 1284770570, -92391741, 206109682, 314613525, 1846145925, -1679521483, -1758341562, -305740502, -1812992807, 425370077, 2006411085, 2119288298, -1688668335, -927444208, -1983562429, 2072888838, 1179265606, -666694217, -1332680264, 1095147585, -1214419261, 152482078, -836569380, 1552116582, 545439851, 967509004, -1610388228, 176155516, 1616517275, 1007627026, 1344973900, -651206088, -1499568181, -2093633496, -509632794, -1690864974, -1086570183, -180293771, -1875343598, -2063004581, 171252936, 2137587053, -928780856, 682135854, -770026716, 269572641, 1278440818, 823503654, -1074186198, 506856913, 725259509, -128547601, 822343559, 2008861382, -1922072846, 322001376, -1193732194, 1538314334, 1373419848, -1629843161, -855259473, -415511704, -1143592739, -561194939, -2122492364, 630284209, 5019038, -1671171907, 344098958, 154568415, 856091331, -785767161, 1629852897, -1319628676, -302467241, -1923901237, -465304261, 1837141845, -94260489, -1453201333, -282733829, 1445939205, 735726297, -929182944, -1364892304, 1054274764, -1389528304, 230403624, 2089178816, -2031848796, -434079731, 282818750, 1283007243, -2133152874, 1414327400, 815984940, 495461839, -107851191, -1472540960, -264932259, -41121395) assertEquals(-53_391_415_378L, sum(values)) } }
69
Kotlin
37
49
687f918f7eef2faf86fdcb4cdfde6e2f9e3faec1
14,412
kotlin-boot-camp
MIT License
shared/src/iosMain/kotlin/com/joelkanyi/focusbloom/platform/Font.ios.kt
JoelKanyi
680,275,879
false
{"Kotlin": 366687, "Swift": 2077, "Ruby": 1763}
/* * Copyright 2023 <NAME>. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.joelkanyi.focusbloom.platform import androidx.compose.runtime.Composable import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.text.font.FontWeight import kotlinx.coroutines.runBlocking import org.jetbrains.compose.resources.ExperimentalResourceApi import org.jetbrains.compose.resources.resource private val cache: MutableMap<String, Font> = mutableMapOf() @OptIn(ExperimentalResourceApi::class) @Composable actual fun font(name: String, res: String, weight: FontWeight, style: FontStyle): Font { return cache.getOrPut(res) { val byteArray = runBlocking { resource("font/$res.ttf").readBytes() } androidx.compose.ui.text.platform.Font(res, byteArray, weight, style) } }
4
Kotlin
16
59
e127ec6afaae541ed735b29f317a3000b90b9c94
1,364
FocusBloom
Apache License 2.0
app/src/main/java/com/canopas/yourspace/ui/flow/home/map/component/MarkerPositionState.kt
canopas
739,382,039
false
{"Kotlin": 802726, "JavaScript": 13096, "Ruby": 908}
package com.canopas.yourspace.ui.flow.home.map.component import androidx.compose.animation.core.Animatable import androidx.compose.animation.core.tween import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import com.canopas.yourspace.data.models.user.ApiUser import com.google.android.gms.maps.model.LatLng import com.google.maps.android.compose.MarkerState @Composable fun rememberMarkerState( user: ApiUser, position: LatLng = LatLng(0.0, 0.0) ): MarkerState { var state by remember(user) { mutableStateOf(MarkerState(position)) } val animatable = remember(user) { Animatable(0f) } LaunchedEffect(key1 = position) { animatable.snapTo(0f) animatable.animateTo(1f, animationSpec = tween(1000)) state = MarkerState( position = LatLng( position.latitude, position.longitude ) ) } val animatedLatLong = animatedLatLng( animatable.value, state.position, LatLng(position.latitude, position.longitude) ) return MarkerState( position = LatLng( animatedLatLong.latitude, animatedLatLong.longitude ) ) } private fun animatedLatLng(fraction: Float, a: LatLng, b: LatLng): LatLng { val lat = (b.latitude - a.latitude) * fraction + a.latitude var lngDelta = b.longitude - a.longitude // Take the shortest path across the 180th meridian. if (Math.abs(lngDelta) > 180) { lngDelta -= Math.signum(lngDelta) * 360 } val lng = lngDelta * fraction + a.longitude return LatLng(lat, lng) }
5
Kotlin
1
7
3ce744ea6663d632b2fff470f9293de72708291d
1,824
your-space-android
Apache License 2.0
src/main/kotlin/org/pokerom/btx/Pallette.kt
PokeForce
636,530,331
false
{"Kotlin": 73510, "Java": 8591}
package org.pokerom.btx import java.awt.Color import java.nio.ByteBuffer import java.nio.ByteOrder class Palette { var offset: Int = 0 var color0: Int = 0 var pal: Array<Color>? = null companion object { fun toBGR555Array(bytes: ByteArray): Array<Color> { val palette = Array(bytes.size / 2) { Color(0, 0, 0) } for (i in bytes.indices step 2) { palette[i / 2] = toBGR555(bytes[i], bytes[i + 1]) } return palette } fun fromBGR555(p: Array<Color>): ByteArray { val b = ByteBuffer.allocate(p.size * 2).order(ByteOrder.LITTLE_ENDIAN) for (color in p) { var num = 0 num += color.red / 8 num += (color.green / 8) shl 5 b.putShort((num + (color.blue / 8 shl 10)).toShort()) } return b.array() } fun toBGR555(byte1: Byte, byte2: Byte): Color { val b = ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN) b.put(byte1) b.put(byte2) val num = b.getShort(0).toInt() return Color((num and 0x1F) * 8, (num and 0x3E0 shr 5) * 8, (num and 0x7C00 shr 10) * 8) } } fun getPalRGBs(): Array<Color> { return pal ?: emptyArray() } }
0
Kotlin
0
7
28959e0e9c9594528204f080fa29a3a736e21975
1,339
pokerom-library
Apache License 2.0
src/main/kotlin/org/pokerom/btx/Pallette.kt
PokeForce
636,530,331
false
{"Kotlin": 73510, "Java": 8591}
package org.pokerom.btx import java.awt.Color import java.nio.ByteBuffer import java.nio.ByteOrder class Palette { var offset: Int = 0 var color0: Int = 0 var pal: Array<Color>? = null companion object { fun toBGR555Array(bytes: ByteArray): Array<Color> { val palette = Array(bytes.size / 2) { Color(0, 0, 0) } for (i in bytes.indices step 2) { palette[i / 2] = toBGR555(bytes[i], bytes[i + 1]) } return palette } fun fromBGR555(p: Array<Color>): ByteArray { val b = ByteBuffer.allocate(p.size * 2).order(ByteOrder.LITTLE_ENDIAN) for (color in p) { var num = 0 num += color.red / 8 num += (color.green / 8) shl 5 b.putShort((num + (color.blue / 8 shl 10)).toShort()) } return b.array() } fun toBGR555(byte1: Byte, byte2: Byte): Color { val b = ByteBuffer.allocate(2).order(ByteOrder.LITTLE_ENDIAN) b.put(byte1) b.put(byte2) val num = b.getShort(0).toInt() return Color((num and 0x1F) * 8, (num and 0x3E0 shr 5) * 8, (num and 0x7C00 shr 10) * 8) } } fun getPalRGBs(): Array<Color> { return pal ?: emptyArray() } }
0
Kotlin
0
7
28959e0e9c9594528204f080fa29a3a736e21975
1,339
pokerom-library
Apache License 2.0
app/src/main/java/in/ceeq/lyte/messages/MessageItemViewModel.kt
rachitmishra
89,640,201
false
{"Java": 65938, "Kotlin": 42714, "JavaScript": 2123}
package `in`.ceeq.lyte.messages import `in`.ceeq.lyte.data.Message import android.databinding.ObservableField class MessageItemViewModel private constructor(message: Message) { val message = ObservableField<Message>(Message()) companion object { fun from(message: Message) = MessageItemViewModel(message) } init { this.message.set(message) } }
1
null
1
1
b966e705440ce46384fd709839c587c2e6aba216
385
lyte
MIT License
codeSnippets/snippets/e2e/src/main/kotlin/e2e/TestServer.kt
ktorio
278,572,893
false
null
package e2e import kotlinx.coroutines.runBlocking import org.junit.After import org.junit.Before import java.util.concurrent.TimeUnit abstract class TestServer { private lateinit var serverProcess: Process @Before fun runServer() { serverProcess = runGradleApp() serverProcess.waitFor(4, TimeUnit.SECONDS) } @After fun stopServer(): Unit = runBlocking { serverProcess.destroy() } }
5
null
94
95
4ede19d93a98dd25c3e1665702f13a8468a364aa
437
ktor-documentation
Apache License 2.0
app/shared/app-component/impl/src/commonMain/kotlin/build/wallet/di/ActivityComponentImpl.kt
proto-at-block
761,306,853
false
null
// We expose all member fields for access in integration tests. @file:Suppress("MemberVisibilityCanBePrivate") package build.wallet.di import build.wallet.amount.AmountCalculatorImpl import build.wallet.amount.DecimalNumberCalculatorImpl import build.wallet.amount.DecimalNumberCreatorImpl import build.wallet.amount.DecimalSeparatorProviderImpl import build.wallet.amount.DoubleFormatterImpl import build.wallet.amount.WholeNumberCalculatorImpl import build.wallet.auth.AuthKeyRotationAttemptDaoImpl import build.wallet.auth.AuthKeyRotationManager import build.wallet.auth.AuthKeyRotationManagerImpl import build.wallet.auth.FullAccountCreatorImpl import build.wallet.auth.LiteAccountCreatorImpl import build.wallet.auth.LiteToFullAccountUpgraderImpl import build.wallet.auth.OnboardingFullAccountDeleterImpl import build.wallet.availability.AppFunctionalityStatusProviderImpl import build.wallet.bitcoin.address.BitcoinAddressParserImpl import build.wallet.bitcoin.blockchain.BitcoinBlockchainImpl import build.wallet.bitcoin.explorer.BitcoinExplorerImpl import build.wallet.bitcoin.fees.BitcoinFeeRateEstimatorImpl import build.wallet.bitcoin.fees.BitcoinTransactionBaseCalculatorImpl import build.wallet.bitcoin.fees.BitcoinTransactionFeeEstimatorImpl import build.wallet.bitcoin.fees.MempoolHttpClientImpl import build.wallet.bitcoin.invoice.BitcoinInvoiceUrlEncoderImpl import build.wallet.bitcoin.invoice.PaymentDataParserImpl import build.wallet.bitcoin.lightning.LightningInvoiceParser import build.wallet.bitcoin.lightning.LightningPreferenceImpl import build.wallet.bitcoin.transactions.BitcoinTransactionBumpabilityCheckerImpl import build.wallet.bitcoin.transactions.BitcoinTransactionSweepCheckerImpl import build.wallet.bitcoin.transactions.OutgoingTransactionDetailRepositoryImpl import build.wallet.bitcoin.transactions.TransactionPriorityPreferenceImpl import build.wallet.cloud.backup.BestEffortFullAccountCloudBackupUploaderImpl import build.wallet.cloud.backup.CloudBackupRepositoryImpl import build.wallet.cloud.backup.FullAccountCloudBackupCreatorImpl import build.wallet.cloud.backup.FullAccountCloudBackupRestorerImpl import build.wallet.cloud.backup.LiteAccountCloudBackupCreatorImpl import build.wallet.cloud.backup.LiteAccountCloudBackupRestorerImpl import build.wallet.cloud.backup.csek.CsekDaoImpl import build.wallet.cloud.backup.csek.CsekGeneratorImpl import build.wallet.cloud.backup.health.CloudBackupHealthRepositoryImpl import build.wallet.cloud.backup.health.FullAccountCloudBackupRepairerImpl import build.wallet.cloud.backup.local.CloudBackupDaoImpl import build.wallet.cloud.backup.v2.CloudBackupV2RestorerImpl import build.wallet.cloud.backup.v2.FullAccountFieldsCreatorImpl import build.wallet.cloud.store.CloudFileStore import build.wallet.cloud.store.CloudKeyValueStore import build.wallet.cloud.store.CloudStoreAccountRepository import build.wallet.configuration.FiatMobilePayConfigurationDaoImpl import build.wallet.configuration.FiatMobilePayConfigurationRepositoryImpl import build.wallet.crypto.Spake2 import build.wallet.datadog.DatadogRumMonitor import build.wallet.email.EmailValidatorImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitApkParametersProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitBackupDateProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitDataProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitMobileKeyParametersProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitPayloadDecoderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitPdfGeneratorImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitRepositoryImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitTemplateProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessPayloadCreatorImpl import build.wallet.emergencyaccesskit.EmergencyAccessPayloadRestorerImpl import build.wallet.encrypt.CryptoBox import build.wallet.encrypt.SymmetricKeyEncryptor import build.wallet.encrypt.SymmetricKeyGenerator import build.wallet.encrypt.XChaCha20Poly1305 import build.wallet.encrypt.XNonceGenerator import build.wallet.f8e.ActiveF8eEnvironmentRepositoryImpl import build.wallet.f8e.configuration.GetBdkConfigurationServiceImpl import build.wallet.f8e.demo.DemoModeServiceImpl import build.wallet.f8e.mobilepay.FiatMobilePayConfigurationServiceImpl import build.wallet.f8e.mobilepay.MobilePayBalanceServiceImpl import build.wallet.f8e.mobilepay.MobilePaySigningServiceImpl import build.wallet.f8e.mobilepay.MobilePaySpendingLimitServiceImpl import build.wallet.f8e.money.FiatCurrencyDefinitionServiceImpl import build.wallet.f8e.notifications.NotificationTouchpointServiceImpl import build.wallet.f8e.notifications.RegisterWatchAddressServiceImpl import build.wallet.f8e.onboarding.CompleteDelayNotifyServiceImpl import build.wallet.f8e.onboarding.CreateAccountKeysetServiceImpl import build.wallet.f8e.onboarding.CreateAccountServiceImpl import build.wallet.f8e.onboarding.DeleteOnboardingFullAccountServiceImpl import build.wallet.f8e.onboarding.OnboardingServiceImpl import build.wallet.f8e.onboarding.SetActiveSpendingKeysetServiceImpl import build.wallet.f8e.onboarding.UpgradeAccountServiceImpl import build.wallet.f8e.partnerships.GetPurchaseOptionsServiceImpl import build.wallet.f8e.partnerships.GetPurchaseQuoteListServiceImpl import build.wallet.f8e.partnerships.GetPurchaseRedirectServiceImpl import build.wallet.f8e.partnerships.GetTransferPartnerListServiceImpl import build.wallet.f8e.partnerships.GetTransferRedirectServiceImpl import build.wallet.f8e.recovery.CancelDelayNotifyRecoveryServiceImpl import build.wallet.f8e.recovery.GetAccountStatusServiceImpl import build.wallet.f8e.recovery.GetDelayNotifyRecoveryStatusServiceImpl import build.wallet.f8e.recovery.InitiateAccountDelayNotifyServiceImpl import build.wallet.f8e.recovery.InitiateHardwareAuthServiceImpl import build.wallet.f8e.recovery.ListKeysetsServiceImpl import build.wallet.f8e.recovery.RecoveryNotificationVerificationServiceImpl import build.wallet.f8e.recovery.RotateAuthKeysService import build.wallet.f8e.recovery.RotateAuthKeysServiceImpl import build.wallet.f8e.socrec.SocialRecoveryServiceFake import build.wallet.f8e.socrec.SocialRecoveryServiceImpl import build.wallet.f8e.support.SupportTicketServiceImpl import build.wallet.home.GettingStartedTaskDaoImpl import build.wallet.home.HomeUiBottomSheetDaoImpl import build.wallet.keybox.AppDataDeleterImpl import build.wallet.keybox.CloudBackupDeleterImpl import build.wallet.limit.MobilePayDisablerImpl import build.wallet.limit.MobilePayLimitSetterImpl import build.wallet.limit.MobilePaySpendingPolicyImpl import build.wallet.limit.MobilePayStatusProviderImpl import build.wallet.limit.SpendingLimitDaoImpl import build.wallet.logging.log import build.wallet.money.currency.FiatCurrencyRepositoryImpl import build.wallet.money.exchange.CurrencyConverterImpl import build.wallet.money.exchange.ExchangeRateDaoImpl import build.wallet.money.exchange.ExchangeRateSyncerImpl import build.wallet.money.exchange.F8eExchangeRateServiceImpl import build.wallet.money.formatter.internal.MoneyDisplayFormatterImpl import build.wallet.money.formatter.internal.MoneyFormatterDefinitionsImpl import build.wallet.money.input.MoneyInputFormatterImpl import build.wallet.nfc.NfcReaderCapabilityProviderImpl import build.wallet.nfc.NfcTransactorImpl import build.wallet.nfc.interceptors.collectFirmwareTelemetry import build.wallet.nfc.interceptors.collectMetrics import build.wallet.nfc.interceptors.haptics import build.wallet.nfc.interceptors.iosMessages import build.wallet.nfc.interceptors.lockDevice import build.wallet.nfc.interceptors.retryCommands import build.wallet.nfc.interceptors.sessionLogger import build.wallet.nfc.interceptors.timeoutSession import build.wallet.nfc.platform.NfcCommandsProvider import build.wallet.nfc.platform.NfcSessionProvider import build.wallet.nfc.transaction.PairingTransactionProviderImpl import build.wallet.notifications.NotificationTouchpointDaoImpl import build.wallet.notifications.RegisterWatchAddressQueueImpl import build.wallet.notifications.RegisterWatchAddressSenderImpl import build.wallet.onboarding.LiteAccountBackupToFullAccountUpgraderImpl import build.wallet.onboarding.OnboardingKeyboxHardwareKeysDaoImpl import build.wallet.onboarding.OnboardingKeyboxSealedCsekDaoImpl import build.wallet.onboarding.OnboardingKeyboxStepStateDaoImpl import build.wallet.partnerships.PartnershipTransactionsDaoImpl import build.wallet.partnerships.PartnershipTransactionsRepositoryImpl import build.wallet.phonenumber.PhoneNumberFormatterImpl import build.wallet.phonenumber.PhoneNumberValidatorImpl import build.wallet.phonenumber.lib.PhoneNumberLibBindings import build.wallet.platform.clipboard.ClipboardImpl import build.wallet.platform.links.DeepLinkHandlerImpl import build.wallet.platform.pdf.PdfAnnotatorFactory import build.wallet.platform.settings.CountryCodeGuesserImpl import build.wallet.platform.settings.LocaleIdentifierProviderImpl import build.wallet.platform.settings.SystemSettingsLauncher import build.wallet.platform.settings.TelephonyCountryCodeProviderImpl import build.wallet.platform.sharing.SharingManager import build.wallet.platform.web.InAppBrowserNavigator import build.wallet.queueprocessor.ProcessorImpl import build.wallet.recovery.LostAppRecoveryAuthenticatorImpl import build.wallet.recovery.LostAppRecoveryInitiatorImpl import build.wallet.recovery.LostHardwareRecoveryStarterImpl import build.wallet.recovery.RecoveryAuthCompleterImpl import build.wallet.recovery.RecoveryCancelerImpl import build.wallet.recovery.RecoverySyncerImpl import build.wallet.recovery.socrec.InviteCodeLoaderImpl import build.wallet.recovery.socrec.PostSocRecTaskRepositoryImpl import build.wallet.recovery.socrec.RecoveryIncompleteDaoImpl import build.wallet.recovery.socrec.SocRecChallengeRepositoryImpl import build.wallet.recovery.socrec.SocRecCryptoFake import build.wallet.recovery.socrec.SocRecCryptoImpl import build.wallet.recovery.socrec.SocRecEnrollmentAuthenticationDaoImpl import build.wallet.recovery.socrec.SocRecKeysDaoImpl import build.wallet.recovery.socrec.SocRecKeysRepository import build.wallet.recovery.socrec.SocRecRelationshipsDaoImpl import build.wallet.recovery.socrec.SocRecRelationshipsRepositoryImpl import build.wallet.recovery.socrec.SocRecStartedChallengeAuthenticationDaoImpl import build.wallet.recovery.socrec.SocRecStartedChallengeDaoImpl import build.wallet.recovery.socrec.SocialChallengeVerifierImpl import build.wallet.recovery.socrec.SocialRecoveryCodeBuilderImpl import build.wallet.recovery.socrec.SocialRecoveryServiceProviderImpl import build.wallet.recovery.socrec.TrustedContactKeyAuthenticatorImpl import build.wallet.recovery.sweep.SweepGeneratorImpl import build.wallet.serialization.Base32Encoding import build.wallet.statemachine.account.ChooseAccountAccessUiStateMachineImpl import build.wallet.statemachine.account.create.full.CreateAccountUiStateMachineImpl import build.wallet.statemachine.account.create.full.OnboardKeyboxUiStateMachineImpl import build.wallet.statemachine.account.create.full.OverwriteFullAccountCloudBackupUiStateMachineImpl import build.wallet.statemachine.account.create.full.ReplaceWithLiteAccountRestoreUiStateMachineImpl import build.wallet.statemachine.account.create.full.hardware.PairNewHardwareUiStateMachineImpl import build.wallet.statemachine.account.create.full.keybox.create.CreateKeyboxUiStateMachineImpl import build.wallet.statemachine.account.create.full.onboard.notifications.NotificationPreferencesSetupUiStateMachineV2Impl import build.wallet.statemachine.account.create.full.onboard.notifications.RecoveryChannelsSetupPushItemModelProviderImpl import build.wallet.statemachine.account.create.full.onboard.notifications.UiErrorHintsProviderImpl import build.wallet.statemachine.account.create.lite.CreateLiteAccountUiStateMachineImpl import build.wallet.statemachine.auth.ProofOfPossessionNfcStateMachineImpl import build.wallet.statemachine.auth.RefreshAuthTokensUiStateMachineImpl import build.wallet.statemachine.cloud.CloudBackupRectificationNavigatorImpl import build.wallet.statemachine.cloud.FullAccountCloudSignInAndBackupUiStateMachineImpl import build.wallet.statemachine.cloud.LiteAccountCloudSignInAndBackupUiStateMachineImpl import build.wallet.statemachine.cloud.RectifiableErrorHandlingUiStateMachineImpl import build.wallet.statemachine.cloud.health.CloudBackupHealthDashboardUiStateMachineImpl import build.wallet.statemachine.cloud.health.RepairCloudBackupStateMachineImpl import build.wallet.statemachine.core.input.EmailInputUiStateMachineImpl import build.wallet.statemachine.core.input.PhoneNumberInputUiStateMachineImpl import build.wallet.statemachine.core.input.VerificationCodeInputStateMachineImpl import build.wallet.statemachine.data.account.create.CreateFullAccountDataStateMachineImpl import build.wallet.statemachine.data.account.create.OnboardConfigDataStateMachineImpl import build.wallet.statemachine.data.account.create.OnboardingStepSkipConfigDaoImpl import build.wallet.statemachine.data.account.create.activate.ActivateFullAccountDataStateMachineImpl import build.wallet.statemachine.data.account.create.keybox.CreateKeyboxDataStateMachineImpl import build.wallet.statemachine.data.account.create.onboard.OnboardKeyboxDataStateMachineImpl import build.wallet.statemachine.data.app.AppDataStateMachineImpl import build.wallet.statemachine.data.firmware.FirmwareDataStateMachineImpl import build.wallet.statemachine.data.keybox.AccountDataStateMachineImpl import build.wallet.statemachine.data.keybox.CloudBackupRefresherImpl import build.wallet.statemachine.data.keybox.HasActiveFullAccountDataStateMachineImpl import build.wallet.statemachine.data.keybox.HasActiveLiteAccountDataStateMachineImpl import build.wallet.statemachine.data.keybox.NoActiveAccountDataStateMachineImpl import build.wallet.statemachine.data.keybox.address.FullAccountAddressDataStateMachineImpl import build.wallet.statemachine.data.keybox.config.TemplateFullAccountConfigDataStateMachineImpl import build.wallet.statemachine.data.keybox.transactions.FullAccountTransactionsDataStateMachineImpl import build.wallet.statemachine.data.lightning.LightningNodeDataStateMachineImpl import build.wallet.statemachine.data.mobilepay.MobilePayDataStateMachineImpl import build.wallet.statemachine.data.money.currency.CurrencyPreferenceDataStateMachineImpl import build.wallet.statemachine.data.notifications.NotificationTouchpointDataStateMachineImpl import build.wallet.statemachine.data.recovery.conflict.NoLongerRecoveringDataStateMachineImpl import build.wallet.statemachine.data.recovery.conflict.SomeoneElseIsRecoveringDataStateMachineImpl import build.wallet.statemachine.data.recovery.inprogress.F8eSpendingKeyRotatorImpl import build.wallet.statemachine.data.recovery.inprogress.RecoveryInProgressDataStateMachineImpl import build.wallet.statemachine.data.recovery.lostapp.LostAppRecoveryDataStateMachineImpl import build.wallet.statemachine.data.recovery.lostapp.LostAppRecoveryHaveNotStartedDataStateMachineImpl import build.wallet.statemachine.data.recovery.lostapp.initiate.InitiatingLostAppRecoveryDataStateMachineImpl import build.wallet.statemachine.data.recovery.losthardware.LostHardwareRecoveryDataStateMachineImpl import build.wallet.statemachine.data.recovery.losthardware.initiate.InitiatingLostHardwareRecoveryDataStateMachineImpl import build.wallet.statemachine.data.recovery.sweep.SweepDataStateMachineImpl import build.wallet.statemachine.data.recovery.verification.RecoveryNotificationVerificationDataStateMachineImpl import build.wallet.statemachine.data.sync.ElectrumServerDataStateMachineImpl import build.wallet.statemachine.demo.DemoModeCodeEntryUiStateMachineImpl import build.wallet.statemachine.demo.DemoModeConfigUiStateMachineImpl import build.wallet.statemachine.dev.AccountConfigUiStateMachineImpl import build.wallet.statemachine.dev.AppStateDeleterOptionsUiStateMachineImpl import build.wallet.statemachine.dev.BitcoinNetworkPickerUiStateMachineImpl import build.wallet.statemachine.dev.BitkeyDeviceOptionsUiStateMachineImpl import build.wallet.statemachine.dev.DebugMenuListStateMachineImpl import build.wallet.statemachine.dev.DebugMenuStateMachineImpl import build.wallet.statemachine.dev.F8eCustomUrlStateMachineImpl import build.wallet.statemachine.dev.F8eEnvironmentPickerUiStateMachineImpl import build.wallet.statemachine.dev.FirmwareMetadataUiStateMachineImpl import build.wallet.statemachine.dev.InfoOptionsUiStateMachineImpl import build.wallet.statemachine.dev.OnboardingAppKeyDeletionUiStateMachineImpl import build.wallet.statemachine.dev.OnboardingConfigStateMachineImpl import build.wallet.statemachine.dev.analytics.AnalyticsOptionsUiStateMachineImpl import build.wallet.statemachine.dev.analytics.AnalyticsUiStateMachineImpl import build.wallet.statemachine.dev.cloud.CloudDevOptionsStateMachine import build.wallet.statemachine.dev.debug.NetworkingDebugConfigPickerUiStateMachineImpl import build.wallet.statemachine.dev.featureFlags.BooleanFlagItemUiStateMachineImpl import build.wallet.statemachine.dev.featureFlags.FeatureFlagsOptionsUiStateMachineImpl import build.wallet.statemachine.dev.featureFlags.FeatureFlagsStateMachineImpl import build.wallet.statemachine.dev.lightning.ConnectAndOpenChannelStateMachineImpl import build.wallet.statemachine.dev.lightning.LightningDebugMenuUiStateMachineImpl import build.wallet.statemachine.dev.lightning.LightningOptionsUiStateMachineImpl import build.wallet.statemachine.dev.lightning.LightningSendReceiveUiStateMachineImpl import build.wallet.statemachine.dev.logs.LogsUiStateMachineImpl import build.wallet.statemachine.fwup.FwupNfcSessionUiStateMachineImpl import build.wallet.statemachine.fwup.FwupNfcUiStateMachineImpl import build.wallet.statemachine.home.full.HomeUiStateMachineImpl import build.wallet.statemachine.home.full.bottomsheet.CurrencyChangeMobilePayBottomSheetUpdaterImpl import build.wallet.statemachine.home.full.bottomsheet.HomeUiBottomSheetStateMachineImpl import build.wallet.statemachine.home.lite.LiteHomeUiStateMachineImpl import build.wallet.statemachine.limit.SetSpendingLimitUiStateMachineImpl import build.wallet.statemachine.limit.picker.SpendingLimitPickerUiStateMachineImpl import build.wallet.statemachine.money.amount.MoneyAmountEntryUiStateMachineImpl import build.wallet.statemachine.money.amount.MoneyAmountUiStateMachineImpl import build.wallet.statemachine.money.calculator.MoneyCalculatorUiStateMachineImpl import build.wallet.statemachine.money.currency.CurrencyPreferenceUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.MoneyHomeCardsUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.backup.CloudBackupHealthCardUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.fwup.DeviceUpdateCardUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.gettingstarted.GettingStartedCardUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.replacehardware.ReplaceHardwareCardUiStateMachineImpl import build.wallet.statemachine.moneyhome.full.MoneyHomeUiStateMachineImpl import build.wallet.statemachine.moneyhome.full.MoneyHomeViewingBalanceUiStateMachineImpl import build.wallet.statemachine.moneyhome.lite.LiteMoneyHomeUiStateMachineImpl import build.wallet.statemachine.nfc.NfcSessionUIStateMachineImpl import build.wallet.statemachine.notifications.NotificationPreferencesUiStateMachineImpl import build.wallet.statemachine.notifications.NotificationTouchpointInputAndVerificationUiStateMachineImpl import build.wallet.statemachine.notifications.NotificationsPreferencesCachedProviderImpl import build.wallet.statemachine.partnerships.AddBitcoinUiStateMachineImpl import build.wallet.statemachine.partnerships.purchase.CustomAmountEntryUiStateMachineImpl import build.wallet.statemachine.partnerships.purchase.PartnershipsPurchaseUiStateMachineImpl import build.wallet.statemachine.partnerships.transfer.PartnershipsTransferUiStateMachineImpl import build.wallet.statemachine.platform.nfc.EnableNfcNavigatorImpl import build.wallet.statemachine.platform.permissions.EnableNotificationsUiStateMachineImpl import build.wallet.statemachine.platform.permissions.NotificationPermissionRequesterImpl import build.wallet.statemachine.platform.permissions.PermissionUiStateMachineImpl import build.wallet.statemachine.receive.AddressQrCodeUiStateMachineImpl import build.wallet.statemachine.recovery.RecoveryInProgressUiStateMachineImpl import build.wallet.statemachine.recovery.cloud.AccessCloudBackupUiStateMachineImpl import build.wallet.statemachine.recovery.cloud.CloudSignInUiStateMachine import build.wallet.statemachine.recovery.cloud.FullAccountCloudBackupRestorationUiStateMachineImpl import build.wallet.statemachine.recovery.cloud.LiteAccountCloudBackupRestorationUiStateMachineImpl import build.wallet.statemachine.recovery.cloud.RotateAuthKeyUIStateMachineImpl import build.wallet.statemachine.recovery.conflict.NoLongerRecoveringUiStateMachineImpl import build.wallet.statemachine.recovery.conflict.SomeoneElseIsRecoveringUiStateMachineImpl import build.wallet.statemachine.recovery.emergencyaccesskit.EmergencyAccessKitRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.hardware.HardwareRecoveryStatusCardUiStateMachineImpl import build.wallet.statemachine.recovery.inprogress.completing.CompletingRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.lostapp.LostAppRecoveryHaveNotStartedUiStateMachineImpl import build.wallet.statemachine.recovery.lostapp.LostAppRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.lostapp.initiate.InitiatingLostAppRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.losthardware.LostHardwareRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.losthardware.initiate.InitiatingLostHardwareRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.LiteTrustedContactManagementUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.RecoveryContactCardsUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.TrustedContactManagementUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.add.AddingTrustedContactUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.challenge.ChallengeCodeFormatterImpl import build.wallet.statemachine.recovery.socrec.challenge.RecoveryChallengeUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.help.HelpingWithRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.inviteflow.InviteTrustedContactFlowUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.list.full.ListingTrustedContactsUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.list.lite.LiteListingTrustedContactsUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.reinvite.ReinviteTrustedContactUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.remove.RemoveTrustedContactUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.view.ViewingInvitationUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.view.ViewingProtectedCustomerUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.view.ViewingRecoveryContactUiStateMachineImpl import build.wallet.statemachine.recovery.sweep.SweepUiStateMachineImpl import build.wallet.statemachine.recovery.verification.RecoveryNotificationVerificationUiStateMachineImpl import build.wallet.statemachine.root.AppUiStateMachineImpl import build.wallet.statemachine.send.BitcoinAddressRecipientUiStateMachineImpl import build.wallet.statemachine.send.BitcoinQrCodeScanUiStateMachineImpl import build.wallet.statemachine.send.SendUiStateMachineImpl import build.wallet.statemachine.send.TransactionDetailsCardUiStateMachineImpl import build.wallet.statemachine.send.TransferAmountEntryUiStateMachineImpl import build.wallet.statemachine.send.TransferConfirmationUiStateMachineImpl import build.wallet.statemachine.send.TransferInitiatedUiStateMachineImpl import build.wallet.statemachine.send.fee.FeeOptionListUiStateMachineImpl import build.wallet.statemachine.send.fee.FeeOptionUiStateMachineImpl import build.wallet.statemachine.send.fee.FeeSelectionUiStateMachineImpl import build.wallet.statemachine.settings.SettingsListUiStateMachineImpl import build.wallet.statemachine.settings.full.SettingsHomeUiStateMachineImpl import build.wallet.statemachine.settings.full.device.DeviceSettingsUiStateMachineImpl import build.wallet.statemachine.settings.full.electrum.CustomElectrumServerSettingUiStateMachineImpl import build.wallet.statemachine.settings.full.electrum.CustomElectrumServerUiStateMachineImpl import build.wallet.statemachine.settings.full.electrum.SetElectrumServerUiStateMachineImpl import build.wallet.statemachine.settings.full.feedback.FeedbackFormUiStateMachineImpl import build.wallet.statemachine.settings.full.feedback.FeedbackUiStateMachineImpl import build.wallet.statemachine.settings.full.mobilepay.MobilePaySettingsUiStateMachineImpl import build.wallet.statemachine.settings.full.mobilepay.MobilePayStatusUiStateMachineImpl import build.wallet.statemachine.settings.full.mobilepay.SpendingLimitCardUiStateMachineImpl import build.wallet.statemachine.settings.full.notifications.NotificationsSettingsUiStateMachineImpl import build.wallet.statemachine.settings.full.notifications.RecoveryChannelSettingsUiStateMachineImpl import build.wallet.statemachine.settings.helpcenter.HelpCenterUiStateMachineImpl import build.wallet.statemachine.settings.lite.LiteSettingsHomeUiStateMachineImpl import build.wallet.statemachine.start.GettingStartedRoutingStateMachineImpl import build.wallet.statemachine.status.AppFunctionalityStatusUiStateMachineImpl import build.wallet.statemachine.status.HomeStatusBannerUiStateMachineImpl import build.wallet.statemachine.transactions.TransactionItemUiStateMachineImpl import build.wallet.statemachine.transactions.TransactionListUiStateMachineImpl import build.wallet.statemachine.trustedcontact.TrustedContactEnrollmentUiStateMachineImpl import build.wallet.support.SupportTicketFormValidatorImpl import build.wallet.support.SupportTicketRepositoryImpl import build.wallet.time.DateTimeFormatterImpl import build.wallet.time.DurationFormatterImpl import build.wallet.time.TimeZoneFormatterImpl import build.wallet.time.TimeZoneProviderImpl import kotlin.time.Duration.Companion.minutes /** * [ActivityComponent] that provides real implementations. * * Should be initialized as a singleton and scoped to the application's lifecycle. */ @Suppress("LargeClass") class ActivityComponentImpl( val appComponent: AppComponent, val cloudKeyValueStore: CloudKeyValueStore, val cloudFileStore: CloudFileStore, cloudSignInUiStateMachine: CloudSignInUiStateMachine, cloudDevOptionsStateMachine: CloudDevOptionsStateMachine, val cloudStoreAccountRepository: CloudStoreAccountRepository, datadogRumMonitor: DatadogRumMonitor, phoneNumberLibBindings: PhoneNumberLibBindings, symmetricKeyEncryptor: SymmetricKeyEncryptor, symmetricKeyGenerator: SymmetricKeyGenerator, lightningInvoiceParser: LightningInvoiceParser, sharingManager: SharingManager, systemSettingsLauncher: SystemSettingsLauncher, inAppBrowserNavigator: InAppBrowserNavigator, nfcCommandsProvider: NfcCommandsProvider, nfcSessionProvider: NfcSessionProvider, xChaCha20Poly1305: XChaCha20Poly1305, xNonceGenerator: XNonceGenerator, spake2: Spake2, cryptoBox: CryptoBox, val pdfAnnotatorFactory: PdfAnnotatorFactory, ) : ActivityComponent { init { log { "App Variant: ${appComponent.appVariant}" } } val timeZoneFormatter = TimeZoneFormatterImpl() val timeZoneProvider = TimeZoneProviderImpl() val dateTimeFormatter = DateTimeFormatterImpl() val clipboard = ClipboardImpl(appComponent.platformContext) val localeIdentifierProvider = LocaleIdentifierProviderImpl( platformContext = appComponent.platformContext ) val doubleFormatter = DoubleFormatterImpl( localeIdentifierProvider = localeIdentifierProvider ) val moneyFormatterDefinitions = MoneyFormatterDefinitionsImpl( doubleFormatter = doubleFormatter ) val moneyDisplayFormatter = MoneyDisplayFormatterImpl( bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, moneyFormatterDefinitions = moneyFormatterDefinitions ) val lightningPreference = LightningPreferenceImpl(appComponent.bitkeyDatabaseProvider) val decimalSeparatorProvider = DecimalSeparatorProviderImpl( localeIdentifierProvider = localeIdentifierProvider ) val decimalNumberCreator = DecimalNumberCreatorImpl( decimalSeparatorProvider = decimalSeparatorProvider, doubleFormatter = doubleFormatter ) val decimalNumberCalculator = DecimalNumberCalculatorImpl( decimalNumberCreator = decimalNumberCreator, decimalSeparatorProvider = decimalSeparatorProvider, doubleFormatter = doubleFormatter ) val wholeNumberCalculator = WholeNumberCalculatorImpl() val csekDao = CsekDaoImpl( encryptedKeyValueStoreFactory = appComponent.secureStoreFactory ) val nfcReaderCapabilityProvider = NfcReaderCapabilityProviderImpl(appComponent.platformContext) val permissionStateMachine = PermissionUiStateMachineImpl() val bitcoinAddressParser = BitcoinAddressParserImpl(appComponent.bdkAddressBuilder) val bitcoinExplorer = BitcoinExplorerImpl() val extendedKeyGenerator = appComponent.extendedKeyGenerator val appKeysGenerator = appComponent.appKeysGenerator val cancelDelayNotifyRecoveryService = CancelDelayNotifyRecoveryServiceImpl(appComponent.f8eHttpClient) val initiateAccountDelayNotifyService = InitiateAccountDelayNotifyServiceImpl( appComponent.f8eHttpClient ) val createAccountService = CreateAccountServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val createAccountKeysetService = CreateAccountKeysetServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val setActiveSpendingKeysetService = SetActiveSpendingKeysetServiceImpl(appComponent.f8eHttpClient) val bitcoinFeeRateEstimator = BitcoinFeeRateEstimatorImpl( mempoolHttpClient = MempoolHttpClientImpl( logLevelPolicy = appComponent.ktorLogLevelPolicy, networkReachabilityProvider = appComponent.networkReachabilityProvider ), bdkBlockchainProvider = appComponent.bdkBlockchainProvider ) val bitcoinInvoiceUrlEncoder = BitcoinInvoiceUrlEncoderImpl( bitcoinAddressParser = bitcoinAddressParser, lightningInvoiceParser = lightningInvoiceParser ) val amountCalculator = AmountCalculatorImpl( decimalNumberCalculator = decimalNumberCalculator, wholeNumberCalculator = wholeNumberCalculator ) val gettingStartedTaskDao = GettingStartedTaskDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val cloudBackupDao = CloudBackupDaoImpl( encryptedKeyValueStoreFactory = appComponent.secureStoreFactory ) val cloudBackupRepository = CloudBackupRepositoryImpl( cloudKeyValueStore = cloudKeyValueStore, cloudBackupDao = cloudBackupDao, authTokensRepository = appComponent.authTokensRepository ) val socRecCrypto = SocRecCryptoImpl( symmetricKeyGenerator = symmetricKeyGenerator, xChaCha20Poly1305 = xChaCha20Poly1305, xNonceGenerator = xNonceGenerator, spake2 = spake2, appAuthKeyMessageSigner = appComponent.appAuthKeyMessageSigner, signatureVerifier = appComponent.signatureVerifier, cryptoBox = cryptoBox ) val socRecCryptoFake = SocRecCryptoFake( messageSigner = appComponent.messageSigner, signatureVerifier = appComponent.signatureVerifier, appPrivateKeyDao = appComponent.appPrivateKeyDao ) val socRecKeysDao = SocRecKeysDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider, appPrivateKeyDao = appComponent.appPrivateKeyDao ) val socRecKeysRepository = SocRecKeysRepository(socRecCrypto, socRecKeysDao) private val fullAccountFieldsCreator = FullAccountFieldsCreatorImpl( appPrivateKeyDao = appComponent.appPrivateKeyDao, csekDao = csekDao, symmetricKeyEncryptor = symmetricKeyEncryptor, socRecCrypto = socRecCrypto ) val fullAccountCloudBackupCreator = FullAccountCloudBackupCreatorImpl( appPrivateKeyDao = appComponent.appPrivateKeyDao, fullAccountFieldsCreator = fullAccountFieldsCreator, socRecKeysRepository = socRecKeysRepository ) val exchangeRateDao = ExchangeRateDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val activeF8eEnvironmentRepository = ActiveF8eEnvironmentRepositoryImpl( keyboxDao = appComponent.keyboxDao ) val f8eExchangeRateService = F8eExchangeRateServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val exchangeRateSyncer = ExchangeRateSyncerImpl( exchangeRateDao = exchangeRateDao, f8eExchangeRateService = f8eExchangeRateService, activeF8eEnvironmentRepository = activeF8eEnvironmentRepository, appSessionManager = appComponent.appSessionManager ) val currencyConverter = CurrencyConverterImpl( accountRepository = appComponent.accountRepository, exchangeRateDao = exchangeRateDao, f8eExchangeRateService = f8eExchangeRateService ) val durationFormatter = DurationFormatterImpl() val getDelayNotifyRecoveryStatusService = GetDelayNotifyRecoveryStatusServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val recoverySyncer = RecoverySyncerImpl( recoveryDao = appComponent.recoveryDao, getRecoveryStatusService = getDelayNotifyRecoveryStatusService, appSessionManager = appComponent.appSessionManager ) val getAccountStatusService = GetAccountStatusServiceImpl(appComponent.f8eHttpClient, appComponent.uuidGenerator) val delayNotifyLostAppRecoveryInitiator = LostAppRecoveryInitiatorImpl( initiateAccountDelayNotifyService = InitiateAccountDelayNotifyServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ), recoveryDao = appComponent.recoveryDao ) val delayNotifyLostAppRecoveryAuthenticator = LostAppRecoveryAuthenticatorImpl( accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, deviceTokenManager = appComponent.deviceTokenManager ) val enableNfcNavigator = EnableNfcNavigatorImpl() val telephonyCountryCodeProvider = TelephonyCountryCodeProviderImpl(appComponent.platformContext) val nfcTransactor = NfcTransactorImpl( commandsProvider = nfcCommandsProvider, sessionProvider = nfcSessionProvider, interceptors = listOf( retryCommands(), iosMessages(), collectFirmwareTelemetry( appComponent.firmwareDeviceInfoDao, appComponent.firmwareTelemetryUploader ), lockDevice(), haptics(appComponent.nfcHaptics), timeoutSession(), collectMetrics(appComponent.datadogRumMonitor, appComponent.datadogTracer), sessionLogger() ) ) val nfcSessionUIStateMachine = NfcSessionUIStateMachineImpl( delayer = appComponent.delayer, nfcReaderCapabilityProvider = nfcReaderCapabilityProvider, enableNfcNavigator = enableNfcNavigator, deviceInfoProvider = appComponent.deviceInfoProvider, nfcTransactor = nfcTransactor ) val initiateHardwareAuthService = InitiateHardwareAuthServiceImpl( authenticationService = appComponent.authenticationService ) val completeDelayNotifyService = CompleteDelayNotifyServiceImpl(appComponent.f8eHttpClient) val csekGenerator = CsekGeneratorImpl( symmetricKeyGenerator = symmetricKeyGenerator ) val bitcoinBlockchain = BitcoinBlockchainImpl( bdkBlockchainProvider = appComponent.bdkBlockchainProvider, bdkPsbtBuilder = appComponent.bdkPartiallySignedTransactionBuilder, clock = appComponent.clock ) val mobilePaySigningService = MobilePaySigningServiceImpl(appComponent.f8eHttpClient) val paymentDataParser = PaymentDataParserImpl( bip21InvoiceEncoder = bitcoinInvoiceUrlEncoder, bitcoinAddressParser = bitcoinAddressParser, lightningInvoiceParser = lightningInvoiceParser ) val bitcoinQrCodeScanStateMachine = BitcoinQrCodeScanUiStateMachineImpl( paymentDataParser = paymentDataParser ) val bitcoinAddressRecipientStateMachine = BitcoinAddressRecipientUiStateMachineImpl( paymentDataParser = paymentDataParser, keysetWalletProvider = appComponent.keysetWalletProvider ) val cloudBackupRectificationNavigator = CloudBackupRectificationNavigatorImpl() val rectifiableErrorHandlingUiStateMachine = RectifiableErrorHandlingUiStateMachineImpl( cloudBackupRectificationNavigator = cloudBackupRectificationNavigator ) val emergencyAccessKitRepository = EmergencyAccessKitRepositoryImpl(cloudFileStore) val emergencyAccessKitDataProvider = EmergencyAccessKitDataProviderImpl(appComponent.appVariant) val eakPayloadCreator = EmergencyAccessPayloadCreatorImpl( csekDao = csekDao, symmetricKeyEncryptor = symmetricKeyEncryptor, appPrivateKeyDao = appComponent.appPrivateKeyDao ) val emergencyAccessKitPdfGenerator = EmergencyAccessKitPdfGeneratorImpl( apkParametersProvider = EmergencyAccessKitApkParametersProviderImpl( emergencyAccessKitDataProvider ), mobileKeyParametersProvider = EmergencyAccessKitMobileKeyParametersProviderImpl( payloadCreator = eakPayloadCreator ), pdfAnnotatorFactory = pdfAnnotatorFactory, templateProvider = EmergencyAccessKitTemplateProviderImpl( platformContext = appComponent.platformContext ), backupDateProvider = EmergencyAccessKitBackupDateProviderImpl( clock = appComponent.clock, timeZoneProvider = timeZoneProvider ), dateTimeFormatter = dateTimeFormatter ) val cloudBackupRepairer = FullAccountCloudBackupRepairerImpl( cloudBackupRepository = cloudBackupRepository, cloudBackupDao = cloudBackupDao, emergencyAccessKitPdfGenerator = emergencyAccessKitPdfGenerator, emergencyAccessKitRepository = emergencyAccessKitRepository ) val cloudBackupHealthRepository = CloudBackupHealthRepositoryImpl( cloudStoreAccountRepository = cloudStoreAccountRepository, cloudBackupRepository = cloudBackupRepository, emergencyAccessKitRepository = emergencyAccessKitRepository, fullAccountCloudBackupRepairer = cloudBackupRepairer, cloudBackupDao = cloudBackupDao ) val fullAccountCloudSignInAndBackupUiStateMachine = FullAccountCloudSignInAndBackupUiStateMachineImpl( cloudBackupRepository = cloudBackupRepository, cloudSignInUiStateMachine = cloudSignInUiStateMachine, fullAccountCloudBackupCreator = fullAccountCloudBackupCreator, eventTracker = appComponent.eventTracker, rectifiableErrorHandlingUiStateMachine = rectifiableErrorHandlingUiStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider, csekGenerator = csekGenerator, nfcSessionUIStateMachine = nfcSessionUIStateMachine, csekDao = csekDao, inAppBrowserNavigator = inAppBrowserNavigator, emergencyAccessKitPdfGenerator = emergencyAccessKitPdfGenerator, emergencyAccessKitRepository = emergencyAccessKitRepository ) val socRecRelationshipsDao = SocRecRelationshipsDaoImpl(appComponent.bitkeyDatabaseProvider) val socRecEnrollmentAuthenticationDao = SocRecEnrollmentAuthenticationDaoImpl( appComponent.appPrivateKeyDao, appComponent.bitkeyDatabaseProvider ) val base32Encoding = Base32Encoding() val pakeCodeBuilder = SocialRecoveryCodeBuilderImpl( base32Encoding = base32Encoding ) val socialRecoveryServiceFake = SocialRecoveryServiceFake( uuidGenerator = appComponent.uuidGenerator, backgroundScope = appComponent.appCoroutineScope ) val socialRecoveryServiceImpl = SocialRecoveryServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val socialRecoveryServiceProvider = SocialRecoveryServiceProviderImpl( accountRepository = appComponent.accountRepository, socRecFake = socialRecoveryServiceFake, socRecService = socialRecoveryServiceImpl, templateFullAccountConfigDao = appComponent.templateFullAccountConfigDao ) val socRecStartedChallengeAuthenticationDao = SocRecStartedChallengeAuthenticationDaoImpl( appComponent.appPrivateKeyDao, appComponent.bitkeyDatabaseProvider ) val socRecRelationshipsRepository = SocRecRelationshipsRepositoryImpl( appScope = appComponent.appCoroutineScope, socialRecoveryServiceProvider = socialRecoveryServiceProvider, socRecRelationshipsDao = socRecRelationshipsDao, socRecEnrollmentAuthenticationDao = socRecEnrollmentAuthenticationDao, socRecCrypto = socRecCrypto, socialRecoveryCodeBuilder = pakeCodeBuilder, appSessionManager = appComponent.appSessionManager ) val bestEffortFullAccountCloudBackupUploader = BestEffortFullAccountCloudBackupUploaderImpl( cloudBackupDao = cloudBackupDao, socRecRelationshipsRepository = socRecRelationshipsRepository, cloudStoreAccountRepository = cloudStoreAccountRepository, fullAccountCloudBackupCreator = fullAccountCloudBackupCreator, cloudBackupRepository = cloudBackupRepository ) val repairMobileKeyBackupUiStateMachine = RepairCloudBackupStateMachineImpl( cloudSignInStateMachine = cloudSignInUiStateMachine, cloudBackupDao = cloudBackupDao, cloudBackupRepository = cloudBackupRepository, cloudBackupHealthRepository = cloudBackupHealthRepository, deviceInfoProvider = appComponent.deviceInfoProvider, csekGenerator = csekGenerator, nfcSessionUIStateMachine = nfcSessionUIStateMachine, csekDao = csekDao, fullAccountCloudBackupCreator = fullAccountCloudBackupCreator, socRecRelationshipsRepository = socRecRelationshipsRepository, emergencyAccessKitPdfGenerator = emergencyAccessKitPdfGenerator, emergencyAccessKitRepository = emergencyAccessKitRepository, inAppBrowserNavigator = inAppBrowserNavigator ) val hardwareRecoveryStatusCardUiStateMachine = HardwareRecoveryStatusCardUiStateMachineImpl( clock = appComponent.clock, durationFormatter = durationFormatter ) val transactionListStateMachine = TransactionListUiStateMachineImpl( transactionItemUiStateMachine = TransactionItemUiStateMachineImpl( currencyConverter = currencyConverter, dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, moneyDisplayFormatter = moneyDisplayFormatter ) ) val spendingLimitDao = SpendingLimitDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val spendingLimitService = MobilePaySpendingLimitServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val mobilePayDisabler = MobilePayDisablerImpl( spendingLimitDao = spendingLimitDao, spendingLimitService = spendingLimitService ) val mobilePayBalanceService = MobilePayBalanceServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, fiatCurrencyDao = appComponent.fiatCurrencyDao ) val mobilePayStatusProvider = MobilePayStatusProviderImpl( spendingLimitDao = spendingLimitDao, mobilePayBalanceService = mobilePayBalanceService, uuidGenerator = appComponent.uuidGenerator, appSpendingWalletProvider = appComponent.appSpendingWalletProvider ) val moneyAmountUiStateMachine = MoneyAmountUiStateMachineImpl( currencyConverter = currencyConverter, moneyDisplayFormatter = moneyDisplayFormatter ) val moneyInputFormatter = MoneyInputFormatterImpl( decimalSeparatorProvider = decimalSeparatorProvider, doubleFormatter = doubleFormatter, moneyFormatterDefinitions = moneyFormatterDefinitions ) val moneyAmountEntryUiStateMachine = MoneyAmountEntryUiStateMachineImpl( moneyInputFormatter = moneyInputFormatter, moneyDisplayFormatter = moneyDisplayFormatter ) val moneyCalculatorUiStateMachine = MoneyCalculatorUiStateMachineImpl( amountCalculator = amountCalculator, bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, currencyConverter = currencyConverter, moneyAmountEntryUiStateMachine = moneyAmountEntryUiStateMachine, decimalNumberCreator = decimalNumberCreator, doubleFormatter = doubleFormatter ) val mobilePaySpendingPolicy = MobilePaySpendingPolicyImpl() val transferAmountEntryUiStateMachine = TransferAmountEntryUiStateMachineImpl( currencyConverter = currencyConverter, moneyCalculatorUiStateMachine = moneyCalculatorUiStateMachine, mobilePaySpendingPolicy = mobilePaySpendingPolicy, moneyDisplayFormatter = moneyDisplayFormatter ) val transactionDetailsCardUiStateMachine = TransactionDetailsCardUiStateMachineImpl( currencyConverter = currencyConverter, moneyDisplayFormatter = moneyDisplayFormatter ) val transferInitiatedUiStateMachine = TransferInitiatedUiStateMachineImpl( transactionDetailsCardUiStateMachine = transactionDetailsCardUiStateMachine ) val refreshAuthTokensStateMachine = RefreshAuthTokensUiStateMachineImpl( authTokensRepository = appComponent.authTokensRepository ) val proofOfPossessionNfcStateMachine = ProofOfPossessionNfcStateMachineImpl( nfcSessionUIStateMachine = nfcSessionUIStateMachine, refreshAuthTokensUiStateMachine = refreshAuthTokensStateMachine ) val fiatMobilePayConfigurationDao = FiatMobilePayConfigurationDaoImpl(appComponent.bitkeyDatabaseProvider) val fiatMobilePayConfigurationService = FiatMobilePayConfigurationServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, fiatCurrencyDao = appComponent.fiatCurrencyDao ) val fiatMobilePayConfigurationRepository = FiatMobilePayConfigurationRepositoryImpl( fiatMobilePayConfigurationDao = fiatMobilePayConfigurationDao, fiatMobilePayConfigurationService = fiatMobilePayConfigurationService ) val spendingLimitPickerUiStateMachine = SpendingLimitPickerUiStateMachineImpl( currencyConverter = currencyConverter, fiatMobilePayConfigurationRepository = fiatMobilePayConfigurationRepository, moneyDisplayFormatter = moneyDisplayFormatter, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine ) val registerWatchAddressQueue = RegisterWatchAddressQueueImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val registerWatchAddressService = RegisterWatchAddressServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val registerWatchAddressSender = RegisterWatchAddressSenderImpl(registerWatchAddressService) private val registerWatchAddressProcessor = ProcessorImpl( queue = registerWatchAddressQueue, processor = registerWatchAddressSender, retryFrequency = 1.minutes, retryBatchSize = 1 ) val addressQrCodeUiStateMachine = AddressQrCodeUiStateMachineImpl( clipboard = clipboard, delayer = appComponent.delayer, sharingManager = sharingManager, bitcoinInvoiceUrlEncoder = bitcoinInvoiceUrlEncoder ) val notificationPermissionRequester = NotificationPermissionRequesterImpl( pushNotificationPermissionStatusProvider = appComponent.pushNotificationPermissionStatusProvider ) val enableNotificationsUiStateMachine = EnableNotificationsUiStateMachineImpl( notificationPermissionRequester = notificationPermissionRequester, permissionChecker = appComponent.permissionChecker, eventTracker = appComponent.eventTracker ) val verificationCodeInputStateMachine = VerificationCodeInputStateMachineImpl( clock = appComponent.clock, durationFormatter = durationFormatter, eventTracker = appComponent.eventTracker ) val recoveryNotificationVerificationUiStateMachine = RecoveryNotificationVerificationUiStateMachineImpl( verificationCodeInputStateMachine = verificationCodeInputStateMachine ) val initiatingLostAppRecoveryUiStateMachineImpl = InitiatingLostAppRecoveryUiStateMachineImpl( nfcSessionUIStateMachine = nfcSessionUIStateMachine, enableNotificationsUiStateMachine = enableNotificationsUiStateMachine, recoveryNotificationVerificationUiStateMachine = recoveryNotificationVerificationUiStateMachine ) val accessCloudBackupUiStateMachine = AccessCloudBackupUiStateMachineImpl( cloudBackupRepository = cloudBackupRepository, cloudSignInUiStateMachine = cloudSignInUiStateMachine, rectifiableErrorHandlingUiStateMachine = rectifiableErrorHandlingUiStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider, inAppBrowserNavigator = inAppBrowserNavigator ) private val cloudBackupV2Restorer = CloudBackupV2RestorerImpl( csekDao = csekDao, symmetricKeyEncryptor = symmetricKeyEncryptor, appPrivateKeyDao = appComponent.appPrivateKeyDao, socRecKeysDao = socRecKeysDao, uuidGenerator = appComponent.uuidGenerator ) val cloudBackupRestorer = FullAccountCloudBackupRestorerImpl( cloudBackupV2Restorer = cloudBackupV2Restorer ) val challengeCodeFormatter = ChallengeCodeFormatterImpl() val socRecPendingChallengeDao = SocRecStartedChallengeDaoImpl(appComponent.bitkeyDatabaseProvider) val socRecChallengeRepository = SocRecChallengeRepositoryImpl( socRec = socialRecoveryServiceImpl, socRecCodeBuilder = pakeCodeBuilder, socRecCrypto = socRecCrypto, socRecFake = socialRecoveryServiceFake, socRecStartedChallengeDao = socRecPendingChallengeDao, socRecStartedChallengeAuthenticationDao = socRecStartedChallengeAuthenticationDao ) val recoveryChallengeUiStateMachine = RecoveryChallengeUiStateMachineImpl( crypto = socRecCrypto, enableNotificationsUiStateMachine = enableNotificationsUiStateMachine, deviceTokenManager = appComponent.deviceTokenManager, challengeCodeFormatter = challengeCodeFormatter, permissionChecker = appComponent.permissionChecker ) val sweepUiStateMachine = SweepUiStateMachineImpl( nfcSessionUIStateMachine = nfcSessionUIStateMachine, moneyAmountUiStateMachine = moneyAmountUiStateMachine ) val completingRecoveryUiStateMachine = CompletingRecoveryUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, fullAccountCloudSignInAndBackupUiStateMachine = fullAccountCloudSignInAndBackupUiStateMachine, sweepUiStateMachine = sweepUiStateMachine, nfcSessionUIStateMachine = nfcSessionUIStateMachine ) val recoveryInProgressUiStateMachine = RecoveryInProgressUiStateMachineImpl( completingRecoveryUiStateMachine, proofOfPossessionNfcStateMachine, durationFormatter, appComponent.clock, eventTracker = appComponent.eventTracker, recoveryNotificationVerificationUiStateMachine = recoveryNotificationVerificationUiStateMachine ) val addingTcsUiStateMachine = AddingTrustedContactUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, clipboard = clipboard, sharingManager = sharingManager, eventTracker = appComponent.eventTracker ) val reinviteTrustedContactUiStateMachine = ReinviteTrustedContactUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, clipboard = clipboard, sharingManager = sharingManager ) val removeTrustedContactUiStateMachine = RemoveTrustedContactUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, clock = appComponent.clock ) val inviteCodeLoader = InviteCodeLoaderImpl( socRecEnrollmentAuthenticationDao = socRecEnrollmentAuthenticationDao, recoveryCodeBuilder = pakeCodeBuilder ) val viewingInvitationUiStateMachine = ViewingInvitationUiStateMachineImpl( removeTrustedContactsUiStateMachine = removeTrustedContactUiStateMachine, reinviteTrustedContactUiStateMachine = reinviteTrustedContactUiStateMachine, sharingManager = sharingManager, clock = appComponent.clock, inviteCodeLoader = inviteCodeLoader ) val viewingRecoveryContactUiStateMachine = ViewingRecoveryContactUiStateMachineImpl( removeTrustedContactUiStateMachine = removeTrustedContactUiStateMachine ) val viewingProtectedCustomerUiStateMachine = ViewingProtectedCustomerUiStateMachineImpl() val helpingWithRecoveryUiStateMachine = HelpingWithRecoveryUiStateMachineImpl( delayer = appComponent.delayer, socialChallengeVerifier = SocialChallengeVerifierImpl( socRecChallengeRepository = socRecChallengeRepository, socRecCrypto = socRecCrypto, socialRecoveryCodeBuilder = pakeCodeBuilder ), socRecKeysRepository = socRecKeysRepository ) val listingTcsUiStateMachine = ListingTrustedContactsUiStateMachineImpl( viewingRecoveryContactUiStateMachine = viewingRecoveryContactUiStateMachine, viewingInvitationUiStateMachine = viewingInvitationUiStateMachine, viewingProtectedCustomerUiStateMachine = viewingProtectedCustomerUiStateMachine, helpingWithRecoveryUiStateMachine = helpingWithRecoveryUiStateMachine, clock = appComponent.clock ) val trustedContactEnrollmentUiStateMachine = TrustedContactEnrollmentUiStateMachineImpl( deviceInfoProvider = appComponent.deviceInfoProvider, socRecKeysRepository = socRecKeysRepository, eventTracker = appComponent.eventTracker ) val trustedContactManagementUiStateMachine = TrustedContactManagementUiStateMachineImpl( addingTrustedContactUiStateMachine = addingTcsUiStateMachine, listingTrustedContactsUiStateMachine = listingTcsUiStateMachine, trustedContactEnrollmentUiStateMachine = trustedContactEnrollmentUiStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider ) val countryCodeGuesser = CountryCodeGuesserImpl( localeCountryCodeProvider = appComponent.localeCountryCodeProvider, telephonyCountryCodeProvider = telephonyCountryCodeProvider ) val phoneNumberValidator = PhoneNumberValidatorImpl( countryCodeGuesser = countryCodeGuesser, phoneNumberLibBindings = phoneNumberLibBindings ) val notificationTouchpointDao = NotificationTouchpointDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider, phoneNumberValidator = phoneNumberValidator ) val notificationTouchpointService = NotificationTouchpointServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, phoneNumberValidator = phoneNumberValidator ) val notificationsPreferencesCachedProvider = NotificationsPreferencesCachedProviderImpl( notificationTouchpointService = notificationTouchpointService, keyValueStoreFactory = appComponent.keyValueStoreFactory ) val upgradeAccountService = UpgradeAccountServiceImpl(appComponent.f8eHttpClient) val fullAccountCreator = FullAccountCreatorImpl( keyboxDao = appComponent.keyboxDao, createFullAccountService = createAccountService, accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, deviceTokenManager = appComponent.deviceTokenManager, uuidGenerator = appComponent.uuidGenerator, notificationTouchpointService = notificationTouchpointService, notificationTouchpointDao = notificationTouchpointDao ) val onboardingKeyboxStepStateDao = OnboardingKeyboxStepStateDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val phoneNumberFormatter = PhoneNumberFormatterImpl( phoneNumberLibBindings = phoneNumberLibBindings ) val phoneNumberInputStateMachine = PhoneNumberInputUiStateMachineImpl( phoneNumberFormatter = phoneNumberFormatter, phoneNumberValidator = phoneNumberValidator ) val emailValidator = EmailValidatorImpl() val emailInputStateMachine = EmailInputUiStateMachineImpl( emailValidator = emailValidator ) val uiErrorHintProvider = UiErrorHintsProviderImpl( keystoreFactory = appComponent.secureStoreFactory, appScope = appComponent.appCoroutineScope ) val notificationTouchpointInputAndVerificationUiStateMachine = NotificationTouchpointInputAndVerificationUiStateMachineImpl( delayer = appComponent.delayer, emailInputUiStateMachine = emailInputStateMachine, notificationTouchpointDao = notificationTouchpointDao, notificationTouchpointService = notificationTouchpointService, phoneNumberInputUiStateMachine = phoneNumberInputStateMachine, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, uiErrorHintSubmitter = uiErrorHintProvider, verificationCodeInputStateMachine = verificationCodeInputStateMachine ) val pushItemModelProviderV2 = RecoveryChannelsSetupPushItemModelProviderImpl( pushNotificationPermissionStatusProvider = appComponent.pushNotificationPermissionStatusProvider, systemSettingsLauncher = systemSettingsLauncher ) val notificationPreferencesUiStateMachine = NotificationPreferencesUiStateMachineImpl( permissionChecker = appComponent.permissionChecker, notificationsPreferencesCachedProvider = notificationsPreferencesCachedProvider, systemSettingsLauncher = systemSettingsLauncher, notificationPermissionRequester = notificationPermissionRequester, inAppBrowserNavigator = inAppBrowserNavigator, eventTracker = appComponent.eventTracker ) val recoveryChannelSettingsUiStateMachineImpl = RecoveryChannelSettingsUiStateMachineImpl( permissionChecker = appComponent.permissionChecker, notificationsPreferencesCachedProvider = notificationsPreferencesCachedProvider, notificationTouchpointInputAndVerificationUiStateMachine = notificationTouchpointInputAndVerificationUiStateMachine, inAppBrowserNavigator = inAppBrowserNavigator, telephonyCountryCodeProvider = telephonyCountryCodeProvider, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, systemSettingsLauncher = systemSettingsLauncher, eventTracker = appComponent.eventTracker, notificationPermissionRequester = notificationPermissionRequester, uiErrorHintsProvider = uiErrorHintProvider ) val notificationPreferencesSetupUiStateMachineV2 = NotificationPreferencesSetupUiStateMachineV2Impl( eventTracker = appComponent.eventTracker, notificationPermissionRequester = notificationPermissionRequester, notificationTouchpointInputAndVerificationUiStateMachine = notificationTouchpointInputAndVerificationUiStateMachine, notificationTouchpointDao = notificationTouchpointDao, notificationPreferencesUiStateMachine = notificationPreferencesUiStateMachine, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao, pushItemModelProvider = pushItemModelProviderV2, inAppBrowserNavigator = inAppBrowserNavigator, telephonyCountryCodeProvider = telephonyCountryCodeProvider, uiErrorHintsProvider = uiErrorHintProvider ) val notificationsSettingsStateMachine = NotificationsSettingsUiStateMachineImpl( notificationTouchpointInputAndVerificationUiStateMachine = notificationTouchpointInputAndVerificationUiStateMachine ) val onboardingKeyboxSealedCsekDao = OnboardingKeyboxSealedCsekDaoImpl( encryptedKeyValueStoreFactory = appComponent.secureStoreFactory ) val onboardingKeyboxHwAuthPublicKeyDao = OnboardingKeyboxHardwareKeysDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val onboardingService = OnboardingServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val listKeysetsService = ListKeysetsServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, uuidGenerator = appComponent.uuidGenerator ) val pairingTransactionProvider = PairingTransactionProviderImpl( csekGenerator = csekGenerator, csekDao = csekDao, uuidGenerator = appComponent.uuidGenerator, appInstallationDao = appComponent.appInstallationDao, hardwareAttestation = appComponent.hardwareAttestation ) val helpCenterUiStateMachine = HelpCenterUiStateMachineImpl( inAppBrowserNavigator = inAppBrowserNavigator ) val pairNewHardwareUiStateMachine = PairNewHardwareUiStateMachineImpl( eventTracker = appComponent.eventTracker, pairingTransactionProvider = pairingTransactionProvider, nfcSessionUIStateMachine = nfcSessionUIStateMachine, helpCenterUiStateMachine = helpCenterUiStateMachine ) private val createKeyboxUiStateMachine = CreateKeyboxUiStateMachineImpl( pairNewHardwareUiStateMachine = pairNewHardwareUiStateMachine ) val fiatCurrencyDefinitionService = FiatCurrencyDefinitionServiceImpl(appComponent.f8eHttpClient) val fiatCurrencyRepository = FiatCurrencyRepositoryImpl( fiatCurrencyDao = appComponent.fiatCurrencyDao, fiatCurrencyDefinitionService = fiatCurrencyDefinitionService ) val currencyPreferenceUiStateMachine = CurrencyPreferenceUiStateMachineImpl( currencyConverter = currencyConverter, fiatCurrencyRepository = fiatCurrencyRepository, moneyDisplayFormatter = moneyDisplayFormatter ) val onboardKeyboxUiStateMachine = OnboardKeyboxUiStateMachineImpl( fullAccountCloudSignInAndBackupUiStateMachine = fullAccountCloudSignInAndBackupUiStateMachine, notificationPreferencesSetupUiStateMachineV2 = notificationPreferencesSetupUiStateMachineV2 ) val deleteOnboardingFullAccountService = DeleteOnboardingFullAccountServiceImpl(appComponent.f8eHttpClient) val onboardingFullAccountDeleter = OnboardingFullAccountDeleterImpl( accountRepository = appComponent.accountRepository, keyboxDao = appComponent.keyboxDao, deleteOnboardingFullAccountService = deleteOnboardingFullAccountService ) val liteToFullAccountUpgrader = LiteToFullAccountUpgraderImpl( keyboxDao = appComponent.keyboxDao, accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, deviceTokenManager = appComponent.deviceTokenManager, upgradeAccountService = upgradeAccountService, uuidGenerator = appComponent.uuidGenerator ) val liteAccountCloudBackupRestorer = LiteAccountCloudBackupRestorerImpl( appPrivateKeyDao = appComponent.appPrivateKeyDao, socRecKeysDao = socRecKeysDao, accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, cloudBackupDao = cloudBackupDao, accountRepository = appComponent.accountRepository ) val liteAccountBackupToFullAccountUpgrader = LiteAccountBackupToFullAccountUpgraderImpl( liteAccountCloudBackupRestorer = liteAccountCloudBackupRestorer, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore, onboardingKeyboxHardwareKeysDao = onboardingKeyboxHwAuthPublicKeyDao, uuidGenerator = appComponent.uuidGenerator, liteToFullAccountUpgrader = liteToFullAccountUpgrader ) private val replaceWithLiteAccountRestoreUiStateMachine = ReplaceWithLiteAccountRestoreUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, onboardingFullAccountDeleter = onboardingFullAccountDeleter, liteAccountBackupToFullAccountUpgrader = liteAccountBackupToFullAccountUpgrader ) val overwriteFullAccountCloudBackupUiStateMachine = OverwriteFullAccountCloudBackupUiStateMachineImpl( onboardingFullAccountDeleter = onboardingFullAccountDeleter, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine ) private val createAccountUiStateMachine = CreateAccountUiStateMachineImpl( createKeyboxUiStateMachine = createKeyboxUiStateMachine, onboardKeyboxUiStateMachine = onboardKeyboxUiStateMachine, replaceWithLiteAccountRestoreUiStateMachine = replaceWithLiteAccountRestoreUiStateMachine, overwriteFullAccountCloudBackupUiStateMachine = overwriteFullAccountCloudBackupUiStateMachine ) val fwupNfcSessionUiStateMachine = FwupNfcSessionUiStateMachineImpl( deviceInfoProvider = appComponent.deviceInfoProvider, enableNfcNavigator = enableNfcNavigator, eventTracker = appComponent.eventTracker, delayer = appComponent.delayer, fwupProgressCalculator = appComponent.fwupProgressCalculator, nfcReaderCapabilityProvider = nfcReaderCapabilityProvider, nfcTransactor = nfcTransactor ) val fwupNfcUiStateMachine = FwupNfcUiStateMachineImpl( deviceInfoProvider = appComponent.deviceInfoProvider, fwupNfcSessionUiStateMachine = fwupNfcSessionUiStateMachine, deviceOs = appComponent.deviceOs ) val infoOptionsStateMachine = InfoOptionsUiStateMachineImpl( appVariant = appComponent.appVariant, accountRepository = appComponent.accountRepository, clipboard = clipboard, appInstallationDao = appComponent.appInstallationDao, appVersion = appComponent.appVersion, osVersionInfoProvider = appComponent.osVersionInfoProvider ) val bitkeyOptionsStateMachine = BitkeyDeviceOptionsUiStateMachineImpl( appVariant = appComponent.appVariant ) val lightningOptionsStateMachine = LightningOptionsUiStateMachineImpl( lightningPreference = lightningPreference ) val firmwareMetadataStateMachine = FirmwareMetadataUiStateMachineImpl( firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, firmwareMetadataDao = appComponent.firmwareMetadataDao, nfcSessionUIStateMachine = nfcSessionUIStateMachine ) val accountConfigStateMachine = AccountConfigUiStateMachineImpl( appVariant = appComponent.appVariant ) val f8eEnvironmentPickerStateMachine = F8eEnvironmentPickerUiStateMachineImpl( appVariant = appComponent.appVariant ) val bitcoinNetworkPickerStateMachine = BitcoinNetworkPickerUiStateMachineImpl( appVariant = appComponent.appVariant ) val mobilePayLimitSetter = MobilePayLimitSetterImpl( spendingLimitDao = spendingLimitDao, mobilePaySpendingLimitService = spendingLimitService ) val setSpendingLimitUiStateMachine = SetSpendingLimitUiStateMachineImpl( spendingLimitPickerUiStateMachine = spendingLimitPickerUiStateMachine, timeZoneProvider = timeZoneProvider, moneyDisplayFormatter = moneyDisplayFormatter ) val spendingLimitCardStateMachine = SpendingLimitCardUiStateMachineImpl( moneyDisplayFormatter = moneyDisplayFormatter, timeZoneFormatter = timeZoneFormatter, localeIdentifierProvider = localeIdentifierProvider ) val mobilePayStatusUiStateMachine = MobilePayStatusUiStateMachineImpl( moneyDisplayFormatter = moneyDisplayFormatter, spendingLimitCardUiStateMachine = spendingLimitCardStateMachine ) val analyticOptionsUiStateMachine = AnalyticsOptionsUiStateMachineImpl( appVariant = appComponent.appVariant ) val analyticsStateMachine = AnalyticsUiStateMachineImpl( eventStore = appComponent.eventStore, analyticsTrackingPreference = appComponent.analyticsTrackingPreference ) val logsStateMachine = LogsUiStateMachineImpl( dateTimeFormatter = dateTimeFormatter, logStore = appComponent.logStore, timeZoneProvider = timeZoneProvider ) val connectAndOpenChannelStateMachine = ConnectAndOpenChannelStateMachineImpl( ldkNodeService = appComponent.ldkNodeService, clipboard = clipboard ) val sendReceiveStateMachine = LightningSendReceiveUiStateMachineImpl( ldkNodeService = appComponent.ldkNodeService, lightningInvoiceParser = lightningInvoiceParser, moneyDisplayFormatter = moneyDisplayFormatter ) val lightningStateMachine = LightningDebugMenuUiStateMachineImpl( clipboard = clipboard, connectAndOpenChannelStateMachine = connectAndOpenChannelStateMachine, lightningSendReceiveUiStateMachine = sendReceiveStateMachine, ldkNodeService = appComponent.ldkNodeService ) val delayNotifyHardwareRecoveryStarter = LostHardwareRecoveryStarterImpl( initiateAccountDelayNotifyService = initiateAccountDelayNotifyService, recoveryDao = appComponent.recoveryDao ) val mobilePaySettingsUiStateMachine = MobilePaySettingsUiStateMachineImpl( mobilePayStatusUiStateMachine = mobilePayStatusUiStateMachine, setSpendingLimitUiStateMachine = setSpendingLimitUiStateMachine ) val transactionPriorityPreference = TransactionPriorityPreferenceImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val feeOptionUiStateMachine = FeeOptionUiStateMachineImpl( currencyConverter = currencyConverter, moneyDisplayFormatter = moneyDisplayFormatter ) val feeOptionListUiStateMachine = FeeOptionListUiStateMachineImpl( feeOptionUiStateMachine = feeOptionUiStateMachine ) val outgoingTransactionDetailRepository = OutgoingTransactionDetailRepositoryImpl( outgoingTransactionDetailDao = appComponent.outgoingTransactionDetailDao ) val transferConfirmationStateMachine = TransferConfirmationUiStateMachineImpl( bitcoinBlockchain = bitcoinBlockchain, mobilePaySigningService = mobilePaySigningService, transactionDetailsCardUiStateMachine = transactionDetailsCardUiStateMachine, nfcSessionUIStateMachine = nfcSessionUIStateMachine, transactionPriorityPreference = transactionPriorityPreference, feeOptionListUiStateMachine = feeOptionListUiStateMachine, appSpendingWalletProvider = appComponent.appSpendingWalletProvider, outgoingTransactionDetailRepository = outgoingTransactionDetailRepository ) val bitcoinTransactionFeeEstimator = BitcoinTransactionFeeEstimatorImpl( bitcoinFeeRateEstimator = bitcoinFeeRateEstimator, appSpendingWalletProvider = appComponent.appSpendingWalletProvider, datadogRumMonitor = datadogRumMonitor ) val feeSelectionStateMachine = FeeSelectionUiStateMachineImpl( bitcoinTransactionFeeEstimator = bitcoinTransactionFeeEstimator, transactionPriorityPreference = transactionPriorityPreference, feeOptionListUiStateMachine = feeOptionListUiStateMachine, transactionBaseCalculator = BitcoinTransactionBaseCalculatorImpl() ) val sendStateMachine = SendUiStateMachineImpl( bitcoinAddressRecipientUiStateMachine = bitcoinAddressRecipientStateMachine, transferAmountEntryUiStateMachine = transferAmountEntryUiStateMachine, transferConfirmationUiStateMachine = transferConfirmationStateMachine, transferInitiatedUiStateMachine = transferInitiatedUiStateMachine, bitcoinQrCodeUiScanStateMachine = bitcoinQrCodeScanStateMachine, permissionUiStateMachine = permissionStateMachine, feeSelectionUiStateMachine = feeSelectionStateMachine, exchangeRateSyncer = exchangeRateSyncer, clock = appComponent.clock, networkReachabilityProvider = appComponent.networkReachabilityProvider ) val transactionDetailStateMachine = build.wallet.statemachine.transactions.TransactionDetailsUiStateMachineImpl( bitcoinExplorer = bitcoinExplorer, bitcoinTransactionBumpabilityChecker = BitcoinTransactionBumpabilityCheckerImpl( sweepChecker = BitcoinTransactionSweepCheckerImpl() ), bitcoinTransactionFeeEstimator = bitcoinTransactionFeeEstimator, clock = appComponent.clock, currencyConverter = currencyConverter, dateTimeFormatter = dateTimeFormatter, durationFormatter = durationFormatter, eventTracker = appComponent.eventTracker, feeBumpEnabled = appComponent.feeBumpIsAvailableFeatureFlag, moneyDisplayFormatter = moneyDisplayFormatter, sendUiStateMachine = sendStateMachine, timeZoneProvider = timeZoneProvider ) val homeUiBottomSheetDao = HomeUiBottomSheetDaoImpl(appComponent.bitkeyDatabaseProvider) val authKeyRotationAttemptDao = AuthKeyRotationAttemptDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val appDataDeleter = AppDataDeleterImpl( appVariant = appComponent.appVariant, appPrivateKeyDao = appComponent.appPrivateKeyDao, accountRepository = appComponent.accountRepository, authTokenDao = appComponent.authTokenDao, gettingStartedTaskDao = gettingStartedTaskDao, keyboxDao = appComponent.keyboxDao, notificationTouchpointDao = notificationTouchpointDao, onboardingKeyboxSealedCsekDao = onboardingKeyboxSealedCsekDao, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao, onboardingKeyboxHardwareKeysDao = onboardingKeyboxHwAuthPublicKeyDao, spendingLimitDao = spendingLimitDao, outgoingTransactionDetailDao = appComponent.outgoingTransactionDetailDao, fwupDataDao = appComponent.fwupDataDao, firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, firmwareMetadataDao = appComponent.firmwareMetadataDao, transactionPriorityPreference = transactionPriorityPreference, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore, fiatCurrencyPreferenceRepository = appComponent.fiatCurrencyPreferenceRepository, homeUiBottomSheetDao = homeUiBottomSheetDao, bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, cloudBackupDao = cloudBackupDao, socRecKeysDao = socRecKeysDao, socRecRelationshipsRepository = socRecRelationshipsRepository, socRecStartedChallengeDao = socRecPendingChallengeDao, csekDao = csekDao, authKeyRotationAttemptDao = authKeyRotationAttemptDao, recoveryDao = appComponent.recoveryDao, authSignatureStatusProvider = appComponent.f8eAuthSignatureStatusProvider ) val deviceUpdateCardUiStateMachine = DeviceUpdateCardUiStateMachineImpl( eventTracker = appComponent.eventTracker ) val gettingStartedCardStateMachine = GettingStartedCardUiStateMachineImpl( gettingStartedTaskDao = gettingStartedTaskDao, eventTracker = appComponent.eventTracker ) val pendingInvitationsCardUiStateMachine = RecoveryContactCardsUiStateMachineImpl( clock = appComponent.clock ) val recoveryIncompleteDao = RecoveryIncompleteDaoImpl(appComponent.bitkeyDatabaseProvider) val postSocRecTaskRepository = PostSocRecTaskRepositoryImpl(recoveryIncompleteDao) val replaceHardwareCardUiStateMachine = ReplaceHardwareCardUiStateMachineImpl( postSocRecTaskRepository = postSocRecTaskRepository ) val cloudBackupHealthCardUiStateMachine = CloudBackupHealthCardUiStateMachineImpl( cloudBackupHealthRepository = cloudBackupHealthRepository ) val cardListStateMachine = MoneyHomeCardsUiStateMachineImpl( deviceUpdateCardUiStateMachine = deviceUpdateCardUiStateMachine, gettingStartedCardUiStateMachine = gettingStartedCardStateMachine, hardwareRecoveryStatusCardUiStateMachine = hardwareRecoveryStatusCardUiStateMachine, recoveryContactCardsUiStateMachine = pendingInvitationsCardUiStateMachine, replaceHardwareCardUiStateMachine = replaceHardwareCardUiStateMachine, cloudBackupHealthCardUiStateMachine = cloudBackupHealthCardUiStateMachine ) val deepLinkHandler = DeepLinkHandlerImpl( platformContext = appComponent.platformContext ) val partnershipsTransactionsDao = PartnershipTransactionsDaoImpl(appComponent.bitkeyDatabaseProvider) val partnershipTransactionsStatusRepository = PartnershipTransactionsRepositoryImpl( dao = partnershipsTransactionsDao, uuidGenerator = appComponent.uuidGenerator, clock = appComponent.clock ) val partnershipsTransferUiStateMachine = PartnershipsTransferUiStateMachineImpl( getTransferPartnerListService = GetTransferPartnerListServiceImpl( countryCodeGuesser, appComponent.f8eHttpClient ), getTransferRedirectService = GetTransferRedirectServiceImpl(appComponent.f8eHttpClient), partnershipsRepository = partnershipTransactionsStatusRepository ) val partnershipsPurchaseUiStateMachine = PartnershipsPurchaseUiStateMachineImpl( moneyDisplayFormatter = moneyDisplayFormatter, getPurchaseOptionsService = GetPurchaseOptionsServiceImpl( countryCodeGuesser, appComponent.f8eHttpClient ), getPurchaseQuoteListService = GetPurchaseQuoteListServiceImpl( countryCodeGuesser, appComponent.f8eHttpClient ), getPurchaseRedirectService = GetPurchaseRedirectServiceImpl(appComponent.f8eHttpClient), partnershipsRepository = partnershipTransactionsStatusRepository ) val addBitcoinUiStateMachine = AddBitcoinUiStateMachineImpl( partnershipsTransferUiStateMachine = partnershipsTransferUiStateMachine, partnershipsPurchaseUiStateMachine = partnershipsPurchaseUiStateMachine ) val initiatingLostHardwareRecoveryUiStateMachine = InitiatingLostHardwareRecoveryUiStateMachineImpl( pairNewHardwareUiStateMachine = pairNewHardwareUiStateMachine, eventTracker = appComponent.eventTracker, recoveryNotificationVerificationUiStateMachine = recoveryNotificationVerificationUiStateMachine, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine ) val lostHardwareRecoveryUiStateMachine = LostHardwareRecoveryUiStateMachineImpl( initiatingLostHardwareRecoveryUiStateMachine = initiatingLostHardwareRecoveryUiStateMachine, recoveryInProgressUiStateMachine = recoveryInProgressUiStateMachine ) val rotateAuthKeysService: RotateAuthKeysService = RotateAuthKeysServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, signer = appComponent.appAuthKeyMessageSigner ) val trustedContactKeyAuthenticator = TrustedContactKeyAuthenticatorImpl( socRecRelationshipsRepository = socRecRelationshipsRepository, socRecRelationshipsDao = socRecRelationshipsDao, socRecEnrollmentAuthenticationDao = socRecEnrollmentAuthenticationDao, socRecCrypto = socRecCrypto, endorseTrustedContactsServiceProvider = { socialRecoveryServiceProvider.get() } ) val authKeyRotationManager: AuthKeyRotationManager = AuthKeyRotationManagerImpl( authKeyRotationAttemptDao = authKeyRotationAttemptDao, rotateAuthKeysService = rotateAuthKeysService, keyboxDao = appComponent.keyboxDao, accountAuthenticator = appComponent.accountAuthenticator, bestEffortFullAccountCloudBackupUploader = bestEffortFullAccountCloudBackupUploader, socRecRelationshipsRepository = socRecRelationshipsRepository, trustedContactKeyAuthenticator = trustedContactKeyAuthenticator ) val rotateAuthUIStateMachine = RotateAuthKeyUIStateMachineImpl( appKeysGenerator = appComponent.appKeysGenerator, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, authKeyRotationManager = authKeyRotationManager, inAppBrowserNavigator = inAppBrowserNavigator ) val inviteTrustedContactFlowUiStateMachine = InviteTrustedContactFlowUiStateMachineImpl( addingTrustedContactUiStateMachine = addingTcsUiStateMachine, gettingStartedTaskDao = gettingStartedTaskDao, socRecRelationshipsRepository = socRecRelationshipsRepository ) val appFunctionalityStatusProvider = AppFunctionalityStatusProviderImpl( networkReachabilityEventDao = appComponent.networkReachabilityEventDao, networkReachabilityProvider = appComponent.networkReachabilityProvider, f8eAuthSignatureStatusProvider = appComponent.f8eAuthSignatureStatusProvider, appVariant = appComponent.appVariant ) val moneyHomeViewingBalanceUiStateMachine = MoneyHomeViewingBalanceUiStateMachineImpl( addBitcoinUiStateMachine = addBitcoinUiStateMachine, appFunctionalityStatusProvider = appFunctionalityStatusProvider, deepLinkHandler = deepLinkHandler, moneyDisplayFormatter = moneyDisplayFormatter, gettingStartedTaskDao = gettingStartedTaskDao, moneyHomeCardsUiStateMachine = cardListStateMachine, transactionListUiStateMachine = transactionListStateMachine, viewingInvitationUiStateMachine = viewingInvitationUiStateMachine, viewingRecoveryContactUiStateMachine = viewingRecoveryContactUiStateMachine, eventTracker = appComponent.eventTracker ) val customAmountEntryUiStateMachine = CustomAmountEntryUiStateMachineImpl( moneyCalculatorUiStateMachine = moneyCalculatorUiStateMachine, moneyDisplayFormatter = moneyDisplayFormatter ) val moneyHomeStateMachine = MoneyHomeUiStateMachineImpl( addressQrCodeUiStateMachine = addressQrCodeUiStateMachine, sendUiStateMachine = sendStateMachine, transactionDetailsUiStateMachine = transactionDetailStateMachine, transactionListUiStateMachine = transactionListStateMachine, fwupNfcUiStateMachine = fwupNfcUiStateMachine, lostHardwareUiStateMachine = lostHardwareRecoveryUiStateMachine, setSpendingLimitUiStateMachine = setSpendingLimitUiStateMachine, inviteTrustedContactFlowUiStateMachine = inviteTrustedContactFlowUiStateMachine, inAppBrowserNavigator = inAppBrowserNavigator, clipboard = clipboard, paymentDataParser = paymentDataParser, recoveryIncompleteRepository = postSocRecTaskRepository, moneyHomeViewingBalanceUiStateMachine = moneyHomeViewingBalanceUiStateMachine, customAmountEntryUiStateMachine = customAmountEntryUiStateMachine, repairCloudBackupStateMachine = repairMobileKeyBackupUiStateMachine ) val appStateDeleterOptionsUiStateMachine = AppStateDeleterOptionsUiStateMachineImpl(appComponent.appVariant) val booleanFlagItemStateMachine = BooleanFlagItemUiStateMachineImpl() val featureFlagsStateMachine = FeatureFlagsStateMachineImpl( allBooleanFeatureFlags = appComponent.allFeatureFlags, booleanFlagItemUiStateMachine = booleanFlagItemStateMachine, featureFlagSyncer = appComponent.featureFlagSyncer ) val featureFlagsOptionsStateMachine = FeatureFlagsOptionsUiStateMachineImpl( appVariant = appComponent.appVariant ) val cloudBackupDeleter = CloudBackupDeleterImpl( appVariant = appComponent.appVariant, cloudStoreAccountRepository = cloudStoreAccountRepository, cloudBackupRepository = cloudBackupRepository ) val onboardingAppKeyDeletionUiStateMachine = OnboardingAppKeyDeletionUiStateMachineImpl( appVariant = appComponent.appVariant, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore ) val networkingDebugConfigPickerUiStateMachine = NetworkingDebugConfigPickerUiStateMachineImpl( appComponent.networkingDebugConfigRepository ) val onboardingConfigStateMachine = OnboardingConfigStateMachineImpl( appVariant = appComponent.appVariant ) val debugMenuListStateMachine = DebugMenuListStateMachineImpl( accountConfigUiStateMachine = accountConfigStateMachine, appDataDeleter = appDataDeleter, appStateDeleterOptionsUiStateMachine = appStateDeleterOptionsUiStateMachine, appVariant = appComponent.appVariant, analyticsOptionsUiStateMachine = analyticOptionsUiStateMachine, bitcoinNetworkPickerUiStateMachine = bitcoinNetworkPickerStateMachine, bitkeyDeviceOptionsUiStateMachine = bitkeyOptionsStateMachine, cloudBackupDeleter = cloudBackupDeleter, f8eEnvironmentPickerUiStateMachine = f8eEnvironmentPickerStateMachine, featureFlagsOptionsUiStateMachine = featureFlagsOptionsStateMachine, infoOptionsUiStateMachine = infoOptionsStateMachine, onboardingAppKeyDeletionUiStateMachine = onboardingAppKeyDeletionUiStateMachine, onboardingConfigStateMachine = onboardingConfigStateMachine, lightningOptionsUiStateMachine = lightningOptionsStateMachine, cloudSignUiStateMachine = cloudSignInUiStateMachine ) val debugMenuStateMachine = DebugMenuStateMachineImpl( analyticsUiStateMachine = analyticsStateMachine, debugMenuListStateMachine = debugMenuListStateMachine, f8eCustomUrlStateMachine = F8eCustomUrlStateMachineImpl(), featureFlagsStateMachine = featureFlagsStateMachine, firmwareMetadataUiStateMachine = firmwareMetadataStateMachine, fwupNfcUiStateMachine = fwupNfcUiStateMachine, lightningDebugMenuUiStateMachine = lightningStateMachine, logsUiStateMachine = logsStateMachine, networkingDebugConfigPickerUiStateMachine = networkingDebugConfigPickerUiStateMachine, nfcSessionUIStateMachine = nfcSessionUIStateMachine, cloudDevOptionsStateMachine = cloudDevOptionsStateMachine ) val demoModeService = DemoModeServiceImpl( appComponent.f8eHttpClient ) val demoModeCodeEntryUiStateMachine = DemoModeCodeEntryUiStateMachineImpl( delayer = appComponent.delayer, demoModeService = demoModeService ) val demoModeConfigUiStateMachine = DemoModeConfigUiStateMachineImpl( demoModeCodeEntryUiStateMachine = demoModeCodeEntryUiStateMachine ) val customElectrumServerUiStateMachine = CustomElectrumServerUiStateMachineImpl() val setElectrumServerUiStateMachine = SetElectrumServerUiStateMachineImpl( delayer = appComponent.delayer, electrumServerSettingProvider = appComponent.electrumServerSettingProvider, electrumReachability = appComponent.electrumReachability ) val customElectrumServerSettingUiStateMachine = CustomElectrumServerSettingUiStateMachineImpl( customElectrumServerUIStateMachine = customElectrumServerUiStateMachine, setElectrumServerUiStateMachine = setElectrumServerUiStateMachine ) val deviceSettingsUiStateMachine = DeviceSettingsUiStateMachineImpl( lostHardwareRecoveryUiStateMachine = lostHardwareRecoveryUiStateMachine, nfcSessionUIStateMachine = nfcSessionUIStateMachine, fwupNfcUiStateMachine = fwupNfcUiStateMachine, dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, durationFormatter = durationFormatter, firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, appFunctionalityStatusProvider = appFunctionalityStatusProvider ) val customerFeedbackService = SupportTicketServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val supportTicketRepository = SupportTicketRepositoryImpl( supportTicketService = customerFeedbackService, logStore = appComponent.logStore, appInstallationDao = appComponent.appInstallationDao, firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, platformInfoProvider = appComponent.platformInfoProvider, allFeatureFlags = appComponent.allFeatureFlags ) val supportTicketFormValidator = SupportTicketFormValidatorImpl( emailValidator = emailValidator ) val feedbackFormUiStateMachine = FeedbackFormUiStateMachineImpl( delayer = appComponent.delayer, supportTicketRepository = supportTicketRepository, supportTicketFormValidator = supportTicketFormValidator, dateTimeFormatter = dateTimeFormatter, inAppBrowserNavigator = inAppBrowserNavigator ) val feedbackUiStateMachine = FeedbackUiStateMachineImpl( supportTicketRepository = supportTicketRepository, feedbackFormUiStateMachine = feedbackFormUiStateMachine ) val settingsListUiStateMachine = SettingsListUiStateMachineImpl( appFunctionalityStatusProvider = appFunctionalityStatusProvider, cloudBackupHealthRepository = cloudBackupHealthRepository ) val cloudBackupHealthDashboardUiStateMachine = CloudBackupHealthDashboardUiStateMachineImpl( uuidGenerator = appComponent.uuidGenerator, cloudBackupHealthRepository = cloudBackupHealthRepository, dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, repairCloudBackupStateMachine = repairMobileKeyBackupUiStateMachine, cloudBackupDao = cloudBackupDao, emergencyAccessKitPdfGenerator = emergencyAccessKitPdfGenerator, sharingManager = sharingManager ) val settingsStateMachine = SettingsHomeUiStateMachineImpl( mobilePaySettingsUiStateMachine = mobilePaySettingsUiStateMachine, notificationPreferencesUiStateMachine = notificationPreferencesUiStateMachine, notificationsSettingsUiStateMachine = notificationsSettingsStateMachine, recoveryChannelSettingsUiStateMachine = recoveryChannelSettingsUiStateMachineImpl, currencyPreferenceUiStateMachine = currencyPreferenceUiStateMachine, customElectrumServerSettingUiStateMachine = customElectrumServerSettingUiStateMachine, deviceSettingsUiStateMachine = deviceSettingsUiStateMachine, feedbackUiStateMachine = feedbackUiStateMachine, helpCenterUiStateMachine = helpCenterUiStateMachine, trustedContactManagementUiStateMachine = trustedContactManagementUiStateMachine, settingsListUiStateMachine = settingsListUiStateMachine, cloudBackupHealthDashboardUiStateMachine = cloudBackupHealthDashboardUiStateMachine, rotateAuthKeyUIStateMachine = rotateAuthUIStateMachine ) val homeUiBottomSheetStateMachine = HomeUiBottomSheetStateMachineImpl( homeUiBottomSheetDao = homeUiBottomSheetDao ) val currencyChangeMobilePayBottomSheetUpdater = CurrencyChangeMobilePayBottomSheetUpdaterImpl( homeUiBottomSheetDao = homeUiBottomSheetDao ) val homeStatusBannerUiStateMachine = HomeStatusBannerUiStateMachineImpl( appFunctionalityStatusProvider = appFunctionalityStatusProvider, dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, clock = appComponent.clock, eventTracker = appComponent.eventTracker ) val appFunctionalityStatusUiStateMachine = AppFunctionalityStatusUiStateMachineImpl( dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, clock = appComponent.clock ) val homeUiStateMachine = HomeUiStateMachineImpl( appFunctionalityStatusUiStateMachine = appFunctionalityStatusUiStateMachine, currencyConverter = currencyConverter, currencyChangeMobilePayBottomSheetUpdater = currencyChangeMobilePayBottomSheetUpdater, homeStatusBannerUiStateMachine = homeStatusBannerUiStateMachine, homeUiBottomSheetStateMachine = homeUiBottomSheetStateMachine, moneyHomeUiStateMachine = moneyHomeStateMachine, settingsHomeUiStateMachine = settingsStateMachine, setSpendingLimitUiStateMachine = setSpendingLimitUiStateMachine, trustedContactEnrollmentUiStateMachine = trustedContactEnrollmentUiStateMachine, socRecRelationshipsRepository = socRecRelationshipsRepository, cloudBackupHealthRepository = cloudBackupHealthRepository, appFunctionalityStatusProvider = appFunctionalityStatusProvider ) val chooseAccountAccessUiStateMachine = ChooseAccountAccessUiStateMachineImpl( appVariant = appComponent.appVariant, demoModeConfigUiStateMachine = demoModeConfigUiStateMachine, debugMenuStateMachine = debugMenuStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider ) val mobilePayDataStateMachine = MobilePayDataStateMachineImpl( mobilePayStatusProvider = mobilePayStatusProvider, mobilePayLimitSetter = mobilePayLimitSetter, mobilePayDisabler = mobilePayDisabler, eventTracker = appComponent.eventTracker, currencyConverter = currencyConverter ) val fullAccountAddressDataStateMachine = FullAccountAddressDataStateMachineImpl( registerWatchAddressProcessor = registerWatchAddressProcessor, appSpendingWalletProvider = appComponent.appSpendingWalletProvider ) val fullAccountTransactionsDataStateMachine = FullAccountTransactionsDataStateMachineImpl() val onboardConfigDao = OnboardingStepSkipConfigDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val onboardConfigDataStateMachine = OnboardConfigDataStateMachineImpl( onboardingStepSkipConfigDao = onboardConfigDao ) val notificationTouchpointDataStateMachine = NotificationTouchpointDataStateMachineImpl( notificationTouchpointDao = notificationTouchpointDao, notificationTouchpointService = notificationTouchpointService ) val firmwareDataStateMachine = FirmwareDataStateMachineImpl( firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, fwupDataFetcher = appComponent.fwupDataFetcher, fwupDataDao = appComponent.fwupDataDao ) val recoveryNotificationVerificationService = RecoveryNotificationVerificationServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val recoveryNotificationVerificationDataStateMachine = RecoveryNotificationVerificationDataStateMachineImpl( notificationTouchpointService = notificationTouchpointService, recoveryNotificationVerificationService = recoveryNotificationVerificationService ) val initiatingLostAppRecoveryStateMachine = InitiatingLostAppRecoveryDataStateMachineImpl( appKeysGenerator = appKeysGenerator, initiateHardwareAuthService = initiateHardwareAuthService, listKeysetsService = listKeysetsService, lostAppRecoveryInitiator = delayNotifyLostAppRecoveryInitiator, lostAppRecoveryAuthenticator = delayNotifyLostAppRecoveryAuthenticator, recoveryNotificationVerificationDataStateMachine = recoveryNotificationVerificationDataStateMachine, cancelDelayNotifyRecoveryService = cancelDelayNotifyRecoveryService, delayer = appComponent.delayer, uuidGenerator = appComponent.uuidGenerator ) val lostAppRecoveryHaveNotStartedDataStateMachine = LostAppRecoveryHaveNotStartedDataStateMachineImpl( initiatingLostAppRecoveryDataStateMachine = initiatingLostAppRecoveryStateMachine ) val lostAppRecoveryCanceler = RecoveryCancelerImpl( cancelDelayNotifyRecoveryService = cancelDelayNotifyRecoveryService, recoverySyncer = recoverySyncer ) val recoveryAuthCompleter = RecoveryAuthCompleterImpl( appAuthKeyMessageSigner = appComponent.appAuthKeyMessageSigner, completeDelayNotifyService = completeDelayNotifyService, accountAuthenticator = appComponent.accountAuthenticator, recoverySyncer = recoverySyncer, authTokenDao = appComponent.authTokenDao, delayer = appComponent.delayer, socRecRelationshipsRepository = socRecRelationshipsRepository ) val sweepGenerator = SweepGeneratorImpl( listKeysetsService = listKeysetsService, bitcoinFeeRateEstimator = bitcoinFeeRateEstimator, appPrivateKeyDao = appComponent.appPrivateKeyDao, keysetWalletProvider = appComponent.keysetWalletProvider, registerWatchAddressProcessor = registerWatchAddressProcessor ) val sweepDataStateMachine = SweepDataStateMachineImpl( bitcoinBlockchain = bitcoinBlockchain, sweepGenerator = sweepGenerator, mobilePaySigningService = mobilePaySigningService, appSpendingWalletProvider = appComponent.appSpendingWalletProvider, exchangeRateSyncer = exchangeRateSyncer, outgoingTransactionDetailRepository = outgoingTransactionDetailRepository ) val f8eSpendingKeyRotator = F8eSpendingKeyRotatorImpl( createAccountKeysetService = createAccountKeysetService, setActiveSpendingKeysetService = setActiveSpendingKeysetService ) val recoveryInProgressDataStateMachine = RecoveryInProgressDataStateMachineImpl( recoveryCanceler = lostAppRecoveryCanceler, delayer = appComponent.delayer, clock = appComponent.clock, csekGenerator = csekGenerator, csekDao = csekDao, recoveryAuthCompleter = recoveryAuthCompleter, sweepDataStateMachine = sweepDataStateMachine, f8eSpendingKeyRotator = f8eSpendingKeyRotator, uuidGenerator = appComponent.uuidGenerator, recoverySyncer = recoverySyncer, recoveryNotificationVerificationDataStateMachine = recoveryNotificationVerificationDataStateMachine, accountAuthenticator = appComponent.accountAuthenticator, recoveryDao = appComponent.recoveryDao, deviceTokenManager = appComponent.deviceTokenManager, socRecRelationshipsRepository = socRecRelationshipsRepository, postSocRecTaskRepository = postSocRecTaskRepository, trustedContactKeyAuthenticator = trustedContactKeyAuthenticator ) val createKeyboxDataStateMachine = CreateKeyboxDataStateMachineImpl( fullAccountCreator = fullAccountCreator, appKeysGenerator = appKeysGenerator, onboardingKeyboxSealedCsekDao = onboardingKeyboxSealedCsekDao, onboardingKeyboxHardwareKeysDao = onboardingKeyboxHwAuthPublicKeyDao, uuidGenerator = appComponent.uuidGenerator, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore, liteToFullAccountUpgrader = liteToFullAccountUpgrader ) val onboardKeyboxDataStateMachine = OnboardKeyboxDataStateMachineImpl( onboardingKeyboxSealedCsekDao = onboardingKeyboxSealedCsekDao, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao ) val activateFullAccountDataStateMachine = ActivateFullAccountDataStateMachineImpl( eventTracker = appComponent.eventTracker, gettingStartedTaskDao = gettingStartedTaskDao, keyboxDao = appComponent.keyboxDao, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao, onboardingService = onboardingService, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore, onboardingKeyboxHardwareKeysDao = onboardingKeyboxHwAuthPublicKeyDao ) val createFullAccountDataStateMachine = CreateFullAccountDataStateMachineImpl( activateFullAccountDataStateMachine = activateFullAccountDataStateMachine, createKeyboxDataStateMachine = createKeyboxDataStateMachine, onboardKeyboxDataStateMachine = onboardKeyboxDataStateMachine, appDataDeleter = appDataDeleter, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao ) val lostAppRecoveryDataStateMachine = LostAppRecoveryDataStateMachineImpl( recoveryInProgressDataStateMachine = recoveryInProgressDataStateMachine, lostAppRecoveryHaveNotStartedDataStateMachine = lostAppRecoveryHaveNotStartedDataStateMachine ) val noActiveAccountDataStateMachine = NoActiveAccountDataStateMachineImpl( createFullAccountDataStateMachine = createFullAccountDataStateMachine, lostAppRecoveryDataStateMachine = lostAppRecoveryDataStateMachine, eventTracker = appComponent.eventTracker, keyboxDao = appComponent.keyboxDao ) val initiatingLostHardwareRecoveryDataStateMachine = InitiatingLostHardwareRecoveryDataStateMachineImpl( appKeysGenerator = appKeysGenerator, delayer = appComponent.delayer, lostHardwareRecoveryStarter = delayNotifyHardwareRecoveryStarter, recoveryNotificationVerificationDataStateMachine = recoveryNotificationVerificationDataStateMachine, cancelDelayNotifyRecoveryService = cancelDelayNotifyRecoveryService ) val lostHardwareRecoveryDataStateMachine = LostHardwareRecoveryDataStateMachineImpl( initiatingLostHardwareRecoveryDataStateMachine = initiatingLostHardwareRecoveryDataStateMachine, recoveryInProgressDataStateMachine = recoveryInProgressDataStateMachine ) val fullAccountCloudBackupRestorationUiStateMachine = FullAccountCloudBackupRestorationUiStateMachineImpl( appSpendingWalletProvider = appComponent.appSpendingWalletProvider, backupRestorer = cloudBackupRestorer, eventTracker = appComponent.eventTracker, deviceTokenManager = appComponent.deviceTokenManager, csekDao = csekDao, accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, appPrivateKeyDao = appComponent.appPrivateKeyDao, nfcSessionUIStateMachine = nfcSessionUIStateMachine, keyboxDao = appComponent.keyboxDao, recoverySyncer = recoverySyncer, deviceInfoProvider = appComponent.deviceInfoProvider, uuidGenerator = appComponent.uuidGenerator, cloudBackupDao = cloudBackupDao, recoveryChallengeStateMachine = recoveryChallengeUiStateMachine, socRecChallengeRepository = socRecChallengeRepository, socialRelationshipsRepository = socRecRelationshipsRepository, postSocRecTaskRepository = postSocRecTaskRepository, socRecStartedChallengeDao = socRecPendingChallengeDao, authKeyRotationManager = authKeyRotationManager ) val lostAppRecoveryHaveNotStartedUiStateMachine = LostAppRecoveryHaveNotStartedUiStateMachineImpl( initiatingLostAppRecoveryUiStateMachine = initiatingLostAppRecoveryUiStateMachineImpl, fullAccountCloudBackupRestorationUiStateMachine = fullAccountCloudBackupRestorationUiStateMachine ) val recoveringKeyboxUiStateMachine = LostAppRecoveryUiStateMachineImpl( lostAppRecoveryHaveNotStartedDataStateMachine = lostAppRecoveryHaveNotStartedUiStateMachine, recoveryInProgressUiStateMachine = recoveryInProgressUiStateMachine ) val cloudBackupRefresher = CloudBackupRefresherImpl( socRecRelationshipsRepository = socRecRelationshipsRepository, cloudBackupDao = cloudBackupDao, cloudStoreAccountRepository = cloudStoreAccountRepository, cloudBackupRepository = cloudBackupRepository, fullAccountCloudBackupCreator = fullAccountCloudBackupCreator, eventTracker = appComponent.eventTracker, clock = appComponent.clock ) val hasActiveFullAccountDataStateMachine = HasActiveFullAccountDataStateMachineImpl( mobilePayDataStateMachine = mobilePayDataStateMachine, fullAccountAddressDataStateMachine = fullAccountAddressDataStateMachine, fullAccountTransactionsDataStateMachine = fullAccountTransactionsDataStateMachine, notificationTouchpointDataStateMachine = notificationTouchpointDataStateMachine, lostHardwareRecoveryDataStateMachine = lostHardwareRecoveryDataStateMachine, appSpendingWalletProvider = appComponent.appSpendingWalletProvider, exchangeRateSyncer = exchangeRateSyncer, cloudBackupRefresher = cloudBackupRefresher, postSocRecTaskRepository = postSocRecTaskRepository, authKeyRotationManager = authKeyRotationManager, trustedContactKeyAuthenticator = trustedContactKeyAuthenticator ) val noLongerRecoveringUiStateMachine = NoLongerRecoveringUiStateMachineImpl() val noLongerRecoveringDataStateMachine = NoLongerRecoveringDataStateMachineImpl( recoveryDao = appComponent.recoveryDao ) val someoneElseIsRecoveringUiStateMachine = SomeoneElseIsRecoveringUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, recoveryNotificationVerificationUiStateMachine = recoveryNotificationVerificationUiStateMachine ) val someoneElseIsRecoveringDataStateMachine = SomeoneElseIsRecoveringDataStateMachineImpl( cancelDelayNotifyRecoveryService = cancelDelayNotifyRecoveryService, recoveryNotificationVerificationDataStateMachine = recoveryNotificationVerificationDataStateMachine, recoverySyncer = recoverySyncer ) val hasActiveLiteAccountDataStateMachine = HasActiveLiteAccountDataStateMachineImpl( createFullAccountDataStateMachine = createFullAccountDataStateMachine, keyboxDao = appComponent.keyboxDao ) val accountDataStateMachine = AccountDataStateMachineImpl( hasActiveFullAccountDataStateMachine = hasActiveFullAccountDataStateMachine, hasActiveLiteAccountDataStateMachine = hasActiveLiteAccountDataStateMachine, noActiveAccountDataStateMachine = noActiveAccountDataStateMachine, accountRepository = appComponent.accountRepository, recoverySyncer = recoverySyncer, noLongerRecoveringDataStateMachine = noLongerRecoveringDataStateMachine, someoneElseIsRecoveringDataStateMachine = someoneElseIsRecoveringDataStateMachine, recoverySyncFrequency = appComponent.recoverySyncFrequency, onboardConfigDataStateMachine = onboardConfigDataStateMachine ) val lightningNodeDataStateMachine = LightningNodeDataStateMachineImpl( lightningPreference = lightningPreference, ldkNodeService = appComponent.ldkNodeService ) val templateFullAccountConfigDataStateMachine = TemplateFullAccountConfigDataStateMachineImpl( templateFullAccountConfigDao = appComponent.templateFullAccountConfigDao ) val electrumServerDataStateMachine = ElectrumServerDataStateMachineImpl( electrumServerRepository = appComponent.electrumServerDao, getBdkConfigurationService = GetBdkConfigurationServiceImpl( appComponent.f8eHttpClient, appComponent.deviceInfoProvider ) ) val currencyPreferenceDataStateMachine = CurrencyPreferenceDataStateMachineImpl( bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, eventTracker = appComponent.eventTracker, fiatCurrencyPreferenceRepository = appComponent.fiatCurrencyPreferenceRepository ) val appDataStateMachine = AppDataStateMachineImpl( eventTracker = appComponent.eventTracker, featureFlagInitializer = appComponent.featureFlagInitializer, featureFlagSyncer = appComponent.featureFlagSyncer, accountDataStateMachine = accountDataStateMachine, periodicEventProcessor = appComponent.periodicEventProcessor, periodicFirmwareTelemetryProcessor = appComponent.periodicFirmwareTelemetryEventProcessor, periodicFirmwareCoredumpProcessor = appComponent.periodicFirmwareCoredumpProcessor, periodicRegisterWatchAddressProcessor = registerWatchAddressProcessor, lightningNodeDataStateMachine = lightningNodeDataStateMachine, templateFullAccountConfigDataStateMachine = templateFullAccountConfigDataStateMachine, electrumServerDataStateMachine = electrumServerDataStateMachine, firmwareDataStateMachine = firmwareDataStateMachine, currencyPreferenceDataStateMachine = currencyPreferenceDataStateMachine, networkingDebugConfigRepository = appComponent.networkingDebugConfigRepository, bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, fiatCurrencyRepository = fiatCurrencyRepository, fiatCurrencyPreferenceRepository = appComponent.fiatCurrencyPreferenceRepository, fiatMobilePayConfigurationRepository = fiatMobilePayConfigurationRepository, emergencyAccessKitDataProvider = emergencyAccessKitDataProvider ) val liteAccountCreator = LiteAccountCreatorImpl( accountAuthenticator = appComponent.accountAuthenticator, accountRepository = appComponent.accountRepository, appKeysGenerator = appComponent.appKeysGenerator, authTokenDao = appComponent.authTokenDao, createLiteAccountService = createAccountService ) val liteAccountCloudBackupCreator = LiteAccountCloudBackupCreatorImpl( socRecKeysRepository = socRecKeysRepository, appPrivateKeyDao = appComponent.appPrivateKeyDao ) val liteAccountCloudSignInAndBackupUiStateMachine = LiteAccountCloudSignInAndBackupUiStateMachineImpl( cloudBackupRepository = cloudBackupRepository, cloudSignInUiStateMachine = cloudSignInUiStateMachine, liteAccountCloudBackupCreator = liteAccountCloudBackupCreator, deviceInfoProvider = appComponent.deviceInfoProvider, eventTracker = appComponent.eventTracker, rectifiableErrorHandlingUiStateMachine = rectifiableErrorHandlingUiStateMachine, inAppBrowserNavigator = inAppBrowserNavigator ) val createLiteAccountUiStateMachine = CreateLiteAccountUiStateMachineImpl( liteAccountCreator = liteAccountCreator, trustedContactEnrollmentUiStateMachine = trustedContactEnrollmentUiStateMachine, socRecRelationshipsRepository = socRecRelationshipsRepository, liteAccountCloudSignInAndBackupUiStateMachine = liteAccountCloudSignInAndBackupUiStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider, eventTracker = appComponent.eventTracker ) val liteMoneyHomeUiStateMachine = LiteMoneyHomeUiStateMachineImpl( inAppBrowserNavigator = inAppBrowserNavigator, viewingProtectedCustomerUiStateMachine = viewingProtectedCustomerUiStateMachine, helpingWithRecoveryUiStateMachine = helpingWithRecoveryUiStateMachine ) val liteListingTrustedContactsUiStateMachine = LiteListingTrustedContactsUiStateMachineImpl( viewingProtectedCustomerUiStateMachine = viewingProtectedCustomerUiStateMachine ) val liteTrustedContactManagementUiStateMachine = LiteTrustedContactManagementUiStateMachineImpl( liteListingTrustedContactsUiStateMachine = liteListingTrustedContactsUiStateMachine, trustedContactEnrollmentUiStateMachine = trustedContactEnrollmentUiStateMachine, helpingWithRecoveryUiStateMachine = helpingWithRecoveryUiStateMachine ) val liteSettingsHomeUiStateMachine = LiteSettingsHomeUiStateMachineImpl( currencyPreferenceUiStateMachine = currencyPreferenceUiStateMachine, helpCenterUiStateMachine = helpCenterUiStateMachine, liteTrustedContactManagementUiStateMachine = liteTrustedContactManagementUiStateMachine, settingsListUiStateMachine = settingsListUiStateMachine, feedbackUiStateMachine = feedbackUiStateMachine ) val liteHomeUiStateMachine = LiteHomeUiStateMachineImpl( homeStatusBannerUiStateMachine = homeStatusBannerUiStateMachine, liteMoneyHomeUiStateMachine = liteMoneyHomeUiStateMachine, liteSettingsHomeUiStateMachine = liteSettingsHomeUiStateMachine, liteTrustedContactManagementUiStateMachine = liteTrustedContactManagementUiStateMachine, socRecRelationshipsRepository = socRecRelationshipsRepository, eventTracker = appComponent.eventTracker ) val gettingStartedRoutingStateMachine = GettingStartedRoutingStateMachineImpl( accessCloudBackupUiStateMachine = accessCloudBackupUiStateMachine ) val liteAccountCloudBackupRestorationUiStateMachine = LiteAccountCloudBackupRestorationUiStateMachineImpl( liteAccountCloudBackupRestorer = liteAccountCloudBackupRestorer ) val emergencyAccessKitRecoveryUiStateMachine = EmergencyAccessKitRecoveryUiStateMachineImpl( clipboard = clipboard, payloadDecoder = EmergencyAccessKitPayloadDecoderImpl, permissionUiStateMachine = permissionStateMachine, emergencyAccessPayloadRestorer = EmergencyAccessPayloadRestorerImpl( csekDao = csekDao, symmetricKeyEncryptor = symmetricKeyEncryptor, appPrivateKeyDao = appComponent.appPrivateKeyDao ), csekDao = csekDao, keyboxDao = appComponent.keyboxDao, nfcSessionUIStateMachine = nfcSessionUIStateMachine, uuidGenerator = appComponent.uuidGenerator ) override val appUiStateMachine = AppUiStateMachineImpl( appVariant = appComponent.appVariant, delayer = appComponent.delayer, debugMenuStateMachine = debugMenuStateMachine, eventTracker = appComponent.eventTracker, lostAppRecoveryUiStateMachine = recoveringKeyboxUiStateMachine, homeUiStateMachine = homeUiStateMachine, liteHomeUiStateMachine = liteHomeUiStateMachine, chooseAccountAccessUiStateMachine = chooseAccountAccessUiStateMachine, createAccountUiStateMachine = createAccountUiStateMachine, appDataStateMachine = appDataStateMachine, noLongerRecoveringUiStateMachine = noLongerRecoveringUiStateMachine, someoneElseIsRecoveringUiStateMachine = someoneElseIsRecoveringUiStateMachine, gettingStartedRoutingStateMachine = gettingStartedRoutingStateMachine, createLiteAccountUiStateMachine = createLiteAccountUiStateMachine, liteAccountCloudBackupRestorationUiStateMachine = liteAccountCloudBackupRestorationUiStateMachine, emergencyAccessKitRecoveryUiStateMachine = emergencyAccessKitRecoveryUiStateMachine, authKeyRotationUiStateMachine = rotateAuthUIStateMachine ) }
0
null
9
98
1f9f2298919dac77e6791aa3f1dbfd67efe7f83c
113,667
bitkey
MIT License
app/shared/app-component/impl/src/commonMain/kotlin/build/wallet/di/ActivityComponentImpl.kt
proto-at-block
761,306,853
false
null
// We expose all member fields for access in integration tests. @file:Suppress("MemberVisibilityCanBePrivate") package build.wallet.di import build.wallet.amount.AmountCalculatorImpl import build.wallet.amount.DecimalNumberCalculatorImpl import build.wallet.amount.DecimalNumberCreatorImpl import build.wallet.amount.DecimalSeparatorProviderImpl import build.wallet.amount.DoubleFormatterImpl import build.wallet.amount.WholeNumberCalculatorImpl import build.wallet.auth.AuthKeyRotationAttemptDaoImpl import build.wallet.auth.AuthKeyRotationManager import build.wallet.auth.AuthKeyRotationManagerImpl import build.wallet.auth.FullAccountCreatorImpl import build.wallet.auth.LiteAccountCreatorImpl import build.wallet.auth.LiteToFullAccountUpgraderImpl import build.wallet.auth.OnboardingFullAccountDeleterImpl import build.wallet.availability.AppFunctionalityStatusProviderImpl import build.wallet.bitcoin.address.BitcoinAddressParserImpl import build.wallet.bitcoin.blockchain.BitcoinBlockchainImpl import build.wallet.bitcoin.explorer.BitcoinExplorerImpl import build.wallet.bitcoin.fees.BitcoinFeeRateEstimatorImpl import build.wallet.bitcoin.fees.BitcoinTransactionBaseCalculatorImpl import build.wallet.bitcoin.fees.BitcoinTransactionFeeEstimatorImpl import build.wallet.bitcoin.fees.MempoolHttpClientImpl import build.wallet.bitcoin.invoice.BitcoinInvoiceUrlEncoderImpl import build.wallet.bitcoin.invoice.PaymentDataParserImpl import build.wallet.bitcoin.lightning.LightningInvoiceParser import build.wallet.bitcoin.lightning.LightningPreferenceImpl import build.wallet.bitcoin.transactions.BitcoinTransactionBumpabilityCheckerImpl import build.wallet.bitcoin.transactions.BitcoinTransactionSweepCheckerImpl import build.wallet.bitcoin.transactions.OutgoingTransactionDetailRepositoryImpl import build.wallet.bitcoin.transactions.TransactionPriorityPreferenceImpl import build.wallet.cloud.backup.BestEffortFullAccountCloudBackupUploaderImpl import build.wallet.cloud.backup.CloudBackupRepositoryImpl import build.wallet.cloud.backup.FullAccountCloudBackupCreatorImpl import build.wallet.cloud.backup.FullAccountCloudBackupRestorerImpl import build.wallet.cloud.backup.LiteAccountCloudBackupCreatorImpl import build.wallet.cloud.backup.LiteAccountCloudBackupRestorerImpl import build.wallet.cloud.backup.csek.CsekDaoImpl import build.wallet.cloud.backup.csek.CsekGeneratorImpl import build.wallet.cloud.backup.health.CloudBackupHealthRepositoryImpl import build.wallet.cloud.backup.health.FullAccountCloudBackupRepairerImpl import build.wallet.cloud.backup.local.CloudBackupDaoImpl import build.wallet.cloud.backup.v2.CloudBackupV2RestorerImpl import build.wallet.cloud.backup.v2.FullAccountFieldsCreatorImpl import build.wallet.cloud.store.CloudFileStore import build.wallet.cloud.store.CloudKeyValueStore import build.wallet.cloud.store.CloudStoreAccountRepository import build.wallet.configuration.FiatMobilePayConfigurationDaoImpl import build.wallet.configuration.FiatMobilePayConfigurationRepositoryImpl import build.wallet.crypto.Spake2 import build.wallet.datadog.DatadogRumMonitor import build.wallet.email.EmailValidatorImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitApkParametersProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitBackupDateProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitDataProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitMobileKeyParametersProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitPayloadDecoderImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitPdfGeneratorImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitRepositoryImpl import build.wallet.emergencyaccesskit.EmergencyAccessKitTemplateProviderImpl import build.wallet.emergencyaccesskit.EmergencyAccessPayloadCreatorImpl import build.wallet.emergencyaccesskit.EmergencyAccessPayloadRestorerImpl import build.wallet.encrypt.CryptoBox import build.wallet.encrypt.SymmetricKeyEncryptor import build.wallet.encrypt.SymmetricKeyGenerator import build.wallet.encrypt.XChaCha20Poly1305 import build.wallet.encrypt.XNonceGenerator import build.wallet.f8e.ActiveF8eEnvironmentRepositoryImpl import build.wallet.f8e.configuration.GetBdkConfigurationServiceImpl import build.wallet.f8e.demo.DemoModeServiceImpl import build.wallet.f8e.mobilepay.FiatMobilePayConfigurationServiceImpl import build.wallet.f8e.mobilepay.MobilePayBalanceServiceImpl import build.wallet.f8e.mobilepay.MobilePaySigningServiceImpl import build.wallet.f8e.mobilepay.MobilePaySpendingLimitServiceImpl import build.wallet.f8e.money.FiatCurrencyDefinitionServiceImpl import build.wallet.f8e.notifications.NotificationTouchpointServiceImpl import build.wallet.f8e.notifications.RegisterWatchAddressServiceImpl import build.wallet.f8e.onboarding.CompleteDelayNotifyServiceImpl import build.wallet.f8e.onboarding.CreateAccountKeysetServiceImpl import build.wallet.f8e.onboarding.CreateAccountServiceImpl import build.wallet.f8e.onboarding.DeleteOnboardingFullAccountServiceImpl import build.wallet.f8e.onboarding.OnboardingServiceImpl import build.wallet.f8e.onboarding.SetActiveSpendingKeysetServiceImpl import build.wallet.f8e.onboarding.UpgradeAccountServiceImpl import build.wallet.f8e.partnerships.GetPurchaseOptionsServiceImpl import build.wallet.f8e.partnerships.GetPurchaseQuoteListServiceImpl import build.wallet.f8e.partnerships.GetPurchaseRedirectServiceImpl import build.wallet.f8e.partnerships.GetTransferPartnerListServiceImpl import build.wallet.f8e.partnerships.GetTransferRedirectServiceImpl import build.wallet.f8e.recovery.CancelDelayNotifyRecoveryServiceImpl import build.wallet.f8e.recovery.GetAccountStatusServiceImpl import build.wallet.f8e.recovery.GetDelayNotifyRecoveryStatusServiceImpl import build.wallet.f8e.recovery.InitiateAccountDelayNotifyServiceImpl import build.wallet.f8e.recovery.InitiateHardwareAuthServiceImpl import build.wallet.f8e.recovery.ListKeysetsServiceImpl import build.wallet.f8e.recovery.RecoveryNotificationVerificationServiceImpl import build.wallet.f8e.recovery.RotateAuthKeysService import build.wallet.f8e.recovery.RotateAuthKeysServiceImpl import build.wallet.f8e.socrec.SocialRecoveryServiceFake import build.wallet.f8e.socrec.SocialRecoveryServiceImpl import build.wallet.f8e.support.SupportTicketServiceImpl import build.wallet.home.GettingStartedTaskDaoImpl import build.wallet.home.HomeUiBottomSheetDaoImpl import build.wallet.keybox.AppDataDeleterImpl import build.wallet.keybox.CloudBackupDeleterImpl import build.wallet.limit.MobilePayDisablerImpl import build.wallet.limit.MobilePayLimitSetterImpl import build.wallet.limit.MobilePaySpendingPolicyImpl import build.wallet.limit.MobilePayStatusProviderImpl import build.wallet.limit.SpendingLimitDaoImpl import build.wallet.logging.log import build.wallet.money.currency.FiatCurrencyRepositoryImpl import build.wallet.money.exchange.CurrencyConverterImpl import build.wallet.money.exchange.ExchangeRateDaoImpl import build.wallet.money.exchange.ExchangeRateSyncerImpl import build.wallet.money.exchange.F8eExchangeRateServiceImpl import build.wallet.money.formatter.internal.MoneyDisplayFormatterImpl import build.wallet.money.formatter.internal.MoneyFormatterDefinitionsImpl import build.wallet.money.input.MoneyInputFormatterImpl import build.wallet.nfc.NfcReaderCapabilityProviderImpl import build.wallet.nfc.NfcTransactorImpl import build.wallet.nfc.interceptors.collectFirmwareTelemetry import build.wallet.nfc.interceptors.collectMetrics import build.wallet.nfc.interceptors.haptics import build.wallet.nfc.interceptors.iosMessages import build.wallet.nfc.interceptors.lockDevice import build.wallet.nfc.interceptors.retryCommands import build.wallet.nfc.interceptors.sessionLogger import build.wallet.nfc.interceptors.timeoutSession import build.wallet.nfc.platform.NfcCommandsProvider import build.wallet.nfc.platform.NfcSessionProvider import build.wallet.nfc.transaction.PairingTransactionProviderImpl import build.wallet.notifications.NotificationTouchpointDaoImpl import build.wallet.notifications.RegisterWatchAddressQueueImpl import build.wallet.notifications.RegisterWatchAddressSenderImpl import build.wallet.onboarding.LiteAccountBackupToFullAccountUpgraderImpl import build.wallet.onboarding.OnboardingKeyboxHardwareKeysDaoImpl import build.wallet.onboarding.OnboardingKeyboxSealedCsekDaoImpl import build.wallet.onboarding.OnboardingKeyboxStepStateDaoImpl import build.wallet.partnerships.PartnershipTransactionsDaoImpl import build.wallet.partnerships.PartnershipTransactionsRepositoryImpl import build.wallet.phonenumber.PhoneNumberFormatterImpl import build.wallet.phonenumber.PhoneNumberValidatorImpl import build.wallet.phonenumber.lib.PhoneNumberLibBindings import build.wallet.platform.clipboard.ClipboardImpl import build.wallet.platform.links.DeepLinkHandlerImpl import build.wallet.platform.pdf.PdfAnnotatorFactory import build.wallet.platform.settings.CountryCodeGuesserImpl import build.wallet.platform.settings.LocaleIdentifierProviderImpl import build.wallet.platform.settings.SystemSettingsLauncher import build.wallet.platform.settings.TelephonyCountryCodeProviderImpl import build.wallet.platform.sharing.SharingManager import build.wallet.platform.web.InAppBrowserNavigator import build.wallet.queueprocessor.ProcessorImpl import build.wallet.recovery.LostAppRecoveryAuthenticatorImpl import build.wallet.recovery.LostAppRecoveryInitiatorImpl import build.wallet.recovery.LostHardwareRecoveryStarterImpl import build.wallet.recovery.RecoveryAuthCompleterImpl import build.wallet.recovery.RecoveryCancelerImpl import build.wallet.recovery.RecoverySyncerImpl import build.wallet.recovery.socrec.InviteCodeLoaderImpl import build.wallet.recovery.socrec.PostSocRecTaskRepositoryImpl import build.wallet.recovery.socrec.RecoveryIncompleteDaoImpl import build.wallet.recovery.socrec.SocRecChallengeRepositoryImpl import build.wallet.recovery.socrec.SocRecCryptoFake import build.wallet.recovery.socrec.SocRecCryptoImpl import build.wallet.recovery.socrec.SocRecEnrollmentAuthenticationDaoImpl import build.wallet.recovery.socrec.SocRecKeysDaoImpl import build.wallet.recovery.socrec.SocRecKeysRepository import build.wallet.recovery.socrec.SocRecRelationshipsDaoImpl import build.wallet.recovery.socrec.SocRecRelationshipsRepositoryImpl import build.wallet.recovery.socrec.SocRecStartedChallengeAuthenticationDaoImpl import build.wallet.recovery.socrec.SocRecStartedChallengeDaoImpl import build.wallet.recovery.socrec.SocialChallengeVerifierImpl import build.wallet.recovery.socrec.SocialRecoveryCodeBuilderImpl import build.wallet.recovery.socrec.SocialRecoveryServiceProviderImpl import build.wallet.recovery.socrec.TrustedContactKeyAuthenticatorImpl import build.wallet.recovery.sweep.SweepGeneratorImpl import build.wallet.serialization.Base32Encoding import build.wallet.statemachine.account.ChooseAccountAccessUiStateMachineImpl import build.wallet.statemachine.account.create.full.CreateAccountUiStateMachineImpl import build.wallet.statemachine.account.create.full.OnboardKeyboxUiStateMachineImpl import build.wallet.statemachine.account.create.full.OverwriteFullAccountCloudBackupUiStateMachineImpl import build.wallet.statemachine.account.create.full.ReplaceWithLiteAccountRestoreUiStateMachineImpl import build.wallet.statemachine.account.create.full.hardware.PairNewHardwareUiStateMachineImpl import build.wallet.statemachine.account.create.full.keybox.create.CreateKeyboxUiStateMachineImpl import build.wallet.statemachine.account.create.full.onboard.notifications.NotificationPreferencesSetupUiStateMachineV2Impl import build.wallet.statemachine.account.create.full.onboard.notifications.RecoveryChannelsSetupPushItemModelProviderImpl import build.wallet.statemachine.account.create.full.onboard.notifications.UiErrorHintsProviderImpl import build.wallet.statemachine.account.create.lite.CreateLiteAccountUiStateMachineImpl import build.wallet.statemachine.auth.ProofOfPossessionNfcStateMachineImpl import build.wallet.statemachine.auth.RefreshAuthTokensUiStateMachineImpl import build.wallet.statemachine.cloud.CloudBackupRectificationNavigatorImpl import build.wallet.statemachine.cloud.FullAccountCloudSignInAndBackupUiStateMachineImpl import build.wallet.statemachine.cloud.LiteAccountCloudSignInAndBackupUiStateMachineImpl import build.wallet.statemachine.cloud.RectifiableErrorHandlingUiStateMachineImpl import build.wallet.statemachine.cloud.health.CloudBackupHealthDashboardUiStateMachineImpl import build.wallet.statemachine.cloud.health.RepairCloudBackupStateMachineImpl import build.wallet.statemachine.core.input.EmailInputUiStateMachineImpl import build.wallet.statemachine.core.input.PhoneNumberInputUiStateMachineImpl import build.wallet.statemachine.core.input.VerificationCodeInputStateMachineImpl import build.wallet.statemachine.data.account.create.CreateFullAccountDataStateMachineImpl import build.wallet.statemachine.data.account.create.OnboardConfigDataStateMachineImpl import build.wallet.statemachine.data.account.create.OnboardingStepSkipConfigDaoImpl import build.wallet.statemachine.data.account.create.activate.ActivateFullAccountDataStateMachineImpl import build.wallet.statemachine.data.account.create.keybox.CreateKeyboxDataStateMachineImpl import build.wallet.statemachine.data.account.create.onboard.OnboardKeyboxDataStateMachineImpl import build.wallet.statemachine.data.app.AppDataStateMachineImpl import build.wallet.statemachine.data.firmware.FirmwareDataStateMachineImpl import build.wallet.statemachine.data.keybox.AccountDataStateMachineImpl import build.wallet.statemachine.data.keybox.CloudBackupRefresherImpl import build.wallet.statemachine.data.keybox.HasActiveFullAccountDataStateMachineImpl import build.wallet.statemachine.data.keybox.HasActiveLiteAccountDataStateMachineImpl import build.wallet.statemachine.data.keybox.NoActiveAccountDataStateMachineImpl import build.wallet.statemachine.data.keybox.address.FullAccountAddressDataStateMachineImpl import build.wallet.statemachine.data.keybox.config.TemplateFullAccountConfigDataStateMachineImpl import build.wallet.statemachine.data.keybox.transactions.FullAccountTransactionsDataStateMachineImpl import build.wallet.statemachine.data.lightning.LightningNodeDataStateMachineImpl import build.wallet.statemachine.data.mobilepay.MobilePayDataStateMachineImpl import build.wallet.statemachine.data.money.currency.CurrencyPreferenceDataStateMachineImpl import build.wallet.statemachine.data.notifications.NotificationTouchpointDataStateMachineImpl import build.wallet.statemachine.data.recovery.conflict.NoLongerRecoveringDataStateMachineImpl import build.wallet.statemachine.data.recovery.conflict.SomeoneElseIsRecoveringDataStateMachineImpl import build.wallet.statemachine.data.recovery.inprogress.F8eSpendingKeyRotatorImpl import build.wallet.statemachine.data.recovery.inprogress.RecoveryInProgressDataStateMachineImpl import build.wallet.statemachine.data.recovery.lostapp.LostAppRecoveryDataStateMachineImpl import build.wallet.statemachine.data.recovery.lostapp.LostAppRecoveryHaveNotStartedDataStateMachineImpl import build.wallet.statemachine.data.recovery.lostapp.initiate.InitiatingLostAppRecoveryDataStateMachineImpl import build.wallet.statemachine.data.recovery.losthardware.LostHardwareRecoveryDataStateMachineImpl import build.wallet.statemachine.data.recovery.losthardware.initiate.InitiatingLostHardwareRecoveryDataStateMachineImpl import build.wallet.statemachine.data.recovery.sweep.SweepDataStateMachineImpl import build.wallet.statemachine.data.recovery.verification.RecoveryNotificationVerificationDataStateMachineImpl import build.wallet.statemachine.data.sync.ElectrumServerDataStateMachineImpl import build.wallet.statemachine.demo.DemoModeCodeEntryUiStateMachineImpl import build.wallet.statemachine.demo.DemoModeConfigUiStateMachineImpl import build.wallet.statemachine.dev.AccountConfigUiStateMachineImpl import build.wallet.statemachine.dev.AppStateDeleterOptionsUiStateMachineImpl import build.wallet.statemachine.dev.BitcoinNetworkPickerUiStateMachineImpl import build.wallet.statemachine.dev.BitkeyDeviceOptionsUiStateMachineImpl import build.wallet.statemachine.dev.DebugMenuListStateMachineImpl import build.wallet.statemachine.dev.DebugMenuStateMachineImpl import build.wallet.statemachine.dev.F8eCustomUrlStateMachineImpl import build.wallet.statemachine.dev.F8eEnvironmentPickerUiStateMachineImpl import build.wallet.statemachine.dev.FirmwareMetadataUiStateMachineImpl import build.wallet.statemachine.dev.InfoOptionsUiStateMachineImpl import build.wallet.statemachine.dev.OnboardingAppKeyDeletionUiStateMachineImpl import build.wallet.statemachine.dev.OnboardingConfigStateMachineImpl import build.wallet.statemachine.dev.analytics.AnalyticsOptionsUiStateMachineImpl import build.wallet.statemachine.dev.analytics.AnalyticsUiStateMachineImpl import build.wallet.statemachine.dev.cloud.CloudDevOptionsStateMachine import build.wallet.statemachine.dev.debug.NetworkingDebugConfigPickerUiStateMachineImpl import build.wallet.statemachine.dev.featureFlags.BooleanFlagItemUiStateMachineImpl import build.wallet.statemachine.dev.featureFlags.FeatureFlagsOptionsUiStateMachineImpl import build.wallet.statemachine.dev.featureFlags.FeatureFlagsStateMachineImpl import build.wallet.statemachine.dev.lightning.ConnectAndOpenChannelStateMachineImpl import build.wallet.statemachine.dev.lightning.LightningDebugMenuUiStateMachineImpl import build.wallet.statemachine.dev.lightning.LightningOptionsUiStateMachineImpl import build.wallet.statemachine.dev.lightning.LightningSendReceiveUiStateMachineImpl import build.wallet.statemachine.dev.logs.LogsUiStateMachineImpl import build.wallet.statemachine.fwup.FwupNfcSessionUiStateMachineImpl import build.wallet.statemachine.fwup.FwupNfcUiStateMachineImpl import build.wallet.statemachine.home.full.HomeUiStateMachineImpl import build.wallet.statemachine.home.full.bottomsheet.CurrencyChangeMobilePayBottomSheetUpdaterImpl import build.wallet.statemachine.home.full.bottomsheet.HomeUiBottomSheetStateMachineImpl import build.wallet.statemachine.home.lite.LiteHomeUiStateMachineImpl import build.wallet.statemachine.limit.SetSpendingLimitUiStateMachineImpl import build.wallet.statemachine.limit.picker.SpendingLimitPickerUiStateMachineImpl import build.wallet.statemachine.money.amount.MoneyAmountEntryUiStateMachineImpl import build.wallet.statemachine.money.amount.MoneyAmountUiStateMachineImpl import build.wallet.statemachine.money.calculator.MoneyCalculatorUiStateMachineImpl import build.wallet.statemachine.money.currency.CurrencyPreferenceUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.MoneyHomeCardsUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.backup.CloudBackupHealthCardUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.fwup.DeviceUpdateCardUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.gettingstarted.GettingStartedCardUiStateMachineImpl import build.wallet.statemachine.moneyhome.card.replacehardware.ReplaceHardwareCardUiStateMachineImpl import build.wallet.statemachine.moneyhome.full.MoneyHomeUiStateMachineImpl import build.wallet.statemachine.moneyhome.full.MoneyHomeViewingBalanceUiStateMachineImpl import build.wallet.statemachine.moneyhome.lite.LiteMoneyHomeUiStateMachineImpl import build.wallet.statemachine.nfc.NfcSessionUIStateMachineImpl import build.wallet.statemachine.notifications.NotificationPreferencesUiStateMachineImpl import build.wallet.statemachine.notifications.NotificationTouchpointInputAndVerificationUiStateMachineImpl import build.wallet.statemachine.notifications.NotificationsPreferencesCachedProviderImpl import build.wallet.statemachine.partnerships.AddBitcoinUiStateMachineImpl import build.wallet.statemachine.partnerships.purchase.CustomAmountEntryUiStateMachineImpl import build.wallet.statemachine.partnerships.purchase.PartnershipsPurchaseUiStateMachineImpl import build.wallet.statemachine.partnerships.transfer.PartnershipsTransferUiStateMachineImpl import build.wallet.statemachine.platform.nfc.EnableNfcNavigatorImpl import build.wallet.statemachine.platform.permissions.EnableNotificationsUiStateMachineImpl import build.wallet.statemachine.platform.permissions.NotificationPermissionRequesterImpl import build.wallet.statemachine.platform.permissions.PermissionUiStateMachineImpl import build.wallet.statemachine.receive.AddressQrCodeUiStateMachineImpl import build.wallet.statemachine.recovery.RecoveryInProgressUiStateMachineImpl import build.wallet.statemachine.recovery.cloud.AccessCloudBackupUiStateMachineImpl import build.wallet.statemachine.recovery.cloud.CloudSignInUiStateMachine import build.wallet.statemachine.recovery.cloud.FullAccountCloudBackupRestorationUiStateMachineImpl import build.wallet.statemachine.recovery.cloud.LiteAccountCloudBackupRestorationUiStateMachineImpl import build.wallet.statemachine.recovery.cloud.RotateAuthKeyUIStateMachineImpl import build.wallet.statemachine.recovery.conflict.NoLongerRecoveringUiStateMachineImpl import build.wallet.statemachine.recovery.conflict.SomeoneElseIsRecoveringUiStateMachineImpl import build.wallet.statemachine.recovery.emergencyaccesskit.EmergencyAccessKitRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.hardware.HardwareRecoveryStatusCardUiStateMachineImpl import build.wallet.statemachine.recovery.inprogress.completing.CompletingRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.lostapp.LostAppRecoveryHaveNotStartedUiStateMachineImpl import build.wallet.statemachine.recovery.lostapp.LostAppRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.lostapp.initiate.InitiatingLostAppRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.losthardware.LostHardwareRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.losthardware.initiate.InitiatingLostHardwareRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.LiteTrustedContactManagementUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.RecoveryContactCardsUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.TrustedContactManagementUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.add.AddingTrustedContactUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.challenge.ChallengeCodeFormatterImpl import build.wallet.statemachine.recovery.socrec.challenge.RecoveryChallengeUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.help.HelpingWithRecoveryUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.inviteflow.InviteTrustedContactFlowUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.list.full.ListingTrustedContactsUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.list.lite.LiteListingTrustedContactsUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.reinvite.ReinviteTrustedContactUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.remove.RemoveTrustedContactUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.view.ViewingInvitationUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.view.ViewingProtectedCustomerUiStateMachineImpl import build.wallet.statemachine.recovery.socrec.view.ViewingRecoveryContactUiStateMachineImpl import build.wallet.statemachine.recovery.sweep.SweepUiStateMachineImpl import build.wallet.statemachine.recovery.verification.RecoveryNotificationVerificationUiStateMachineImpl import build.wallet.statemachine.root.AppUiStateMachineImpl import build.wallet.statemachine.send.BitcoinAddressRecipientUiStateMachineImpl import build.wallet.statemachine.send.BitcoinQrCodeScanUiStateMachineImpl import build.wallet.statemachine.send.SendUiStateMachineImpl import build.wallet.statemachine.send.TransactionDetailsCardUiStateMachineImpl import build.wallet.statemachine.send.TransferAmountEntryUiStateMachineImpl import build.wallet.statemachine.send.TransferConfirmationUiStateMachineImpl import build.wallet.statemachine.send.TransferInitiatedUiStateMachineImpl import build.wallet.statemachine.send.fee.FeeOptionListUiStateMachineImpl import build.wallet.statemachine.send.fee.FeeOptionUiStateMachineImpl import build.wallet.statemachine.send.fee.FeeSelectionUiStateMachineImpl import build.wallet.statemachine.settings.SettingsListUiStateMachineImpl import build.wallet.statemachine.settings.full.SettingsHomeUiStateMachineImpl import build.wallet.statemachine.settings.full.device.DeviceSettingsUiStateMachineImpl import build.wallet.statemachine.settings.full.electrum.CustomElectrumServerSettingUiStateMachineImpl import build.wallet.statemachine.settings.full.electrum.CustomElectrumServerUiStateMachineImpl import build.wallet.statemachine.settings.full.electrum.SetElectrumServerUiStateMachineImpl import build.wallet.statemachine.settings.full.feedback.FeedbackFormUiStateMachineImpl import build.wallet.statemachine.settings.full.feedback.FeedbackUiStateMachineImpl import build.wallet.statemachine.settings.full.mobilepay.MobilePaySettingsUiStateMachineImpl import build.wallet.statemachine.settings.full.mobilepay.MobilePayStatusUiStateMachineImpl import build.wallet.statemachine.settings.full.mobilepay.SpendingLimitCardUiStateMachineImpl import build.wallet.statemachine.settings.full.notifications.NotificationsSettingsUiStateMachineImpl import build.wallet.statemachine.settings.full.notifications.RecoveryChannelSettingsUiStateMachineImpl import build.wallet.statemachine.settings.helpcenter.HelpCenterUiStateMachineImpl import build.wallet.statemachine.settings.lite.LiteSettingsHomeUiStateMachineImpl import build.wallet.statemachine.start.GettingStartedRoutingStateMachineImpl import build.wallet.statemachine.status.AppFunctionalityStatusUiStateMachineImpl import build.wallet.statemachine.status.HomeStatusBannerUiStateMachineImpl import build.wallet.statemachine.transactions.TransactionItemUiStateMachineImpl import build.wallet.statemachine.transactions.TransactionListUiStateMachineImpl import build.wallet.statemachine.trustedcontact.TrustedContactEnrollmentUiStateMachineImpl import build.wallet.support.SupportTicketFormValidatorImpl import build.wallet.support.SupportTicketRepositoryImpl import build.wallet.time.DateTimeFormatterImpl import build.wallet.time.DurationFormatterImpl import build.wallet.time.TimeZoneFormatterImpl import build.wallet.time.TimeZoneProviderImpl import kotlin.time.Duration.Companion.minutes /** * [ActivityComponent] that provides real implementations. * * Should be initialized as a singleton and scoped to the application's lifecycle. */ @Suppress("LargeClass") class ActivityComponentImpl( val appComponent: AppComponent, val cloudKeyValueStore: CloudKeyValueStore, val cloudFileStore: CloudFileStore, cloudSignInUiStateMachine: CloudSignInUiStateMachine, cloudDevOptionsStateMachine: CloudDevOptionsStateMachine, val cloudStoreAccountRepository: CloudStoreAccountRepository, datadogRumMonitor: DatadogRumMonitor, phoneNumberLibBindings: PhoneNumberLibBindings, symmetricKeyEncryptor: SymmetricKeyEncryptor, symmetricKeyGenerator: SymmetricKeyGenerator, lightningInvoiceParser: LightningInvoiceParser, sharingManager: SharingManager, systemSettingsLauncher: SystemSettingsLauncher, inAppBrowserNavigator: InAppBrowserNavigator, nfcCommandsProvider: NfcCommandsProvider, nfcSessionProvider: NfcSessionProvider, xChaCha20Poly1305: XChaCha20Poly1305, xNonceGenerator: XNonceGenerator, spake2: Spake2, cryptoBox: CryptoBox, val pdfAnnotatorFactory: PdfAnnotatorFactory, ) : ActivityComponent { init { log { "App Variant: ${appComponent.appVariant}" } } val timeZoneFormatter = TimeZoneFormatterImpl() val timeZoneProvider = TimeZoneProviderImpl() val dateTimeFormatter = DateTimeFormatterImpl() val clipboard = ClipboardImpl(appComponent.platformContext) val localeIdentifierProvider = LocaleIdentifierProviderImpl( platformContext = appComponent.platformContext ) val doubleFormatter = DoubleFormatterImpl( localeIdentifierProvider = localeIdentifierProvider ) val moneyFormatterDefinitions = MoneyFormatterDefinitionsImpl( doubleFormatter = doubleFormatter ) val moneyDisplayFormatter = MoneyDisplayFormatterImpl( bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, moneyFormatterDefinitions = moneyFormatterDefinitions ) val lightningPreference = LightningPreferenceImpl(appComponent.bitkeyDatabaseProvider) val decimalSeparatorProvider = DecimalSeparatorProviderImpl( localeIdentifierProvider = localeIdentifierProvider ) val decimalNumberCreator = DecimalNumberCreatorImpl( decimalSeparatorProvider = decimalSeparatorProvider, doubleFormatter = doubleFormatter ) val decimalNumberCalculator = DecimalNumberCalculatorImpl( decimalNumberCreator = decimalNumberCreator, decimalSeparatorProvider = decimalSeparatorProvider, doubleFormatter = doubleFormatter ) val wholeNumberCalculator = WholeNumberCalculatorImpl() val csekDao = CsekDaoImpl( encryptedKeyValueStoreFactory = appComponent.secureStoreFactory ) val nfcReaderCapabilityProvider = NfcReaderCapabilityProviderImpl(appComponent.platformContext) val permissionStateMachine = PermissionUiStateMachineImpl() val bitcoinAddressParser = BitcoinAddressParserImpl(appComponent.bdkAddressBuilder) val bitcoinExplorer = BitcoinExplorerImpl() val extendedKeyGenerator = appComponent.extendedKeyGenerator val appKeysGenerator = appComponent.appKeysGenerator val cancelDelayNotifyRecoveryService = CancelDelayNotifyRecoveryServiceImpl(appComponent.f8eHttpClient) val initiateAccountDelayNotifyService = InitiateAccountDelayNotifyServiceImpl( appComponent.f8eHttpClient ) val createAccountService = CreateAccountServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val createAccountKeysetService = CreateAccountKeysetServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val setActiveSpendingKeysetService = SetActiveSpendingKeysetServiceImpl(appComponent.f8eHttpClient) val bitcoinFeeRateEstimator = BitcoinFeeRateEstimatorImpl( mempoolHttpClient = MempoolHttpClientImpl( logLevelPolicy = appComponent.ktorLogLevelPolicy, networkReachabilityProvider = appComponent.networkReachabilityProvider ), bdkBlockchainProvider = appComponent.bdkBlockchainProvider ) val bitcoinInvoiceUrlEncoder = BitcoinInvoiceUrlEncoderImpl( bitcoinAddressParser = bitcoinAddressParser, lightningInvoiceParser = lightningInvoiceParser ) val amountCalculator = AmountCalculatorImpl( decimalNumberCalculator = decimalNumberCalculator, wholeNumberCalculator = wholeNumberCalculator ) val gettingStartedTaskDao = GettingStartedTaskDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val cloudBackupDao = CloudBackupDaoImpl( encryptedKeyValueStoreFactory = appComponent.secureStoreFactory ) val cloudBackupRepository = CloudBackupRepositoryImpl( cloudKeyValueStore = cloudKeyValueStore, cloudBackupDao = cloudBackupDao, authTokensRepository = appComponent.authTokensRepository ) val socRecCrypto = SocRecCryptoImpl( symmetricKeyGenerator = symmetricKeyGenerator, xChaCha20Poly1305 = xChaCha20Poly1305, xNonceGenerator = xNonceGenerator, spake2 = spake2, appAuthKeyMessageSigner = appComponent.appAuthKeyMessageSigner, signatureVerifier = appComponent.signatureVerifier, cryptoBox = cryptoBox ) val socRecCryptoFake = SocRecCryptoFake( messageSigner = appComponent.messageSigner, signatureVerifier = appComponent.signatureVerifier, appPrivateKeyDao = appComponent.appPrivateKeyDao ) val socRecKeysDao = SocRecKeysDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider, appPrivateKeyDao = appComponent.appPrivateKeyDao ) val socRecKeysRepository = SocRecKeysRepository(socRecCrypto, socRecKeysDao) private val fullAccountFieldsCreator = FullAccountFieldsCreatorImpl( appPrivateKeyDao = appComponent.appPrivateKeyDao, csekDao = csekDao, symmetricKeyEncryptor = symmetricKeyEncryptor, socRecCrypto = socRecCrypto ) val fullAccountCloudBackupCreator = FullAccountCloudBackupCreatorImpl( appPrivateKeyDao = appComponent.appPrivateKeyDao, fullAccountFieldsCreator = fullAccountFieldsCreator, socRecKeysRepository = socRecKeysRepository ) val exchangeRateDao = ExchangeRateDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val activeF8eEnvironmentRepository = ActiveF8eEnvironmentRepositoryImpl( keyboxDao = appComponent.keyboxDao ) val f8eExchangeRateService = F8eExchangeRateServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val exchangeRateSyncer = ExchangeRateSyncerImpl( exchangeRateDao = exchangeRateDao, f8eExchangeRateService = f8eExchangeRateService, activeF8eEnvironmentRepository = activeF8eEnvironmentRepository, appSessionManager = appComponent.appSessionManager ) val currencyConverter = CurrencyConverterImpl( accountRepository = appComponent.accountRepository, exchangeRateDao = exchangeRateDao, f8eExchangeRateService = f8eExchangeRateService ) val durationFormatter = DurationFormatterImpl() val getDelayNotifyRecoveryStatusService = GetDelayNotifyRecoveryStatusServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val recoverySyncer = RecoverySyncerImpl( recoveryDao = appComponent.recoveryDao, getRecoveryStatusService = getDelayNotifyRecoveryStatusService, appSessionManager = appComponent.appSessionManager ) val getAccountStatusService = GetAccountStatusServiceImpl(appComponent.f8eHttpClient, appComponent.uuidGenerator) val delayNotifyLostAppRecoveryInitiator = LostAppRecoveryInitiatorImpl( initiateAccountDelayNotifyService = InitiateAccountDelayNotifyServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ), recoveryDao = appComponent.recoveryDao ) val delayNotifyLostAppRecoveryAuthenticator = LostAppRecoveryAuthenticatorImpl( accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, deviceTokenManager = appComponent.deviceTokenManager ) val enableNfcNavigator = EnableNfcNavigatorImpl() val telephonyCountryCodeProvider = TelephonyCountryCodeProviderImpl(appComponent.platformContext) val nfcTransactor = NfcTransactorImpl( commandsProvider = nfcCommandsProvider, sessionProvider = nfcSessionProvider, interceptors = listOf( retryCommands(), iosMessages(), collectFirmwareTelemetry( appComponent.firmwareDeviceInfoDao, appComponent.firmwareTelemetryUploader ), lockDevice(), haptics(appComponent.nfcHaptics), timeoutSession(), collectMetrics(appComponent.datadogRumMonitor, appComponent.datadogTracer), sessionLogger() ) ) val nfcSessionUIStateMachine = NfcSessionUIStateMachineImpl( delayer = appComponent.delayer, nfcReaderCapabilityProvider = nfcReaderCapabilityProvider, enableNfcNavigator = enableNfcNavigator, deviceInfoProvider = appComponent.deviceInfoProvider, nfcTransactor = nfcTransactor ) val initiateHardwareAuthService = InitiateHardwareAuthServiceImpl( authenticationService = appComponent.authenticationService ) val completeDelayNotifyService = CompleteDelayNotifyServiceImpl(appComponent.f8eHttpClient) val csekGenerator = CsekGeneratorImpl( symmetricKeyGenerator = symmetricKeyGenerator ) val bitcoinBlockchain = BitcoinBlockchainImpl( bdkBlockchainProvider = appComponent.bdkBlockchainProvider, bdkPsbtBuilder = appComponent.bdkPartiallySignedTransactionBuilder, clock = appComponent.clock ) val mobilePaySigningService = MobilePaySigningServiceImpl(appComponent.f8eHttpClient) val paymentDataParser = PaymentDataParserImpl( bip21InvoiceEncoder = bitcoinInvoiceUrlEncoder, bitcoinAddressParser = bitcoinAddressParser, lightningInvoiceParser = lightningInvoiceParser ) val bitcoinQrCodeScanStateMachine = BitcoinQrCodeScanUiStateMachineImpl( paymentDataParser = paymentDataParser ) val bitcoinAddressRecipientStateMachine = BitcoinAddressRecipientUiStateMachineImpl( paymentDataParser = paymentDataParser, keysetWalletProvider = appComponent.keysetWalletProvider ) val cloudBackupRectificationNavigator = CloudBackupRectificationNavigatorImpl() val rectifiableErrorHandlingUiStateMachine = RectifiableErrorHandlingUiStateMachineImpl( cloudBackupRectificationNavigator = cloudBackupRectificationNavigator ) val emergencyAccessKitRepository = EmergencyAccessKitRepositoryImpl(cloudFileStore) val emergencyAccessKitDataProvider = EmergencyAccessKitDataProviderImpl(appComponent.appVariant) val eakPayloadCreator = EmergencyAccessPayloadCreatorImpl( csekDao = csekDao, symmetricKeyEncryptor = symmetricKeyEncryptor, appPrivateKeyDao = appComponent.appPrivateKeyDao ) val emergencyAccessKitPdfGenerator = EmergencyAccessKitPdfGeneratorImpl( apkParametersProvider = EmergencyAccessKitApkParametersProviderImpl( emergencyAccessKitDataProvider ), mobileKeyParametersProvider = EmergencyAccessKitMobileKeyParametersProviderImpl( payloadCreator = eakPayloadCreator ), pdfAnnotatorFactory = pdfAnnotatorFactory, templateProvider = EmergencyAccessKitTemplateProviderImpl( platformContext = appComponent.platformContext ), backupDateProvider = EmergencyAccessKitBackupDateProviderImpl( clock = appComponent.clock, timeZoneProvider = timeZoneProvider ), dateTimeFormatter = dateTimeFormatter ) val cloudBackupRepairer = FullAccountCloudBackupRepairerImpl( cloudBackupRepository = cloudBackupRepository, cloudBackupDao = cloudBackupDao, emergencyAccessKitPdfGenerator = emergencyAccessKitPdfGenerator, emergencyAccessKitRepository = emergencyAccessKitRepository ) val cloudBackupHealthRepository = CloudBackupHealthRepositoryImpl( cloudStoreAccountRepository = cloudStoreAccountRepository, cloudBackupRepository = cloudBackupRepository, emergencyAccessKitRepository = emergencyAccessKitRepository, fullAccountCloudBackupRepairer = cloudBackupRepairer, cloudBackupDao = cloudBackupDao ) val fullAccountCloudSignInAndBackupUiStateMachine = FullAccountCloudSignInAndBackupUiStateMachineImpl( cloudBackupRepository = cloudBackupRepository, cloudSignInUiStateMachine = cloudSignInUiStateMachine, fullAccountCloudBackupCreator = fullAccountCloudBackupCreator, eventTracker = appComponent.eventTracker, rectifiableErrorHandlingUiStateMachine = rectifiableErrorHandlingUiStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider, csekGenerator = csekGenerator, nfcSessionUIStateMachine = nfcSessionUIStateMachine, csekDao = csekDao, inAppBrowserNavigator = inAppBrowserNavigator, emergencyAccessKitPdfGenerator = emergencyAccessKitPdfGenerator, emergencyAccessKitRepository = emergencyAccessKitRepository ) val socRecRelationshipsDao = SocRecRelationshipsDaoImpl(appComponent.bitkeyDatabaseProvider) val socRecEnrollmentAuthenticationDao = SocRecEnrollmentAuthenticationDaoImpl( appComponent.appPrivateKeyDao, appComponent.bitkeyDatabaseProvider ) val base32Encoding = Base32Encoding() val pakeCodeBuilder = SocialRecoveryCodeBuilderImpl( base32Encoding = base32Encoding ) val socialRecoveryServiceFake = SocialRecoveryServiceFake( uuidGenerator = appComponent.uuidGenerator, backgroundScope = appComponent.appCoroutineScope ) val socialRecoveryServiceImpl = SocialRecoveryServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val socialRecoveryServiceProvider = SocialRecoveryServiceProviderImpl( accountRepository = appComponent.accountRepository, socRecFake = socialRecoveryServiceFake, socRecService = socialRecoveryServiceImpl, templateFullAccountConfigDao = appComponent.templateFullAccountConfigDao ) val socRecStartedChallengeAuthenticationDao = SocRecStartedChallengeAuthenticationDaoImpl( appComponent.appPrivateKeyDao, appComponent.bitkeyDatabaseProvider ) val socRecRelationshipsRepository = SocRecRelationshipsRepositoryImpl( appScope = appComponent.appCoroutineScope, socialRecoveryServiceProvider = socialRecoveryServiceProvider, socRecRelationshipsDao = socRecRelationshipsDao, socRecEnrollmentAuthenticationDao = socRecEnrollmentAuthenticationDao, socRecCrypto = socRecCrypto, socialRecoveryCodeBuilder = pakeCodeBuilder, appSessionManager = appComponent.appSessionManager ) val bestEffortFullAccountCloudBackupUploader = BestEffortFullAccountCloudBackupUploaderImpl( cloudBackupDao = cloudBackupDao, socRecRelationshipsRepository = socRecRelationshipsRepository, cloudStoreAccountRepository = cloudStoreAccountRepository, fullAccountCloudBackupCreator = fullAccountCloudBackupCreator, cloudBackupRepository = cloudBackupRepository ) val repairMobileKeyBackupUiStateMachine = RepairCloudBackupStateMachineImpl( cloudSignInStateMachine = cloudSignInUiStateMachine, cloudBackupDao = cloudBackupDao, cloudBackupRepository = cloudBackupRepository, cloudBackupHealthRepository = cloudBackupHealthRepository, deviceInfoProvider = appComponent.deviceInfoProvider, csekGenerator = csekGenerator, nfcSessionUIStateMachine = nfcSessionUIStateMachine, csekDao = csekDao, fullAccountCloudBackupCreator = fullAccountCloudBackupCreator, socRecRelationshipsRepository = socRecRelationshipsRepository, emergencyAccessKitPdfGenerator = emergencyAccessKitPdfGenerator, emergencyAccessKitRepository = emergencyAccessKitRepository, inAppBrowserNavigator = inAppBrowserNavigator ) val hardwareRecoveryStatusCardUiStateMachine = HardwareRecoveryStatusCardUiStateMachineImpl( clock = appComponent.clock, durationFormatter = durationFormatter ) val transactionListStateMachine = TransactionListUiStateMachineImpl( transactionItemUiStateMachine = TransactionItemUiStateMachineImpl( currencyConverter = currencyConverter, dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, moneyDisplayFormatter = moneyDisplayFormatter ) ) val spendingLimitDao = SpendingLimitDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val spendingLimitService = MobilePaySpendingLimitServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val mobilePayDisabler = MobilePayDisablerImpl( spendingLimitDao = spendingLimitDao, spendingLimitService = spendingLimitService ) val mobilePayBalanceService = MobilePayBalanceServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, fiatCurrencyDao = appComponent.fiatCurrencyDao ) val mobilePayStatusProvider = MobilePayStatusProviderImpl( spendingLimitDao = spendingLimitDao, mobilePayBalanceService = mobilePayBalanceService, uuidGenerator = appComponent.uuidGenerator, appSpendingWalletProvider = appComponent.appSpendingWalletProvider ) val moneyAmountUiStateMachine = MoneyAmountUiStateMachineImpl( currencyConverter = currencyConverter, moneyDisplayFormatter = moneyDisplayFormatter ) val moneyInputFormatter = MoneyInputFormatterImpl( decimalSeparatorProvider = decimalSeparatorProvider, doubleFormatter = doubleFormatter, moneyFormatterDefinitions = moneyFormatterDefinitions ) val moneyAmountEntryUiStateMachine = MoneyAmountEntryUiStateMachineImpl( moneyInputFormatter = moneyInputFormatter, moneyDisplayFormatter = moneyDisplayFormatter ) val moneyCalculatorUiStateMachine = MoneyCalculatorUiStateMachineImpl( amountCalculator = amountCalculator, bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, currencyConverter = currencyConverter, moneyAmountEntryUiStateMachine = moneyAmountEntryUiStateMachine, decimalNumberCreator = decimalNumberCreator, doubleFormatter = doubleFormatter ) val mobilePaySpendingPolicy = MobilePaySpendingPolicyImpl() val transferAmountEntryUiStateMachine = TransferAmountEntryUiStateMachineImpl( currencyConverter = currencyConverter, moneyCalculatorUiStateMachine = moneyCalculatorUiStateMachine, mobilePaySpendingPolicy = mobilePaySpendingPolicy, moneyDisplayFormatter = moneyDisplayFormatter ) val transactionDetailsCardUiStateMachine = TransactionDetailsCardUiStateMachineImpl( currencyConverter = currencyConverter, moneyDisplayFormatter = moneyDisplayFormatter ) val transferInitiatedUiStateMachine = TransferInitiatedUiStateMachineImpl( transactionDetailsCardUiStateMachine = transactionDetailsCardUiStateMachine ) val refreshAuthTokensStateMachine = RefreshAuthTokensUiStateMachineImpl( authTokensRepository = appComponent.authTokensRepository ) val proofOfPossessionNfcStateMachine = ProofOfPossessionNfcStateMachineImpl( nfcSessionUIStateMachine = nfcSessionUIStateMachine, refreshAuthTokensUiStateMachine = refreshAuthTokensStateMachine ) val fiatMobilePayConfigurationDao = FiatMobilePayConfigurationDaoImpl(appComponent.bitkeyDatabaseProvider) val fiatMobilePayConfigurationService = FiatMobilePayConfigurationServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, fiatCurrencyDao = appComponent.fiatCurrencyDao ) val fiatMobilePayConfigurationRepository = FiatMobilePayConfigurationRepositoryImpl( fiatMobilePayConfigurationDao = fiatMobilePayConfigurationDao, fiatMobilePayConfigurationService = fiatMobilePayConfigurationService ) val spendingLimitPickerUiStateMachine = SpendingLimitPickerUiStateMachineImpl( currencyConverter = currencyConverter, fiatMobilePayConfigurationRepository = fiatMobilePayConfigurationRepository, moneyDisplayFormatter = moneyDisplayFormatter, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine ) val registerWatchAddressQueue = RegisterWatchAddressQueueImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val registerWatchAddressService = RegisterWatchAddressServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val registerWatchAddressSender = RegisterWatchAddressSenderImpl(registerWatchAddressService) private val registerWatchAddressProcessor = ProcessorImpl( queue = registerWatchAddressQueue, processor = registerWatchAddressSender, retryFrequency = 1.minutes, retryBatchSize = 1 ) val addressQrCodeUiStateMachine = AddressQrCodeUiStateMachineImpl( clipboard = clipboard, delayer = appComponent.delayer, sharingManager = sharingManager, bitcoinInvoiceUrlEncoder = bitcoinInvoiceUrlEncoder ) val notificationPermissionRequester = NotificationPermissionRequesterImpl( pushNotificationPermissionStatusProvider = appComponent.pushNotificationPermissionStatusProvider ) val enableNotificationsUiStateMachine = EnableNotificationsUiStateMachineImpl( notificationPermissionRequester = notificationPermissionRequester, permissionChecker = appComponent.permissionChecker, eventTracker = appComponent.eventTracker ) val verificationCodeInputStateMachine = VerificationCodeInputStateMachineImpl( clock = appComponent.clock, durationFormatter = durationFormatter, eventTracker = appComponent.eventTracker ) val recoveryNotificationVerificationUiStateMachine = RecoveryNotificationVerificationUiStateMachineImpl( verificationCodeInputStateMachine = verificationCodeInputStateMachine ) val initiatingLostAppRecoveryUiStateMachineImpl = InitiatingLostAppRecoveryUiStateMachineImpl( nfcSessionUIStateMachine = nfcSessionUIStateMachine, enableNotificationsUiStateMachine = enableNotificationsUiStateMachine, recoveryNotificationVerificationUiStateMachine = recoveryNotificationVerificationUiStateMachine ) val accessCloudBackupUiStateMachine = AccessCloudBackupUiStateMachineImpl( cloudBackupRepository = cloudBackupRepository, cloudSignInUiStateMachine = cloudSignInUiStateMachine, rectifiableErrorHandlingUiStateMachine = rectifiableErrorHandlingUiStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider, inAppBrowserNavigator = inAppBrowserNavigator ) private val cloudBackupV2Restorer = CloudBackupV2RestorerImpl( csekDao = csekDao, symmetricKeyEncryptor = symmetricKeyEncryptor, appPrivateKeyDao = appComponent.appPrivateKeyDao, socRecKeysDao = socRecKeysDao, uuidGenerator = appComponent.uuidGenerator ) val cloudBackupRestorer = FullAccountCloudBackupRestorerImpl( cloudBackupV2Restorer = cloudBackupV2Restorer ) val challengeCodeFormatter = ChallengeCodeFormatterImpl() val socRecPendingChallengeDao = SocRecStartedChallengeDaoImpl(appComponent.bitkeyDatabaseProvider) val socRecChallengeRepository = SocRecChallengeRepositoryImpl( socRec = socialRecoveryServiceImpl, socRecCodeBuilder = pakeCodeBuilder, socRecCrypto = socRecCrypto, socRecFake = socialRecoveryServiceFake, socRecStartedChallengeDao = socRecPendingChallengeDao, socRecStartedChallengeAuthenticationDao = socRecStartedChallengeAuthenticationDao ) val recoveryChallengeUiStateMachine = RecoveryChallengeUiStateMachineImpl( crypto = socRecCrypto, enableNotificationsUiStateMachine = enableNotificationsUiStateMachine, deviceTokenManager = appComponent.deviceTokenManager, challengeCodeFormatter = challengeCodeFormatter, permissionChecker = appComponent.permissionChecker ) val sweepUiStateMachine = SweepUiStateMachineImpl( nfcSessionUIStateMachine = nfcSessionUIStateMachine, moneyAmountUiStateMachine = moneyAmountUiStateMachine ) val completingRecoveryUiStateMachine = CompletingRecoveryUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, fullAccountCloudSignInAndBackupUiStateMachine = fullAccountCloudSignInAndBackupUiStateMachine, sweepUiStateMachine = sweepUiStateMachine, nfcSessionUIStateMachine = nfcSessionUIStateMachine ) val recoveryInProgressUiStateMachine = RecoveryInProgressUiStateMachineImpl( completingRecoveryUiStateMachine, proofOfPossessionNfcStateMachine, durationFormatter, appComponent.clock, eventTracker = appComponent.eventTracker, recoveryNotificationVerificationUiStateMachine = recoveryNotificationVerificationUiStateMachine ) val addingTcsUiStateMachine = AddingTrustedContactUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, clipboard = clipboard, sharingManager = sharingManager, eventTracker = appComponent.eventTracker ) val reinviteTrustedContactUiStateMachine = ReinviteTrustedContactUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, clipboard = clipboard, sharingManager = sharingManager ) val removeTrustedContactUiStateMachine = RemoveTrustedContactUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, clock = appComponent.clock ) val inviteCodeLoader = InviteCodeLoaderImpl( socRecEnrollmentAuthenticationDao = socRecEnrollmentAuthenticationDao, recoveryCodeBuilder = pakeCodeBuilder ) val viewingInvitationUiStateMachine = ViewingInvitationUiStateMachineImpl( removeTrustedContactsUiStateMachine = removeTrustedContactUiStateMachine, reinviteTrustedContactUiStateMachine = reinviteTrustedContactUiStateMachine, sharingManager = sharingManager, clock = appComponent.clock, inviteCodeLoader = inviteCodeLoader ) val viewingRecoveryContactUiStateMachine = ViewingRecoveryContactUiStateMachineImpl( removeTrustedContactUiStateMachine = removeTrustedContactUiStateMachine ) val viewingProtectedCustomerUiStateMachine = ViewingProtectedCustomerUiStateMachineImpl() val helpingWithRecoveryUiStateMachine = HelpingWithRecoveryUiStateMachineImpl( delayer = appComponent.delayer, socialChallengeVerifier = SocialChallengeVerifierImpl( socRecChallengeRepository = socRecChallengeRepository, socRecCrypto = socRecCrypto, socialRecoveryCodeBuilder = pakeCodeBuilder ), socRecKeysRepository = socRecKeysRepository ) val listingTcsUiStateMachine = ListingTrustedContactsUiStateMachineImpl( viewingRecoveryContactUiStateMachine = viewingRecoveryContactUiStateMachine, viewingInvitationUiStateMachine = viewingInvitationUiStateMachine, viewingProtectedCustomerUiStateMachine = viewingProtectedCustomerUiStateMachine, helpingWithRecoveryUiStateMachine = helpingWithRecoveryUiStateMachine, clock = appComponent.clock ) val trustedContactEnrollmentUiStateMachine = TrustedContactEnrollmentUiStateMachineImpl( deviceInfoProvider = appComponent.deviceInfoProvider, socRecKeysRepository = socRecKeysRepository, eventTracker = appComponent.eventTracker ) val trustedContactManagementUiStateMachine = TrustedContactManagementUiStateMachineImpl( addingTrustedContactUiStateMachine = addingTcsUiStateMachine, listingTrustedContactsUiStateMachine = listingTcsUiStateMachine, trustedContactEnrollmentUiStateMachine = trustedContactEnrollmentUiStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider ) val countryCodeGuesser = CountryCodeGuesserImpl( localeCountryCodeProvider = appComponent.localeCountryCodeProvider, telephonyCountryCodeProvider = telephonyCountryCodeProvider ) val phoneNumberValidator = PhoneNumberValidatorImpl( countryCodeGuesser = countryCodeGuesser, phoneNumberLibBindings = phoneNumberLibBindings ) val notificationTouchpointDao = NotificationTouchpointDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider, phoneNumberValidator = phoneNumberValidator ) val notificationTouchpointService = NotificationTouchpointServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, phoneNumberValidator = phoneNumberValidator ) val notificationsPreferencesCachedProvider = NotificationsPreferencesCachedProviderImpl( notificationTouchpointService = notificationTouchpointService, keyValueStoreFactory = appComponent.keyValueStoreFactory ) val upgradeAccountService = UpgradeAccountServiceImpl(appComponent.f8eHttpClient) val fullAccountCreator = FullAccountCreatorImpl( keyboxDao = appComponent.keyboxDao, createFullAccountService = createAccountService, accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, deviceTokenManager = appComponent.deviceTokenManager, uuidGenerator = appComponent.uuidGenerator, notificationTouchpointService = notificationTouchpointService, notificationTouchpointDao = notificationTouchpointDao ) val onboardingKeyboxStepStateDao = OnboardingKeyboxStepStateDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val phoneNumberFormatter = PhoneNumberFormatterImpl( phoneNumberLibBindings = phoneNumberLibBindings ) val phoneNumberInputStateMachine = PhoneNumberInputUiStateMachineImpl( phoneNumberFormatter = phoneNumberFormatter, phoneNumberValidator = phoneNumberValidator ) val emailValidator = EmailValidatorImpl() val emailInputStateMachine = EmailInputUiStateMachineImpl( emailValidator = emailValidator ) val uiErrorHintProvider = UiErrorHintsProviderImpl( keystoreFactory = appComponent.secureStoreFactory, appScope = appComponent.appCoroutineScope ) val notificationTouchpointInputAndVerificationUiStateMachine = NotificationTouchpointInputAndVerificationUiStateMachineImpl( delayer = appComponent.delayer, emailInputUiStateMachine = emailInputStateMachine, notificationTouchpointDao = notificationTouchpointDao, notificationTouchpointService = notificationTouchpointService, phoneNumberInputUiStateMachine = phoneNumberInputStateMachine, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, uiErrorHintSubmitter = uiErrorHintProvider, verificationCodeInputStateMachine = verificationCodeInputStateMachine ) val pushItemModelProviderV2 = RecoveryChannelsSetupPushItemModelProviderImpl( pushNotificationPermissionStatusProvider = appComponent.pushNotificationPermissionStatusProvider, systemSettingsLauncher = systemSettingsLauncher ) val notificationPreferencesUiStateMachine = NotificationPreferencesUiStateMachineImpl( permissionChecker = appComponent.permissionChecker, notificationsPreferencesCachedProvider = notificationsPreferencesCachedProvider, systemSettingsLauncher = systemSettingsLauncher, notificationPermissionRequester = notificationPermissionRequester, inAppBrowserNavigator = inAppBrowserNavigator, eventTracker = appComponent.eventTracker ) val recoveryChannelSettingsUiStateMachineImpl = RecoveryChannelSettingsUiStateMachineImpl( permissionChecker = appComponent.permissionChecker, notificationsPreferencesCachedProvider = notificationsPreferencesCachedProvider, notificationTouchpointInputAndVerificationUiStateMachine = notificationTouchpointInputAndVerificationUiStateMachine, inAppBrowserNavigator = inAppBrowserNavigator, telephonyCountryCodeProvider = telephonyCountryCodeProvider, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, systemSettingsLauncher = systemSettingsLauncher, eventTracker = appComponent.eventTracker, notificationPermissionRequester = notificationPermissionRequester, uiErrorHintsProvider = uiErrorHintProvider ) val notificationPreferencesSetupUiStateMachineV2 = NotificationPreferencesSetupUiStateMachineV2Impl( eventTracker = appComponent.eventTracker, notificationPermissionRequester = notificationPermissionRequester, notificationTouchpointInputAndVerificationUiStateMachine = notificationTouchpointInputAndVerificationUiStateMachine, notificationTouchpointDao = notificationTouchpointDao, notificationPreferencesUiStateMachine = notificationPreferencesUiStateMachine, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao, pushItemModelProvider = pushItemModelProviderV2, inAppBrowserNavigator = inAppBrowserNavigator, telephonyCountryCodeProvider = telephonyCountryCodeProvider, uiErrorHintsProvider = uiErrorHintProvider ) val notificationsSettingsStateMachine = NotificationsSettingsUiStateMachineImpl( notificationTouchpointInputAndVerificationUiStateMachine = notificationTouchpointInputAndVerificationUiStateMachine ) val onboardingKeyboxSealedCsekDao = OnboardingKeyboxSealedCsekDaoImpl( encryptedKeyValueStoreFactory = appComponent.secureStoreFactory ) val onboardingKeyboxHwAuthPublicKeyDao = OnboardingKeyboxHardwareKeysDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val onboardingService = OnboardingServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val listKeysetsService = ListKeysetsServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, uuidGenerator = appComponent.uuidGenerator ) val pairingTransactionProvider = PairingTransactionProviderImpl( csekGenerator = csekGenerator, csekDao = csekDao, uuidGenerator = appComponent.uuidGenerator, appInstallationDao = appComponent.appInstallationDao, hardwareAttestation = appComponent.hardwareAttestation ) val helpCenterUiStateMachine = HelpCenterUiStateMachineImpl( inAppBrowserNavigator = inAppBrowserNavigator ) val pairNewHardwareUiStateMachine = PairNewHardwareUiStateMachineImpl( eventTracker = appComponent.eventTracker, pairingTransactionProvider = pairingTransactionProvider, nfcSessionUIStateMachine = nfcSessionUIStateMachine, helpCenterUiStateMachine = helpCenterUiStateMachine ) private val createKeyboxUiStateMachine = CreateKeyboxUiStateMachineImpl( pairNewHardwareUiStateMachine = pairNewHardwareUiStateMachine ) val fiatCurrencyDefinitionService = FiatCurrencyDefinitionServiceImpl(appComponent.f8eHttpClient) val fiatCurrencyRepository = FiatCurrencyRepositoryImpl( fiatCurrencyDao = appComponent.fiatCurrencyDao, fiatCurrencyDefinitionService = fiatCurrencyDefinitionService ) val currencyPreferenceUiStateMachine = CurrencyPreferenceUiStateMachineImpl( currencyConverter = currencyConverter, fiatCurrencyRepository = fiatCurrencyRepository, moneyDisplayFormatter = moneyDisplayFormatter ) val onboardKeyboxUiStateMachine = OnboardKeyboxUiStateMachineImpl( fullAccountCloudSignInAndBackupUiStateMachine = fullAccountCloudSignInAndBackupUiStateMachine, notificationPreferencesSetupUiStateMachineV2 = notificationPreferencesSetupUiStateMachineV2 ) val deleteOnboardingFullAccountService = DeleteOnboardingFullAccountServiceImpl(appComponent.f8eHttpClient) val onboardingFullAccountDeleter = OnboardingFullAccountDeleterImpl( accountRepository = appComponent.accountRepository, keyboxDao = appComponent.keyboxDao, deleteOnboardingFullAccountService = deleteOnboardingFullAccountService ) val liteToFullAccountUpgrader = LiteToFullAccountUpgraderImpl( keyboxDao = appComponent.keyboxDao, accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, deviceTokenManager = appComponent.deviceTokenManager, upgradeAccountService = upgradeAccountService, uuidGenerator = appComponent.uuidGenerator ) val liteAccountCloudBackupRestorer = LiteAccountCloudBackupRestorerImpl( appPrivateKeyDao = appComponent.appPrivateKeyDao, socRecKeysDao = socRecKeysDao, accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, cloudBackupDao = cloudBackupDao, accountRepository = appComponent.accountRepository ) val liteAccountBackupToFullAccountUpgrader = LiteAccountBackupToFullAccountUpgraderImpl( liteAccountCloudBackupRestorer = liteAccountCloudBackupRestorer, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore, onboardingKeyboxHardwareKeysDao = onboardingKeyboxHwAuthPublicKeyDao, uuidGenerator = appComponent.uuidGenerator, liteToFullAccountUpgrader = liteToFullAccountUpgrader ) private val replaceWithLiteAccountRestoreUiStateMachine = ReplaceWithLiteAccountRestoreUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, onboardingFullAccountDeleter = onboardingFullAccountDeleter, liteAccountBackupToFullAccountUpgrader = liteAccountBackupToFullAccountUpgrader ) val overwriteFullAccountCloudBackupUiStateMachine = OverwriteFullAccountCloudBackupUiStateMachineImpl( onboardingFullAccountDeleter = onboardingFullAccountDeleter, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine ) private val createAccountUiStateMachine = CreateAccountUiStateMachineImpl( createKeyboxUiStateMachine = createKeyboxUiStateMachine, onboardKeyboxUiStateMachine = onboardKeyboxUiStateMachine, replaceWithLiteAccountRestoreUiStateMachine = replaceWithLiteAccountRestoreUiStateMachine, overwriteFullAccountCloudBackupUiStateMachine = overwriteFullAccountCloudBackupUiStateMachine ) val fwupNfcSessionUiStateMachine = FwupNfcSessionUiStateMachineImpl( deviceInfoProvider = appComponent.deviceInfoProvider, enableNfcNavigator = enableNfcNavigator, eventTracker = appComponent.eventTracker, delayer = appComponent.delayer, fwupProgressCalculator = appComponent.fwupProgressCalculator, nfcReaderCapabilityProvider = nfcReaderCapabilityProvider, nfcTransactor = nfcTransactor ) val fwupNfcUiStateMachine = FwupNfcUiStateMachineImpl( deviceInfoProvider = appComponent.deviceInfoProvider, fwupNfcSessionUiStateMachine = fwupNfcSessionUiStateMachine, deviceOs = appComponent.deviceOs ) val infoOptionsStateMachine = InfoOptionsUiStateMachineImpl( appVariant = appComponent.appVariant, accountRepository = appComponent.accountRepository, clipboard = clipboard, appInstallationDao = appComponent.appInstallationDao, appVersion = appComponent.appVersion, osVersionInfoProvider = appComponent.osVersionInfoProvider ) val bitkeyOptionsStateMachine = BitkeyDeviceOptionsUiStateMachineImpl( appVariant = appComponent.appVariant ) val lightningOptionsStateMachine = LightningOptionsUiStateMachineImpl( lightningPreference = lightningPreference ) val firmwareMetadataStateMachine = FirmwareMetadataUiStateMachineImpl( firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, firmwareMetadataDao = appComponent.firmwareMetadataDao, nfcSessionUIStateMachine = nfcSessionUIStateMachine ) val accountConfigStateMachine = AccountConfigUiStateMachineImpl( appVariant = appComponent.appVariant ) val f8eEnvironmentPickerStateMachine = F8eEnvironmentPickerUiStateMachineImpl( appVariant = appComponent.appVariant ) val bitcoinNetworkPickerStateMachine = BitcoinNetworkPickerUiStateMachineImpl( appVariant = appComponent.appVariant ) val mobilePayLimitSetter = MobilePayLimitSetterImpl( spendingLimitDao = spendingLimitDao, mobilePaySpendingLimitService = spendingLimitService ) val setSpendingLimitUiStateMachine = SetSpendingLimitUiStateMachineImpl( spendingLimitPickerUiStateMachine = spendingLimitPickerUiStateMachine, timeZoneProvider = timeZoneProvider, moneyDisplayFormatter = moneyDisplayFormatter ) val spendingLimitCardStateMachine = SpendingLimitCardUiStateMachineImpl( moneyDisplayFormatter = moneyDisplayFormatter, timeZoneFormatter = timeZoneFormatter, localeIdentifierProvider = localeIdentifierProvider ) val mobilePayStatusUiStateMachine = MobilePayStatusUiStateMachineImpl( moneyDisplayFormatter = moneyDisplayFormatter, spendingLimitCardUiStateMachine = spendingLimitCardStateMachine ) val analyticOptionsUiStateMachine = AnalyticsOptionsUiStateMachineImpl( appVariant = appComponent.appVariant ) val analyticsStateMachine = AnalyticsUiStateMachineImpl( eventStore = appComponent.eventStore, analyticsTrackingPreference = appComponent.analyticsTrackingPreference ) val logsStateMachine = LogsUiStateMachineImpl( dateTimeFormatter = dateTimeFormatter, logStore = appComponent.logStore, timeZoneProvider = timeZoneProvider ) val connectAndOpenChannelStateMachine = ConnectAndOpenChannelStateMachineImpl( ldkNodeService = appComponent.ldkNodeService, clipboard = clipboard ) val sendReceiveStateMachine = LightningSendReceiveUiStateMachineImpl( ldkNodeService = appComponent.ldkNodeService, lightningInvoiceParser = lightningInvoiceParser, moneyDisplayFormatter = moneyDisplayFormatter ) val lightningStateMachine = LightningDebugMenuUiStateMachineImpl( clipboard = clipboard, connectAndOpenChannelStateMachine = connectAndOpenChannelStateMachine, lightningSendReceiveUiStateMachine = sendReceiveStateMachine, ldkNodeService = appComponent.ldkNodeService ) val delayNotifyHardwareRecoveryStarter = LostHardwareRecoveryStarterImpl( initiateAccountDelayNotifyService = initiateAccountDelayNotifyService, recoveryDao = appComponent.recoveryDao ) val mobilePaySettingsUiStateMachine = MobilePaySettingsUiStateMachineImpl( mobilePayStatusUiStateMachine = mobilePayStatusUiStateMachine, setSpendingLimitUiStateMachine = setSpendingLimitUiStateMachine ) val transactionPriorityPreference = TransactionPriorityPreferenceImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val feeOptionUiStateMachine = FeeOptionUiStateMachineImpl( currencyConverter = currencyConverter, moneyDisplayFormatter = moneyDisplayFormatter ) val feeOptionListUiStateMachine = FeeOptionListUiStateMachineImpl( feeOptionUiStateMachine = feeOptionUiStateMachine ) val outgoingTransactionDetailRepository = OutgoingTransactionDetailRepositoryImpl( outgoingTransactionDetailDao = appComponent.outgoingTransactionDetailDao ) val transferConfirmationStateMachine = TransferConfirmationUiStateMachineImpl( bitcoinBlockchain = bitcoinBlockchain, mobilePaySigningService = mobilePaySigningService, transactionDetailsCardUiStateMachine = transactionDetailsCardUiStateMachine, nfcSessionUIStateMachine = nfcSessionUIStateMachine, transactionPriorityPreference = transactionPriorityPreference, feeOptionListUiStateMachine = feeOptionListUiStateMachine, appSpendingWalletProvider = appComponent.appSpendingWalletProvider, outgoingTransactionDetailRepository = outgoingTransactionDetailRepository ) val bitcoinTransactionFeeEstimator = BitcoinTransactionFeeEstimatorImpl( bitcoinFeeRateEstimator = bitcoinFeeRateEstimator, appSpendingWalletProvider = appComponent.appSpendingWalletProvider, datadogRumMonitor = datadogRumMonitor ) val feeSelectionStateMachine = FeeSelectionUiStateMachineImpl( bitcoinTransactionFeeEstimator = bitcoinTransactionFeeEstimator, transactionPriorityPreference = transactionPriorityPreference, feeOptionListUiStateMachine = feeOptionListUiStateMachine, transactionBaseCalculator = BitcoinTransactionBaseCalculatorImpl() ) val sendStateMachine = SendUiStateMachineImpl( bitcoinAddressRecipientUiStateMachine = bitcoinAddressRecipientStateMachine, transferAmountEntryUiStateMachine = transferAmountEntryUiStateMachine, transferConfirmationUiStateMachine = transferConfirmationStateMachine, transferInitiatedUiStateMachine = transferInitiatedUiStateMachine, bitcoinQrCodeUiScanStateMachine = bitcoinQrCodeScanStateMachine, permissionUiStateMachine = permissionStateMachine, feeSelectionUiStateMachine = feeSelectionStateMachine, exchangeRateSyncer = exchangeRateSyncer, clock = appComponent.clock, networkReachabilityProvider = appComponent.networkReachabilityProvider ) val transactionDetailStateMachine = build.wallet.statemachine.transactions.TransactionDetailsUiStateMachineImpl( bitcoinExplorer = bitcoinExplorer, bitcoinTransactionBumpabilityChecker = BitcoinTransactionBumpabilityCheckerImpl( sweepChecker = BitcoinTransactionSweepCheckerImpl() ), bitcoinTransactionFeeEstimator = bitcoinTransactionFeeEstimator, clock = appComponent.clock, currencyConverter = currencyConverter, dateTimeFormatter = dateTimeFormatter, durationFormatter = durationFormatter, eventTracker = appComponent.eventTracker, feeBumpEnabled = appComponent.feeBumpIsAvailableFeatureFlag, moneyDisplayFormatter = moneyDisplayFormatter, sendUiStateMachine = sendStateMachine, timeZoneProvider = timeZoneProvider ) val homeUiBottomSheetDao = HomeUiBottomSheetDaoImpl(appComponent.bitkeyDatabaseProvider) val authKeyRotationAttemptDao = AuthKeyRotationAttemptDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val appDataDeleter = AppDataDeleterImpl( appVariant = appComponent.appVariant, appPrivateKeyDao = appComponent.appPrivateKeyDao, accountRepository = appComponent.accountRepository, authTokenDao = appComponent.authTokenDao, gettingStartedTaskDao = gettingStartedTaskDao, keyboxDao = appComponent.keyboxDao, notificationTouchpointDao = notificationTouchpointDao, onboardingKeyboxSealedCsekDao = onboardingKeyboxSealedCsekDao, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao, onboardingKeyboxHardwareKeysDao = onboardingKeyboxHwAuthPublicKeyDao, spendingLimitDao = spendingLimitDao, outgoingTransactionDetailDao = appComponent.outgoingTransactionDetailDao, fwupDataDao = appComponent.fwupDataDao, firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, firmwareMetadataDao = appComponent.firmwareMetadataDao, transactionPriorityPreference = transactionPriorityPreference, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore, fiatCurrencyPreferenceRepository = appComponent.fiatCurrencyPreferenceRepository, homeUiBottomSheetDao = homeUiBottomSheetDao, bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, cloudBackupDao = cloudBackupDao, socRecKeysDao = socRecKeysDao, socRecRelationshipsRepository = socRecRelationshipsRepository, socRecStartedChallengeDao = socRecPendingChallengeDao, csekDao = csekDao, authKeyRotationAttemptDao = authKeyRotationAttemptDao, recoveryDao = appComponent.recoveryDao, authSignatureStatusProvider = appComponent.f8eAuthSignatureStatusProvider ) val deviceUpdateCardUiStateMachine = DeviceUpdateCardUiStateMachineImpl( eventTracker = appComponent.eventTracker ) val gettingStartedCardStateMachine = GettingStartedCardUiStateMachineImpl( gettingStartedTaskDao = gettingStartedTaskDao, eventTracker = appComponent.eventTracker ) val pendingInvitationsCardUiStateMachine = RecoveryContactCardsUiStateMachineImpl( clock = appComponent.clock ) val recoveryIncompleteDao = RecoveryIncompleteDaoImpl(appComponent.bitkeyDatabaseProvider) val postSocRecTaskRepository = PostSocRecTaskRepositoryImpl(recoveryIncompleteDao) val replaceHardwareCardUiStateMachine = ReplaceHardwareCardUiStateMachineImpl( postSocRecTaskRepository = postSocRecTaskRepository ) val cloudBackupHealthCardUiStateMachine = CloudBackupHealthCardUiStateMachineImpl( cloudBackupHealthRepository = cloudBackupHealthRepository ) val cardListStateMachine = MoneyHomeCardsUiStateMachineImpl( deviceUpdateCardUiStateMachine = deviceUpdateCardUiStateMachine, gettingStartedCardUiStateMachine = gettingStartedCardStateMachine, hardwareRecoveryStatusCardUiStateMachine = hardwareRecoveryStatusCardUiStateMachine, recoveryContactCardsUiStateMachine = pendingInvitationsCardUiStateMachine, replaceHardwareCardUiStateMachine = replaceHardwareCardUiStateMachine, cloudBackupHealthCardUiStateMachine = cloudBackupHealthCardUiStateMachine ) val deepLinkHandler = DeepLinkHandlerImpl( platformContext = appComponent.platformContext ) val partnershipsTransactionsDao = PartnershipTransactionsDaoImpl(appComponent.bitkeyDatabaseProvider) val partnershipTransactionsStatusRepository = PartnershipTransactionsRepositoryImpl( dao = partnershipsTransactionsDao, uuidGenerator = appComponent.uuidGenerator, clock = appComponent.clock ) val partnershipsTransferUiStateMachine = PartnershipsTransferUiStateMachineImpl( getTransferPartnerListService = GetTransferPartnerListServiceImpl( countryCodeGuesser, appComponent.f8eHttpClient ), getTransferRedirectService = GetTransferRedirectServiceImpl(appComponent.f8eHttpClient), partnershipsRepository = partnershipTransactionsStatusRepository ) val partnershipsPurchaseUiStateMachine = PartnershipsPurchaseUiStateMachineImpl( moneyDisplayFormatter = moneyDisplayFormatter, getPurchaseOptionsService = GetPurchaseOptionsServiceImpl( countryCodeGuesser, appComponent.f8eHttpClient ), getPurchaseQuoteListService = GetPurchaseQuoteListServiceImpl( countryCodeGuesser, appComponent.f8eHttpClient ), getPurchaseRedirectService = GetPurchaseRedirectServiceImpl(appComponent.f8eHttpClient), partnershipsRepository = partnershipTransactionsStatusRepository ) val addBitcoinUiStateMachine = AddBitcoinUiStateMachineImpl( partnershipsTransferUiStateMachine = partnershipsTransferUiStateMachine, partnershipsPurchaseUiStateMachine = partnershipsPurchaseUiStateMachine ) val initiatingLostHardwareRecoveryUiStateMachine = InitiatingLostHardwareRecoveryUiStateMachineImpl( pairNewHardwareUiStateMachine = pairNewHardwareUiStateMachine, eventTracker = appComponent.eventTracker, recoveryNotificationVerificationUiStateMachine = recoveryNotificationVerificationUiStateMachine, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine ) val lostHardwareRecoveryUiStateMachine = LostHardwareRecoveryUiStateMachineImpl( initiatingLostHardwareRecoveryUiStateMachine = initiatingLostHardwareRecoveryUiStateMachine, recoveryInProgressUiStateMachine = recoveryInProgressUiStateMachine ) val rotateAuthKeysService: RotateAuthKeysService = RotateAuthKeysServiceImpl( f8eHttpClient = appComponent.f8eHttpClient, signer = appComponent.appAuthKeyMessageSigner ) val trustedContactKeyAuthenticator = TrustedContactKeyAuthenticatorImpl( socRecRelationshipsRepository = socRecRelationshipsRepository, socRecRelationshipsDao = socRecRelationshipsDao, socRecEnrollmentAuthenticationDao = socRecEnrollmentAuthenticationDao, socRecCrypto = socRecCrypto, endorseTrustedContactsServiceProvider = { socialRecoveryServiceProvider.get() } ) val authKeyRotationManager: AuthKeyRotationManager = AuthKeyRotationManagerImpl( authKeyRotationAttemptDao = authKeyRotationAttemptDao, rotateAuthKeysService = rotateAuthKeysService, keyboxDao = appComponent.keyboxDao, accountAuthenticator = appComponent.accountAuthenticator, bestEffortFullAccountCloudBackupUploader = bestEffortFullAccountCloudBackupUploader, socRecRelationshipsRepository = socRecRelationshipsRepository, trustedContactKeyAuthenticator = trustedContactKeyAuthenticator ) val rotateAuthUIStateMachine = RotateAuthKeyUIStateMachineImpl( appKeysGenerator = appComponent.appKeysGenerator, proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, authKeyRotationManager = authKeyRotationManager, inAppBrowserNavigator = inAppBrowserNavigator ) val inviteTrustedContactFlowUiStateMachine = InviteTrustedContactFlowUiStateMachineImpl( addingTrustedContactUiStateMachine = addingTcsUiStateMachine, gettingStartedTaskDao = gettingStartedTaskDao, socRecRelationshipsRepository = socRecRelationshipsRepository ) val appFunctionalityStatusProvider = AppFunctionalityStatusProviderImpl( networkReachabilityEventDao = appComponent.networkReachabilityEventDao, networkReachabilityProvider = appComponent.networkReachabilityProvider, f8eAuthSignatureStatusProvider = appComponent.f8eAuthSignatureStatusProvider, appVariant = appComponent.appVariant ) val moneyHomeViewingBalanceUiStateMachine = MoneyHomeViewingBalanceUiStateMachineImpl( addBitcoinUiStateMachine = addBitcoinUiStateMachine, appFunctionalityStatusProvider = appFunctionalityStatusProvider, deepLinkHandler = deepLinkHandler, moneyDisplayFormatter = moneyDisplayFormatter, gettingStartedTaskDao = gettingStartedTaskDao, moneyHomeCardsUiStateMachine = cardListStateMachine, transactionListUiStateMachine = transactionListStateMachine, viewingInvitationUiStateMachine = viewingInvitationUiStateMachine, viewingRecoveryContactUiStateMachine = viewingRecoveryContactUiStateMachine, eventTracker = appComponent.eventTracker ) val customAmountEntryUiStateMachine = CustomAmountEntryUiStateMachineImpl( moneyCalculatorUiStateMachine = moneyCalculatorUiStateMachine, moneyDisplayFormatter = moneyDisplayFormatter ) val moneyHomeStateMachine = MoneyHomeUiStateMachineImpl( addressQrCodeUiStateMachine = addressQrCodeUiStateMachine, sendUiStateMachine = sendStateMachine, transactionDetailsUiStateMachine = transactionDetailStateMachine, transactionListUiStateMachine = transactionListStateMachine, fwupNfcUiStateMachine = fwupNfcUiStateMachine, lostHardwareUiStateMachine = lostHardwareRecoveryUiStateMachine, setSpendingLimitUiStateMachine = setSpendingLimitUiStateMachine, inviteTrustedContactFlowUiStateMachine = inviteTrustedContactFlowUiStateMachine, inAppBrowserNavigator = inAppBrowserNavigator, clipboard = clipboard, paymentDataParser = paymentDataParser, recoveryIncompleteRepository = postSocRecTaskRepository, moneyHomeViewingBalanceUiStateMachine = moneyHomeViewingBalanceUiStateMachine, customAmountEntryUiStateMachine = customAmountEntryUiStateMachine, repairCloudBackupStateMachine = repairMobileKeyBackupUiStateMachine ) val appStateDeleterOptionsUiStateMachine = AppStateDeleterOptionsUiStateMachineImpl(appComponent.appVariant) val booleanFlagItemStateMachine = BooleanFlagItemUiStateMachineImpl() val featureFlagsStateMachine = FeatureFlagsStateMachineImpl( allBooleanFeatureFlags = appComponent.allFeatureFlags, booleanFlagItemUiStateMachine = booleanFlagItemStateMachine, featureFlagSyncer = appComponent.featureFlagSyncer ) val featureFlagsOptionsStateMachine = FeatureFlagsOptionsUiStateMachineImpl( appVariant = appComponent.appVariant ) val cloudBackupDeleter = CloudBackupDeleterImpl( appVariant = appComponent.appVariant, cloudStoreAccountRepository = cloudStoreAccountRepository, cloudBackupRepository = cloudBackupRepository ) val onboardingAppKeyDeletionUiStateMachine = OnboardingAppKeyDeletionUiStateMachineImpl( appVariant = appComponent.appVariant, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore ) val networkingDebugConfigPickerUiStateMachine = NetworkingDebugConfigPickerUiStateMachineImpl( appComponent.networkingDebugConfigRepository ) val onboardingConfigStateMachine = OnboardingConfigStateMachineImpl( appVariant = appComponent.appVariant ) val debugMenuListStateMachine = DebugMenuListStateMachineImpl( accountConfigUiStateMachine = accountConfigStateMachine, appDataDeleter = appDataDeleter, appStateDeleterOptionsUiStateMachine = appStateDeleterOptionsUiStateMachine, appVariant = appComponent.appVariant, analyticsOptionsUiStateMachine = analyticOptionsUiStateMachine, bitcoinNetworkPickerUiStateMachine = bitcoinNetworkPickerStateMachine, bitkeyDeviceOptionsUiStateMachine = bitkeyOptionsStateMachine, cloudBackupDeleter = cloudBackupDeleter, f8eEnvironmentPickerUiStateMachine = f8eEnvironmentPickerStateMachine, featureFlagsOptionsUiStateMachine = featureFlagsOptionsStateMachine, infoOptionsUiStateMachine = infoOptionsStateMachine, onboardingAppKeyDeletionUiStateMachine = onboardingAppKeyDeletionUiStateMachine, onboardingConfigStateMachine = onboardingConfigStateMachine, lightningOptionsUiStateMachine = lightningOptionsStateMachine, cloudSignUiStateMachine = cloudSignInUiStateMachine ) val debugMenuStateMachine = DebugMenuStateMachineImpl( analyticsUiStateMachine = analyticsStateMachine, debugMenuListStateMachine = debugMenuListStateMachine, f8eCustomUrlStateMachine = F8eCustomUrlStateMachineImpl(), featureFlagsStateMachine = featureFlagsStateMachine, firmwareMetadataUiStateMachine = firmwareMetadataStateMachine, fwupNfcUiStateMachine = fwupNfcUiStateMachine, lightningDebugMenuUiStateMachine = lightningStateMachine, logsUiStateMachine = logsStateMachine, networkingDebugConfigPickerUiStateMachine = networkingDebugConfigPickerUiStateMachine, nfcSessionUIStateMachine = nfcSessionUIStateMachine, cloudDevOptionsStateMachine = cloudDevOptionsStateMachine ) val demoModeService = DemoModeServiceImpl( appComponent.f8eHttpClient ) val demoModeCodeEntryUiStateMachine = DemoModeCodeEntryUiStateMachineImpl( delayer = appComponent.delayer, demoModeService = demoModeService ) val demoModeConfigUiStateMachine = DemoModeConfigUiStateMachineImpl( demoModeCodeEntryUiStateMachine = demoModeCodeEntryUiStateMachine ) val customElectrumServerUiStateMachine = CustomElectrumServerUiStateMachineImpl() val setElectrumServerUiStateMachine = SetElectrumServerUiStateMachineImpl( delayer = appComponent.delayer, electrumServerSettingProvider = appComponent.electrumServerSettingProvider, electrumReachability = appComponent.electrumReachability ) val customElectrumServerSettingUiStateMachine = CustomElectrumServerSettingUiStateMachineImpl( customElectrumServerUIStateMachine = customElectrumServerUiStateMachine, setElectrumServerUiStateMachine = setElectrumServerUiStateMachine ) val deviceSettingsUiStateMachine = DeviceSettingsUiStateMachineImpl( lostHardwareRecoveryUiStateMachine = lostHardwareRecoveryUiStateMachine, nfcSessionUIStateMachine = nfcSessionUIStateMachine, fwupNfcUiStateMachine = fwupNfcUiStateMachine, dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, durationFormatter = durationFormatter, firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, appFunctionalityStatusProvider = appFunctionalityStatusProvider ) val customerFeedbackService = SupportTicketServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val supportTicketRepository = SupportTicketRepositoryImpl( supportTicketService = customerFeedbackService, logStore = appComponent.logStore, appInstallationDao = appComponent.appInstallationDao, firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, platformInfoProvider = appComponent.platformInfoProvider, allFeatureFlags = appComponent.allFeatureFlags ) val supportTicketFormValidator = SupportTicketFormValidatorImpl( emailValidator = emailValidator ) val feedbackFormUiStateMachine = FeedbackFormUiStateMachineImpl( delayer = appComponent.delayer, supportTicketRepository = supportTicketRepository, supportTicketFormValidator = supportTicketFormValidator, dateTimeFormatter = dateTimeFormatter, inAppBrowserNavigator = inAppBrowserNavigator ) val feedbackUiStateMachine = FeedbackUiStateMachineImpl( supportTicketRepository = supportTicketRepository, feedbackFormUiStateMachine = feedbackFormUiStateMachine ) val settingsListUiStateMachine = SettingsListUiStateMachineImpl( appFunctionalityStatusProvider = appFunctionalityStatusProvider, cloudBackupHealthRepository = cloudBackupHealthRepository ) val cloudBackupHealthDashboardUiStateMachine = CloudBackupHealthDashboardUiStateMachineImpl( uuidGenerator = appComponent.uuidGenerator, cloudBackupHealthRepository = cloudBackupHealthRepository, dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, repairCloudBackupStateMachine = repairMobileKeyBackupUiStateMachine, cloudBackupDao = cloudBackupDao, emergencyAccessKitPdfGenerator = emergencyAccessKitPdfGenerator, sharingManager = sharingManager ) val settingsStateMachine = SettingsHomeUiStateMachineImpl( mobilePaySettingsUiStateMachine = mobilePaySettingsUiStateMachine, notificationPreferencesUiStateMachine = notificationPreferencesUiStateMachine, notificationsSettingsUiStateMachine = notificationsSettingsStateMachine, recoveryChannelSettingsUiStateMachine = recoveryChannelSettingsUiStateMachineImpl, currencyPreferenceUiStateMachine = currencyPreferenceUiStateMachine, customElectrumServerSettingUiStateMachine = customElectrumServerSettingUiStateMachine, deviceSettingsUiStateMachine = deviceSettingsUiStateMachine, feedbackUiStateMachine = feedbackUiStateMachine, helpCenterUiStateMachine = helpCenterUiStateMachine, trustedContactManagementUiStateMachine = trustedContactManagementUiStateMachine, settingsListUiStateMachine = settingsListUiStateMachine, cloudBackupHealthDashboardUiStateMachine = cloudBackupHealthDashboardUiStateMachine, rotateAuthKeyUIStateMachine = rotateAuthUIStateMachine ) val homeUiBottomSheetStateMachine = HomeUiBottomSheetStateMachineImpl( homeUiBottomSheetDao = homeUiBottomSheetDao ) val currencyChangeMobilePayBottomSheetUpdater = CurrencyChangeMobilePayBottomSheetUpdaterImpl( homeUiBottomSheetDao = homeUiBottomSheetDao ) val homeStatusBannerUiStateMachine = HomeStatusBannerUiStateMachineImpl( appFunctionalityStatusProvider = appFunctionalityStatusProvider, dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, clock = appComponent.clock, eventTracker = appComponent.eventTracker ) val appFunctionalityStatusUiStateMachine = AppFunctionalityStatusUiStateMachineImpl( dateTimeFormatter = dateTimeFormatter, timeZoneProvider = timeZoneProvider, clock = appComponent.clock ) val homeUiStateMachine = HomeUiStateMachineImpl( appFunctionalityStatusUiStateMachine = appFunctionalityStatusUiStateMachine, currencyConverter = currencyConverter, currencyChangeMobilePayBottomSheetUpdater = currencyChangeMobilePayBottomSheetUpdater, homeStatusBannerUiStateMachine = homeStatusBannerUiStateMachine, homeUiBottomSheetStateMachine = homeUiBottomSheetStateMachine, moneyHomeUiStateMachine = moneyHomeStateMachine, settingsHomeUiStateMachine = settingsStateMachine, setSpendingLimitUiStateMachine = setSpendingLimitUiStateMachine, trustedContactEnrollmentUiStateMachine = trustedContactEnrollmentUiStateMachine, socRecRelationshipsRepository = socRecRelationshipsRepository, cloudBackupHealthRepository = cloudBackupHealthRepository, appFunctionalityStatusProvider = appFunctionalityStatusProvider ) val chooseAccountAccessUiStateMachine = ChooseAccountAccessUiStateMachineImpl( appVariant = appComponent.appVariant, demoModeConfigUiStateMachine = demoModeConfigUiStateMachine, debugMenuStateMachine = debugMenuStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider ) val mobilePayDataStateMachine = MobilePayDataStateMachineImpl( mobilePayStatusProvider = mobilePayStatusProvider, mobilePayLimitSetter = mobilePayLimitSetter, mobilePayDisabler = mobilePayDisabler, eventTracker = appComponent.eventTracker, currencyConverter = currencyConverter ) val fullAccountAddressDataStateMachine = FullAccountAddressDataStateMachineImpl( registerWatchAddressProcessor = registerWatchAddressProcessor, appSpendingWalletProvider = appComponent.appSpendingWalletProvider ) val fullAccountTransactionsDataStateMachine = FullAccountTransactionsDataStateMachineImpl() val onboardConfigDao = OnboardingStepSkipConfigDaoImpl( databaseProvider = appComponent.bitkeyDatabaseProvider ) val onboardConfigDataStateMachine = OnboardConfigDataStateMachineImpl( onboardingStepSkipConfigDao = onboardConfigDao ) val notificationTouchpointDataStateMachine = NotificationTouchpointDataStateMachineImpl( notificationTouchpointDao = notificationTouchpointDao, notificationTouchpointService = notificationTouchpointService ) val firmwareDataStateMachine = FirmwareDataStateMachineImpl( firmwareDeviceInfoDao = appComponent.firmwareDeviceInfoDao, fwupDataFetcher = appComponent.fwupDataFetcher, fwupDataDao = appComponent.fwupDataDao ) val recoveryNotificationVerificationService = RecoveryNotificationVerificationServiceImpl( f8eHttpClient = appComponent.f8eHttpClient ) val recoveryNotificationVerificationDataStateMachine = RecoveryNotificationVerificationDataStateMachineImpl( notificationTouchpointService = notificationTouchpointService, recoveryNotificationVerificationService = recoveryNotificationVerificationService ) val initiatingLostAppRecoveryStateMachine = InitiatingLostAppRecoveryDataStateMachineImpl( appKeysGenerator = appKeysGenerator, initiateHardwareAuthService = initiateHardwareAuthService, listKeysetsService = listKeysetsService, lostAppRecoveryInitiator = delayNotifyLostAppRecoveryInitiator, lostAppRecoveryAuthenticator = delayNotifyLostAppRecoveryAuthenticator, recoveryNotificationVerificationDataStateMachine = recoveryNotificationVerificationDataStateMachine, cancelDelayNotifyRecoveryService = cancelDelayNotifyRecoveryService, delayer = appComponent.delayer, uuidGenerator = appComponent.uuidGenerator ) val lostAppRecoveryHaveNotStartedDataStateMachine = LostAppRecoveryHaveNotStartedDataStateMachineImpl( initiatingLostAppRecoveryDataStateMachine = initiatingLostAppRecoveryStateMachine ) val lostAppRecoveryCanceler = RecoveryCancelerImpl( cancelDelayNotifyRecoveryService = cancelDelayNotifyRecoveryService, recoverySyncer = recoverySyncer ) val recoveryAuthCompleter = RecoveryAuthCompleterImpl( appAuthKeyMessageSigner = appComponent.appAuthKeyMessageSigner, completeDelayNotifyService = completeDelayNotifyService, accountAuthenticator = appComponent.accountAuthenticator, recoverySyncer = recoverySyncer, authTokenDao = appComponent.authTokenDao, delayer = appComponent.delayer, socRecRelationshipsRepository = socRecRelationshipsRepository ) val sweepGenerator = SweepGeneratorImpl( listKeysetsService = listKeysetsService, bitcoinFeeRateEstimator = bitcoinFeeRateEstimator, appPrivateKeyDao = appComponent.appPrivateKeyDao, keysetWalletProvider = appComponent.keysetWalletProvider, registerWatchAddressProcessor = registerWatchAddressProcessor ) val sweepDataStateMachine = SweepDataStateMachineImpl( bitcoinBlockchain = bitcoinBlockchain, sweepGenerator = sweepGenerator, mobilePaySigningService = mobilePaySigningService, appSpendingWalletProvider = appComponent.appSpendingWalletProvider, exchangeRateSyncer = exchangeRateSyncer, outgoingTransactionDetailRepository = outgoingTransactionDetailRepository ) val f8eSpendingKeyRotator = F8eSpendingKeyRotatorImpl( createAccountKeysetService = createAccountKeysetService, setActiveSpendingKeysetService = setActiveSpendingKeysetService ) val recoveryInProgressDataStateMachine = RecoveryInProgressDataStateMachineImpl( recoveryCanceler = lostAppRecoveryCanceler, delayer = appComponent.delayer, clock = appComponent.clock, csekGenerator = csekGenerator, csekDao = csekDao, recoveryAuthCompleter = recoveryAuthCompleter, sweepDataStateMachine = sweepDataStateMachine, f8eSpendingKeyRotator = f8eSpendingKeyRotator, uuidGenerator = appComponent.uuidGenerator, recoverySyncer = recoverySyncer, recoveryNotificationVerificationDataStateMachine = recoveryNotificationVerificationDataStateMachine, accountAuthenticator = appComponent.accountAuthenticator, recoveryDao = appComponent.recoveryDao, deviceTokenManager = appComponent.deviceTokenManager, socRecRelationshipsRepository = socRecRelationshipsRepository, postSocRecTaskRepository = postSocRecTaskRepository, trustedContactKeyAuthenticator = trustedContactKeyAuthenticator ) val createKeyboxDataStateMachine = CreateKeyboxDataStateMachineImpl( fullAccountCreator = fullAccountCreator, appKeysGenerator = appKeysGenerator, onboardingKeyboxSealedCsekDao = onboardingKeyboxSealedCsekDao, onboardingKeyboxHardwareKeysDao = onboardingKeyboxHwAuthPublicKeyDao, uuidGenerator = appComponent.uuidGenerator, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore, liteToFullAccountUpgrader = liteToFullAccountUpgrader ) val onboardKeyboxDataStateMachine = OnboardKeyboxDataStateMachineImpl( onboardingKeyboxSealedCsekDao = onboardingKeyboxSealedCsekDao, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao ) val activateFullAccountDataStateMachine = ActivateFullAccountDataStateMachineImpl( eventTracker = appComponent.eventTracker, gettingStartedTaskDao = gettingStartedTaskDao, keyboxDao = appComponent.keyboxDao, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao, onboardingService = onboardingService, onboardingAppKeyKeystore = appComponent.onboardingAppKeyKeystore, onboardingKeyboxHardwareKeysDao = onboardingKeyboxHwAuthPublicKeyDao ) val createFullAccountDataStateMachine = CreateFullAccountDataStateMachineImpl( activateFullAccountDataStateMachine = activateFullAccountDataStateMachine, createKeyboxDataStateMachine = createKeyboxDataStateMachine, onboardKeyboxDataStateMachine = onboardKeyboxDataStateMachine, appDataDeleter = appDataDeleter, onboardingKeyboxStepStateDao = onboardingKeyboxStepStateDao ) val lostAppRecoveryDataStateMachine = LostAppRecoveryDataStateMachineImpl( recoveryInProgressDataStateMachine = recoveryInProgressDataStateMachine, lostAppRecoveryHaveNotStartedDataStateMachine = lostAppRecoveryHaveNotStartedDataStateMachine ) val noActiveAccountDataStateMachine = NoActiveAccountDataStateMachineImpl( createFullAccountDataStateMachine = createFullAccountDataStateMachine, lostAppRecoveryDataStateMachine = lostAppRecoveryDataStateMachine, eventTracker = appComponent.eventTracker, keyboxDao = appComponent.keyboxDao ) val initiatingLostHardwareRecoveryDataStateMachine = InitiatingLostHardwareRecoveryDataStateMachineImpl( appKeysGenerator = appKeysGenerator, delayer = appComponent.delayer, lostHardwareRecoveryStarter = delayNotifyHardwareRecoveryStarter, recoveryNotificationVerificationDataStateMachine = recoveryNotificationVerificationDataStateMachine, cancelDelayNotifyRecoveryService = cancelDelayNotifyRecoveryService ) val lostHardwareRecoveryDataStateMachine = LostHardwareRecoveryDataStateMachineImpl( initiatingLostHardwareRecoveryDataStateMachine = initiatingLostHardwareRecoveryDataStateMachine, recoveryInProgressDataStateMachine = recoveryInProgressDataStateMachine ) val fullAccountCloudBackupRestorationUiStateMachine = FullAccountCloudBackupRestorationUiStateMachineImpl( appSpendingWalletProvider = appComponent.appSpendingWalletProvider, backupRestorer = cloudBackupRestorer, eventTracker = appComponent.eventTracker, deviceTokenManager = appComponent.deviceTokenManager, csekDao = csekDao, accountAuthenticator = appComponent.accountAuthenticator, authTokenDao = appComponent.authTokenDao, appPrivateKeyDao = appComponent.appPrivateKeyDao, nfcSessionUIStateMachine = nfcSessionUIStateMachine, keyboxDao = appComponent.keyboxDao, recoverySyncer = recoverySyncer, deviceInfoProvider = appComponent.deviceInfoProvider, uuidGenerator = appComponent.uuidGenerator, cloudBackupDao = cloudBackupDao, recoveryChallengeStateMachine = recoveryChallengeUiStateMachine, socRecChallengeRepository = socRecChallengeRepository, socialRelationshipsRepository = socRecRelationshipsRepository, postSocRecTaskRepository = postSocRecTaskRepository, socRecStartedChallengeDao = socRecPendingChallengeDao, authKeyRotationManager = authKeyRotationManager ) val lostAppRecoveryHaveNotStartedUiStateMachine = LostAppRecoveryHaveNotStartedUiStateMachineImpl( initiatingLostAppRecoveryUiStateMachine = initiatingLostAppRecoveryUiStateMachineImpl, fullAccountCloudBackupRestorationUiStateMachine = fullAccountCloudBackupRestorationUiStateMachine ) val recoveringKeyboxUiStateMachine = LostAppRecoveryUiStateMachineImpl( lostAppRecoveryHaveNotStartedDataStateMachine = lostAppRecoveryHaveNotStartedUiStateMachine, recoveryInProgressUiStateMachine = recoveryInProgressUiStateMachine ) val cloudBackupRefresher = CloudBackupRefresherImpl( socRecRelationshipsRepository = socRecRelationshipsRepository, cloudBackupDao = cloudBackupDao, cloudStoreAccountRepository = cloudStoreAccountRepository, cloudBackupRepository = cloudBackupRepository, fullAccountCloudBackupCreator = fullAccountCloudBackupCreator, eventTracker = appComponent.eventTracker, clock = appComponent.clock ) val hasActiveFullAccountDataStateMachine = HasActiveFullAccountDataStateMachineImpl( mobilePayDataStateMachine = mobilePayDataStateMachine, fullAccountAddressDataStateMachine = fullAccountAddressDataStateMachine, fullAccountTransactionsDataStateMachine = fullAccountTransactionsDataStateMachine, notificationTouchpointDataStateMachine = notificationTouchpointDataStateMachine, lostHardwareRecoveryDataStateMachine = lostHardwareRecoveryDataStateMachine, appSpendingWalletProvider = appComponent.appSpendingWalletProvider, exchangeRateSyncer = exchangeRateSyncer, cloudBackupRefresher = cloudBackupRefresher, postSocRecTaskRepository = postSocRecTaskRepository, authKeyRotationManager = authKeyRotationManager, trustedContactKeyAuthenticator = trustedContactKeyAuthenticator ) val noLongerRecoveringUiStateMachine = NoLongerRecoveringUiStateMachineImpl() val noLongerRecoveringDataStateMachine = NoLongerRecoveringDataStateMachineImpl( recoveryDao = appComponent.recoveryDao ) val someoneElseIsRecoveringUiStateMachine = SomeoneElseIsRecoveringUiStateMachineImpl( proofOfPossessionNfcStateMachine = proofOfPossessionNfcStateMachine, recoveryNotificationVerificationUiStateMachine = recoveryNotificationVerificationUiStateMachine ) val someoneElseIsRecoveringDataStateMachine = SomeoneElseIsRecoveringDataStateMachineImpl( cancelDelayNotifyRecoveryService = cancelDelayNotifyRecoveryService, recoveryNotificationVerificationDataStateMachine = recoveryNotificationVerificationDataStateMachine, recoverySyncer = recoverySyncer ) val hasActiveLiteAccountDataStateMachine = HasActiveLiteAccountDataStateMachineImpl( createFullAccountDataStateMachine = createFullAccountDataStateMachine, keyboxDao = appComponent.keyboxDao ) val accountDataStateMachine = AccountDataStateMachineImpl( hasActiveFullAccountDataStateMachine = hasActiveFullAccountDataStateMachine, hasActiveLiteAccountDataStateMachine = hasActiveLiteAccountDataStateMachine, noActiveAccountDataStateMachine = noActiveAccountDataStateMachine, accountRepository = appComponent.accountRepository, recoverySyncer = recoverySyncer, noLongerRecoveringDataStateMachine = noLongerRecoveringDataStateMachine, someoneElseIsRecoveringDataStateMachine = someoneElseIsRecoveringDataStateMachine, recoverySyncFrequency = appComponent.recoverySyncFrequency, onboardConfigDataStateMachine = onboardConfigDataStateMachine ) val lightningNodeDataStateMachine = LightningNodeDataStateMachineImpl( lightningPreference = lightningPreference, ldkNodeService = appComponent.ldkNodeService ) val templateFullAccountConfigDataStateMachine = TemplateFullAccountConfigDataStateMachineImpl( templateFullAccountConfigDao = appComponent.templateFullAccountConfigDao ) val electrumServerDataStateMachine = ElectrumServerDataStateMachineImpl( electrumServerRepository = appComponent.electrumServerDao, getBdkConfigurationService = GetBdkConfigurationServiceImpl( appComponent.f8eHttpClient, appComponent.deviceInfoProvider ) ) val currencyPreferenceDataStateMachine = CurrencyPreferenceDataStateMachineImpl( bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, eventTracker = appComponent.eventTracker, fiatCurrencyPreferenceRepository = appComponent.fiatCurrencyPreferenceRepository ) val appDataStateMachine = AppDataStateMachineImpl( eventTracker = appComponent.eventTracker, featureFlagInitializer = appComponent.featureFlagInitializer, featureFlagSyncer = appComponent.featureFlagSyncer, accountDataStateMachine = accountDataStateMachine, periodicEventProcessor = appComponent.periodicEventProcessor, periodicFirmwareTelemetryProcessor = appComponent.periodicFirmwareTelemetryEventProcessor, periodicFirmwareCoredumpProcessor = appComponent.periodicFirmwareCoredumpProcessor, periodicRegisterWatchAddressProcessor = registerWatchAddressProcessor, lightningNodeDataStateMachine = lightningNodeDataStateMachine, templateFullAccountConfigDataStateMachine = templateFullAccountConfigDataStateMachine, electrumServerDataStateMachine = electrumServerDataStateMachine, firmwareDataStateMachine = firmwareDataStateMachine, currencyPreferenceDataStateMachine = currencyPreferenceDataStateMachine, networkingDebugConfigRepository = appComponent.networkingDebugConfigRepository, bitcoinDisplayPreferenceRepository = appComponent.bitcoinDisplayPreferenceRepository, fiatCurrencyRepository = fiatCurrencyRepository, fiatCurrencyPreferenceRepository = appComponent.fiatCurrencyPreferenceRepository, fiatMobilePayConfigurationRepository = fiatMobilePayConfigurationRepository, emergencyAccessKitDataProvider = emergencyAccessKitDataProvider ) val liteAccountCreator = LiteAccountCreatorImpl( accountAuthenticator = appComponent.accountAuthenticator, accountRepository = appComponent.accountRepository, appKeysGenerator = appComponent.appKeysGenerator, authTokenDao = appComponent.authTokenDao, createLiteAccountService = createAccountService ) val liteAccountCloudBackupCreator = LiteAccountCloudBackupCreatorImpl( socRecKeysRepository = socRecKeysRepository, appPrivateKeyDao = appComponent.appPrivateKeyDao ) val liteAccountCloudSignInAndBackupUiStateMachine = LiteAccountCloudSignInAndBackupUiStateMachineImpl( cloudBackupRepository = cloudBackupRepository, cloudSignInUiStateMachine = cloudSignInUiStateMachine, liteAccountCloudBackupCreator = liteAccountCloudBackupCreator, deviceInfoProvider = appComponent.deviceInfoProvider, eventTracker = appComponent.eventTracker, rectifiableErrorHandlingUiStateMachine = rectifiableErrorHandlingUiStateMachine, inAppBrowserNavigator = inAppBrowserNavigator ) val createLiteAccountUiStateMachine = CreateLiteAccountUiStateMachineImpl( liteAccountCreator = liteAccountCreator, trustedContactEnrollmentUiStateMachine = trustedContactEnrollmentUiStateMachine, socRecRelationshipsRepository = socRecRelationshipsRepository, liteAccountCloudSignInAndBackupUiStateMachine = liteAccountCloudSignInAndBackupUiStateMachine, deviceInfoProvider = appComponent.deviceInfoProvider, eventTracker = appComponent.eventTracker ) val liteMoneyHomeUiStateMachine = LiteMoneyHomeUiStateMachineImpl( inAppBrowserNavigator = inAppBrowserNavigator, viewingProtectedCustomerUiStateMachine = viewingProtectedCustomerUiStateMachine, helpingWithRecoveryUiStateMachine = helpingWithRecoveryUiStateMachine ) val liteListingTrustedContactsUiStateMachine = LiteListingTrustedContactsUiStateMachineImpl( viewingProtectedCustomerUiStateMachine = viewingProtectedCustomerUiStateMachine ) val liteTrustedContactManagementUiStateMachine = LiteTrustedContactManagementUiStateMachineImpl( liteListingTrustedContactsUiStateMachine = liteListingTrustedContactsUiStateMachine, trustedContactEnrollmentUiStateMachine = trustedContactEnrollmentUiStateMachine, helpingWithRecoveryUiStateMachine = helpingWithRecoveryUiStateMachine ) val liteSettingsHomeUiStateMachine = LiteSettingsHomeUiStateMachineImpl( currencyPreferenceUiStateMachine = currencyPreferenceUiStateMachine, helpCenterUiStateMachine = helpCenterUiStateMachine, liteTrustedContactManagementUiStateMachine = liteTrustedContactManagementUiStateMachine, settingsListUiStateMachine = settingsListUiStateMachine, feedbackUiStateMachine = feedbackUiStateMachine ) val liteHomeUiStateMachine = LiteHomeUiStateMachineImpl( homeStatusBannerUiStateMachine = homeStatusBannerUiStateMachine, liteMoneyHomeUiStateMachine = liteMoneyHomeUiStateMachine, liteSettingsHomeUiStateMachine = liteSettingsHomeUiStateMachine, liteTrustedContactManagementUiStateMachine = liteTrustedContactManagementUiStateMachine, socRecRelationshipsRepository = socRecRelationshipsRepository, eventTracker = appComponent.eventTracker ) val gettingStartedRoutingStateMachine = GettingStartedRoutingStateMachineImpl( accessCloudBackupUiStateMachine = accessCloudBackupUiStateMachine ) val liteAccountCloudBackupRestorationUiStateMachine = LiteAccountCloudBackupRestorationUiStateMachineImpl( liteAccountCloudBackupRestorer = liteAccountCloudBackupRestorer ) val emergencyAccessKitRecoveryUiStateMachine = EmergencyAccessKitRecoveryUiStateMachineImpl( clipboard = clipboard, payloadDecoder = EmergencyAccessKitPayloadDecoderImpl, permissionUiStateMachine = permissionStateMachine, emergencyAccessPayloadRestorer = EmergencyAccessPayloadRestorerImpl( csekDao = csekDao, symmetricKeyEncryptor = symmetricKeyEncryptor, appPrivateKeyDao = appComponent.appPrivateKeyDao ), csekDao = csekDao, keyboxDao = appComponent.keyboxDao, nfcSessionUIStateMachine = nfcSessionUIStateMachine, uuidGenerator = appComponent.uuidGenerator ) override val appUiStateMachine = AppUiStateMachineImpl( appVariant = appComponent.appVariant, delayer = appComponent.delayer, debugMenuStateMachine = debugMenuStateMachine, eventTracker = appComponent.eventTracker, lostAppRecoveryUiStateMachine = recoveringKeyboxUiStateMachine, homeUiStateMachine = homeUiStateMachine, liteHomeUiStateMachine = liteHomeUiStateMachine, chooseAccountAccessUiStateMachine = chooseAccountAccessUiStateMachine, createAccountUiStateMachine = createAccountUiStateMachine, appDataStateMachine = appDataStateMachine, noLongerRecoveringUiStateMachine = noLongerRecoveringUiStateMachine, someoneElseIsRecoveringUiStateMachine = someoneElseIsRecoveringUiStateMachine, gettingStartedRoutingStateMachine = gettingStartedRoutingStateMachine, createLiteAccountUiStateMachine = createLiteAccountUiStateMachine, liteAccountCloudBackupRestorationUiStateMachine = liteAccountCloudBackupRestorationUiStateMachine, emergencyAccessKitRecoveryUiStateMachine = emergencyAccessKitRecoveryUiStateMachine, authKeyRotationUiStateMachine = rotateAuthUIStateMachine ) }
0
null
9
98
1f9f2298919dac77e6791aa3f1dbfd67efe7f83c
113,667
bitkey
MIT License
ipv4_count/src/jmh/kotlin/dev/aspid812/ipv4_count/benchmark/IntegralBenchmarks.kt
Const-Grigoryev
526,881,680
false
{"Kotlin": 27280, "Java": 13876}
package dev.aspid812.ipv4_count.benchmark import java.lang.ProcessBuilder.Redirect import java.nio.file.Path import java.util.concurrent.TimeUnit import org.openjdk.jmh.annotations.* import dev.aspid812.ipv4_count.IPv4Count import dev.aspid812.ipv4_count.IPv4CountApp import dev.aspid812.ipv4_count.benchmark.util.PrepareProcess import dev.aspid812.ipv4_gen.IPv4RandomGenerator import dev.aspid812.ipv4_gen.IPv4RandomGenerator.Companion.RECOMMENDED_POOL_SIZE import dev.aspid812.ipv4_gen.main as IPv4RandomGeneratorApp_main @State(Scope.Thread) @Fork(1) @Measurement(iterations = 5) @BenchmarkMode(Mode.SingleShotTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) open class BI01_ModesComparison : ExternalDatasetFeaturedBenchmark { companion object { // Since „callable references to top-level functions don't support fully-qualified syntax right now,“ // (R. Elizarov, https://youtrack.jetbrains.com/issue/KT-52701), we have to work-around by aliasing import val IPv4_GENERATOR_APP = ::IPv4RandomGeneratorApp_main val IPv4_COUNT_APP = IPv4CountApp::main } private val errorHandler = BenchmarkFeatures.newThrowingErrorHandler() private val generator = IPv4RandomGenerator(RECOMMENDED_POOL_SIZE) private val counter = IPv4Count(errorHandler) @Param("1K", "25K", "1M", "16M") override lateinit var lines: String lateinit var datasetPath: Path @Setup fun setup() { datasetPath = ensureDatasetPresent(generator::sample) } @Benchmark fun v1_application_stdin() { val process = PrepareProcess.java(IPv4_COUNT_APP) .redirectInput(datasetPath.toFile()) .redirectOutput(Redirect.DISCARD) .start() process.waitFor() } @Benchmark fun v2_application_file() { val process = PrepareProcess.java(IPv4_COUNT_APP, "$datasetPath") .redirectOutput(Redirect.DISCARD) .start() process.waitFor() } @Benchmark fun v3_library_file(): Long { counter.account(datasetPath) return counter.uniqueAddresses().asLong } } @State(Scope.Thread) @Fork(5) @BenchmarkMode(Mode.SingleShotTime) @OutputTimeUnit(TimeUnit.SECONDS) open class BI02_Performance : ExternalDatasetFeaturedBenchmark { private val errorHandler = BenchmarkFeatures.newThrowingErrorHandler() private val generator = IPv4RandomGenerator(RECOMMENDED_POOL_SIZE) private val counter = IPv4Count(errorHandler) @Param("500M") override lateinit var lines: String lateinit var datasetPath: Path @Setup fun setup() { datasetPath = ensureDatasetPresent(generator::sample) } @Benchmark fun v1_measure(): Long { counter.account(datasetPath) return counter.uniqueAddresses().asLong } }
0
Kotlin
0
0
d54de209d521ffb458803e8e1c595d0d9b4f5440
2,597
Ecwid-Demo
MIT License
javalin/src/main/java/io/javalin/websocket/JavalinWsServlet.kt
lhfei
268,796,863
false
null
/* * Javalin - https://javalin.io * Copyright 2017 <NAME> * Licensed under Apache 2.0: https://github.com/tipsy/javalin/blob/master/LICENSE */ package io.javalin.websocket import io.javalin.core.JavalinConfig import io.javalin.core.security.RouteRole import io.javalin.core.util.Header import io.javalin.http.Context import io.javalin.http.JavalinServlet import io.javalin.http.UnauthorizedResponse import io.javalin.http.util.ContextUtil import org.eclipse.jetty.websocket.api.WebSocketConstants import org.eclipse.jetty.websocket.servlet.WebSocketCreator import org.eclipse.jetty.websocket.servlet.WebSocketServlet import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory import java.util.function.Consumer import javax.servlet.http.HttpServletRequest import javax.servlet.http.HttpServletResponse internal const val upgradeAllowedKey = "javalin-ws-upgrade-allowed" internal const val upgradeContextKey = "javalin-ws-upgrade-context" internal const val upgradeSessionAttrsKey = "javalin-ws-upgrade-http-session" /** * The JavalinWsServlet is responsible for both WebSocket and HTTP requests. * It extends Jetty's WebSocketServlet, and has a HTTP Servlet as a constructor arg. * It switches between WebSocket and HTTP in the `service` method. */ class JavalinWsServlet(val config: JavalinConfig, private val httpServlet: JavalinServlet) : WebSocketServlet() { val wsExceptionMapper = WsExceptionMapper() private val wsPathMatcher = WsPathMatcher() override fun configure(factory: WebSocketServletFactory) { config.inner.wsFactoryConfig?.accept(factory) factory.creator = WebSocketCreator { req, res -> val preUpgradeContext = req.httpServletRequest.getAttribute(upgradeContextKey) as Context req.httpServletRequest.setAttribute(upgradeContextKey, ContextUtil.changeBaseRequest(preUpgradeContext, req.httpServletRequest)) req.httpServletRequest.setAttribute(upgradeSessionAttrsKey, req.session?.attributeNames?.asSequence()?.associateWith { req.session.getAttribute(it) }) return@WebSocketCreator WsConnection(wsPathMatcher, wsExceptionMapper, config.inner.wsLogger) } } override fun service(req: HttpServletRequest, res: HttpServletResponse) { // this handles both http and websocket if (!req.isWebSocket()) { return httpServlet.service(req, res) } val requestUri = req.requestURI.removePrefix(req.contextPath) val entry = wsPathMatcher.findEndpointHandlerEntry(requestUri) ?: return res.sendError(404, "WebSocket handler not found") try { val upgradeContext = Context(req, res).apply { pathParamMap = entry.extractPathParams(requestUri) matchedPath = entry.path } config.inner.accessManager.manage({ ctx -> ctx.req.setAttribute(upgradeAllowedKey, true) }, upgradeContext, entry.roles) if (req.getAttribute(upgradeAllowedKey) != true) throw UnauthorizedResponse() // if set to true, the access manager ran the handler (== valid) req.setAttribute(upgradeContextKey, upgradeContext) val wsProtocolHeader = req.getHeader(WebSocketConstants.SEC_WEBSOCKET_PROTOCOL) if (wsProtocolHeader != null) { val protocolNames = wsProtocolHeader.split(',').map { it.trim() }.filter { it != "" } if (protocolNames.isNotEmpty()) { res.setHeader(WebSocketConstants.SEC_WEBSOCKET_PROTOCOL, protocolNames.first()) } } super.service(req, res) // everything is okay, perform websocket upgrade } catch (e: Exception) { res.sendError(401, "Unauthorized") } } fun addHandler(handlerType: WsHandlerType, path: String, ws: Consumer<WsConfig>, roles: Set<RouteRole>) { wsPathMatcher.add(WsEntry(handlerType, path, config.ignoreTrailingSlashes, WsConfig().apply { ws.accept(this) }, roles)) } } fun HttpServletRequest.isWebSocket(): Boolean = this.getHeader(Header.SEC_WEBSOCKET_KEY) != null
4
null
0
1
4bba86d75a242ab0742554ec31537ea3014df2bf
4,094
javalin
Apache License 2.0
src/main/kotlin/com/github/ziscloud/intellijplatformplugindemo/listeners/MyProjectManagerListener.kt
ziscloud
557,763,677
false
{"Kotlin": 7349}
package com.github.ziscloud.intellijplatformplugindemo.listeners import com.intellij.openapi.components.service import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectManagerListener import com.github.ziscloud.intellijplatformplugindemo.services.MyProjectService internal class MyProjectManagerListener : ProjectManagerListener { override fun projectOpened(project: Project) { project.service<MyProjectService>() System.getenv("CI") ?: TODO("Don't forget to remove all non-needed sample code files with their corresponding registration entries in `plugin.xml`.") } }
0
Kotlin
0
0
503a9117d1c8e282f865b133b99ea400b18fcd10
639
intellij-platform-plugin-demo
Apache License 2.0
tools/excel/src/main/kotlin/top/bettercode/summer/tools/excel/ExcelFieldCell.kt
top-bettercode
387,652,015
false
{"Kotlin": 2939064, "Java": 24119, "JavaScript": 22541, "CSS": 22336, "HTML": 15833}
package top.bettercode.summer.tools.excel /** * @author <NAME> */ open class ExcelFieldCell<T>(val row: Int, val column: Int, val isLastRow: Boolean, index: Int, var isFillColor: Boolean, val excelField: ExcelField<T, *>, val entity: T) { var cellValue: Any? = null constructor(row: Int, column: Int, firstRow: Int, lastRow: Boolean, excelField: ExcelField<T, *>, entity: T) : this(row, column, lastRow, row - firstRow + 1, (row - firstRow + 1) % 2 == 0, excelField, entity) init { cellValue = if (excelField.isIndexColumn) { index }else { excelField.toCellValue(entity) } } fun setFillColor(index: Int) { isFillColor = index % 2 == 0 } open fun needSetValue(): Boolean { return true } companion object { /** * 默认日期格式 */ const val DEFAULT_DATE_FORMAT = "yyyy-m-dd" /** * 默认时间格式 */ const val DEFAULT_DATE_TIME_FORMAT = "yyyy-m-dd hh:mm" /** * 默认格式 */ const val DEFAULT_FORMAT = "@" } }
0
Kotlin
0
1
d07ed7250e6dcdbcce51f27f5f22602e9c222b3c
1,158
summer
Apache License 2.0
common/src/main/kotlin/io/github/techtastic/kubevs/events/KubeVSShipLoadClientEvent.kt
TechTastic
695,449,652
false
{"Kotlin": 17238, "Java": 2716}
package io.github.techtastic.kubevs.events import dev.latvian.mods.kubejs.event.EventJS import org.valkyrienskies.core.impl.game.ships.ShipObjectClient import org.valkyrienskies.core.impl.hooks.VSEvents class KubeVSShipLoadClientEvent(val shipObjectClient: ShipObjectClient): EventJS() { constructor(event: VSEvents.ShipLoadEventClient) : this(event.ship) override fun canCancel(): Boolean = false }
0
Kotlin
0
1
98bc9f4b8be45334177abbbccba4074a8baa2d72
410
kubevs
Apache License 2.0
src/main/kotlin/com/ort/howlingwolf/domain/model/village/setting/VillageMessageRestricts.kt
h-orito
176,481,255
false
{"Kotlin": 820146, "HTML": 245777, "Batchfile": 522, "Shell": 454}
package com.ort.howlingwolf.domain.model.village.setting import com.ort.dbflute.allcommon.CDef import com.ort.howlingwolf.domain.model.message.MessageType data class VillageMessageRestricts( val existRestricts: Boolean = true, val restrictList: List<VillageMessageRestrict> = listOf( VillageMessageRestrict( type = MessageType(CDef.MessageType.通常発言), count = 20, length = 200 ), VillageMessageRestrict( type = MessageType(CDef.MessageType.人狼の囁き), count = 40, length = 200 ) ) ) { fun restrict(cdefMessageType: CDef.MessageType): VillageMessageRestrict? { return if (!existRestricts) null else restrictList.find { it.type.toCdef() == cdefMessageType } } fun existsDifference(messageRestrict: VillageMessageRestricts): Boolean { if (existRestricts != messageRestrict.existRestricts) return true if (restrictList.size != messageRestrict.restrictList.size) return true return restrictList.any { restrict1 -> messageRestrict.restrictList.none { restrict2 -> restrict1.type.code == restrict2.type.code && restrict1.count == restrict2.count && restrict1.length == restrict2.length } } } }
0
Kotlin
1
3
ec5db8e5323ea79f4a23648a33f8e81a71df96dc
1,345
wolf4busy-api
MIT License
app/src/main/kotlin/sk/mholecy/meteorites/common/di/module/android/ViewModelModule.kt
ashishkharcheiuforks
242,836,170
true
{"Kotlin": 48667}
package sk.mholecy.meteorites.common.di.module.android import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider import dagger.Binds import dagger.Module import dagger.multibindings.IntoMap import sk.mholecy.meteorites.common.di.AppViewModelFactory import sk.mholecy.meteorites.common.di.retention.ViewModelKey import sk.mholecy.meteorites.meteorites.ui.detail.MeteoriteMapViewModel import sk.mholecy.meteorites.meteorites.ui.list.MeteoritesListViewModel @Module abstract class ViewModelModule { @Binds abstract fun bindAppViewModelFactory(appViewModelFactory: AppViewModelFactory): ViewModelProvider.Factory @Binds @IntoMap @ViewModelKey(MeteoriteMapViewModel::class) internal abstract fun bindMeteoriteMapViewModel(viewModel: MeteoriteMapViewModel): ViewModel @Binds @IntoMap @ViewModelKey(MeteoritesListViewModel::class) internal abstract fun bindMeteoritesListViewModel(viewModel: MeteoritesListViewModel): ViewModel }
0
null
0
0
0d6a9c4f3b22646970435be105afb8b718452317
989
meteorites
MIT License
app/src/main/java/com/example/covidapp/utils/ExtensionFun.kt
swapnilsparsh
341,976,513
false
null
package com.example.covidapp.utils import android.app.Activity import android.content.Intent import android.net.Uri fun Activity.goNextScreen(nextActivity: Class<*>, isFinished: Boolean = false) { startActivity(Intent(this, nextActivity)) if (isFinished) { finish() } } fun Activity.loadWeb(url: String) { startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(url))) }
1
Kotlin
7
9
37770bc00d7f5a461b34a78129e840bba3abb2ac
393
Covid-App
MIT License
rtmp/src/test/java/com/pedro/rtmp/rtmp/message/DataTest.kt
pedroSG94
79,667,969
false
null
/* * Copyright (C) 2024 pedroSG94. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.pedro.rtmp.rtmp.message import com.pedro.rtmp.amf.v0.AmfNumber import com.pedro.rtmp.amf.v0.AmfString import com.pedro.rtmp.rtmp.message.data.DataAmf0 import com.pedro.rtmp.utils.CommandSessionHistory import com.pedro.rtmp.utils.RtmpConfig import org.junit.Assert.assertArrayEquals import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Test import java.io.ByteArrayInputStream import java.io.ByteArrayOutputStream /** * Created by pedro on 10/9/23. */ class DataTest { private val commandSessionHistory = CommandSessionHistory() @Test fun `GIVEN a buffer WHEN read rtmp message THEN get expected data amf0 packet`() { val buffer = byteArrayOf(3, 0, 0, 0, 0, 0, 25, 18, 0, 0, 0, 0, 2, 0, 4, 116, 101, 115, 116, 2, 0, 6, 114, 97, 110, 100, 111, 109, 0, 64, 52, 0, 0, 0, 0, 0, 0) val dataAmf0 = DataAmf0("test") dataAmf0.addData(AmfString("random")) dataAmf0.addData(AmfNumber(20.0)) val message = RtmpMessage.getRtmpMessage(ByteArrayInputStream(buffer), RtmpConfig.DEFAULT_CHUNK_SIZE, commandSessionHistory) assertTrue(message is DataAmf0) assertEquals(dataAmf0.toString(), (message as DataAmf0).toString()) } @Test fun `GIVEN a data amf0 packet WHEN write into a buffer THEN get expected buffer`() { val expectedBuffer = byteArrayOf(3, 0, 0, 0, 0, 0, 25, 18, 0, 0, 0, 0, 2, 0, 4, 116, 101, 115, 116, 2, 0, 6, 114, 97, 110, 100, 111, 109, 0, 64, 52, 0, 0, 0, 0, 0, 0) val output = ByteArrayOutputStream() val dataAmf0 = DataAmf0("test") dataAmf0.addData(AmfString("random")) dataAmf0.addData(AmfNumber(20.0)) dataAmf0.writeHeader(output) dataAmf0.writeBody(output) assertArrayEquals(expectedBuffer, output.toByteArray()) } }
87
null
772
2,545
eca59948009d5a7b564f9a838c149b850898d089
2,350
RootEncoder
Apache License 2.0
app/src/main/java/com/base/pokedex/data/remote/model/DreamWorld.kt
kose135
681,053,150
false
null
package com.base.pokedex.data.remote.model import com.squareup.moshi.Json import com.squareup.moshi.JsonClass @JsonClass(generateAdapter = true) data class DreamWorld( @Json(name = "front_default") val frontDefault: String, @Json(name = "front_female") val frontFemale: Any )
0
Kotlin
0
0
1954e1a4b26879aa279c5553c82228a1af796b53
294
Pokdex-AOS
Apache License 2.0
openrndr-draw/src/commonMain/kotlin/org/openrndr/draw/Session.kt
openrndr
122,222,767
false
null
package org.openrndr.draw import mu.KotlinLogging import org.openrndr.internal.Driver private val logger = KotlinLogging.logger {} private val sessionStack = mutableMapOf<Long, ArrayDeque<Session>>() /** * Session statistics */ class SessionStatistics( val renderTargets: Int, val colorBuffers: Int, val depthBuffers: Int, val bufferTextures: Int, val indexBuffers: Int, val vertexBuffers: Int, val shaders: Int, val cubemaps: Int, val arrayTextures: Int, val computeShaders: Int, val atomicCounterBuffers: Int, val arrayCubemaps: Int, val shaderStorageBuffers: Int) /** * Session */ class Session(val parent: Session?) { val context = Driver.instance.contextID companion object { /** * The session stack (on the active context) */ val stack: ArrayDeque<Session> get() = sessionStack.getOrPut(Driver.instance.contextID) { ArrayDeque<Session>().apply { addLast(Session(null)) } } /** * The active session (on the active context) */ val active: Session get() = stack.last() /** * The root session (on the active context) */ val root: Session get() = stack.first() /** * Ends the active session and pops it off the session stack (on the active context) */ fun endActive() { val session = sessionStack.getValue(Driver.instance.contextID).removeLast() session.end() } } private val children = mutableListOf<Session>() private val renderTargets = mutableSetOf<RenderTarget>() private val colorBuffers = mutableSetOf<ColorBuffer>() private val depthBuffers = mutableSetOf<DepthBuffer>() private val bufferTextures = mutableSetOf<BufferTexture>() private val vertexBuffers = mutableSetOf<VertexBuffer>() private val shaders = mutableSetOf<Shader>() private val computeShaders = mutableSetOf<ComputeShader>() private val cubemaps = mutableSetOf<Cubemap>() private val arrayTextures = mutableSetOf<ArrayTexture>() private val arrayCubemaps = mutableSetOf<ArrayCubemap>() private val indexBuffers = mutableSetOf<IndexBuffer>() private val volumeTextures = mutableSetOf<VolumeTexture>() private val shaderStorageBuffers = mutableSetOf<ShaderStorageBuffer>() private val atomicCounterBuffers = mutableSetOf<AtomicCounterBuffer>() /** Session statistics */ val statistics get() = SessionStatistics(renderTargets = renderTargets.size, colorBuffers = colorBuffers.size, depthBuffers = depthBuffers.size, bufferTextures = bufferTextures.size, indexBuffers = indexBuffers.size, vertexBuffers = vertexBuffers.size, shaders = shaders.size, cubemaps = cubemaps.size, arrayTextures = arrayTextures.size, computeShaders = computeShaders.size, atomicCounterBuffers = atomicCounterBuffers.size, arrayCubemaps = arrayCubemaps.size, shaderStorageBuffers = shaderStorageBuffers.size) fun track(renderTarget: RenderTarget) = renderTargets.add(renderTarget) fun untrack(renderTarget: RenderTarget) = renderTargets.remove(renderTarget) fun track(colorBuffer: ColorBuffer) = colorBuffers.add(colorBuffer) fun untrack(colorBuffer: ColorBuffer) = colorBuffers.remove(colorBuffer) fun track(depthBuffer: DepthBuffer) = depthBuffers.add(depthBuffer) fun untrack(depthBuffer: DepthBuffer) = depthBuffers.remove(depthBuffer) fun track(vertexBuffer: VertexBuffer) = vertexBuffers.add(vertexBuffer) fun untrack(vertexBuffer: VertexBuffer) = vertexBuffers.remove(vertexBuffer) fun track(indexBuffer: IndexBuffer) = indexBuffers.add(indexBuffer) fun untrack(indexBuffer: IndexBuffer) = indexBuffers.remove(indexBuffer) fun track(shader: Shader) = shaders.add(shader) fun untrack(shader: Shader) = shaders.remove(shader) fun track(computeShader: ComputeShader) = computeShaders.add(computeShader) fun untrack(computeShader: ComputeShader) = computeShaders.remove(computeShader) fun track(cubemap: Cubemap) = cubemaps.add(cubemap) fun untrack(cubemap: Cubemap) = cubemaps.remove(cubemap) fun track(bufferTexture: BufferTexture) = bufferTextures.add(bufferTexture) fun untrack(bufferTexture: BufferTexture) = bufferTextures.remove(bufferTexture) fun track(arrayTexture: ArrayTexture) = arrayTextures.add(arrayTexture) fun untrack(arrayTexture: ArrayTexture) = arrayTextures.remove(arrayTexture) fun track(atomicCounterBuffer: AtomicCounterBuffer) = atomicCounterBuffers.add(atomicCounterBuffer) fun untrack(atomicCounterBuffer: AtomicCounterBuffer) = atomicCounterBuffers.remove(atomicCounterBuffer) fun track(arrayCubemap: ArrayCubemap) = arrayCubemaps.add(arrayCubemap) fun untrack(arrayCubemap: ArrayCubemap) = arrayCubemaps.remove(arrayCubemap) fun track(volumeTexture: VolumeTexture) = volumeTextures.add(volumeTexture) fun untrack(volumeTexture: VolumeTexture) = volumeTextures.remove(volumeTexture) fun track(shaderStorageBuffer: ShaderStorageBuffer) = shaderStorageBuffers.add(shaderStorageBuffer) fun untrack(shaderStorageBuffer: ShaderStorageBuffer) = shaderStorageBuffers.remove(shaderStorageBuffer) /** * Fork the session */ fun fork(): Session { logger.debug { "starting new session for context [id=${context}]" } val child = Session(this) sessionStack.getValue(Driver.instance.contextID).addLast(child) children.add(child) return child } /** * Ends the session, destroys any GPU resources in use by the session */ fun end() { parent?.children?.remove(this) for (child in children.map { it }) { child.end() } children.clear() logger.debug { """ session ended for context [id=${context}] destroying ${renderTargets.size} render targets destroying ${shaders.size} shaders destroying ${colorBuffers.size} color buffers destroying ${depthBuffers.size} depth buffers destroying ${vertexBuffers.size} vertex buffers destroying ${cubemaps.size} cubemaps destroying ${bufferTextures.size} buffer textures destroying ${arrayTextures.size} array textures destroying ${computeShaders.size} compute shaders destroying ${atomicCounterBuffers.size} atomic counter buffers destroying ${arrayCubemaps.size} array cubemaps """.trimIndent() } renderTargets.map { it }.forEach { it.detachColorAttachments() it.detachDepthBuffer() it.destroy() } renderTargets.clear() colorBuffers.map { it }.forEach { it.destroy() } colorBuffers.clear() depthBuffers.map { it }.forEach { it.destroy() } depthBuffers.clear() vertexBuffers.map { it }.forEach { it.destroy() } vertexBuffers.clear() indexBuffers.map { it }.forEach { it.destroy() } indexBuffers.clear() cubemaps.map { it }.forEach { it.destroy() } cubemaps.clear() bufferTextures.map { it }.forEach { it.destroy() } bufferTextures.clear() shaders.map { it }.forEach { it.destroy() } shaders.clear() computeShaders.map { it }.forEach { it.destroy() } computeShaders.clear() arrayTextures.map { it }.forEach { it.destroy() } arrayTextures.clear() arrayCubemaps.map { it }.forEach { it.destroy() } arrayCubemaps.clear() shaderStorageBuffers.map { it }.forEach { it.destroy() } shaderStorageBuffers.clear() } } /** Runs code inside a (short-lived) session */ fun session(code: () -> Unit) { val s = Session.active.fork() code() s.end() } /** * Mark a GPU resource or code that uses GPU resources as persistent */ fun <T> persistent(builder: () -> T): T { Session.stack.addLast(Session.root) val result = builder() Session.stack.removeLast() return result }
24
null
73
880
2ef3c463ecb66701771dc0cf8fb3364e960a5e3c
8,701
openrndr
BSD 2-Clause FreeBSD License
app/src/main/java/com/mohsenoid/abcs/dial/DialViewModel.kt
mohsenoid
635,004,133
false
null
package com.mohsenoid.abcs.dial import androidx.lifecycle.ViewModel import com.mohsenoid.abcs.speech.SpeechHelper class DialViewModel(private val speechHelper: SpeechHelper) : ViewModel() { fun onClicked(number: Int) { val numberName = NUMBERS[number] speechHelper.speak(numberName) } companion object { val NUMBERS = listOf( "Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", ) } }
0
Kotlin
0
0
ea05b2ab3064343d3616896117b4382b6c9958d8
584
ABCs
Apache License 2.0
kotlin-electron/src/jsMain/generated/electron/TouchBarButtonConstructorOptions.kt
JetBrains
93,250,841
false
{"Kotlin": 12635434, "JavaScript": 423801}
// Generated by Karakum - do not modify it manually! package electron typealias TouchBarButtonConstructorOptions = electron.core.TouchBarButtonConstructorOptions
38
Kotlin
162
1,347
997ed3902482883db4a9657585426f6ca167d556
164
kotlin-wrappers
Apache License 2.0
src/me/egorand/kotlin/playground/misc/Collections.kt
Vaporice
189,554,404
true
{"Kotlin": 88970, "HTML": 509}
/* * Copyright 2016 Egor Andreevici * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package me.egorand.kotlin.playground.misc import java.util.* class Controller { // _items is mutable inside the class private val _items = mutableListOf<String>() // but only exposed as a snapshot, which is immutable val items: List<String> get() = _items.toList() } fun main(args: Array<String>) { val numbers: MutableList<Int> = mutableListOf(1, 2, 3) val readOnlyView: List<Int> = numbers println(numbers) numbers.add(4) println(readOnlyView) // readOnlyView.clear() won't compile val strings = hashSetOf("a", "b", "c", "c") println(strings.size) // fun with Lists val items = listOf(1, 2, 3, 4) println(items.first() == 1) println(items.last() == 4) println(items.filter { it % 2 == 0 }) println(items.requireNoNulls()) if (items.none { it > 6 }) println("No items above 6") println(items.firstOrNull()) // fun with maps val readWriteMap = hashMapOf("foo" to 1, "bar" to 2) println(readWriteMap["foo"]) val snapshot: Map<String, Int> = HashMap(readWriteMap) println(snapshot) }
0
Kotlin
0
0
4c82596c75a8dc4046df565e08f75bafd0365887
1,688
kotlin-playground
Apache License 2.0
script/src/main/kotlin/script/block/player/PlayerRecolorBlock.kts
runetopic
448,110,155
false
null
package script.block.player import xlitekt.game.actor.render.Render.Recolor import xlitekt.game.actor.render.block.PlayerRenderingBlockListener import xlitekt.shared.buffer.writeByte import xlitekt.shared.buffer.writeByteSubtract import xlitekt.shared.buffer.writeShortAdd import xlitekt.shared.buffer.writeShortLittleEndianAdd import xlitekt.shared.insert /** * @author Jordan Abraham */ insert<PlayerRenderingBlockListener>().fixedPlayerUpdateBlock<Recolor>(index = 11, mask = 0x200, size = 8) { it.writeShortLittleEndianAdd(startDelay) it.writeShortAdd(endDelay) it.writeByte(hue) it.writeByteSubtract(saturation) it.writeByte(luminance) it.writeByte(amount) }
0
Kotlin
3
8
c896a2957470769a212961ba3e4331f04fc785df
692
xlitekt
MIT License
src/main/kotlin/com/alzakharov/patterns/url/Url.kt
al-zakharov
508,063,626
false
{"Kotlin": 22276}
package com.alzakharov.patterns.url object Url { fun apply(url: String) = ( "(http|ftp|https):\\/\\/[\\w\\-_]+(\\.[\\w\\-_]+)+([\\w\\-\\.,@?^=%&amp;:/~\\+#]*[\\w\\-\\@?^=%&amp;/~\\+#])?" ) .toRegex().matches(url) }
0
Kotlin
0
0
e80d2853a4546e2493df72b92dd64dd73166fac6
244
kotlin-validators
Apache License 2.0
app/src/main/java/com/android/ao/newsapp/common/Resource.kt
kairos34
517,762,992
false
{"Kotlin": 47481}
package com.android.ao.newsapp.common /** * @author alper * Created 25.07.2022 */ sealed class Resource<T>(val data: T? = null, val message: String? = null) { class Success<T>(data: T) : Resource<T>(data) class Error<T>(message: String, data: T? = null) : Resource<T>(data, message) class Loading<T> : Resource<T>() }
0
Kotlin
0
0
eaca9c9ab063f16aaffde7e7e975f5797b6571b9
333
NewsApp
MIT License
app/src/main/java/com/example/androiddevchallenge/ui/screen/Home.kt
eneim
347,079,541
false
null
/* * Copyright 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.androiddevchallenge.ui.screen import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.items import androidx.compose.material.BottomNavigation import androidx.compose.material.BottomNavigationItem import androidx.compose.material.Card import androidx.compose.material.Checkbox import androidx.compose.material.CheckboxDefaults import androidx.compose.material.Divider import androidx.compose.material.Icon import androidx.compose.material.MaterialTheme import androidx.compose.material.OutlinedTextField import androidx.compose.material.Scaffold import androidx.compose.material.Surface import androidx.compose.material.Text import androidx.compose.material.TextFieldDefaults import androidx.compose.material.icons.Icons.Filled import androidx.compose.material.icons.filled.AccountCircle import androidx.compose.material.icons.filled.FavoriteBorder import androidx.compose.material.icons.filled.FilterList import androidx.compose.material.icons.filled.Home import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.filled.ShoppingCart import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.layout.FirstBaseline import androidx.compose.ui.layout.Layout import androidx.compose.ui.res.painterResource import androidx.compose.ui.text.style.TextOverflow.Ellipsis import androidx.compose.ui.unit.dp import com.example.androiddevchallenge.data.Data import com.example.androiddevchallenge.ui.utils.firstBaselineToTop import dev.chrisbanes.accompanist.insets.navigationBarsPadding import dev.chrisbanes.accompanist.insets.systemBarsPadding @Composable fun HomeScreen() { val horizontalPadding = Modifier.padding(horizontal = 16.dp) Scaffold( modifier = Modifier .systemBarsPadding(enabled = false) .navigationBarsPadding() .fillMaxSize(), bottomBar = { BottomNavigation( backgroundColor = MaterialTheme.colors.primary, elevation = 16.dp ) { NavItem.values().forEachIndexed { index, item -> BottomNavigationItem( icon = { Icon( imageVector = item.icon, contentDescription = item.title ) }, label = { Text( text = item.title, style = MaterialTheme.typography.caption ) }, // There is no actual navigation in this challenge. selected = index == 0, onClick = {} ) } } } ) { padding -> LazyColumn( contentPadding = PaddingValues( horizontal = 0.dp, vertical = 0.dp ), modifier = Modifier .padding(padding) .fillMaxSize(), ) { item { var keyword: String by rememberSaveable { mutableStateOf("") } OutlinedTextField( value = keyword, onValueChange = { keyword = it }, textStyle = MaterialTheme.typography.body1, label = { Text( text = "Search", style = MaterialTheme.typography.body1 ) }, leadingIcon = { Icon( Filled.Search, contentDescription = null, modifier = Modifier.size(18.dp) ) }, singleLine = true, colors = TextFieldDefaults.outlinedTextFieldColors( focusedBorderColor = MaterialTheme.colors.secondary, focusedLabelColor = MaterialTheme.colors.secondary ), modifier = horizontalPadding .padding(top = (40.dp - padding.calculateTopPadding()).coerceAtLeast(0.dp)) .fillMaxWidth() .height(56.dp), ) } item { Text( text = "Browse themes", style = MaterialTheme.typography.h1, modifier = Modifier .fillMaxWidth() .firstBaselineToTop(32.dp) .then(horizontalPadding), ) } // Themes item { LazyRow( contentPadding = PaddingValues(start = 16.dp, end = 16.dp, top = 16.dp), horizontalArrangement = Arrangement.spacedBy(8.dp) ) { items(Data.themes) { val item = it Column( modifier = Modifier .padding(bottom = 8.dp) // The next text will have 32dp top padding to baseline. ) { val isLight = MaterialTheme.colors.isLight Card( shape = MaterialTheme.shapes.small, elevation = 4.dp ) { Column(modifier = Modifier.size(136.dp)) { Image( painter = painterResource(item.image), contentDescription = item.title, contentScale = ContentScale.Crop, modifier = Modifier .aspectRatio(17f / 12f) ) Box( contentAlignment = Alignment.CenterStart, modifier = Modifier .background( color = if (isLight) { MaterialTheme.colors.background } else { // MaterialTheme.colors.background.copy(alpha = 0.65f) Color(0xFF393939) // Use manual pick. } ) .fillMaxSize() .padding(horizontal = 16.dp) ) { Text( text = item.title, style = MaterialTheme.typography.h2, ) } } } } } } } // Design your home garden item { Layout( content = { Text( text = "Design your home garden", overflow = Ellipsis, style = MaterialTheme.typography.h1 ) Icon( Filled.FilterList, contentDescription = "Filter", modifier = Modifier.size(24.dp) ) } ) { measurables, constraints -> val paddingInPx = 16.dp.roundToPx() val contentWidth = constraints.maxWidth - paddingInPx * 2 val icon = measurables[1].measure(constraints) val text = measurables[0].measure( constraints.copy( maxWidth = contentWidth - icon.width - 8.dp.roundToPx() ) ) val firstBaseline = text[FirstBaseline] val top = 32.dp.roundToPx() - firstBaseline layout(width = constraints.maxWidth, height = 44.dp.roundToPx()) { text.place(paddingInPx, top) icon.place( constraints.maxWidth - icon.width - paddingInPx, top + (text.height - icon.height) / 2 ) } } } // Designs items(Data.designs) { val item = it Row( modifier = Modifier .padding(horizontal = 16.dp, vertical = 4.dp) .fillMaxWidth() .height(64.dp) ) { Surface(shape = MaterialTheme.shapes.small) { Image( painter = painterResource(item.image), contentDescription = item.name, contentScale = ContentScale.Crop, modifier = Modifier .fillMaxHeight() .aspectRatio(1f) .background(MaterialTheme.colors.primary) ) } Column { Row(modifier = Modifier.weight(1f)) { Column( modifier = horizontalPadding .fillMaxHeight() .weight(1f) ) { Text( text = item.name, style = MaterialTheme.typography.h2, modifier = Modifier.firstBaselineToTop(24.dp) ) Text( text = item.description, style = MaterialTheme.typography.body1, modifier = Modifier.firstBaselineToTop(16.dp) ) } var checked: Boolean by rememberSaveable { mutableStateOf(false) } Checkbox( checked = checked, onCheckedChange = { state -> checked = state }, colors = CheckboxDefaults.colors( checkmarkColor = MaterialTheme.colors.background ), modifier = Modifier .padding(top = 16.dp) .size(24.dp) ) } Divider( color = Color(0xFF9E9E9E), startIndent = 8.dp ) } } } item { Spacer(modifier = Modifier.height(16.dp)) } } } } enum class NavItem(val title: String, val icon: ImageVector) { Home("Home", Filled.Home), Favorites("Favourites", Filled.FavoriteBorder), Profile("Profile", Filled.AccountCircle), Cart("Card", Filled.ShoppingCart) }
0
Kotlin
0
0
a6d6cb1653d5c56e9b6e25a1e764153489764715
13,917
PxFive
Apache License 2.0
feature-account-api/src/main/java/jp/co/soramitsu/feature_account_api/presenatation/actions/ExternalAccountActionsProvider.kt
soramitsu
278,060,397
false
null
package jp.co.soramitsu.common.account.external.actions import androidx.lifecycle.MutableLiveData import jp.co.soramitsu.common.R import jp.co.soramitsu.common.data.network.AppLinksProvider import jp.co.soramitsu.common.data.network.ExternalAnalyzer import jp.co.soramitsu.common.resources.ClipboardManager import jp.co.soramitsu.common.resources.ResourceManager import jp.co.soramitsu.common.utils.Event import jp.co.soramitsu.core.model.Node class ExternalAccountActionsProvider( val clipboardManager: ClipboardManager, val appLinksProvider: AppLinksProvider, val resourceManager: ResourceManager ) : ExternalAccountActions.Presentation { override val openBrowserEvent = MutableLiveData<Event<String>>() override val showExternalActionsEvent = MutableLiveData<Event<ExternalAccountActions.Payload>>() override fun showBrowser(url: String) { openBrowserEvent.value = Event(url) } override fun showExternalActions(payload: ExternalAccountActions.Payload) { showExternalActionsEvent.value = Event(payload) } override fun copyAddress(address: String, messageShower: (message: String) -> Unit) { clipboardManager.addToClipboard(address) val message = resourceManager.getString(R.string.common_copied) messageShower.invoke(message) } override fun viewExternalClicked(analyzer: ExternalAnalyzer, address: String, networkType: Node.NetworkType) { val url = appLinksProvider.getExternalAddressUrl(analyzer, address, networkType) openBrowserEvent.value = Event(url) } }
3
null
11
51
ce2d28cd14a57c20f4d1757a89e23d2709c63072
1,579
fearless-Android
Apache License 2.0
src/main/kotlin/nbt/lang/format/NbttLanguageCodeStyleSettingsProvider.kt
minecraft-dev
42,327,118
false
null
/* * Minecraft Dev for IntelliJ * * https://minecraftdev.org * * Copyright (c) 2023 minecraft-dev * * MIT License */ package com.demonwav.mcdev.nbt.lang.format import com.demonwav.mcdev.nbt.lang.NbttLanguage import com.intellij.application.options.IndentOptionsEditor import com.intellij.application.options.SmartIndentOptionsEditor import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizable import com.intellij.psi.codeStyle.CodeStyleSettingsCustomizableOptions import com.intellij.psi.codeStyle.CommonCodeStyleSettings import com.intellij.psi.codeStyle.LanguageCodeStyleSettingsProvider import org.intellij.lang.annotations.Language class NbttLanguageCodeStyleSettingsProvider : LanguageCodeStyleSettingsProvider() { override fun getCodeSample(settingsType: SettingsType) = SAMPLE override fun customizeSettings(consumer: CodeStyleSettingsCustomizable, settingsType: SettingsType) { when (settingsType) { SettingsType.WRAPPING_AND_BRACES_SETTINGS -> { consumer.showStandardOptions("RIGHT_MARGIN") consumer.showCustomOption( NbttCodeStyleSettings::class.java, "LIST_WRAPPING", "Wrap list items", CodeStyleSettingsCustomizableOptions.getInstance().WRAPPING_BRACES, arrayOf( "Do not wrap", "Wrap as needed", "Wrap always", ), intArrayOf( CommonCodeStyleSettings.DO_NOT_WRAP, CommonCodeStyleSettings.WRAP_AS_NEEDED, CommonCodeStyleSettings.WRAP_ALWAYS, ) ) consumer.showCustomOption( NbttCodeStyleSettings::class.java, "ARRAY_WRAPPING", "Wrap array items", CodeStyleSettingsCustomizableOptions.getInstance().WRAPPING_BRACES, arrayOf( "Do not wrap", "Wrap as needed", "Wrap always", ), intArrayOf( CommonCodeStyleSettings.DO_NOT_WRAP, CommonCodeStyleSettings.WRAP_AS_NEEDED, CommonCodeStyleSettings.WRAP_ALWAYS, ) ) } SettingsType.SPACING_SETTINGS -> { consumer.showStandardOptions( "SPACE_WITHIN_BRACKETS", "SPACE_WITHIN_PARENTHESES", "SPACE_BEFORE_COMMA", "SPACE_AFTER_COMMA" ) consumer.showCustomOption( NbttCodeStyleSettings::class.java, "SPACE_BEFORE_COLON", "Space before colon", CodeStyleSettingsCustomizableOptions.getInstance().SPACES_AROUND_OPERATORS ) consumer.showCustomOption( NbttCodeStyleSettings::class.java, "SPACE_AFTER_COLON", "Space after colon", CodeStyleSettingsCustomizableOptions.getInstance().SPACES_AROUND_OPERATORS ) consumer.renameStandardOption("SPACE_WITHIN_BRACKETS", "List brackets") consumer.renameStandardOption("SPACE_WITHIN_PARENTHESES", "Array parentheses") } else -> { } } } override fun getIndentOptionsEditor(): IndentOptionsEditor = SmartIndentOptionsEditor() override fun getLanguage() = NbttLanguage override fun customizeDefaults( commonSettings: CommonCodeStyleSettings, indentOptions: CommonCodeStyleSettings.IndentOptions ) { commonSettings.RIGHT_MARGIN = 150 indentOptions.USE_TAB_CHARACTER = true indentOptions.TAB_SIZE = 4 indentOptions.INDENT_SIZE = indentOptions.TAB_SIZE indentOptions.CONTINUATION_INDENT_SIZE = indentOptions.INDENT_SIZE } } @Language("NBTT") private const val SAMPLE = """ "": { list: [ { "created-on": 1264099775885L "name": "Compound tag #0" }, { primitive list: [ 0B, 1B, false, true, 14B, ] array: ints(1, 3, 4) number: 1264099775885L }, ] } """
204
null
152
1,154
36cc3d47f7f39c847c0ebdcbf84980bc7262dab7
4,399
MinecraftDev
MIT License
projects/court-case-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt
ministryofjustice
500,855,647
false
null
package uk.gov.justice.digital.hmpps import com.github.tomakehurst.wiremock.WireMockServer import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc import org.springframework.boot.test.context.SpringBootTest import org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT import org.springframework.boot.test.mock.mockito.MockBean import org.springframework.test.web.servlet.MockMvc import org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get import org.springframework.test.web.servlet.result.MockMvcResultMatchers import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status import uk.gov.justice.digital.hmpps.api.model.ProbationStatus import uk.gov.justice.digital.hmpps.api.model.ProbationStatusDetail import uk.gov.justice.digital.hmpps.data.generator.PersonGenerator import uk.gov.justice.digital.hmpps.security.withOAuth2Token import uk.gov.justice.digital.hmpps.telemetry.TelemetryService import java.time.LocalDate @AutoConfigureMockMvc @SpringBootTest(webEnvironment = RANDOM_PORT) internal class IntegrationTest { @Autowired lateinit var mockMvc: MockMvc @Autowired lateinit var wireMockServer: WireMockServer @MockBean lateinit var telemetryService: TelemetryService @ParameterizedTest @MethodSource("probationStatuses") fun `correct status returned for each case`(crn: String, statusDetail: ProbationStatusDetail) { val expect = mockMvc .perform(get("/probation-case/$crn/status").withOAuth2Token(wireMockServer)) .andExpect(status().is2xxSuccessful) .andExpect(MockMvcResultMatchers.jsonPath("$.status").value(statusDetail.status.name)) .andExpect(MockMvcResultMatchers.jsonPath("$.inBreach").value(statusDetail.inBreach)) .andExpect(MockMvcResultMatchers.jsonPath("$.preSentenceActivity").value(statusDetail.preSentenceActivity)) .andExpect(MockMvcResultMatchers.jsonPath("$.awaitingPsr").value(statusDetail.awaitingPsr)) statusDetail.terminationDate?.let { expect.andExpect(MockMvcResultMatchers.jsonPath("$.terminationDate").value(it.toString())) } } companion object { private val DEFAULT_DETAIL = ProbationStatusDetail.NO_RECORD @JvmStatic fun probationStatuses() = listOf( Arguments.of("D035N73", DEFAULT_DETAIL), Arguments.of(PersonGenerator.NEW_TO_PROBATION.crn, DEFAULT_DETAIL.copy(ProbationStatus.CURRENT)), Arguments.of( PersonGenerator.CURRENTLY_MANAGED.crn, DEFAULT_DETAIL.copy(ProbationStatus.CURRENT, inBreach = true) ), Arguments.of( PersonGenerator.PREVIOUSLY_MANAGED.crn, DEFAULT_DETAIL.copy(ProbationStatus.PREVIOUSLY_KNOWN, LocalDate.now().minusDays(7)) ), Arguments.of( PersonGenerator.NO_SENTENCE.crn, DEFAULT_DETAIL.copy(ProbationStatus.NOT_SENTENCED, preSentenceActivity = true, awaitingPsr = true) ) ) } }
4
Kotlin
0
2
404fca1520f49953b96a792d266ee3d3d12ee73a
3,340
hmpps-probation-integration-services
MIT License
packages/react-native-gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/TaskUtils.kt
react-native-tvos
177,633,560
false
null
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package com.facebook.react.utils internal fun windowsAwareCommandLine(vararg args: Any): List<Any> = if (Os.isWindows()) { listOf("cmd", "/c") + args } else { args.toList() } internal fun windowsAwareBashCommandLine( vararg args: String, bashWindowsHome: String? = null ): List<String> = if (Os.isWindows()) { listOf(bashWindowsHome ?: "bash", "-c") + args } else { args.toList() }
8
null
141
897
f8904c210b1be562d3e141b083c7c24b6fc85750
631
react-native-tvos
MIT License
HMA.Mobile/app/src/main/java/com/example/hma_mobile/HiltApplication.kt
blahutakrystian
757,301,168
false
{"Kotlin": 6641}
package com.example.hma_mobile import android.app.Application class HiltApplication : Application() { override fun onCreate() { super.onCreate() } }
0
Kotlin
0
0
2d6c7d756e6a85727922673023a2e6ec3459863b
166
home-management-assistant
MIT License
coil-gif/src/main/java/coil3/gif/AnimatedTransformation.kt
coil-kt
201,684,760
false
null
package coil3.transform import android.graphics.Canvas import coil3.annotation.ExperimentalCoilApi /** * An interface for making transformations to an animated image's pixel data. */ @ExperimentalCoilApi fun interface AnimatedTransformation { /** * Apply the transformation to the [canvas]. * * @param canvas The [Canvas] to draw on. * @return The opacity of the image after drawing. */ fun transform(canvas: Canvas): PixelOpacity }
43
null
626
9,954
9b3f851b2763b4c72a3863f8273b8346487b363b
471
coil
Apache License 2.0
coil-gif/src/main/java/coil3/gif/AnimatedTransformation.kt
coil-kt
201,684,760
false
null
package coil3.transform import android.graphics.Canvas import coil3.annotation.ExperimentalCoilApi /** * An interface for making transformations to an animated image's pixel data. */ @ExperimentalCoilApi fun interface AnimatedTransformation { /** * Apply the transformation to the [canvas]. * * @param canvas The [Canvas] to draw on. * @return The opacity of the image after drawing. */ fun transform(canvas: Canvas): PixelOpacity }
43
null
626
9,954
9b3f851b2763b4c72a3863f8273b8346487b363b
471
coil
Apache License 2.0
wallet-sdk/src/main/kotlin/org/stellar/walletsdk/auth/Sep10.kt
stellar
523,604,257
false
null
package org.stellar.walletsdk.auth import io.ktor.client.* import io.ktor.client.call.* import io.ktor.client.request.* import io.ktor.http.* import java.util.* import kotlinx.datetime.Clock import mu.KotlinLogging import org.stellar.sdk.Network import org.stellar.sdk.Transaction import org.stellar.walletsdk.Config import org.stellar.walletsdk.exception.* import org.stellar.walletsdk.horizon.AccountKeyPair import org.stellar.walletsdk.util.Util.postJson private val log = KotlinLogging.logger {} /** * Authenticate to an external server using * [SEP-10](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0010.md). */ class Sep10 internal constructor( private val cfg: Config, private val webAuthEndpoint: String, private val homeDomain: String, private val httpClient: HttpClient ) { /** * Authenticates to an external server. * * @param accountAddress Stellar address of the account authenticating * @param walletSigner overriding [Sep10.defaultSigner] to use in this authentication * @param memoId optional memo ID to distinguish the account * @param clientDomain optional domain hosting stellar.toml file containing `SIGNING_KEY` * @return authentication token (JWT) * @throws [ValidationException] when some of the request arguments are not valid * @throws [InvalidResponseException] when JSON response is malformed */ suspend fun authenticate( accountAddress: AccountKeyPair, walletSigner: WalletSigner? = null, memoId: String? = null, clientDomain: String? = null ): AuthToken { val challengeTxn = challenge(accountAddress, memoId, clientDomain ?: cfg.app.defaultClientDomain) val signedTxn = sign(accountAddress, challengeTxn, walletSigner ?: cfg.app.defaultSigner) return getToken(signedTxn) } /** * Request transaction challenge from the auth endpoint. * * @return transaction as Base64 encoded TransactionEnvelope XDR string and network passphrase * from the auth endpoint * @throws [InvalidMemoIdException] when memo ID is not valid * @throws [ClientDomainWithMemoException] when both client domain and memo ID provided * @throws [InvalidResponseException] when JSON response is malformed */ @Suppress("ThrowsCount") private suspend fun challenge( account: AccountKeyPair, memoId: String? = null, clientDomain: String? = null ): ChallengeResponse { val url = URLBuilder(webAuthEndpoint) // Add required query params url.parameters.append("account", account.address) url.parameters.append("home_domain", homeDomain) if (!memoId.isNullOrBlank()) { if (memoId.toInt() < 0) { throw InvalidMemoIdException } url.parameters.append("memo", memoId) } if (!clientDomain.isNullOrBlank()) { if (!memoId.isNullOrBlank()) { throw ClientDomainWithMemoException } url.parameters.append("client_domain", clientDomain) } log.debug { "Challenge request: account = $account, memo = $memoId, client_domain = $clientDomain" } val jsonResponse = httpClient.get(url.build()).body<ChallengeResponse>() if (jsonResponse.transaction.isBlank()) { throw MissingTransactionException } if (jsonResponse.networkPassphrase != cfg.stellar.network.networkPassphrase) { throw NetworkMismatchException } return jsonResponse } /** * Sign transaction with client account and, optionally, domain account using [WalletSigner] * methods. * * @param challengeResponse challenge transaction and network passphrase returned from the auth * endpoint * @return signed transaction */ private suspend fun sign( account: AccountKeyPair, challengeResponse: ChallengeResponse, walletSigner: WalletSigner ): Transaction { var challengeTxn = Transaction.fromEnvelopeXdr( challengeResponse.transaction, Network(challengeResponse.networkPassphrase) ) as Transaction val clientDomainOperation = challengeTxn.operations.firstOrNull { it.toXdr().body?.manageDataOp?.dataName?.string64.toString() == "client_domain" } if (clientDomainOperation != null) { log.debug { "Authenticating with client domain" } challengeTxn = walletSigner.signWithDomainAccount( challengeResponse.transaction, challengeResponse.networkPassphrase, account ) } walletSigner.signWithClientAccount(challengeTxn, account) return challengeTxn } /** * Send signed transaction to the auth endpoint to get JWT token. * * @param signedTransaction signed transaction * @return transaction as Base64 encoded TransactionEnvelope XDR string * @throws [MissingTokenException] when request JSON response does not contain `token` */ private suspend fun getToken(signedTransaction: Transaction): AuthToken { val signedChallengeTxnXdr = signedTransaction.toEnvelopeXdrBase64() val tokenRequestParams = AuthTransaction(signedChallengeTxnXdr) val resp: AuthTokenResponse = httpClient.postJson(webAuthEndpoint, tokenRequestParams) if (resp.token.isBlank()) { throw MissingTokenException } val token = AuthToken.from(resp.token) if (token.expiresAt < Clock.System.now()) { throw ValidationException( "Auth token has already expired. Expiration time: ${token.expiresAt}" ) } return token } }
3
Kotlin
8
5
cf6ab208aa9ab2b60e0a691005ced6ba6f4219d7
5,467
kotlin-wallet-sdk
Apache License 2.0
src/main/kotlin/bpm/mc/registries/ModAttachments.kt
meng-devs
852,470,964
false
{"Kotlin": 1123351, "GLSL": 2785}
package bpm.mc.registries import bpm.Bpm import bpm.booostrap.ModRegistry import bpm.mc.block.UUIDSerializer import net.neoforged.neoforge.attachment.AttachmentType import net.neoforged.neoforge.registries.DeferredRegister import net.neoforged.neoforge.registries.NeoForgeRegistries import java.util.* import java.util.function.Supplier object ModAttachments : ModRegistry<AttachmentType<*>> { override val registry: DeferredRegister<AttachmentType<*>> = DeferredRegister.create( NeoForgeRegistries.ATTACHMENT_TYPES, Bpm.ID ) val UUID_ATTACHMENT: AttachmentType<UUID> by register { registry.register("uuid", Supplier { AttachmentType.builder(Supplier { UUID.randomUUID() }) .serialize(UUIDSerializer) .build() }) } }
5
Kotlin
0
0
caf36397c9aa72a21e2b19f6051d76db66c9f77c
841
bpm.core
MIT License
kotlin-code-generation/src/test/kotlin/support/ThrowsAnnotationTest.kt
toolisticon
804,098,315
false
{"Kotlin": 321372}
package io.toolisticon.kotlin.generation.support import com.squareup.kotlinpoet.ExperimentalKotlinPoetApi import org.assertj.core.api.Assertions.assertThat import org.junit.jupiter.api.Test @OptIn(ExperimentalKotlinPoetApi::class) internal class ThrowsAnnotationTest { @Test fun `create throw annotation with one type`() { val annotation = ThrowsAnnotation(RuntimeException::class) assertThat(annotation.spec().code).isEqualToIgnoringWhitespace(""" @kotlin.jvm.Throws(java.lang.RuntimeException::class) """.trimIndent()) } @Test fun `create throw annotation with two type`() { val annotation = ThrowsAnnotation(RuntimeException::class, NotImplementedError::class) assertThat(annotation.spec().code).isEqualToIgnoringWhitespace(""" @kotlin.jvm.Throws(java.lang.RuntimeException::class, kotlin.NotImplementedError::class) """.trimIndent()) } }
5
Kotlin
0
2
d50b3f82cb6c2181da03429f2ac05b41e60fa695
896
kotlin-code-generation
Apache License 2.0
app/src/main/java/com/davismiyashiro/expenses/view/opentab/ParticipantFragmentPresenter.kt
DavisJP
109,140,022
false
null
/* * MIT License * * Copyright (c) 2019 Davis Miyashiro * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.davismiyashiro.expenses.view.opentab import com.davismiyashiro.expenses.datatypes.Participant import com.davismiyashiro.expenses.datatypes.Tab import com.davismiyashiro.expenses.model.Repository /** * Class that centralizes access to repository and the fragments */ class ParticipantFragmentPresenter(internal var repository: Repository) : ParticipantInterfaces.UserActionsListener { internal lateinit var participantView: ParticipantInterfaces.ParticipantView override fun setParticipantView(view: ParticipantInterfaces.ParticipantView) { participantView = view } override fun loadParticipants(tab: Tab) { repository.refreshData() // Fix to get Participants list updated when switching tabs repository.getParticipants(tab.groupId, object : Repository.LoadParticipantsCallback { override fun onParticipantsLoaded(participants: MutableList<Participant>) { participantView.showParticipants(participants) } }) } override fun removeParticipant(participant: Participant) { repository.deleteParticipant(participant) } }
0
Kotlin
0
0
e88daf146151fa7ff3d2d4cc0a378af480dc48aa
2,281
Expenses
MIT License
app/src/main/java/ua/com/radiokot/photoprism/db/roomMigration.kt
Radiokot
612,884,518
false
null
package ua.com.radiokot.photoprism.db import androidx.sqlite.db.SupportSQLiteDatabase /** * Clean lambda-based [androidx.room.migration.Migration] implementation. */ internal fun roomMigration( from: Int, to: Int, migration: SupportSQLiteDatabase.() -> Unit, ) = object : androidx.room.migration.Migration(from, to) { override fun migrate(database: SupportSQLiteDatabase) = database.run(migration) }
0
Kotlin
8
121
97b659c553b25b4bdc59a1e245229f61f0667db2
419
photoprism-android-client
Apache License 2.0
app/src/main/java/org/wordpress/edittextrecycled/MyEditText.kt
hypest
126,629,280
false
null
package org.wordpress.edittextrecycled import android.content.Context import android.graphics.drawable.ShapeDrawable import android.graphics.drawable.shapes.RectShape import android.text.Spannable import android.text.SpannableString import android.text.SpannableStringBuilder import android.text.style.DrawableMarginSpan import android.util.AttributeSet import android.util.Log import android.widget.EditText class MyEditText : EditText { constructor(context: Context?) : super(context) constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) var prevSpan: Any? = null override fun onScrollChanged(horiz: Int, vert: Int, oldHoriz: Int, oldVert: Int) { super.onScrollChanged(horiz, vert, oldHoriz, oldVert) val topLine = layout.getLineForVertical(vert) // wait till we have couple of lines hidden if (topLine > 2) { // replace two lines up the current one val hideUpTo = topLine - 2 val endHide = layout.getLineEnd(hideUpTo) val toBottom = layout.getLineBottom(hideUpTo) val shape = ShapeDrawable(RectShape()) shape.intrinsicWidth = 100 shape.intrinsicHeight = toBottom // the span will be as tall as the replaced lines shape.setBounds(0, 0, shape.intrinsicWidth, shape.intrinsicHeight) // Cast to SpannableStringBuilder otherwise the `replace` call will mess up the spans and kill the scroll val t = text as SpannableStringBuilder val spannable = SpannableString("@\n".padStart(10)) val span = DrawableMarginSpan(shape, 0) spannable.setSpan(span, 0, 10, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE) t.replace(0, endHide, spannable) if (prevSpan != null) { t.removeSpan(prevSpan) } prevSpan = span refreshDrawableState() } } }
0
Kotlin
0
0
41f73ba7cff668c66e38c522106435cb73b44ef9
2,057
edittext-recycled
Apache License 2.0
src/main/kotlin/no/nav/sosialhjelp/innsyn/app/mdc/MDCFilter.kt
navikt
184,267,271
false
{"Kotlin": 750292, "Dockerfile": 427, "Procfile": 92}
package no.nav.sosialhjelp.innsyn.app.mdc import jakarta.servlet.FilterChain import jakarta.servlet.http.HttpServletRequest import jakarta.servlet.http.HttpServletResponse import no.nav.sosialhjelp.innsyn.app.mdc.MDCUtils.CALL_ID import no.nav.sosialhjelp.innsyn.app.mdc.MDCUtils.DIGISOS_ID import no.nav.sosialhjelp.innsyn.app.mdc.MDCUtils.clearMDC import no.nav.sosialhjelp.innsyn.app.mdc.MDCUtils.generateCallId import no.nav.sosialhjelp.innsyn.app.mdc.MDCUtils.put import no.nav.sosialhjelp.innsyn.utils.IntegrationUtils.HEADER_CALL_ID import org.springframework.http.HttpHeaders import org.springframework.stereotype.Component import org.springframework.web.filter.OncePerRequestFilter @Component class MDCFilter : OncePerRequestFilter() { override fun doFilterInternal( request: HttpServletRequest, response: HttpServletResponse, filterChain: FilterChain, ) { addCallId(request) addDigisosId(request) put(MDCUtils.PATH, request.requestURI) request.getHeader(HttpHeaders.USER_AGENT)?.let { put(MDCUtils.USER_AGENT, it) } request.getHeader(HttpHeaders.REFERER)?.let { put(MDCUtils.REFERER, it) } try { filterChain.doFilter(request, response) } finally { clearMDC() } } private fun addCallId(request: HttpServletRequest) { request.getHeader(HEADER_CALL_ID) ?.let { put(CALL_ID, it) } ?: put(CALL_ID, generateCallId()) } private fun addDigisosId(request: HttpServletRequest) { if (request.requestURI.matches( Regex( "^$INNSYN_BASE_URL(.*)/(forelopigSvar|hendelser|kommune|oppgaver|oppgaver/(.*)" + "|saksStatus|soknadsStatus|vedlegg|vilkar|dokumentasjonkrav|dokumentasjonkrav/(.*)" + "|harLeverteDokumentasjonkrav|fagsystemHarDokumentasjonkrav)", ), ) ) { val digisosId = request.requestURI.substringAfter(INNSYN_BASE_URL).substringBefore("/") put(DIGISOS_ID, digisosId) } else if (request.requestURI.matches(Regex("^${INNSYN_BASE_URL}saksDetaljer")) && request.parameterMap.containsKey( "id", ) ) { val digisosId = request.getParameter("id") put(DIGISOS_ID, digisosId) } } companion object { private const val INNSYN_BASE_URL = "/sosialhjelp/innsyn-api/api/v1/innsyn/" } }
6
Kotlin
0
0
55867535dc0778572255c942102eb0a215302b0b
2,510
sosialhjelp-innsyn-api
MIT License
spi/src/main/kotlin/com/atlassian/migration/datacenter/spi/exceptions/ConfigurationReadException.kt
andrewpowell
269,599,826
true
{"TSQL": 599562, "Java": 455015, "Kotlin": 212757, "TypeScript": 182843, "JavaScript": 20409, "Python": 3813, "HTML": 2599, "Makefile": 2424, "Shell": 1292, "Dockerfile": 703}
/* * Copyright (c) 2020. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and limitations under the License. */ package com.atlassian.migration.datacenter.spi.exceptions class ConfigurationReadException : RuntimeException { constructor(message: String) : super(message) {} constructor(message: String, cause: Throwable) : super(message, cause) {} }
0
null
0
0
a35f6282e4e596e454db773c0415dce6a21b9064
826
dc-migration-assistant
Apache License 2.0
kground/src/commonTest/kotlin/ure/UreTestsForBasicStuffCmn.kt
mareklangiewicz
676,002,318
false
{"Kotlin": 179917, "HTML": 270}
package pl.mareklangiewicz.ure import pl.mareklangiewicz.annotations.* import pl.mareklangiewicz.uspek.* const val exampleABCDEx3 = "aBcDe\naBcDe\nABCDE" fun testSomeUreBasicStuff() { // some example very basic sanity tests "chDot compiled pattern is quoted dot" o { chDot.compile().pattern eq "\\." } "chAnyInLine compiled pattern just a dot" o { chAnyInLine.compile().pattern eq "." } testUreWithDifferentOptions() testUreQuantifAndAtomic() // TODO("Test some quantifiers (is UreQuantif.toClosedIR() correct?)") // TODO NOW testUreBasicEmail() } fun testUreQuantifAndAtomic() { // TODO NOW (which platforms support atomic, which possessive quantifiers, etc) } @OptIn(DelicateApi::class) fun testUreBasicEmail() { "On ureBasicEmail" o { "assert IR as expected" o { // This assertion is kinda lame (expecting exact impl/ir / cementing impl), // but it's useful for me now as documentation and to track if sth changes. ureBasicEmail.toIR().str eq """\b(?<user>[\w.\-]+)\b@\b(?<domain>(?:[\w\-]+\.)+[\w\-]{2,16})\b""" } testUreEmail(ureBasicEmail) } } private fun testUreEmail(ureEmail: Ure) { val ureEmailIR = ureEmail.toIR() val ureEmailRegex = ureEmail.compile() // println("ure:\n$ureEmail") // println("ureIR:\n$ureEmailIR") // println("regex:\n$ureEmailRegex") testRegexWithEmail(ureEmailRegex, "<EMAIL>", "marek.langiewicz", "gmail.com") testRegexWithEmail(ureEmailRegex, "<EMAIL>", "langara", "wp.pl") testRegexWithEmail(ureEmailRegex, "a.b.c@d.e.f.hhh", "a.b.c", "d.e.f.hhh") testRegexWithIncorrectEmail(ureEmailRegex, "a.b.cd.e.f.hhh") testRegexWithIncorrectEmail(ureEmailRegex, "a@b@c") } private fun testRegexWithEmail(regex: Regex, email: String, expectedUser: String, expectedDomain: String) { "for email: $email" o { "it matches" o { regex.matches(email) eq true } "for match result" o { val result = regex.matchEntire(email)!! val groups = result.groups "it captures expected user name: $expectedUser" o { groups["user"]!!.value eq expectedUser } "it captures expected domain: $expectedDomain" o { groups["domain"]!!.value eq expectedDomain } } } } private fun testRegexWithIncorrectEmail(regex: Regex, email: String) { "for incorrect email: $email" o { "it does not match" o { regex.matches(email) eq false } "match result is null" o { regex.matchEntire(email) eq null } } }
0
Kotlin
0
0
4c432301942c94fd0b0434f2b69c45dc3ed7bec3
2,551
KGround
Apache License 2.0
app/src/main/java/dlp/android/ma7moud3ly/data/Downloads.kt
Ma7moud3ly
783,520,987
false
{"Kotlin": 92450, "Python": 4734}
package dlp.android.ma7moud3ly.data import android.graphics.Bitmap import java.io.File data class DownloadProgress( val downloaded: Double = 0.0, val size: Double = 0.0, val percent: Float = 0f ) /** * Downloaded file info in app internal storage */ data class DownloadInfo( val file: File = File(""), val thumbnail: Bitmap? = null, val canPlay: Boolean = false ) { val size: Double get() = file.length().toInt().toMega val name: String get() = file.name val ext get() = file.extension }
0
Kotlin
0
3
4387d8b6c053da743ba59f1485b6c4148334d4bc
529
dlp-android
MIT License
kotlin-eclipse-ui-test/testData/refactoring/rename/renameKotlinTopLevelFunFromJava/before/KotlinCls.kt
bvfalcon
263,980,575
false
null
fun kotlinTopLevelFun() { }
19
null
7
43
e6360b023e1e377325f1d10bda5755e3fc3af591
27
kotlin-eclipse
Apache License 2.0
room/room-compiler/src/test/test-data/kotlinCodeGen/shortcutMethods_rx3.kt
androidx
256,589,781
false
null
import androidx.room.EntityDeletionOrUpdateAdapter import androidx.room.EntityInsertionAdapter import androidx.room.EntityUpsertionAdapter import androidx.room.RoomDatabase import androidx.sqlite.db.SupportSQLiteStatement import io.reactivex.rxjava3.core.Completable import io.reactivex.rxjava3.core.Single import java.lang.Class import java.lang.Void import java.util.concurrent.Callable import javax.`annotation`.processing.Generated import kotlin.Int import kotlin.Long import kotlin.String import kotlin.Suppress import kotlin.Unit import kotlin.collections.List import kotlin.jvm.JvmStatic @Generated(value = ["androidx.room.RoomProcessor"]) @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION"]) public class MyDao_Impl( __db: RoomDatabase, ) : MyDao { private val __db: RoomDatabase private val __insertionAdapterOfMyEntity: EntityInsertionAdapter<MyEntity> private val __deletionAdapterOfMyEntity: EntityDeletionOrUpdateAdapter<MyEntity> private val __updateAdapterOfMyEntity: EntityDeletionOrUpdateAdapter<MyEntity> private val __upsertionAdapterOfMyEntity: EntityUpsertionAdapter<MyEntity> init { this.__db = __db this.__insertionAdapterOfMyEntity = object : EntityInsertionAdapter<MyEntity>(__db) { public override fun createQuery(): String = "INSERT OR ABORT INTO `MyEntity` (`pk`,`other`) VALUES (?,?)" public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity): Unit { statement.bindLong(1, entity.pk.toLong()) statement.bindString(2, entity.other) } } this.__deletionAdapterOfMyEntity = object : EntityDeletionOrUpdateAdapter<MyEntity>(__db) { public override fun createQuery(): String = "DELETE FROM `MyEntity` WHERE `pk` = ?" public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity): Unit { statement.bindLong(1, entity.pk.toLong()) } } this.__updateAdapterOfMyEntity = object : EntityDeletionOrUpdateAdapter<MyEntity>(__db) { public override fun createQuery(): String = "UPDATE OR ABORT `MyEntity` SET `pk` = ?,`other` = ? WHERE `pk` = ?" public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity): Unit { statement.bindLong(1, entity.pk.toLong()) statement.bindString(2, entity.other) statement.bindLong(3, entity.pk.toLong()) } } this.__upsertionAdapterOfMyEntity = EntityUpsertionAdapter<MyEntity>(object : EntityInsertionAdapter<MyEntity>(__db) { public override fun createQuery(): String = "INSERT INTO `MyEntity` (`pk`,`other`) VALUES (?,?)" public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity): Unit { statement.bindLong(1, entity.pk.toLong()) statement.bindString(2, entity.other) } }, object : EntityDeletionOrUpdateAdapter<MyEntity>(__db) { public override fun createQuery(): String = "UPDATE `MyEntity` SET `pk` = ?,`other` = ? WHERE `pk` = ?" public override fun bind(statement: SupportSQLiteStatement, entity: MyEntity): Unit { statement.bindLong(1, entity.pk.toLong()) statement.bindString(2, entity.other) statement.bindLong(3, entity.pk.toLong()) } }) } public override fun insertSingle(vararg entities: MyEntity): Single<List<Long>> = Single.fromCallable(object : Callable<List<Long>?> { public override fun call(): List<Long>? { __db.beginTransaction() try { val _result: List<Long>? = __insertionAdapterOfMyEntity.insertAndReturnIdsList(entities) __db.setTransactionSuccessful() return _result } finally { __db.endTransaction() } } }) public override fun insertCompletable(vararg entities: MyEntity): Completable = Completable.fromCallable(object : Callable<Void?> { public override fun call(): Void? { __db.beginTransaction() try { __insertionAdapterOfMyEntity.insert(entities) __db.setTransactionSuccessful() return null } finally { __db.endTransaction() } } }) public override fun deleteSingle(entity: MyEntity): Single<Int> = Single.fromCallable(object : Callable<Int?> { public override fun call(): Int? { var _total: Int = 0 __db.beginTransaction() try { _total += __deletionAdapterOfMyEntity.handle(entity) __db.setTransactionSuccessful() return _total } finally { __db.endTransaction() } } }) public override fun deleteCompletable(entity: MyEntity): Completable = Completable.fromCallable(object : Callable<Void?> { public override fun call(): Void? { __db.beginTransaction() try { __deletionAdapterOfMyEntity.handle(entity) __db.setTransactionSuccessful() return null } finally { __db.endTransaction() } } }) public override fun updateSingle(entity: MyEntity): Single<Int> = Single.fromCallable(object : Callable<Int?> { public override fun call(): Int? { var _total: Int = 0 __db.beginTransaction() try { _total += __updateAdapterOfMyEntity.handle(entity) __db.setTransactionSuccessful() return _total } finally { __db.endTransaction() } } }) public override fun updateCompletable(entity: MyEntity): Completable = Completable.fromCallable(object : Callable<Void?> { public override fun call(): Void? { __db.beginTransaction() try { __updateAdapterOfMyEntity.handle(entity) __db.setTransactionSuccessful() return null } finally { __db.endTransaction() } } }) public override fun upsertSingle(vararg entities: MyEntity): Single<List<Long>> = Single.fromCallable(object : Callable<List<Long>?> { public override fun call(): List<Long>? { __db.beginTransaction() try { val _result: List<Long>? = __upsertionAdapterOfMyEntity.upsertAndReturnIdsList(entities) __db.setTransactionSuccessful() return _result } finally { __db.endTransaction() } } }) public override fun upsertCompletable(vararg entities: MyEntity): Completable = Completable.fromCallable(object : Callable<Void?> { public override fun call(): Void? { __db.beginTransaction() try { __upsertionAdapterOfMyEntity.upsert(entities) __db.setTransactionSuccessful() return null } finally { __db.endTransaction() } } }) public companion object { @JvmStatic public fun getRequiredConverters(): List<Class<*>> = emptyList() } }
26
null
913
4,930
a9b86d2cfe642b58f8bce108217f04e62ade1d97
7,856
androidx
Apache License 2.0
src/main/kotlin/kotlinmud/mob/race/impl/Giant.kt
danielmunro
241,230,796
false
null
package kotlinmud.mob.race.impl import kotlinmud.attributes.factory.createStats import kotlinmud.mob.fight.type.DamageType import kotlinmud.mob.race.type.Race import kotlinmud.mob.race.type.RaceType import kotlinmud.mob.type.Form import kotlinmud.mob.type.Size class Giant : Race() { override val type = RaceType.GIANT override val resist = listOf(DamageType.FIRE, DamageType.COLD) override val vulnerableTo = listOf(DamageType.ENERGY, DamageType.MENTAL) override val unarmedAttackVerb = "punch" override val unarmedDamageType = DamageType.POUND override val form = Form.MAMMAL override val attributes = createStats(3, -2, -2, -2, 3, 0, 1) override val size = Size.HUGE override val maxAppetite = 240 override val maxThirst = 240 }
0
Kotlin
1
9
b7ee0d21ae813990896b1b8c6703da9bd1f1fc5b
774
kotlinmud
MIT License
app/src/main/java/com/example/bitfit_part1/MainActivity.kt
clearFrost
617,833,886
false
null
package com.example.bitfit_part1 import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.Display import android.widget.Button import android.widget.TextView import androidx.fragment.app.Fragment import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.google.android.material.bottomnavigation.BottomNavigationView import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.launch class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) supportActionBar!!.setTitle("Exertrack") val exerciseInput: TextView = findViewById(R.id.exerciseET) val repetitionsInput: TextView = findViewById(R.id.repsET) val addWorkoutBtn: Button = findViewById<Button>(R.id.addWorkoutBtn) /* val exerciseTrackerRv: RecyclerView = findViewById(R.id.exerciseTrackerRv)*/ val exerciseList: MutableList<DisplayExercise> = listOf<DisplayExercise>().toMutableList() val exerciseAdapter = ExerciseAdapter(exerciseList) /* exerciseTrackerRv.adapter = exerciseAdapter exerciseTrackerRv.layoutManager=LinearLayoutManager(this)*/ val exerciseFragment: Fragment = ExerciseFragment() val statsFragment: Fragment = StatsFragment() val bottomNavigationView: BottomNavigationView = findViewById(R.id.bottom_navigation) lifecycleScope.launch { (application as ArticleApplication).db.exerciseDao().getAll().collect { databaseList -> databaseList.map { entity -> DisplayExercise( entity.id, entity.exercise, entity.reps) }.also { mappedList -> exerciseList.clear() exerciseList.addAll(mappedList) exerciseAdapter.notifyDataSetChanged() } } } addWorkoutBtn.setOnClickListener { lifecycleScope.launch(IO){ (application as ArticleApplication).db.exerciseDao().insert( ExerciseEntity( exercise = exerciseInput.text.toString(), reps = repetitionsInput.text.toString() ) )} } bottomNavigationView.setOnItemSelectedListener { item -> lateinit var fragment: Fragment when (item.itemId){ R.id.exerciseItem -> fragment = exerciseFragment R.id.statsItem -> fragment = statsFragment } replaceFragment(fragment) true } bottomNavigationView.selectedItemId = R.id.exerciseItem } private fun replaceFragment(fragment: Fragment) { val fragmentManager = supportFragmentManager val fragmentTransaction = fragmentManager.beginTransaction() fragmentTransaction.replace(R.id.article_frame_layout, fragment) fragmentTransaction.commit() } }
1
Kotlin
0
0
6836bf1ce0c4d4dd5316b0c952cec04c8c7ee5a8
3,190
Exertrack
Apache License 2.0
sketch-animated/src/androidInstrumentedTest/kotlin/com/github/panpf/sketch/animated/android/test/decode/WebpAnimatedDecoderTest.kt
panpf
14,798,941
false
null
/* * Copyright (C) 2022 panpf <<EMAIL>> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.github.panpf.sketch.animated.android.test.decode import android.graphics.ColorSpace import android.os.Build import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry import com.github.panpf.sketch.ComponentRegistry import com.github.panpf.sketch.decode.ImageInfo import com.github.panpf.sketch.decode.WebpAnimatedDecoder import com.github.panpf.sketch.decode.internal.createInSampledTransformed import com.github.panpf.sketch.decode.supportAnimatedWebp import com.github.panpf.sketch.drawable.AnimatableDrawable import com.github.panpf.sketch.fetch.FetchResult import com.github.panpf.sketch.getDrawableOrThrow import com.github.panpf.sketch.images.MyImages import com.github.panpf.sketch.request.ImageRequest import com.github.panpf.sketch.request.colorSpace import com.github.panpf.sketch.request.onAnimationEnd import com.github.panpf.sketch.request.onAnimationStart import com.github.panpf.sketch.request.repeatCount import com.github.panpf.sketch.source.AssetDataSource import com.github.panpf.sketch.source.DataFrom.LOCAL import com.github.panpf.sketch.test.singleton.sketch import com.github.panpf.sketch.test.utils.intrinsicSize import com.github.panpf.sketch.test.utils.toRequestContext import com.github.panpf.sketch.util.Size import kotlinx.coroutines.runBlocking import kotlinx.coroutines.test.runTest import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class WebpAnimatedDecoderTest { @Test fun testSupportApkIcon() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return ComponentRegistry.Builder().apply { build().apply { Assert.assertEquals( "ComponentRegistry(" + "fetcherFactoryList=[]," + "decoderFactoryList=[]," + "requestInterceptorList=[]," + "decodeInterceptorList=[]" + ")", toString() ) } supportAnimatedWebp() build().apply { Assert.assertEquals( "ComponentRegistry(" + "fetcherFactoryList=[]," + "decoderFactoryList=[WebpAnimatedDecoder]," + "requestInterceptorList=[]," + "decodeInterceptorList=[]" + ")", toString() ) } supportAnimatedWebp() build().apply { Assert.assertEquals( "ComponentRegistry(" + "fetcherFactoryList=[]," + "decoderFactoryList=[WebpAnimatedDecoder,WebpAnimatedDecoder]," + "requestInterceptorList=[]," + "decodeInterceptorList=[]" + ")", toString() ) } } } @Test fun testFactory() = runTest { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return@runTest val context = InstrumentationRegistry.getInstrumentation().context val sketch = context.sketch val factory = WebpAnimatedDecoder.Factory() Assert.assertEquals("WebpAnimatedDecoder", factory.toString()) // normal ImageRequest(context, MyImages.animWebp.uri).let { val fetchResult = FetchResult( AssetDataSource(sketch, it, MyImages.animWebp.fileName), "image/webp" ) factory.create(it.toRequestContext(sketch), fetchResult) }.apply { Assert.assertNotNull(this) } ImageRequest(context, MyImages.animWebp.uri).let { val fetchResult = FetchResult(AssetDataSource(sketch, it, MyImages.animWebp.fileName), null) factory.create(it.toRequestContext(sketch), fetchResult) }.apply { Assert.assertNotNull(this) } // disallowAnimatedImage true ImageRequest(context, MyImages.animWebp.uri) { disallowAnimatedImage() }.let { val fetchResult = FetchResult(AssetDataSource(sketch, it, MyImages.animWebp.fileName), null) factory.create(it.toRequestContext(sketch), fetchResult) }.apply { Assert.assertNull(this) } // data error ImageRequest(context, MyImages.png.uri).let { val fetchResult = FetchResult(AssetDataSource(sketch, it, MyImages.png.fileName), null) factory.create(it.toRequestContext(sketch), fetchResult) }.apply { Assert.assertNull(this) } ImageRequest(context, MyImages.animGif.uri).let { val fetchResult = FetchResult(AssetDataSource(sketch, it, MyImages.animGif.fileName), "image/webp") factory.create(it.toRequestContext(sketch), fetchResult) }.apply { Assert.assertNull(this) } // mimeType error ImageRequest(context, MyImages.animWebp.uri).let { val fetchResult = FetchResult( AssetDataSource(sketch, it, MyImages.animWebp.fileName), "image/jpeg", ) factory.create(it.toRequestContext(sketch), fetchResult) }.apply { Assert.assertNull(this) } } @Test fun testDecodeDrawable() = runTest { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) return@runTest val context = InstrumentationRegistry.getInstrumentation().context val sketch = context.sketch val factory = WebpAnimatedDecoder.Factory() val request = ImageRequest(context, MyImages.animWebp.uri) { colorSpace(ColorSpace.Named.SRGB) onAnimationEnd { } onAnimationStart { } } val fetchResult = sketch.components.newFetcherOrThrow(request) .let { runBlocking { it.fetch() }.getOrThrow() } factory.create(request.toRequestContext(sketch), fetchResult)!! .let { runBlocking { it.decode() }.getOrThrow() }.apply { Assert.assertEquals(ImageInfo(480, 270, "image/webp"), this.imageInfo) Assert.assertEquals(Size(480, 270), image.getDrawableOrThrow().intrinsicSize) Assert.assertEquals(LOCAL, this.dataFrom) Assert.assertNull(this.transformeds) val animatedImageDrawable = ((image.getDrawableOrThrow() as AnimatableDrawable).drawable as com.github.panpf.sketch.drawable.ScaledAnimatedImageDrawable).drawable Assert.assertEquals(-1, animatedImageDrawable.repeatCount) } val request1 = ImageRequest(context, MyImages.animWebp.uri) { repeatCount(3) size(300, 300) } val fetchResult1 = sketch.components.newFetcherOrThrow(request1) .let { runBlocking { it.fetch() }.getOrThrow() } factory.create(request1.toRequestContext(sketch), fetchResult1)!! .let { runBlocking { it.decode().getOrThrow() } }.apply { Assert.assertEquals(ImageInfo(480, 270, "image/webp"), this.imageInfo) Assert.assertEquals(Size(240, 135), image.getDrawableOrThrow().intrinsicSize) Assert.assertEquals(LOCAL, this.dataFrom) Assert.assertEquals(listOf(createInSampledTransformed(2)), this.transformeds) val animatedImageDrawable = ((image.getDrawableOrThrow() as AnimatableDrawable).drawable as com.github.panpf.sketch.drawable.ScaledAnimatedImageDrawable).drawable Assert.assertEquals(3, animatedImageDrawable.repeatCount) } } @Test fun testFactoryEqualsAndHashCode() { val element1 = WebpAnimatedDecoder.Factory() val element11 = WebpAnimatedDecoder.Factory() val element2 = WebpAnimatedDecoder.Factory() Assert.assertNotSame(element1, element11) Assert.assertNotSame(element1, element2) Assert.assertNotSame(element2, element11) Assert.assertEquals(element1, element1) Assert.assertEquals(element1, element11) Assert.assertEquals(element1, element2) Assert.assertEquals(element2, element11) Assert.assertNotEquals(element1, null) Assert.assertNotEquals(element1, Any()) Assert.assertEquals(element1.hashCode(), element1.hashCode()) Assert.assertEquals(element1.hashCode(), element11.hashCode()) Assert.assertEquals(element1.hashCode(), element2.hashCode()) Assert.assertEquals(element2.hashCode(), element11.hashCode()) } }
8
null
309
2,057
89784530da0de6085a5b08f810415147cb3165cf
9,529
sketch
Apache License 2.0
core/design/src/main/kotlin/rt/cccl/design/Dimen.kt
queencodemonkey
840,896,614
false
{"Kotlin": 195780}
/* * MIT License * * Copyright (c) 2024 Randomly Typing * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package rt.cccl.design import androidx.compose.ui.unit.dp // // CCCL defined/default dimensions // /** * Tokens defining elevation levels. */ object ElevationTokens { val Level0 = 0.0.dp val Level1 = 1.0.dp val Level2 = 3.0.dp val Level3 = 6.0.dp val Level4 = 8.0.dp val Level5 = 12.0.dp }
0
Kotlin
0
1
1ad60898776b6bfa8a92bfaa59199ac0c3e741ff
1,445
creating-custom-compose-layouts
MIT License
core/design/src/main/kotlin/rt/cccl/design/Dimen.kt
queencodemonkey
840,896,614
false
{"Kotlin": 195780}
/* * MIT License * * Copyright (c) 2024 Randomly Typing * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package rt.cccl.design import androidx.compose.ui.unit.dp // // CCCL defined/default dimensions // /** * Tokens defining elevation levels. */ object ElevationTokens { val Level0 = 0.0.dp val Level1 = 1.0.dp val Level2 = 3.0.dp val Level3 = 6.0.dp val Level4 = 8.0.dp val Level5 = 12.0.dp }
0
Kotlin
0
1
1ad60898776b6bfa8a92bfaa59199ac0c3e741ff
1,445
creating-custom-compose-layouts
MIT License
ospf-kotlin-utils/src/main/fuookami/ospf/kotlin/utils/parallel/MapIndexed.kt
fuookami
359,831,793
false
{"Kotlin": 1652659, "Vue": 46343, "Rust": 23739, "Python": 6629, "JavaScript": 5101, "CSS": 1302, "HTML": 1297}
package fuookami.ospf.kotlin.utils.parallel import kotlinx.coroutines.* import fuookami.ospf.kotlin.utils.math.* import fuookami.ospf.kotlin.utils.error.* import fuookami.ospf.kotlin.utils.functional.* suspend inline fun <R, T> Iterable<T>.mapIndexedParallelly( crossinline extractor: SuspendIndexedExtractor<R, T>): List<R> { return this.mapIndexedParallelly(UInt64.ten, extractor) } suspend inline fun <R, T> Iterable<T>.mapIndexedParallelly( segment: UInt64, crossinline extractor: SuspendIndexedExtractor<R, T> ): List<R> { return coroutineScope { val promises = ArrayList<Deferred<List<R>>>() val iterator = this@mapIndexedParallelly.iterator() var i = 0 while (iterator.hasNext()) { val thisSegment = ArrayList<Pair<Int, T>>() var j = UInt64.zero while (iterator.hasNext() && j != segment) { thisSegment.add(Pair(i, iterator.next())) ++i ++j } promises.add(async(Dispatchers.Default) { thisSegment.map { extractor(it.first, it.second) } }) } promises.flatMap { it.await() } } } suspend inline fun <R, T> Iterable<T>.tryMapIndexedParallelly( crossinline extractor: SuspendTryIndexedExtractor<R, T> ): Ret<List<R>> { return this.tryMapIndexedParallelly(UInt64.ten, extractor) } suspend inline fun <R, T> Iterable<T>.tryMapIndexedParallelly( segment: UInt64, crossinline extractor: SuspendTryIndexedExtractor<R, T> ): Ret<List<R>> { var error: Error? = null return try { coroutineScope { val promises = ArrayList<Deferred<List<R>>>() val iterator = this@tryMapIndexedParallelly.iterator() var i = 0 while (iterator.hasNext()) { val thisSegment = ArrayList<Pair<Int, T>>() var j = UInt64.zero while (iterator.hasNext() && j != segment) { thisSegment.add(Pair(i, iterator.next())) ++i ++j } promises.add(async(Dispatchers.Default) { thisSegment.mapNotNull { when (val result = extractor(it.first, it.second)) { is Ok -> { result.value } is Failed -> { error = result.error cancel() null } } } }) } Ok(promises.flatMap { it.await() }) } } catch (e: CancellationException) { error?.let { Failed(it) } ?: Ok(emptyList()) } } suspend inline fun <R, T> Collection<T>.mapIndexedParallelly( crossinline extractor: SuspendIndexedExtractor<R, T> ): List<R> { return (this as Iterable<T>).mapIndexedParallelly( defaultConcurrentAmount, extractor ) } suspend inline fun <R, T> Collection<T>.mapIndexedParallelly( concurrentAmount: UInt64, crossinline extractor: SuspendIndexedExtractor<R, T> ): List<R> { return (this as Iterable<T>).mapIndexedParallelly(this.usize / concurrentAmount, extractor) } suspend inline fun <R, T> Collection<T>.tryMapIndexedParallelly( crossinline extractor: SuspendTryIndexedExtractor<R, T> ): Ret<List<R>> { return (this as Iterable<T>).tryMapIndexedParallelly( defaultConcurrentAmount, extractor ) } suspend inline fun <R, T> Collection<T>.tryMapIndexedParallelly( concurrentAmount: UInt64, crossinline extractor: SuspendTryIndexedExtractor<R, T> ): Ret<List<R>> { return (this as Iterable<T>).tryMapIndexedParallelly(this.usize / concurrentAmount, extractor) } suspend inline fun <R, T> List<T>.mapIndexedParallelly( crossinline extractor: SuspendIndexedExtractor<R, T> ): List<R> { return this.mapIndexedParallelly( defaultConcurrentAmount, extractor ) } suspend inline fun <R, T> List<T>.mapIndexedParallelly( concurrentAmount: UInt64, crossinline extractor: SuspendIndexedExtractor<R, T> ): List<R> { return coroutineScope { val promises = ArrayList<Deferred<List<R>>>() val segmentAmount = this@mapIndexedParallelly.size / concurrentAmount.toInt() var i = 0 while (i != this@mapIndexedParallelly.size) { val j = i val k = i + minOf( segmentAmount, this@mapIndexedParallelly.size - j ) promises.add(async(Dispatchers.Default) { this@mapIndexedParallelly.mapIndexed { i, v -> extractor(i + j, v) } }) i = k } promises.flatMap { it.await() } } } suspend inline fun <R, T> List<T>.tryMapIndexedParallelly( crossinline extractor: SuspendTryIndexedExtractor<R, T> ): Ret<List<R>> { return this.tryMapIndexedParallelly( defaultConcurrentAmount, extractor ) } suspend inline fun <R, T> List<T>.tryMapIndexedParallelly( concurrentAmount: UInt64, crossinline extractor: SuspendTryIndexedExtractor<R, T> ): Ret<List<R>> { var error: Error? = null return try { coroutineScope { val promises = ArrayList<Deferred<List<R>>>() val segmentAmount = this@tryMapIndexedParallelly.size / concurrentAmount.toInt() var i = 0 while (i != this@tryMapIndexedParallelly.size) { val j = i val k = i + minOf( segmentAmount, this@tryMapIndexedParallelly.size - j ) promises.add(async(Dispatchers.Default) { this@tryMapIndexedParallelly.mapIndexedNotNull { i, v -> when (val result = extractor(i + j, v)) { is Ok -> { result.value } is Failed -> { error = result.error cancel() null } } } }) i = k } Ok(promises.flatMap { it.await() }) } } catch (e: CancellationException) { error?.let { Failed(it) } ?: Ok(emptyList()) } }
0
Kotlin
0
1
fdeeb1e4bf3bd4ec486beb69840f881123a2a628
6,565
ospf-kotlin
Apache License 2.0
source-code/starter-project/app/src/main/java/com/droidcon/tinyinvoice/ui/invoice/InvoiceListScreen.kt
droidcon-academy
733,026,693
false
{"Kotlin": 241858}
package com.droidcon.tinyinvoice.ui.invoice import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.sp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.droidcon.tinyinvoice.designsystem.component.FloatingButton import com.droidcon.tinyinvoice.designsystem.preview.ThemePreviews import com.droidcon.tinyinvoice.designsystem.theme.TinyInvoiceTheme import com.droidcon.tinyinvoice.ui.invoice.component.InvoiceListItem import com.droidcon.tinyinvoice.ui.invoice.preview_provider.InvoiceListStateProvider @Composable fun InvoiceListRoute( viewModel: InvoiceViewModel = hiltViewModel(), onNavigateToSelectBusinessScreen: () -> Unit, ) { LaunchedEffect(key1 = Unit) { viewModel.getInvoiceList() } val state by viewModel.state.collectAsStateWithLifecycle() InvoiceListScreen( state = state, onNavigateToSelectBusinessScreen = onNavigateToSelectBusinessScreen, ) } @Composable fun InvoiceListScreen( state: InvoiceListState, onNavigateToSelectBusinessScreen: () -> Unit, ) { Scaffold( floatingActionButton = { FloatingButton( onClick = onNavigateToSelectBusinessScreen, shape = CircleShape, containerColor = MaterialTheme.colorScheme.secondaryContainer, contentColor = MaterialTheme.colorScheme.secondary, ) { Icon( imageVector = Icons.Filled.Add, contentDescription = "Add new invoice item", ) } } ) { paddingValues -> if (state.invoiceList.isEmpty()) Text( text = "Empty!", textAlign = TextAlign.Center, fontSize = 32.sp, modifier = Modifier .fillMaxSize() .wrapContentHeight(align = Alignment.CenterVertically), ) LazyColumn( modifier = Modifier .padding(paddingValues) .fillMaxSize() ) { items( items = state.invoiceList, key = { it.invoice.id } ) { InvoiceListItem( modifier = Modifier, invoice = it, onItemClick = {}, ) } } } } @ThemePreviews @Composable private fun InvoiceListScreenPrev( @PreviewParameter(InvoiceListStateProvider::class) state: InvoiceListState, ) { TinyInvoiceTheme { Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { InvoiceListScreen( state = state, onNavigateToSelectBusinessScreen = {}, ) } } } @ThemePreviews @Composable private fun InvoiceListScreenEmptyPrev( state: InvoiceListState = InvoiceListState(), ) { TinyInvoiceTheme { Surface( modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background ) { InvoiceListScreen( state = state, onNavigateToSelectBusinessScreen = {}, ) } } }
0
Kotlin
0
0
432e43a61b5d18c55bd919e8f770b87fab12848a
4,226
android-mc-sqldelight
Apache License 2.0
app/src/main/java/com/orange/ods/app/ui/components/buttons/ButtonCustomizationState.kt
Orange-OpenSource
440,548,737
false
null
/* * * Copyright 2021 Orange * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * / */ package com.orange.ods.app.ui.components.buttons import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import com.orange.ods.compose.component.button.OdsButtonStyle import com.orange.ods.compose.component.button.OdsTextButtonStyle @Composable fun rememberButtonCustomizationState( buttonStyle: MutableState<OdsButtonStyle> = rememberSaveable { mutableStateOf(OdsButtonStyle.Default) }, textButtonStyle: MutableState<OdsTextButtonStyle> = rememberSaveable { mutableStateOf(OdsTextButtonStyle.Default) }, leadingIcon: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) }, fullScreenWidth: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) }, enabled: MutableState<Boolean> = rememberSaveable { mutableStateOf(true) } ) = remember(buttonStyle, textButtonStyle, leadingIcon, fullScreenWidth, enabled) { ButtonCustomizationState(buttonStyle, textButtonStyle, leadingIcon, fullScreenWidth, enabled) } class ButtonCustomizationState( val buttonStyle: MutableState<OdsButtonStyle>, val textButtonStyle: MutableState<OdsTextButtonStyle>, val leadingIcon: MutableState<Boolean>, val fullScreenWidth: MutableState<Boolean>, val enabled: MutableState<Boolean> ) { val hasLeadingIcon get() = leadingIcon.value val isEnabled get() = enabled.value val hasFullScreenWidth get() = fullScreenWidth.value }
61
Kotlin
2
8
400be520263417b1f73f85c4e17d55f597e43131
1,793
ods-android
MIT License
src/main/java/com/ozodrukh/android/pkg/installer/score.kt
ozodrukh
102,261,075
false
null
package com.xabarin /** * This is a port of Joshaven Potter's string_score.js: String Scoring Algorithm 0.1.22 * <p/> * http://joshaven.com/string_score * https://github.com/joshaven/string_score * <p/> * Ported By: <NAME> * Date: 3 december 2016 */ /** * This is a port of Joshaven Potter's string_score.js: String Scoring Algorithm 0.1.22 * <p/> * http://joshaven.com/string_score * https://github.com/joshaven/string_score * <p/> * score is a Kotlin String extension function. It returns a Double value that represents the scoring value. * @property word is the String that contains the * @property fuzziness allows mismatched info to still score the string (optional, default value 0.0) */ fun String.score(word: String, fuzziness: Double = 0.0) : Double { when(word) { // If the string is equal to the word, perfect match. this -> return 1.0 // if it's not a perfect match and is empty return 0 "" -> return 0.0 // Let's computeScore the result else -> return computeScore(this, word, fuzziness) } } private fun computeScore(string: String, word: String, fuzziness: Double) : Double { val lString = string.toLowerCase() val lWord = word.toLowerCase() var idxOf: Int var startAt = 0 var charScore: Double var runningScore: Double = 0.0 var fuzzyFactor: Double = 1 - fuzziness // Cache fuzzyFactor for speed increase var fuzzies: Double = 1.0 for (index in word.indices) { // Find next first case-insensitive match of a character. idxOf = lString.indexOf(lWord[index], startAt) if (idxOf == -1) { // if there is fuzziness > evaluate the fuzzies values. // If there is not fuzzines means that the character does not exists, so we do not have a match. if (fuzziness > 0.0) fuzzies += fuzzyFactor else return 0.0 } else { charScore = if (startAt == idxOf) 0.7 else if (idxOf.minus(1) >= 0 && string[idxOf-1].toString() == " ") 0.9 else 0.1 if (string[idxOf] == word[index]) charScore += 0.1 runningScore += charScore startAt = idxOf + 1 } } // Reduce penalty for longer strings. var finalScore = 0.5 * (runningScore / string.length + runningScore / word.length) / fuzzies finalScore += if ((word.toLowerCase()[0] == string.toLowerCase()[0]) && (finalScore < 0.85)) 0.15 else 0.0 return finalScore }
0
null
1
4
b8fae0050b658b06e64820f4ec41500cfe205b45
2,467
android-pkg-installer
MIT License
app/src/main/java/com/google/android/soundchecker/BitPerfectFilePlayerActivity.kt
google
679,463,835
false
null
/** * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.android.soundchecker import android.annotation.TargetApi import android.media.AudioDeviceCallback import android.media.AudioDeviceInfo import android.media.AudioFormat import android.media.AudioManager import android.media.AudioMixerAttributes import android.os.Build import android.os.Bundle import android.util.Log import com.google.android.soundchecker.utils.PlaybackConfigurationDiscover /** * Base class for playing a file bit-perfectly. Currently, the framework only support * bit-perfect playback over USB. */ @TargetApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) open class BitPerfectFilePlayerActivity : BaseFilePlayerActivity() { private var mUsbDevice: AudioDeviceInfo? = null private var mBitPerfectMixerAttributes = ArrayList<AudioMixerAttributes>() private val mDeviceCallback = DeviceConnectionListener() override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) mAudioManager.registerAudioDeviceCallback(mDeviceCallback, getHandler()) mTag = "BitPerfectFilePlayerActivity" } override fun getSelectedFileUnplayableReason(): String { val reason = super.getSelectedFileUnplayableReason(); if (reason.isNotEmpty()) { return reason } if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.TIRAMISU) { return getString(R.string.sdk_required, 34) } if (mUsbDevice == null) { return getString(R.string.connect_usb) } if (mBitPerfectMixerAttributes.isEmpty()) { return getString(R.string.no_bit_perfect_mixer_attr) } return "" } override fun getStartDelayAfterRegainingAudioFocus(): Int { // Always wait a while to start bit-perfect playback after regaining audio focus. // That allows the playback that gets audio focus can be fully released. The reason of // waiting previous playback to be released is that the framework will not allow to create // bit-perfect playback if there is any high priority playback active. return 500 } protected val mPlaybackConfigurationDiscover: PlaybackConfigurationDiscover = object : PlaybackConfigurationDiscover { override fun onPlaybackConfigured(format: AudioFormat): AudioFormat { Log.i(mTag, "playback config=$format") val builder = AudioFormat.Builder(format) if (mUsbDevice != null) { // If there is any mixer attributes matching the requested configuration, use it. for (mixerAttr in mBitPerfectMixerAttributes) { if (mixerAttr.format == format) { Log.i(mTag, "Found exactly matched mixer attributes=$mixerAttr") mAudioManager.setPreferredMixerAttributes( mAttrs, mUsbDevice!!, mixerAttr) return builder.build() } } // There is not exactly matched mixer attributes, try greater bit depth val greaterBitDepths = getGreaterBitDepth(format.encoding) for (mixerAttr in mBitPerfectMixerAttributes) { if (mixerAttr.format.channelMask == format.channelMask && mixerAttr.format.sampleRate == format.sampleRate && greaterBitDepths.contains(mixerAttr.format.encoding)) { Log.i(mTag, "Use greater bit depth for mixer attributes=$mixerAttr") mAudioManager.setPreferredMixerAttributes( mAttrs, mUsbDevice!!, mixerAttr) builder.setEncoding(mixerAttr.format.encoding) return builder.build() } } Log.i(mTag, "Cannot find any suitable mixer attribute") } else { Log.i(mTag, "Usb device is not found") } return builder.build() } } private fun getGreaterBitDepth(encoding: Int): Set<Int> { return when (encoding) { AudioFormat.ENCODING_PCM_16BIT -> setOf(AudioFormat.ENCODING_PCM_24BIT_PACKED, AudioFormat.ENCODING_PCM_32BIT) AudioFormat.ENCODING_PCM_24BIT_PACKED -> setOf(AudioFormat.ENCODING_PCM_32BIT) else -> emptySet() } } private fun scanForUsbDevice() { mBitPerfectMixerAttributes.clear() for (device in mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS)) { mUsbDevice = null if (device.type == AudioDeviceInfo.TYPE_USB_HEADSET || device.type == AudioDeviceInfo.TYPE_USB_DEVICE) { mUsbDevice = device for (mixerAttr in mAudioManager.getSupportedMixerAttributes(device)) { if (mixerAttr.mixerBehavior == AudioMixerAttributes.MIXER_BEHAVIOR_BIT_PERFECT) { Log.i(mTag, "find mixer attributes=$mixerAttr") mBitPerfectMixerAttributes.add(mixerAttr) } } break } } } private inner class DeviceConnectionListener : AudioDeviceCallback() { override fun onAudioDevicesAdded(addedDevices: Array<AudioDeviceInfo>) { Log.i(mTag, "onAudioDeviceAdded") scanForUsbDevice() sendUpdateUIMsg(0) } override fun onAudioDevicesRemoved(removedDevices: Array<AudioDeviceInfo>) { scanForUsbDevice() if (mUsbDevice == null) { Log.i(mTag, "Try to stop playback as there is not USB device connected") sendStopPlaybackMsg(0) } sendUpdateUIMsg(0) } } }
8
null
7
9
18c12f3435802834e471c339bd4dcfbcf72c44b9
6,744
sound-checker
Apache License 2.0
database/database-symbol-processor/src/main/kotlin/ru/tinkoff/kora/database/symbol/processor/vertx/extension/VertxTypesExtension.kt
Tinkoff
568,800,636
false
null
package ru.tinkoff.kora.database.symbol.processor.vertx.extension import com.google.devtools.ksp.getClassDeclarationByName import com.google.devtools.ksp.getFunctionDeclarationsByName import com.google.devtools.ksp.processing.CodeGenerator import com.google.devtools.ksp.processing.KSPLogger import com.google.devtools.ksp.processing.Resolver import com.google.devtools.ksp.symbol.KSType import com.google.devtools.ksp.symbol.Variance import com.squareup.kotlinpoet.* import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy import com.squareup.kotlinpoet.ksp.toTypeName import com.squareup.kotlinpoet.ksp.writeTo import ru.tinkoff.kora.database.symbol.processor.DbEntityReader import ru.tinkoff.kora.database.symbol.processor.model.DbEntity import ru.tinkoff.kora.database.symbol.processor.vertx.VertxNativeTypes import ru.tinkoff.kora.database.symbol.processor.vertx.VertxTypes import ru.tinkoff.kora.kora.app.ksp.extension.ExtensionResult import ru.tinkoff.kora.kora.app.ksp.extension.KoraExtension import ru.tinkoff.kora.ksp.common.KotlinPoetUtils.controlFlow import ru.tinkoff.kora.ksp.common.KspCommonUtils.generated import ru.tinkoff.kora.ksp.common.KspCommonUtils.parametrized import ru.tinkoff.kora.ksp.common.getOuterClassesAsPrefix //RowMapper<T> //RowSetMapper<List<T>> class VertxTypesExtension(val resolver: Resolver, val kspLogger: KSPLogger, val codeGenerator: CodeGenerator) : KoraExtension { private val entityReader: DbEntityReader = DbEntityReader( VertxTypes.resultColumnMapper, { CodeBlock.of("%N.apply(_row, %N)", it.mapperFieldName, "_idx_${it.fieldName}") }, { VertxNativeTypes.findNativeType(it.type.toTypeName())?.extract("_row", "_idx_${it.fieldName}") }, { if (it.isNullable) { CodeBlock.of("") } else { CodeBlock.of( "if (%N == null) {\n throw %T(%S);\n}\n", it.fieldName, NullPointerException::class.asClassName(), "Required field ${it.columnName} is not nullable but row has null" ) } } ) override fun getDependencyGenerator(resolver: Resolver, type: KSType, tag: Set<String>): (() -> ExtensionResult)? { if (tag.isNotEmpty()) { return null } if (type.declaration.qualifiedName?.asString()?.equals(VertxTypes.rowMapper.canonicalName) == true) { val rowType = type.arguments[0].type!!.resolve() return this.generateRowMapper(resolver, rowType) } if (type.declaration.qualifiedName?.asString()?.equals(VertxTypes.rowSetMapper.canonicalName) == true) { val rowSetArg = type.arguments[0] if (rowSetArg.type!!.resolve().declaration.qualifiedName?.asString()?.equals("kotlin.collections.List") == true) { return this.generateListRowSetMapper(resolver, type) } return this.generateRowSetMapper(resolver, type) } return null } private fun generateRowMapper(resolver: Resolver, rowKSType: KSType): (() -> ExtensionResult)? { val entity = DbEntity.parseEntity(rowKSType) if (entity == null) { return null } val mapperName = rowKSType.declaration.getOuterClassesAsPrefix() + entity.classDeclaration.simpleName.getShortName() + "_VertxRowMapper" val packageName = rowKSType.declaration.packageName.asString() return lambda@{ val maybeGenerated = resolver.getClassDeclarationByName("$packageName.$mapperName") if (maybeGenerated != null) { val constructor = maybeGenerated.primaryConstructor if (constructor == null) { throw IllegalStateException() } return@lambda ExtensionResult.fromConstructor(constructor, maybeGenerated) } val type = TypeSpec.classBuilder(mapperName) .generated(VertxTypesExtension::class) .addSuperinterface(VertxTypes.rowMapper.parameterizedBy(entity.type.toTypeName())) val constructor = FunSpec.constructorBuilder() val apply = FunSpec.builder("apply") .addModifiers(KModifier.OVERRIDE) .addParameter("_row", VertxTypes.row) .returns(entity.type.toTypeName()) for (field in entity.columns) { apply.addCode("val %N = _row.getColumnIndex(%S);\n", "_idx_${field.variableName}", field.columnName) } val read = this.entityReader.readEntity("_result", entity) read.enrich(type, constructor) apply.addCode(read.block) apply.addCode("return _result;\n") type.primaryConstructor(constructor.build()) type.addFunction(apply.build()) FileSpec.get(packageName, type.build()).writeTo(codeGenerator, true, listOfNotNull(entity.type.declaration.containingFile)) ExtensionResult.RequiresCompilingResult } } private fun generateListRowSetMapper(resolver: Resolver, ksType: KSType): (() -> ExtensionResult)? { val rowSetArg = ksType.arguments[0].type!!.resolve() val rowType = rowSetArg.arguments[0].type!!.resolve() val entity = DbEntity.parseEntity(rowType) if (entity == null) { val resultSetMapperDecl = resolver.getClassDeclarationByName(VertxTypes.rowSetMapper.canonicalName)!! val rowMapperDecl = resolver.getClassDeclarationByName(VertxTypes.rowMapper.canonicalName)!! val resultSetMapperType = resultSetMapperDecl.asType( listOf( resolver.getTypeArgument(ksType.arguments[0].type!!, Variance.INVARIANT), ) ) val rowMapperType = rowMapperDecl.asType( listOf( resolver.getTypeArgument(rowSetArg.arguments[0].type!!, Variance.INVARIANT) ) ) val functionDecl = resolver.getFunctionDeclarationsByName(VertxTypes.rowSetMapper.canonicalName + ".listRowSetMapper").first() val functionType = functionDecl.parametrized(resultSetMapperType, listOf(rowMapperType)) return { ExtensionResult.fromExecutable(functionDecl, functionType) } return null } val mapperName = entity.classDeclaration.getOuterClassesAsPrefix() + entity.classDeclaration.simpleName.getShortName() + "_VertxListRowSetMapper" val packageName = entity.classDeclaration.packageName.asString() return lambda@{ val maybeGenerated = resolver.getClassDeclarationByName("$packageName.$mapperName") if (maybeGenerated != null) { val constructor = maybeGenerated.primaryConstructor if (constructor == null) { throw IllegalStateException() } return@lambda ExtensionResult.fromConstructor(constructor, maybeGenerated) } val type = TypeSpec.classBuilder(mapperName) .generated(VertxTypesExtension::class) .addSuperinterface(VertxTypes.rowSetMapper.parameterizedBy(rowSetArg.toTypeName())) val readEntity = entityReader.readEntity("_rowValue", entity) val constructor = FunSpec.constructorBuilder() readEntity.enrich(type, constructor) val apply = FunSpec.builder("apply") .addModifiers(KModifier.OVERRIDE) .returns(rowSetArg.toTypeName()) .addParameter("_rs", VertxTypes.rowSet) for (field in entity.columns) { apply.addCode("val %N = _rs.columnsNames().indexOf(%S);\n", "_idx_${field.variableName}", field.columnName) } apply.addStatement("val _result = %T<%T>(_rs.rowCount())", ArrayList::class, rowType.toTypeName()) apply.controlFlow("for (_row in _rs)") { apply.addCode(readEntity.block) apply.addStatement("_result.add(_rowValue)") } .addStatement("return _result") type.primaryConstructor(constructor.build()) type.addFunction(apply.build()) FileSpec.get(packageName, type.build()).writeTo(codeGenerator, true, listOfNotNull(entity.type.declaration.containingFile)) ExtensionResult.RequiresCompilingResult } } private fun generateRowSetMapper(resolver: Resolver, ksType: KSType): (() -> ExtensionResult) { val rowSetArg = ksType.arguments[0] val rowType = rowSetArg.type!!.resolve() return { val rowSetMapperDecl = resolver.getClassDeclarationByName(VertxTypes.rowSetMapper.canonicalName)!! val rowMapperDecl = resolver.getClassDeclarationByName(VertxTypes.rowMapper.canonicalName)!! val rowSetMapper = rowSetMapperDecl .asType(listOf(resolver.getTypeArgument(resolver.createKSTypeReferenceFromKSType(rowType), Variance.INVARIANT))) val rowMapper = rowMapperDecl .asType(listOf(resolver.getTypeArgument(resolver.createKSTypeReferenceFromKSType(rowType), Variance.INVARIANT))) val functionDecl = resolver.getFunctionDeclarationsByName(VertxTypes.rowSetMapper.canonicalName + ".singleRowSetMapper").first() val functionType = functionDecl.parametrized(rowSetMapper, listOf(rowMapper)) ExtensionResult.fromExecutable(functionDecl, functionType) } } }
21
null
23
146
bb6f65080d9f50b674c8a77dac08116b2ee9eebf
9,629
kora
Apache License 2.0
core/model/src/main/kotlin/de/tum/informatics/www1/artemis/native_app/core/model/lecture/Lecture.kt
ls1intum
537,104,541
false
null
package de.tum.informatics.www1.artemis.native_app.core.model.lecture import de.tum.informatics.www1.artemis.native_app.core.model.Course import de.tum.informatics.www1.artemis.native_app.core.model.lecture.lecture_units.LectureUnit import kotlinx.datetime.Instant import kotlinx.serialization.Serializable @Serializable data class Lecture( val id: Long = 0, val title: String = "", val description: String? = null, val startDate: Instant? = null, val endDate: Instant? = null, val attachments: List<Attachment> = emptyList(), val lectureUnits: List<LectureUnit> = emptyList(), val course: Course? = null )
2
null
0
6
dd4b99ab6a143b669d3db20af45dbe533c650bd4
640
artemis-android
MIT License
core/src/commonMain/kotlin/it/unibo/pulvreakt/core/component/AbstractComponent.kt
pulvreakt
540,771,410
false
null
package it.unibo.pulvreakt.core.component import arrow.core.Either import arrow.core.firstOrNone import arrow.core.raise.either import arrow.core.raise.ensure import arrow.core.right import io.github.oshai.kotlinlogging.KotlinLogging import it.unibo.pulvreakt.core.communicator.Communicator import it.unibo.pulvreakt.core.component.errors.ComponentError import it.unibo.pulvreakt.core.context.Context import it.unibo.pulvreakt.core.reconfiguration.component.ComponentModeReconfigurator import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.cancelChildren import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import kotlinx.serialization.KSerializer import kotlinx.serialization.json.Json import kotlinx.serialization.serializer import org.kodein.di.DI import org.kodein.di.instance import org.kodein.di.provider /** * Predefined [Component] which handle out-of-the-box the [Communicator] needed to interact with other components. */ abstract class AbstractComponent : Component { override lateinit var di: DI protected val context by instance<Context>() private val reconfigurator by instance<ComponentModeReconfigurator>() private val communicatorFactory: () -> Communicator by provider() private lateinit var communicators: Map<ComponentRef, Communicator> private lateinit var unitManagerJob: Job protected val links = mutableSetOf<ComponentRef>() private val logger = KotlinLogging.logger(this::class.simpleName!!) private val scope = CoroutineScope(Dispatchers.Default + Job()) override fun getRef(): ComponentRef = ComponentRef.create(this) override suspend fun initialize(): Either<ComponentError, Unit> = coroutineScope { either { ensure(::di.isInitialized) { ComponentError.InjectorNotInitialized } ensure(links.isNotEmpty()) { ComponentError.WiringNotInitialized } communicators = links.associateWith { component -> val communicator = communicatorFactory() with(communicator) { setupInjector(this@AbstractComponent.di) communicatorSetup(this@AbstractComponent.getRef(), component) .mapLeft { ComponentError.WrapCommunicatorError(it) } .bind() } communicator } unitManagerJob = scope.launch { logger.debug { "Starting collecting new update" } reconfigurator.receiveModeUpdates().collect { (component, mode) -> logger.debug { "Received mode update for $component: $mode" } communicators[component]?.setMode(mode) } } logger.debug { "Component [${this@AbstractComponent::class.simpleName}] initialization concluded" } } } override suspend fun finalize(): Either<ComponentError, Unit> = either { ensure(::communicators.isInitialized) { ComponentError.FinalizedBeforeInitialization } if (::unitManagerJob.isInitialized) { unitManagerJob.cancel() } scope.coroutineContext.cancelChildren() communicators.forEach { (_, communicator) -> communicator.finalize() } } override fun setupWiring(vararg components: ComponentRef) { links += components.toSet() } final override suspend fun <P : Any> send(toComponent: ComponentRef, message: P, serializer: KSerializer<in P>): Either<ComponentError, Unit> = either { isDependencyInjectionInitialized().bind() ensure(::communicators.isInitialized) { ComponentError.ComponentNotInitialized } val communicator = communicators.getCommunicator(toComponent).bind() communicator.sendToComponent(Json.encodeToString(serializer, message).encodeToByteArray()) } final override suspend fun <P : Any> receive(fromComponent: ComponentRef, serializer: KSerializer<out P>): Either<ComponentError, Flow<P>> = either { isDependencyInjectionInitialized().bind() ensure(::communicators.isInitialized) { ComponentError.ComponentNotInitialized } val communicator = communicators.getCommunicator(fromComponent).bind() val flow = communicator.receiveFromComponent().mapLeft { ComponentError.WrapCommunicatorError(it) }.bind() return flow.map { Json.decodeFromString(serializer, it.decodeToString()) }.right() } override fun setupInjector(kodein: DI) { di = kodein } private fun Map<ComponentRef, Communicator>.getCommunicator( component: ComponentRef, ): Either<ComponentError, Communicator> = filterKeys { it == component } .values .firstOrNone() .toEither { ComponentError.ComponentNotRegistered(component) } private fun isDependencyInjectionInitialized(): Either<ComponentError, Unit> = either { ensure(::di.isInitialized) { ComponentError.InjectorNotInitialized } } companion object { /** * Helper method to send a [message] [toComponent] without specifying the serialization. */ suspend inline fun <reified P : Any> Component.send( toComponent: ComponentRef, message: P, ): Either<ComponentError, Unit> = send(toComponent, message, serializer()) /** * Helper method to receive messages [fromComponent] without specifying the serialization. */ suspend inline fun <reified P : Any> Component.receive( fromComponent: ComponentRef, ): Either<ComponentError, Flow<P>> = receive(fromComponent, serializer()) } }
4
null
1
3
a095703596b0336497527f95d49f979bec022d75
5,829
pulvreakt
MIT License
src/main/kotlin/rei/NEUItemEntrySerializer.kt
nea89o
637,563,904
false
{"Kotlin": 661685, "Java": 144356, "GLSL": 2115, "Nix": 1217}
package moe.nea.firmament.rei import me.shedaniel.rei.api.common.entry.EntrySerializer import me.shedaniel.rei.api.common.entry.EntryStack import net.minecraft.nbt.NbtCompound import moe.nea.firmament.repo.RepoManager import moe.nea.firmament.util.SkyblockId object NEUItemEntrySerializer : EntrySerializer<SBItemStack> { const val SKYBLOCK_ID_ENTRY = "SKYBLOCK_ID" const val SKYBLOCK_ITEM_COUNT = "SKYBLOCK_ITEM_COUNT" override fun supportSaving(): Boolean = true override fun supportReading(): Boolean = true override fun read(tag: NbtCompound): SBItemStack { val id = SkyblockId(tag.getString(SKYBLOCK_ID_ENTRY)) val count = if (tag.contains(SKYBLOCK_ITEM_COUNT)) tag.getInt(SKYBLOCK_ITEM_COUNT) else 1 return SBItemStack(id, RepoManager.getNEUItem(id), count) } override fun save(entry: EntryStack<SBItemStack>, value: SBItemStack): NbtCompound { return NbtCompound().apply { putString(SKYBLOCK_ID_ENTRY, value.skyblockId.neuItem) putInt(SKYBLOCK_ITEM_COUNT, value.stackSize) } } }
25
Kotlin
6
37
0357245e88be4b8cd3d0681340d9a7065361ea74
1,087
Firmament
Apache License 2.0
app/src/main/java/com/example/simplepomodoro/ui/components/charts/BarChart.kt
maximilianproell
423,197,437
false
{"Kotlin": 72654}
package com.example.simplepomodoro.ui.components.charts import androidx.compose.animation.core.* import androidx.compose.foundation.Canvas import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.material.MaterialTheme.colors import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Size import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.example.simplepomodoro.ui.components.charts.utils.* import com.example.simplepomodoro.ui.theme.SimplePomodoroTheme import kotlin.math.ceil @Composable fun BarChart( modifier: Modifier = Modifier, dataPoints: List<ChartDataPoint>, maxYValue: Float, barColor: Color = colors.onBackground, barWidthDp: Dp = 12.dp, axisColor: Color = colors.onBackground, labelTextSize: TextUnit = 12.sp ) { val currentAnimationState = remember(dataPoints) { MutableTransitionState(AnimationProgress.START).apply { targetState = AnimationProgress.END } } val barAnimationTransition = updateTransition( transitionState = currentAnimationState, label = "bar_chart_transition" ) val barPercentageHeights = dataPoints.map { dataPoint -> barAnimationTransition.animateFloat( transitionSpec = { tween( delayMillis = 500, durationMillis = 2000, easing = FastOutSlowInEasing, ) }, label = dataPoint.xValue ) { progress -> if (progress == AnimationProgress.START) 0f else dataPoint.yValue / maxYValue } } Box(modifier = modifier.padding(12.dp)) { Canvas( modifier = modifier ) { val (canvasWidth, canvasHeight) = size val spaceForLabel = 24.dp.toPx() val chartWidth = canvasWidth - spaceForLabel val chartHeight = canvasHeight - spaceForLabel // calculate bar spacing in px val chartPadding = 12.dp.toPx() // 2 * chart padding + space for Label at start val barSpaceHorizontal = chartWidth - (chartPadding * 2) val sizeOccupiedByBars = barWidthDp.toPx() * dataPoints.size val barSpacing = (barSpaceHorizontal - sizeOccupiedByBars) / (dataPoints.size - 1) drawAxis( drawScope = this, axisColor = axisColor, axisType = Axis.X_AXIS, offsetPadding = spaceForLabel ) drawAxis( drawScope = this, axisColor = axisColor, axisType = Axis.Y_AXIS, offsetPadding = spaceForLabel ) var currentBarOffset = chartPadding + spaceForLabel dataPoints.forEachIndexed { index, dataPoint -> val barHeight = barPercentageHeights[index].value * chartHeight drawRect( color = barColor, size = Size(width = barWidthDp.toPx(), height = barHeight), topLeft = Offset(currentBarOffset, chartHeight - barHeight) ) drawYAxisLabel( drawScope = this, labelColor = axisColor, text = dataPoint.xValue, labelTextSizePx = labelTextSize.toPx(), xPosition = currentBarOffset, yPosition = canvasHeight ) currentBarOffset += barSpacing + barWidthDp.toPx() } // draw highest y value label drawYAxisLabel( drawScope = this, labelColor = axisColor, text = "${ceil(maxYValue).toInt()}h", labelTextSizePx = labelTextSize.toPx(), xPosition = 0f, yPosition = 12.dp.toPx(), ) } } } @Preview(showBackground = true) @Composable fun BarChartPreview() { SimplePomodoroTheme { BarChart( modifier = Modifier .fillMaxWidth() .height(300.dp), dataPoints = listOf( ChartDataPoint("MO", 8.5f), ChartDataPoint("DI", 10.5f), ChartDataPoint("MI", 8.5f), ChartDataPoint("DO", 4.5f), ChartDataPoint("FR", 3.0f), ChartDataPoint("SA", 8.25f), ChartDataPoint("SO", 12.0f), ), // let's just say, 12h is the maximum one would work a day maxYValue = 12.0f ) } }
0
Kotlin
0
0
9b0314c91e88e8ecd67163387daa94617cf9441c
5,092
SimplePomodoro
Apache License 2.0
protocol/osrs-226/osrs-226-desktop/src/main/kotlin/net/rsprot/protocol/game/outgoing/codec/interfaces/IfSetPlayerModelBodyTypeEncoder.kt
blurite
771,753,685
false
{"Kotlin": 8753620}
package net.rsprot.protocol.game.outgoing.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.crypto.cipher.StreamCipher import net.rsprot.protocol.ServerProt import net.rsprot.protocol.game.outgoing.interfaces.IfSetPlayerModelBodyType import net.rsprot.protocol.game.outgoing.prot.GameServerProt import net.rsprot.protocol.message.codec.MessageEncoder import net.rsprot.protocol.util.pCombinedIdAlt3 public class IfSetPlayerModelBodyTypeEncoder : MessageEncoder<IfSetPlayerModelBodyType> { override val prot: ServerProt = GameServerProt.IF_SETPLAYERMODEL_BODYTYPE override fun encode( streamCipher: StreamCipher, buffer: JagByteBuf, message: IfSetPlayerModelBodyType, ) { buffer.p1Alt3(message.bodyType) buffer.pCombinedIdAlt3(message.combinedId) } }
4
Kotlin
6
27
d3849749f0787f9a538d2f8afc6b4b8d029e8143
830
rsprot
MIT License
src/main/kotlin/crux/api/query/context/WhereContext.kt
AlistairONeill
378,195,098
true
{"Kotlin": 91562}
package crux.api.query.context import clojure.lang.Keyword import clojure.lang.Symbol import crux.api.query.domain.QuerySection.WhereSection import crux.api.query.domain.WhereClause import crux.api.query.domain.WhereClause.* import crux.api.query.domain.WhereClause.Join.Type.* import crux.api.query.domain.WhereClause.Predicate.Type.* import crux.api.underware.* class WhereContext private constructor(): ComplexBuilderContext<WhereClause, WhereSection>(::WhereSection) { companion object: BuilderContext.Companion<WhereSection, WhereContext>(::WhereContext) operator fun WhereClause.unaryPlus() = add(this) data class SymbolAndKey(val symbol: Symbol, val key: Keyword) infix fun Symbol.has(key: Keyword) = SymbolAndKey(this, key).also { add(HasKey(this, key)) } infix fun SymbolAndKey.eq(value: Any) = replace(HasKeyEqualTo(symbol, key, value)) private fun join(type: Join.Type, block: WhereContext.() -> Unit) = add(Join(type, build(block))) fun not(block: WhereContext.() -> Unit) = join(NOT, block) fun or(block: WhereContext.() -> Unit) = join(OR, block) private fun pred(predicateType: Predicate.Type, i: Symbol, j: Any) = add(Predicate(predicateType, i, j)) infix fun Symbol.gt(other: Any) = pred(GT, this, other) infix fun Symbol.lt(other: Any) = pred(LT, this, other) infix fun Symbol.gte(other: Any) = pred(GTE, this, other) infix fun Symbol.lte(other: Any) = pred(LTE, this, other) infix fun Symbol.eq(other: Any) = pred(EQ, this, other) infix fun Symbol.neq(other: Any) = pred(NEQ, this, other) data class RuleDeclaration(val name: Symbol) fun rule(name: Symbol) = RuleDeclaration(name) operator fun RuleDeclaration.invoke(vararg params: Any) = add(RuleInvocation(name, params.toList())) }
0
Kotlin
0
1
1ced1d04d8dc9318fb0e6a22021f969c76e7b5b1
1,814
crux-kotlin-dsl-1
MIT License
src/main/java/com/maddyhome/idea/vim/helper/VimStandalonePluginUpdateChecker.kt
JetBrains
1,459,486
false
{"Kotlin": 5959132, "Java": 211095, "ANTLR": 84686, "HTML": 2184}
/* * Copyright 2003-2023 The IdeaVim authors * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE.txt file or at * https://opensource.org/licenses/MIT. */ package com.maddyhome.idea.vim.helper import com.intellij.ide.plugins.StandalonePluginUpdateChecker import com.intellij.openapi.components.Service import com.intellij.openapi.components.service import com.maddyhome.idea.vim.VimPlugin import com.maddyhome.idea.vim.group.NotificationService import com.maddyhome.idea.vim.icons.VimIcons @Service(Service.Level.APP) internal class VimStandalonePluginUpdateChecker : StandalonePluginUpdateChecker( VimPlugin.getPluginId(), updateTimestampProperty = PROPERTY_NAME, NotificationService.IDEAVIM_STICKY_GROUP, VimIcons.IDEAVIM, ) { override fun skipUpdateCheck(): Boolean = !VimPlugin.isEnabled() || "dev" in VimPlugin.getVersion() companion object { private const val PROPERTY_NAME = "ideavim.statistics.timestamp" val instance: VimStandalonePluginUpdateChecker = service() } }
6
Kotlin
749
9,241
66b01b0b0d48ffec7b0148465b85e43dfbc908d3
1,055
ideavim
MIT License
foryouandme/src/main/java/com/foryouandme/data/datasource/StudySettings.kt
4youandme
308,387,557
false
null
package com.foryouandme.data.datasource abstract class StudySettings { abstract val isDebuggable: Boolean abstract val isStaging: Boolean abstract val studyId: String abstract val getApiBaseUrl: String abstract val getOAuthBaseUrl: String abstract val useCustomData: Boolean open val pinCodeSuffix: String = "" abstract val isLocationPermissionEnabled: Boolean }
0
Kotlin
0
0
5a57ba15c408638a3cfea8084f609293a1defdc6
404
4YouandmeAndroid
MIT License
app/src/main/java/io/horizontalsystems/bankwallet/modules/market/search/MarketDiscoveryService.kt
horizontalsystems
142,825,178
false
{"Kotlin": 5050886, "Shell": 6112, "Ruby": 1350}
package io.horizontalsystems.bankwallet.modules.market.search import io.horizontalsystems.bankwallet.core.ILocalStorage import io.horizontalsystems.bankwallet.core.managers.MarketKitWrapper import io.horizontalsystems.marketkit.models.Coin import io.horizontalsystems.marketkit.models.FullCoin import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update class MarketDiscoveryService( private val marketKit: MarketKitWrapper, private val localStorage: ILocalStorage, ) { private var recentCoins: List<FullCoin> = listOf() private var popularCoins: List<FullCoin> = listOf() private val _stateFlow = MutableStateFlow( State( recent = recentCoins, popular = popularCoins, ) ) val stateFlow: StateFlow<State> get() = _stateFlow.asStateFlow() fun start() { recentCoins = marketKit .fullCoins(localStorage.marketSearchRecentCoinUids) .sortedBy { localStorage.marketSearchRecentCoinUids.indexOf(it.coin.uid) } popularCoins = marketKit.fullCoins("") emitState() } private fun emitState() { _stateFlow.update { State( recent = recentCoins, popular = popularCoins ) } } fun addCoinToRecent(coin: Coin) { localStorage.marketSearchRecentCoinUids = (listOf(coin.uid) + localStorage.marketSearchRecentCoinUids).distinct().take(5) } data class State( val recent: List<FullCoin>, val popular: List<FullCoin>, ) }
168
Kotlin
364
895
218cd81423c570cdd92b1d5161a600d07c35c232
1,707
unstoppable-wallet-android
MIT License
src/main/kotlin/com/soprasteria/initiatives/ideas/config/AuthenticatedUser.kt
SopraSteriaGroup
91,157,755
false
null
package com.soprasteria.initiatives.ideas.config import org.springframework.security.core.GrantedAuthority import java.security.Principal import java.util.* class AuthenticatedUser(val username: String, val firstName: String, val lastName: String, val authorities: Collection<GrantedAuthority>) : Principal { override fun equals(o: Any?): Boolean { if (this === o) { return true } if (o !is AuthenticatedUser) { return false } return username == o.username } override fun hashCode(): Int { return Objects.hash(username) } /** * Returns the name of this principal. * @return the name of this principal. */ override fun getName(): String { return username } override fun toString(): String { return "AuthenticatedUser(username='$username', firstName='$firstName', lastName='$lastName', authorities=$authorities)" } }
0
Kotlin
0
2
edb30025520b4e6425e30167a0d606a93cd33dca
965
initiatives_backend_ideas
MIT License
app/src/main/java/com/mindorks/framework/mvp/ui/movies/view/MoviesActivity.kt
JoeJohnRio
290,540,621
false
null
package com.mindorks.framework.mvp.ui.login.view import android.os.Bundle import android.util.Log import androidx.databinding.DataBindingUtil import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.mindorks.framework.mvp.R import com.mindorks.framework.mvp.data.models.Genre import com.mindorks.framework.mvp.data.models.Movie import com.mindorks.framework.mvp.data.models.MoviesPage import com.mindorks.framework.mvp.databinding.ActivityGenreBinding import com.mindorks.framework.mvp.databinding.ActivityMoviesBinding import com.mindorks.framework.mvp.ui.base.view.BaseActivity import com.mindorks.framework.mvp.ui.genre.view.GenreListAdapter import com.mindorks.framework.mvp.ui.genre.view.MoviesListAdapter import com.mindorks.framework.mvp.ui.login.presenter.GenreMVPPresenter import com.mindorks.framework.mvp.ui.login.presenter.MoviesMVPPresenter import javax.inject.Inject /** * Created by jyotidubey on 10/01/18. */ class MoviesActivity : BaseActivity(), MoviesMVPView { override fun onFragmentAttached() { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun onFragmentDetached(tag: String) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } @Inject internal lateinit var presenter: MoviesMVPPresenter<MoviesMVPView> lateinit var viewBind: ActivityMoviesBinding lateinit var listAdapter: MoviesListAdapter var listMovies: MutableList<Movie> = mutableListOf() var genres = 1 var pageNumber = 1 var lastPage = 2 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) viewBind = DataBindingUtil.setContentView(this, R.layout.activity_movies) presenter.onAttach(this) genres = intent.getIntExtra("tvMovieId", 1) viewBind.tvGenreTitle.text = intent.getStringExtra("genreName") ?: "Genre" listAdapter = MoviesListAdapter(this) listAdapter.stateRestorationPolicy = RecyclerView.Adapter.StateRestorationPolicy.PREVENT presenter.getMovies(genres, pageNumber, true) viewBind.rvMoviesList.addOnScrollListener(object : RecyclerView.OnScrollListener() { override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) { super.onScrollStateChanged(recyclerView, newState) if (!recyclerView.canScrollVertically(1)) { if (lastPage >= pageNumber) { Log.d("onScrolled", "Sedang scroll") pageNumber++ presenter.getMovies(genres, pageNumber, false) } } } }) } override fun setMovies(moviesPage: MoviesPage, isRefresh: Boolean) { listAdapter = MoviesListAdapter(this) if (isRefresh) { listMovies = moviesPage.results as MutableList<Movie> lastPage = moviesPage.totalPages ?: 2 } else { listMovies = (listMovies + moviesPage.results as MutableList<Movie>).toMutableList() } listAdapter.submitList(listMovies) viewBind.rvMoviesList.apply { // if (adapter == null){ adapter = listAdapter // } if (layoutManager == null) { layoutManager = LinearLayoutManager(this@MoviesActivity, LinearLayoutManager.VERTICAL, false) } adapter?.notifyDataSetChanged() } viewBind.rvMoviesList.scrollToPosition(listMovies.size-19) } override fun onDestroy() { presenter.onDetach() super.onDestroy() } }
0
Kotlin
0
0
ab6e5cf668202c6fe6eec51b67440bb3520fb62c
3,761
movietofind
Apache License 2.0
sdk/src/test/java/com/exponea/sdk/tracking/CampaignSessionTests_008.kt
exponea
134,699,893
false
null
package com.exponea.sdk.tracking import android.app.Activity import android.os.Bundle import androidx.test.platform.app.InstrumentationRegistry import com.exponea.sdk.Exponea import com.exponea.sdk.models.Constants import org.junit.After import org.junit.AfterClass import org.junit.BeforeClass import org.junit.Test import org.junit.runner.RunWith import org.robolectric.Robolectric import org.robolectric.RobolectricTestRunner import kotlin.test.assertEquals import kotlin.test.assertNotNull import kotlin.test.assertNull import kotlin.test.assertTrue @RunWith(RobolectricTestRunner::class) class CampaignSessionTests_005 : CampaignSessionTests_Base() { /** * Hot Start with new session, campaign click start, SDK init in onResume */ @Test fun testBehavior_005() { initExponea(InstrumentationRegistry.getInstrumentation().context) val campaignIntent = createDeeplinkIntent() val controller = Robolectric.buildActivity(TestActivity::class.java, campaignIntent) controller.create() assertTrue(Exponea.isInitialized) val campaignEvent = Exponea.component.campaignRepository.get() assertNotNull(campaignEvent) assertTrue(Exponea.component.eventRepository.all().any { it.item.type == Constants.EventTypes.push }) controller.resume() assertTrue(Exponea.isInitialized) assertNull(Exponea.component.campaignRepository.get()) val sessionEvent = Exponea.component.eventRepository.all().find { it.item.type == Constants.EventTypes.sessionStart }?.item assertNotNull(sessionEvent) assertNotNull(sessionEvent.properties) assertEquals(campaignEvent.completeUrl, sessionEvent.properties!!["location"]) assertEquals(campaignEvent.source, sessionEvent.properties!!["utm_source"]) assertEquals(campaignEvent.campaign, sessionEvent.properties!!["utm_campaign"]) assertEquals(campaignEvent.content, sessionEvent.properties!!["utm_content"]) assertEquals(campaignEvent.term, sessionEvent.properties!!["utm_term"]) } /** * Used by test testBehavior_005 (Hot Start with new session, campaign click start, SDK init in onResume) */ class TestActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) Exponea.handleCampaignIntent(intent, applicationContext) } override fun onResume() { super.onResume() Exponea.init(applicationContext, configuration) } } }
5
null
17
17
150999cffec54fa2266e0d9db07c16143dc17a26
2,594
exponea-android-sdk
MIT License
clients/kotlin/generated/src/main/kotlin/org/openapitools/client/models/ComDayCqWcmContentsyncImplRewriterPathRewriterTransformerFactorProperties.kt
shinesolutions
190,217,155
false
null
/** * Adobe Experience Manager OSGI config (AEM) API * Swagger AEM OSGI is an OpenAPI specification for Adobe Experience Manager (AEM) OSGI Configurations API * * OpenAPI spec version: 1.0.0-pre.0 * Contact: opensource@shinesolutions.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package org.openapitools.client.models import org.openapitools.client.models.ConfigNodePropertyArray import org.openapitools.client.models.ConfigNodePropertyString /** * * @param cqPeriodcontentsyncPeriodpathrewritertransformerPeriodmappingPeriodlinks * @param cqPeriodcontentsyncPeriodpathrewritertransformerPeriodmappingPeriodclientlibs * @param cqPeriodcontentsyncPeriodpathrewritertransformerPeriodmappingPeriodimages * @param cqPeriodcontentsyncPeriodpathrewritertransformerPeriodattributePeriodpattern * @param cqPeriodcontentsyncPeriodpathrewritertransformerPeriodclientlibraryPeriodpattern * @param cqPeriodcontentsyncPeriodpathrewritertransformerPeriodclientlibraryPeriodreplace */ data class ComDayCqWcmContentsyncImplRewriterPathRewriterTransformerFactorProperties ( val cqPeriodcontentsyncPeriodpathrewritertransformerPeriodmappingPeriodlinks: ConfigNodePropertyArray? = null, val cqPeriodcontentsyncPeriodpathrewritertransformerPeriodmappingPeriodclientlibs: ConfigNodePropertyArray? = null, val cqPeriodcontentsyncPeriodpathrewritertransformerPeriodmappingPeriodimages: ConfigNodePropertyArray? = null, val cqPeriodcontentsyncPeriodpathrewritertransformerPeriodattributePeriodpattern: ConfigNodePropertyString? = null, val cqPeriodcontentsyncPeriodpathrewritertransformerPeriodclientlibraryPeriodpattern: ConfigNodePropertyString? = null, val cqPeriodcontentsyncPeriodpathrewritertransformerPeriodclientlibraryPeriodreplace: ConfigNodePropertyString? = null ) { }
12
null
1
4
c2f6e076971d2592c1cbd3f70695c679e807396b
1,923
swagger-aem-osgi
Apache License 2.0
ospf-kotlin-utils/src/main/fuookami/ospf/kotlin/utils/functional/MaxOfWithOrNull.kt
fuookami
359,831,793
false
{"Kotlin": 1433872, "Vue": 46326, "Rust": 23739, "Python": 6611, "JavaScript": 5100, "HTML": 1369, "CSS": 1302}
package fuookami.ospf.kotlin.utils.functional inline fun <T, U> Iterable<U>.maxOfWithComparatorOrNull( crossinline comparator: Comparator<T>, crossinline extractor: Extractor<T, U> ): T? { return this.maxOfWithOrNull({ lhs, rhs -> if (comparator(lhs, rhs)) { -1 } else if (comparator(rhs, lhs)) { 1 } else { 0 } }, extractor) } inline fun <T, U> Iterable<U>.maxOfWithPartialComparatorOrNull( crossinline comparator: PartialComparator<T>, crossinline extractor: Extractor<T, U> ): T? { return this.maxOfWithOrNull({ lhs: T, rhs: T -> if (comparator(lhs, rhs) == true) { -1 } else if (comparator(rhs, lhs) == true) { 1 } else { 0 } }, extractor) } inline fun <T, U> Iterable<U>.maxOfWithThreeWayComparatorOrNull( crossinline comparator: ThreeWayComparator<T>, crossinline extractor: Extractor<T, U> ): T? { return this.maxOfWithOrNull({ lhs: T, rhs: T -> comparator(lhs, rhs).value }, extractor) } inline fun <T, U> Iterable<U>.maxOfWithPartialThreeWayComparatorOrNull( crossinline comparator: PartialThreeWayComparator<T>, crossinline extractor: Extractor<T, U> ): T? { return this.maxOfWithOrNull({ lhs: T, rhs: T -> comparator(lhs, rhs)?.value ?: 0 }, extractor) }
0
Kotlin
0
1
fdeeb1e4bf3bd4ec486beb69840f881123a2a628
1,386
ospf-kotlin
Apache License 2.0
data/src/main/java/com/rodrigobresan/data/movie/sources/data_store/remote/MovieRemote.kt
rodrigobressan
107,698,692
false
null
package com.rodrigobresan.data.movie.sources.data_store.remote import com.rodrigobresan.data.movie.model.MovieEntity import io.reactivex.Single /** * Define the interface for any class that will fetch Movies from a remote storage */ interface MovieRemote { /** * Get the popular movies */ fun getPopularMovies(): Single<List<MovieEntity>> /** * Get the now playing movies */ fun getNowPlayingMovies(): Single<List<MovieEntity>> /** * Get the top rated movies */ fun getTopRatedMovies(): Single<List<MovieEntity>> /** * Get the upcoming movies */ fun getUpcomingMovies(): Single<List<MovieEntity>> }
0
Kotlin
17
68
99b861f813b907d9604903c4ba2ca2e33b7c3ecd
677
android_tmdb_clean_architecture
MIT License
core/src/main/java/com/ziss/core/data/datasources/remote/network/ApiService.kt
ziss11
686,203,789
false
{"Kotlin": 58545}
package com.ziss.core.data.datasources.remote.network import com.ziss.core.data.datasources.remote.responses.MovieListResponse import retrofit2.http.GET import retrofit2.http.Query interface ApiService { @GET("movie/top_rated") suspend fun getTopRatedMovies(): MovieListResponse @GET("movie/now_playing") suspend fun getNowPlayingMovies(): MovieListResponse @GET("search/movie") suspend fun searchMovies(@Query("query") query: String): MovieListResponse }
0
Kotlin
0
1
1f8fca83e35200f218e99b6ece83d818270b0e99
483
movie-app-native
MIT License
app/src/main/java/com/example/myweather/injection/module/ApplicationModule.kt
serj113
227,987,490
false
null
package com.example.myweather.injection.module import android.content.Context import com.example.myweather.App import dagger.Binds import dagger.Module @Module abstract class ApplicationModule { /** * Provides the application. * @return the application. */ @Binds abstract fun provideApplicationContext(app: App): Context }
0
Kotlin
0
0
152f181c1e16e8691332854f86617075b678f304
352
My-Weather
Apache License 2.0
platform/ide-core/src/com/intellij/ide/GeneralLocalSettings.kt
ingokegel
72,937,917
false
null
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.ide import com.intellij.ide.util.PropertiesComponent import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.components.* import com.intellij.openapi.util.SystemInfoRt import org.jetbrains.annotations.SystemDependent @Service(Service.Level.APP) @State(name = "GeneralLocalSettings", storages = [Storage(value = "ide.general.local.xml", roamingType = RoamingType.DISABLED)]) class GeneralLocalSettings : SimplePersistentStateComponent<GeneralLocalState>(GeneralLocalState()) { companion object { private const val MIGRATED_FROM_GENERAL_SETTINGS = "migrated.non.roamable.values.from.general.settings" @JvmStatic fun getInstance(): GeneralLocalSettings { return ApplicationManager.getApplication().service<GeneralLocalSettings>() } private fun getDefaultAlternativeBrowserPath(): String { return when { SystemInfoRt.isWindows -> "C:\\Program Files\\Internet Explorer\\IExplore.exe" SystemInfoRt.isMac -> "open" SystemInfoRt.isUnix -> "/usr/bin/firefox" else -> "" } } } override fun noStateLoaded() { migrateFromGeneralSettings() } private fun migrateFromGeneralSettings() { val propertyManager = PropertiesComponent.getInstance() if (propertyManager.getBoolean(MIGRATED_FROM_GENERAL_SETTINGS, false)) { return } propertyManager.setValue(MIGRATED_FROM_GENERAL_SETTINGS, true) val generalSettingsState = GeneralSettings.getInstance().state defaultProjectDirectory = generalSettingsState.defaultProjectDirectory ?: "" useDefaultBrowser = generalSettingsState.useDefaultBrowser browserPath = generalSettingsState.browserPath ?: "" generalSettingsState.defaultProjectDirectory = "" generalSettingsState.useDefaultBrowser = true generalSettingsState.browserPath = "" } var defaultProjectDirectory: @SystemDependent String get() = state.defaultProjectDirectory ?: "" set(value) { state.defaultProjectDirectory = value } var browserPath: String get() = state.browserPath ?: getDefaultAlternativeBrowserPath() set(value) { state.browserPath = value } var useDefaultBrowser: Boolean get() = state.useDefaultBrowser set(value) { state.useDefaultBrowser = value } } class GeneralLocalState : BaseState() { var defaultProjectDirectory: String? by string("") var useDefaultBrowser: Boolean by property(true) var browserPath: String? by string(null) }
214
null
4829
2
b07eabd319ad5b591373d63c8f502761c2b2dfe8
2,634
intellij-community
Apache License 2.0
data/RF03318/rnartist.kts
fjossinet
449,239,232
false
{"Kotlin": 8214424}
import io.github.fjossinet.rnartist.core.* rnartist { ss { rfam { id = "RF03318" name = "consensus" use alignment numbering } } theme { details { value = 3 } color { location { 1 to 9 51 to 59 } value = "#1005ef" } color { location { 11 to 17 43 to 49 } value = "#3ef806" } color { location { 19 to 24 37 to 42 } value = "#dbbc3b" } color { location { 10 to 10 50 to 50 } value = "#cb86cc" } color { location { 18 to 18 43 to 42 } value = "#ebd12e" } color { location { 25 to 36 } value = "#1fccc1" } color { location { 60 to 61 } value = "#32aa02" } } }
0
Kotlin
0
0
3016050675602d506a0e308f07d071abf1524b67
1,242
Rfam-for-RNArtist
MIT License
flowredux/src/commonTest/kotlin/com/freeletics/flowredux/sideeffects/OnEnterStartStateMachineTest.kt
freeletics
184,753,749
false
null
package com.freeletics.flowredux.sideeffects import app.cash.turbine.awaitItem import app.cash.turbine.test import com.freeletics.flowredux.StateMachine import com.freeletics.flowredux.TestAction import com.freeletics.flowredux.TestState import com.freeletics.flowredux.dsl.FlowReduxStateMachine import com.freeletics.flowredux.dsl.FlowReduxStoreBuilder import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.launch import kotlinx.coroutines.test.runTest @OptIn(ExperimentalCoroutinesApi::class) internal class OnEnterStartStateMachineTest { @Test fun childStateMachineEmitsInitialStateToParentStateMachine() = runTest { val child = childStateMachine(initialState = TestState.S3) { } val stateMachine = StateMachine { inState<TestState.Initial> { onEnterStartStateMachine(child) } } stateMachine.state.test { assertEquals(TestState.Initial, awaitItem()) // parent initial state assertEquals(TestState.S3, awaitItem()) // child initial state } } @Test fun delegateToChildSubStateMachineWhileInState() = runTest { var inS3onA1Action = 0 var inS2OnA1Action = 0 val receivedChildStateUpdates = mutableListOf<TestState>() val receivedChildStateUpdatesParentState = mutableListOf<TestState>() val child = childStateMachine(initialState = TestState.S3) { inState<TestState.S3> { on<TestAction.A1> { _, state -> inS3onA1Action++ state.override { TestState.S1 } } } inState<TestState.S2> { on<TestAction.A1> { _, state -> inS2OnA1Action++ state.override { TestState.S2 } } } } val parent = StateMachine { inState<TestState.Initial> { onEnterStartStateMachine( stateMachine = child, actionMapper = { it }, ) { state, subStateMachineState -> receivedChildStateUpdates += subStateMachineState receivedChildStateUpdatesParentState += state.snapshot if (subStateMachineState == TestState.S3) { state.noChange() } else { state.override { subStateMachineState } } } } inState<TestState.S1> { on<TestAction.A1> { _, state -> state.override { TestState.S2 } } } } parent.state.test { assertEquals(TestState.Initial, awaitItem()) parent.dispatchAsync(TestAction.A1) assertEquals(TestState.S1, awaitItem()) parent.dispatchAsync(TestAction.A1) assertEquals(TestState.S2, awaitItem()) assertEquals(1, inS3onA1Action) assertEquals(0, inS2OnA1Action) assertEquals(listOf(TestState.S3, TestState.S1), receivedChildStateUpdates) assertEquals( listOf<TestState>(TestState.Initial, TestState.Initial), receivedChildStateUpdatesParentState, ) } } @Test fun subStateMachineDoesNotRestartIfStateParentStateIsStillTheSame() = runTest { val factoryInvocations = Channel<Unit>(Channel.UNLIMITED) val childEntersInitialState = Channel<Unit>(Channel.UNLIMITED) val child = childStateMachine { inState<TestState.Initial> { onEnterEffect { childEntersInitialState.send(Unit) } } } val sm = StateMachine(initialState = TestState.GenericState("generic", 0)) { inState<TestState.GenericState> { onEnterStartStateMachine( stateMachineFactory = { launch { factoryInvocations.send(Unit) } child }, actionMapper = { it }, stateMapper = { state, _ -> state.noChange() }, ) on<TestAction.A1> { _, state -> state.override { state.snapshot.copy(anInt = state.snapshot.anInt + 1) } } } } sm.state.test { assertEquals(TestState.GenericState("generic", 0), awaitItem()) assertEquals(Unit, factoryInvocations.awaitItem()) assertEquals(Unit, childEntersInitialState.awaitItem()) sm.dispatchAsync(TestAction.A1) assertEquals(TestState.GenericState("generic", 1), awaitItem()) assertTrue(factoryInvocations.isEmpty) assertTrue(childEntersInitialState.isEmpty) sm.dispatchAsync(TestAction.A1) assertEquals(TestState.GenericState("generic", 2), awaitItem()) assertTrue(factoryInvocations.isEmpty) assertTrue(childEntersInitialState.isEmpty) } } @Test fun subStateMachineFactoryIsCalledEveryTimeParentStateIsEntered() = runTest { val factoryInvocations = Channel<Unit>(Channel.UNLIMITED) val childEntersInitialState = Channel<Unit>(Channel.UNLIMITED) val child = childStateMachine { inState<TestState.Initial> { onEnterEffect { childEntersInitialState.send(Unit) } } } val sm = StateMachine(initialState = TestState.S1) { inState<TestState.S1> { onEnterStartStateMachine( stateMachineFactory = { launch { factoryInvocations.send(Unit) } child }, actionMapper = { it }, stateMapper = { state, _ -> state.noChange() }, ) on<TestAction.A1> { _, state -> state.override { TestState.S2 } } } inState<TestState.S2> { on<TestAction.A2> { _, state -> state.override { TestState.S1 } } } } sm.state.test { assertEquals(TestState.S1, awaitItem()) assertEquals(Unit, factoryInvocations.awaitItem()) assertEquals(Unit, childEntersInitialState.awaitItem()) sm.dispatchAsync(TestAction.A1) assertEquals(TestState.S2, awaitItem()) assertTrue(factoryInvocations.isEmpty) assertTrue(childEntersInitialState.isEmpty) sm.dispatchAsync(TestAction.A2) assertEquals(TestState.S1, awaitItem()) assertEquals(Unit, factoryInvocations.awaitItem()) assertEquals(Unit, childEntersInitialState.awaitItem()) sm.dispatchAsync(TestAction.A1) assertEquals(TestState.S2, awaitItem()) assertTrue(factoryInvocations.isEmpty) assertTrue(childEntersInitialState.isEmpty) } } @Test fun actionsAreOnlyDispatchedToSubStateMachineWhileParentStateMachineIsInState() = runTest { val childActionInvocations = Channel<Unit>(Channel.UNLIMITED) val parentActionInvocations = Channel<Unit>(Channel.UNLIMITED) val child = childStateMachine(initialState = TestState.S1) { inState<TestState.S1> { on<TestAction.A1> { _, state -> childActionInvocations.send(Unit) state.noChange() } } } val sm = StateMachine(initialState = TestState.S1) { inState<TestState.S1> { onEnterStartStateMachine(child) on<TestAction.A2> { _, state -> state.override { TestState.S2 } } } inState<TestState.S2> { on<TestAction.A1> { _, state -> parentActionInvocations.send(Unit) state.noChange() } } } sm.state.test { // initial state assertEquals(TestState.S1, awaitItem()) // dispatch action to child state machine sm.dispatch(TestAction.A1) assertEquals(Unit, childActionInvocations.awaitItem()) // transition parent to other state sm.dispatch(TestAction.A2) assertEquals(TestState.S2, awaitItem()) // dispatch A1 action which is part of child definition but should not be // handled by child because parent not in state where delegation to child happens for (i in 1..3) { sm.dispatch(TestAction.A1) assertEquals(Unit, parentActionInvocations.awaitItem()) assertTrue(childActionInvocations.isEmpty) // no further emissions } } } @Test fun actionsAreOnlyDispatchedToSubStateMachineIfTheyAreMapped() = runTest { val childActionInvocations = Channel<Unit>(Channel.UNLIMITED) val parentActionInvocations = Channel<Unit>(Channel.UNLIMITED) val child = childStateMachine(initialState = TestState.S1) { inState<TestState> { on<TestAction> { _, state -> childActionInvocations.send(Unit) state.noChange() } } } val sm = StateMachine(initialState = TestState.S1) { inState<TestState.S1> { onEnterStartStateMachine( stateMachine = child, actionMapper = { when (it) { TestAction.A1 -> it TestAction.A2 -> it TestAction.A3 -> null is TestAction.A4 -> null } }, ) on<TestAction> { _, state -> parentActionInvocations.send(Unit) state.noChange() } } } sm.state.test { // initial state assertEquals(TestState.S1, awaitItem()) // dispatch mapped A1 action sm.dispatch(TestAction.A1) assertEquals(Unit, childActionInvocations.awaitItem()) assertEquals(Unit, parentActionInvocations.awaitItem()) // dispatch mapped A2 action sm.dispatch(TestAction.A2) assertEquals(Unit, childActionInvocations.awaitItem()) assertEquals(Unit, parentActionInvocations.awaitItem()) // dispatch unmapped A3 action sm.dispatch(TestAction.A3) // assert that child state machine was not triggered after first two initial actions assertTrue(childActionInvocations.isEmpty) assertEquals(Unit, parentActionInvocations.awaitItem()) // dispatch unmapped A4 action sm.dispatch(TestAction.A4(0)) // assert that child state machine was not triggered after first two initial actions assertTrue(childActionInvocations.isEmpty) assertEquals(Unit, parentActionInvocations.awaitItem()) } } @Test fun reenteringStateSoThatSubStateMachineTriggersWorksWithSameChildInstate() = runTest { var childOnEnterS2 = 0 var childActionA2 = 0 var parentS2 = 0 var childFactory = 0 val child = childStateMachine(initialState = TestState.S2) { inState<TestState.S2> { onEnter { childOnEnterS2++ it.noChange() } on<TestAction.A2> { _, state -> childActionA2++ state.override { TestState.S1 } } } } val sm = StateMachine(initialState = TestState.S1) { inState<TestState.S1> { on<TestAction.A1> { _, state -> state.override { TestState.S2 } } } inState<TestState.S2> { onEnterEffect { parentS2++ } onEnterStartStateMachine( stateMachineFactory = { childFactory++ child }, actionMapper = { it }, stateMapper = { state, childState -> state.override { childState } }, ) } } sm.state.test { // initial state assertEquals(TestState.S1, awaitItem()) for (i in 1..3) { // move to S2 sm.dispatch(TestAction.A1) assertEquals(TestState.S2, awaitItem()) assertEquals(i, parentS2) assertEquals(i, childOnEnterS2) assertEquals(i, childFactory) // dispatch action to child and move back to S1 sm.dispatch(TestAction.A2) assertEquals(TestState.S1, awaitItem()) assertEquals(i, childActionA2) assertEquals(i, childOnEnterS2) } } } private fun childStateMachine( initialState: TestState = TestState.Initial, builderBlock: FlowReduxStoreBuilder<TestState, TestAction>.() -> Unit, ): FlowReduxStateMachine<TestState, TestAction> { return object : FlowReduxStateMachine<TestState, TestAction>(initialState) { init { spec(builderBlock) } } } }
9
null
27
707
eecee7caf3bba31fca8d8f2a8ed66a60839310ca
13,961
FlowRedux
Apache License 2.0
flowredux/src/commonTest/kotlin/com/freeletics/flowredux/sideeffects/OnEnterStartStateMachineTest.kt
freeletics
184,753,749
false
null
package com.freeletics.flowredux.sideeffects import app.cash.turbine.awaitItem import app.cash.turbine.test import com.freeletics.flowredux.StateMachine import com.freeletics.flowredux.TestAction import com.freeletics.flowredux.TestState import com.freeletics.flowredux.dsl.FlowReduxStateMachine import com.freeletics.flowredux.dsl.FlowReduxStoreBuilder import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.assertTrue import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.launch import kotlinx.coroutines.test.runTest @OptIn(ExperimentalCoroutinesApi::class) internal class OnEnterStartStateMachineTest { @Test fun childStateMachineEmitsInitialStateToParentStateMachine() = runTest { val child = childStateMachine(initialState = TestState.S3) { } val stateMachine = StateMachine { inState<TestState.Initial> { onEnterStartStateMachine(child) } } stateMachine.state.test { assertEquals(TestState.Initial, awaitItem()) // parent initial state assertEquals(TestState.S3, awaitItem()) // child initial state } } @Test fun delegateToChildSubStateMachineWhileInState() = runTest { var inS3onA1Action = 0 var inS2OnA1Action = 0 val receivedChildStateUpdates = mutableListOf<TestState>() val receivedChildStateUpdatesParentState = mutableListOf<TestState>() val child = childStateMachine(initialState = TestState.S3) { inState<TestState.S3> { on<TestAction.A1> { _, state -> inS3onA1Action++ state.override { TestState.S1 } } } inState<TestState.S2> { on<TestAction.A1> { _, state -> inS2OnA1Action++ state.override { TestState.S2 } } } } val parent = StateMachine { inState<TestState.Initial> { onEnterStartStateMachine( stateMachine = child, actionMapper = { it }, ) { state, subStateMachineState -> receivedChildStateUpdates += subStateMachineState receivedChildStateUpdatesParentState += state.snapshot if (subStateMachineState == TestState.S3) { state.noChange() } else { state.override { subStateMachineState } } } } inState<TestState.S1> { on<TestAction.A1> { _, state -> state.override { TestState.S2 } } } } parent.state.test { assertEquals(TestState.Initial, awaitItem()) parent.dispatchAsync(TestAction.A1) assertEquals(TestState.S1, awaitItem()) parent.dispatchAsync(TestAction.A1) assertEquals(TestState.S2, awaitItem()) assertEquals(1, inS3onA1Action) assertEquals(0, inS2OnA1Action) assertEquals(listOf(TestState.S3, TestState.S1), receivedChildStateUpdates) assertEquals( listOf<TestState>(TestState.Initial, TestState.Initial), receivedChildStateUpdatesParentState, ) } } @Test fun subStateMachineDoesNotRestartIfStateParentStateIsStillTheSame() = runTest { val factoryInvocations = Channel<Unit>(Channel.UNLIMITED) val childEntersInitialState = Channel<Unit>(Channel.UNLIMITED) val child = childStateMachine { inState<TestState.Initial> { onEnterEffect { childEntersInitialState.send(Unit) } } } val sm = StateMachine(initialState = TestState.GenericState("generic", 0)) { inState<TestState.GenericState> { onEnterStartStateMachine( stateMachineFactory = { launch { factoryInvocations.send(Unit) } child }, actionMapper = { it }, stateMapper = { state, _ -> state.noChange() }, ) on<TestAction.A1> { _, state -> state.override { state.snapshot.copy(anInt = state.snapshot.anInt + 1) } } } } sm.state.test { assertEquals(TestState.GenericState("generic", 0), awaitItem()) assertEquals(Unit, factoryInvocations.awaitItem()) assertEquals(Unit, childEntersInitialState.awaitItem()) sm.dispatchAsync(TestAction.A1) assertEquals(TestState.GenericState("generic", 1), awaitItem()) assertTrue(factoryInvocations.isEmpty) assertTrue(childEntersInitialState.isEmpty) sm.dispatchAsync(TestAction.A1) assertEquals(TestState.GenericState("generic", 2), awaitItem()) assertTrue(factoryInvocations.isEmpty) assertTrue(childEntersInitialState.isEmpty) } } @Test fun subStateMachineFactoryIsCalledEveryTimeParentStateIsEntered() = runTest { val factoryInvocations = Channel<Unit>(Channel.UNLIMITED) val childEntersInitialState = Channel<Unit>(Channel.UNLIMITED) val child = childStateMachine { inState<TestState.Initial> { onEnterEffect { childEntersInitialState.send(Unit) } } } val sm = StateMachine(initialState = TestState.S1) { inState<TestState.S1> { onEnterStartStateMachine( stateMachineFactory = { launch { factoryInvocations.send(Unit) } child }, actionMapper = { it }, stateMapper = { state, _ -> state.noChange() }, ) on<TestAction.A1> { _, state -> state.override { TestState.S2 } } } inState<TestState.S2> { on<TestAction.A2> { _, state -> state.override { TestState.S1 } } } } sm.state.test { assertEquals(TestState.S1, awaitItem()) assertEquals(Unit, factoryInvocations.awaitItem()) assertEquals(Unit, childEntersInitialState.awaitItem()) sm.dispatchAsync(TestAction.A1) assertEquals(TestState.S2, awaitItem()) assertTrue(factoryInvocations.isEmpty) assertTrue(childEntersInitialState.isEmpty) sm.dispatchAsync(TestAction.A2) assertEquals(TestState.S1, awaitItem()) assertEquals(Unit, factoryInvocations.awaitItem()) assertEquals(Unit, childEntersInitialState.awaitItem()) sm.dispatchAsync(TestAction.A1) assertEquals(TestState.S2, awaitItem()) assertTrue(factoryInvocations.isEmpty) assertTrue(childEntersInitialState.isEmpty) } } @Test fun actionsAreOnlyDispatchedToSubStateMachineWhileParentStateMachineIsInState() = runTest { val childActionInvocations = Channel<Unit>(Channel.UNLIMITED) val parentActionInvocations = Channel<Unit>(Channel.UNLIMITED) val child = childStateMachine(initialState = TestState.S1) { inState<TestState.S1> { on<TestAction.A1> { _, state -> childActionInvocations.send(Unit) state.noChange() } } } val sm = StateMachine(initialState = TestState.S1) { inState<TestState.S1> { onEnterStartStateMachine(child) on<TestAction.A2> { _, state -> state.override { TestState.S2 } } } inState<TestState.S2> { on<TestAction.A1> { _, state -> parentActionInvocations.send(Unit) state.noChange() } } } sm.state.test { // initial state assertEquals(TestState.S1, awaitItem()) // dispatch action to child state machine sm.dispatch(TestAction.A1) assertEquals(Unit, childActionInvocations.awaitItem()) // transition parent to other state sm.dispatch(TestAction.A2) assertEquals(TestState.S2, awaitItem()) // dispatch A1 action which is part of child definition but should not be // handled by child because parent not in state where delegation to child happens for (i in 1..3) { sm.dispatch(TestAction.A1) assertEquals(Unit, parentActionInvocations.awaitItem()) assertTrue(childActionInvocations.isEmpty) // no further emissions } } } @Test fun actionsAreOnlyDispatchedToSubStateMachineIfTheyAreMapped() = runTest { val childActionInvocations = Channel<Unit>(Channel.UNLIMITED) val parentActionInvocations = Channel<Unit>(Channel.UNLIMITED) val child = childStateMachine(initialState = TestState.S1) { inState<TestState> { on<TestAction> { _, state -> childActionInvocations.send(Unit) state.noChange() } } } val sm = StateMachine(initialState = TestState.S1) { inState<TestState.S1> { onEnterStartStateMachine( stateMachine = child, actionMapper = { when (it) { TestAction.A1 -> it TestAction.A2 -> it TestAction.A3 -> null is TestAction.A4 -> null } }, ) on<TestAction> { _, state -> parentActionInvocations.send(Unit) state.noChange() } } } sm.state.test { // initial state assertEquals(TestState.S1, awaitItem()) // dispatch mapped A1 action sm.dispatch(TestAction.A1) assertEquals(Unit, childActionInvocations.awaitItem()) assertEquals(Unit, parentActionInvocations.awaitItem()) // dispatch mapped A2 action sm.dispatch(TestAction.A2) assertEquals(Unit, childActionInvocations.awaitItem()) assertEquals(Unit, parentActionInvocations.awaitItem()) // dispatch unmapped A3 action sm.dispatch(TestAction.A3) // assert that child state machine was not triggered after first two initial actions assertTrue(childActionInvocations.isEmpty) assertEquals(Unit, parentActionInvocations.awaitItem()) // dispatch unmapped A4 action sm.dispatch(TestAction.A4(0)) // assert that child state machine was not triggered after first two initial actions assertTrue(childActionInvocations.isEmpty) assertEquals(Unit, parentActionInvocations.awaitItem()) } } @Test fun reenteringStateSoThatSubStateMachineTriggersWorksWithSameChildInstate() = runTest { var childOnEnterS2 = 0 var childActionA2 = 0 var parentS2 = 0 var childFactory = 0 val child = childStateMachine(initialState = TestState.S2) { inState<TestState.S2> { onEnter { childOnEnterS2++ it.noChange() } on<TestAction.A2> { _, state -> childActionA2++ state.override { TestState.S1 } } } } val sm = StateMachine(initialState = TestState.S1) { inState<TestState.S1> { on<TestAction.A1> { _, state -> state.override { TestState.S2 } } } inState<TestState.S2> { onEnterEffect { parentS2++ } onEnterStartStateMachine( stateMachineFactory = { childFactory++ child }, actionMapper = { it }, stateMapper = { state, childState -> state.override { childState } }, ) } } sm.state.test { // initial state assertEquals(TestState.S1, awaitItem()) for (i in 1..3) { // move to S2 sm.dispatch(TestAction.A1) assertEquals(TestState.S2, awaitItem()) assertEquals(i, parentS2) assertEquals(i, childOnEnterS2) assertEquals(i, childFactory) // dispatch action to child and move back to S1 sm.dispatch(TestAction.A2) assertEquals(TestState.S1, awaitItem()) assertEquals(i, childActionA2) assertEquals(i, childOnEnterS2) } } } private fun childStateMachine( initialState: TestState = TestState.Initial, builderBlock: FlowReduxStoreBuilder<TestState, TestAction>.() -> Unit, ): FlowReduxStateMachine<TestState, TestAction> { return object : FlowReduxStateMachine<TestState, TestAction>(initialState) { init { spec(builderBlock) } } } }
9
null
27
707
eecee7caf3bba31fca8d8f2a8ed66a60839310ca
13,961
FlowRedux
Apache License 2.0
modules/conflate-logging/src/test/kotlin/com/encodeering/conflate/experimental/logging/LoggingTest.kt
encodeering
81,722,175
false
null
package com.encodeering.conflate.experimental.logging import com.encodeering.conflate.experimental.api.Action import com.encodeering.conflate.experimental.test.co import com.encodeering.conflate.experimental.test.eq import com.encodeering.conflate.experimental.test.fixture.Act import com.encodeering.conflate.experimental.test.fixture.Middlewares.connection import com.encodeering.conflate.experimental.test.mock import com.encodeering.conflate.experimental.test.throws import org.jetbrains.spek.api.Spek import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.it import org.junit.platform.runner.JUnitPlatform import org.junit.runner.RunWith import org.mockito.Mockito import org.mockito.Mockito.verify import org.mockito.Mockito.verifyNoMoreInteractions /** * @author <NAME> - <EMAIL> */ @RunWith (JUnitPlatform::class) class LoggingTest : Spek({ describe ("Logging") { fun log () = mock<(String, Action) -> Unit> () fun logging (before : Boolean = false, after : Boolean = false, exception : Boolean = false, log : (String, Action) -> Unit) = Logging<Unit> ( before = { before }, after = { after }, exception = { exception }, log = log ) it ("should log before") { val action = Act ("scott") val log = log () val logging = logging (before = true, log = log) co { logging.interceptor (connection ()).dispatch (action) verify (log).invoke (">>", action) verifyNoMoreInteractions (log) } } it ("should log after") { val action = Act ("scott") val log = log () val logging = logging (after = true, log = log) co { logging.interceptor (connection ()).dispatch (action) verify (log).invoke ("--", action) verifyNoMoreInteractions (log) } } it ("should log and rethrow exceptions") { val action = Act ("scott") val log = log () val logging = logging (exception = true, log = log) throws<IllegalStateException> { co { try { logging.interceptor (connection (next = { throw IllegalStateException () })).dispatch (action) } finally { verify (log).invoke ("!!", action) verifyNoMoreInteractions (log) } } } } it ("should call the next middleware") { val action = Act ("scott") val next = mock<(Action)-> Unit> () val logging = logging (exception = true, log = log ()) co { logging.interceptor (connection (next = next)).dispatch (action) verify (next).invoke (action) } } it ("should call before, proceed and after in the correct order") { val action = Act ("scott") val next = mock<(Action)-> Unit> () val log = log () val logging = logging (before = true, after = true, log = log) co { logging.interceptor (connection (next = next)).dispatch (action) val ordered = Mockito.inOrder (log, next) ordered.verify (log).invoke (eq (">>"), eq (action)) ordered.verify (next).invoke (action) ordered.verify (log).invoke (eq ("--"), eq (action)) } } } })
3
Kotlin
0
1
51fd2e4cee32e29bb72cd182611393d7f8420914
3,697
conflate
Apache License 2.0
app/src/main/java/com/axel_stein/glucose_tracker/ui/export_pdf/ExportPdfFactory.kt
AxelStein
320,277,698
false
null
package com.axel_stein.glucose_tracker.ui.export_pdf import androidx.lifecycle.AbstractSavedStateViewModelFactory import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.ViewModel import androidx.savedstate.SavedStateRegistryOwner @Suppress("UNCHECKED_CAST") class ExportPdfFactory( owner: SavedStateRegistryOwner ) : AbstractSavedStateViewModelFactory(owner, null) { override fun <T : ViewModel?> create( key: String, modelClass: Class<T>, handle: SavedStateHandle ): T = ExportPdfViewModel(handle) as T }
4
Kotlin
0
1
960fe9268fb04663de836c6ce9f5500f7179cabf
557
GlucoseTracker
Apache License 2.0
app/src/main/java/com/suyash/creditmanager/domain/util/LocalDateJSONConverter.kt
suyash01
732,788,266
false
{"Kotlin": 216552}
package com.suyash.creditmanager.domain.util import com.google.gson.JsonDeserializationContext import com.google.gson.JsonDeserializer import com.google.gson.JsonElement import com.google.gson.JsonPrimitive import com.google.gson.JsonSerializationContext import com.google.gson.JsonSerializer import java.lang.reflect.Type import java.time.LocalDate import java.time.format.DateTimeFormatter class LocalDateJSONConverter: JsonSerializer<LocalDate>, JsonDeserializer<LocalDate> { override fun serialize(src: LocalDate, typeOfSrc: Type, context: JsonSerializationContext): JsonElement { return JsonPrimitive(DateTimeFormatter.ISO_LOCAL_DATE.format(src)) } override fun deserialize(json: JsonElement, typeOfT: Type, context: JsonDeserializationContext): LocalDate { return DateTimeFormatter.ISO_LOCAL_DATE.parse(json.asString, LocalDate::from) } }
0
Kotlin
0
0
5d7f1de1d1acf8c5a1069eb32d4edcf1683326dd
879
credit-manager
Apache License 2.0
app/src/main/java/com/example/graduation/data/apiservice/MainAppService.kt
PanicLess-2023
628,118,517
false
null
package com.example.graduation.data.apiservice import com.example.graduation.data.models.postbody.CreateReadBody import com.example.graduation.data.models.response.reading.ReadingResponse import retrofit2.Response import retrofit2.http.* interface MainAppService { @POST("/reading/create-reading/") suspend fun createReading( @Body createReadBody: CreateReadBody ): Response<ReadingResponse> @DELETE("/reading/delete-reading/{id}/") suspend fun deleteReading( @Path("id") id: Int ): Response<Any> @GET("/reading/last-reading/") suspend fun getLastReading( ): Response<List<ReadingResponse>> @GET("/reading/list-reading/") suspend fun getListReading( ): Response<List<ReadingResponse>> }
0
Kotlin
0
0
c6c8e69421f441e48b5869e98dea804ffe31183a
759
Panicless
MIT License
presentation-widget/src/main/java/tachiyomi/presentation/widget/components/LockedWidget.kt
mihonapp
743,704,912
false
null
package tachiyomi.presentation.widget.components.manga import android.content.Intent import androidx.compose.runtime.Composable import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.glance.GlanceModifier import androidx.glance.LocalContext import androidx.glance.action.clickable import androidx.glance.appwidget.action.actionStartActivity import androidx.glance.layout.Alignment import androidx.glance.layout.Box import androidx.glance.layout.padding import androidx.glance.text.Text import androidx.glance.text.TextAlign import androidx.glance.text.TextStyle import androidx.glance.unit.ColorProvider import eu.kanade.tachiyomi.core.Constants import tachiyomi.i18n.MR import tachiyomi.presentation.core.i18n.stringResource @Composable fun LockedMangaWidget( foreground: ColorProvider, modifier: GlanceModifier = GlanceModifier, ) { val intent = Intent(LocalContext.current, Class.forName(Constants.MAIN_ACTIVITY)).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } Box( modifier = modifier .clickable(actionStartActivity(intent)) .padding(8.dp), contentAlignment = Alignment.Center, ) { Text( text = stringResource(MR.strings.appwidget_unavailable_locked), style = TextStyle( color = foreground, fontSize = 12.sp, textAlign = TextAlign.Center, ), ) } }
280
null
98
9,867
f3a2f566c8a09ab862758ae69b43da2a2cd8f1db
1,464
mihon
Apache License 2.0
domain/src/main/java/com/nedaluof/domain/di/UseCaseModule.kt
nedaluof
678,119,328
false
null
package com.nedaluof.domain.di import com.nedaluof.domain.usecase.categories.CategoriesUseCase import com.nedaluof.domain.usecase.categories.CategoriesUseCaseImpl import com.nedaluof.domain.usecase.categories.categoryphoto.CategoryPhotosUseCase import com.nedaluof.domain.usecase.categories.categoryphoto.CategoryPhotosUseCaseImpl import com.nedaluof.domain.usecase.photos.PhotosUseCase import com.nedaluof.domain.usecase.photos.PhotosUseCaseImpl import com.nedaluof.domain.usecase.search.SearchForPhotosUseCase import com.nedaluof.domain.usecase.search.SearchForPhotosUseCaseImpl import dagger.Binds import dagger.Module import dagger.hilt.InstallIn import dagger.hilt.android.components.ViewModelComponent import dagger.hilt.android.scopes.ViewModelScoped /** * Created By NedaluOf - 7/22/2023. */ @InstallIn(ViewModelComponent::class) @Module abstract class UseCaseModule { @ViewModelScoped @Binds abstract fun bindPhotosUseCase( useCaseImpl: PhotosUseCaseImpl ): PhotosUseCase @ViewModelScoped @Binds abstract fun bindCategoriesUseCase( useCaseImpl: CategoriesUseCaseImpl ): CategoriesUseCase @ViewModelScoped @Binds abstract fun bindCategoryPhotosUseCase( useCaseImpl: CategoryPhotosUseCaseImpl ): CategoryPhotosUseCase @ViewModelScoped @Binds abstract fun bindSearchForPhotosUseCase( useCaseImpl: SearchForPhotosUseCaseImpl ): SearchForPhotosUseCase }
0
Kotlin
0
0
163bc45964a5622f5f1ba846d390ababe7389021
1,413
PixabayX
Apache License 2.0
app/src/main/java/com/farmerbb/notepad/ui/previews/ViewNotePreview.kt
farmerbb
17,308,977
false
null
/* Copyright 2021 <NAME> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.farmerbb.notepad.ui.previews import androidx.compose.material.* import androidx.compose.runtime.Composable import androidx.compose.ui.res.colorResource import androidx.compose.ui.tooling.preview.Preview import com.farmerbb.notepad.R import com.farmerbb.notepad.models.Note import com.farmerbb.notepad.models.NoteContents import com.farmerbb.notepad.models.NoteMetadata import com.farmerbb.notepad.ui.content.ViewNoteContent import com.farmerbb.notepad.ui.widgets.NoteViewEditMenu import com.farmerbb.notepad.ui.widgets.* import java.util.Date @Composable private fun ViewNote(note: Note) { Scaffold( topBar = { TopAppBar( navigationIcon = { BackButton() }, title = { AppBarText(note.metadata.title) }, backgroundColor = colorResource(id = R.color.primary), actions = { EditButton() DeleteButton() NoteViewEditMenu() } ) }, content = { ViewNoteContent(note.contents.text) } ) } @Preview @Composable fun ViewNotePreview() = MaterialTheme { ViewNote( note = Note( metadata = NoteMetadata( metadataId = -1, title = "Title", date = Date() ), contents = NoteContents( contentsId = -1, text = "This is some text", isDraft = false ) ), ) }
50
null
82
207
112f3abff48b5df81731b49e71463bfb6e06616c
2,098
Notepad
Apache License 2.0
app/src/test/java/com/mateuszcholyn/wallet/frontend/view/screen/expenseform/ExpenseFormViewModelTest.kt
mateusz-nalepa
467,673,984
false
{"Kotlin": 606018}
package com.mateuszcholyn.wallet.frontend.view.screen.expenseform import com.mateuszcholyn.wallet.R import com.mateuszcholyn.wallet.backend.api.categoriesquicksummary.randomCategoryQuickSummary import com.mateuszcholyn.wallet.backend.api.core.expense.AddExpenseParameters import com.mateuszcholyn.wallet.backend.api.core.expense.Expense import com.mateuszcholyn.wallet.frontend.domain.usecase.core.expense.AddExpenseUseCase import com.mateuszcholyn.wallet.frontend.domain.usecase.core.expense.GetExpenseUseCase import com.mateuszcholyn.wallet.frontend.domain.usecase.core.expense.UpdateExpenseUseCase import com.mateuszcholyn.wallet.frontend.view.screen.history.filters.CategoryView import com.mateuszcholyn.wallet.frontend.view.screen.history.toCategoryView import com.mateuszcholyn.wallet.frontend.view.screen.util.actionButton.ErrorModalState import com.mateuszcholyn.wallet.frontend.view.util.EMPTY_STRING import com.mateuszcholyn.wallet.frontend.view.util.asPrintableAmountWithoutCurrencySymbol import com.mateuszcholyn.wallet.frontend.view.util.withTwoSignsPrecision import com.mateuszcholyn.wallet.manager.randomExpenseWithCategory import com.mateuszcholyn.wallet.util.localDateTimeUtils.fromUTCInstantToUserLocalTimeZone import com.mateuszcholyn.wallet.util.localDateTimeUtils.fromUserLocalTimeZoneToUTCInstant import io.kotest.matchers.shouldBe import io.mockk.coEvery import io.mockk.coVerify import io.mockk.mockk import io.mockk.verify import kotlinx.coroutines.test.runTest import org.junit.Before import org.junit.Rule import org.junit.Test import java.math.BigDecimal import java.time.LocalDateTime class ExpenseFormViewModelTest { private lateinit var viewModel: ExpenseFormViewModel @get:Rule val mainDispatcherRule = MainDispatcherRule() private lateinit var addExpenseUseCase: AddExpenseUseCase private lateinit var updateExpenseUseCase: UpdateExpenseUseCase private lateinit var getExpenseUseCase: GetExpenseUseCase private val testGetCategoriesQuickSummaryUseCase: TestGetCategoriesQuickSummaryUseCase = TestGetCategoriesQuickSummaryUseCase() private val timeProvider: TestLocalDateTimeProvider = TestLocalDateTimeProvider() @Before fun setUp() { addExpenseUseCase = mockk<AddExpenseUseCase>(relaxed = true) updateExpenseUseCase = mockk<UpdateExpenseUseCase>(relaxed = true) getExpenseUseCase = mockk<GetExpenseUseCase>(relaxed = true) viewModel = ExpenseFormViewModel( localDateTimeProvider = timeProvider, addExpenseUseCase = addExpenseUseCase, updateExpenseUseCase = updateExpenseUseCase, getExpenseUseCase = getExpenseUseCase, getCategoriesQuickSummaryUseCase = testGetCategoriesQuickSummaryUseCase, ) } @Test fun defaultExpenseFormScreenStateShouldBeLoading() = runTest { // expect assert(viewModel.exportedExpenseFormScreenState.value is ExpenseFormScreenState.Loading) } @Test fun expenseFormScreenShouldBeExpenseFormScreenStateNoCategoriesWhenThereIsNoCategories() = runTest { // given testGetCategoriesQuickSummaryUseCase.willReturnCategories(emptyList()) // when viewModel.initExpenseFormScreenExt() // then assert(viewModel.exportedExpenseFormScreenState.value is ExpenseFormScreenState.NoCategories) } @Test fun expenseFormScreenShouldBeExpenseFormScreenStateErrorWhenGetCategoriesThrowsError() = runTest { // given testGetCategoriesQuickSummaryUseCase.willThrowException() // when viewModel.initExpenseFormScreenExt() // then viewModel.exportedExpenseFormScreenState.value shouldBe ExpenseFormScreenState.Error("error on init XD") } @Test fun shouldShowExpenseFormWhereThereAreCategoriesPresent() = runTest { // given val actualTime = LocalDateTime.now() timeProvider.willReturnTime(actualTime) val givenCategories = listOf( randomCategoryQuickSummary(), randomCategoryQuickSummary(), ) testGetCategoriesQuickSummaryUseCase.willReturnCategories(givenCategories) // when viewModel.initExpenseFormScreenExt() // then viewModel.exportedExpenseFormDetailsUiState.value.run { assert(submitButtonLabelKey == R.string.button_addExpense) assert(categories == givenCategories.map { it.toCategoryView() }) assert(selectedCategory == givenCategories.first().toCategoryView()) assert(paidAt == actualTime) } assert(viewModel.exportedExpenseFormScreenState.value is ExpenseFormScreenState.Show) } @Test fun shouldThrowExceptionWhenTryingToSaveExpenseWhenAmountIsEmpty() = runTest { // given testGetCategoriesQuickSummaryUseCase.willReturnCategories(listOf(randomCategoryQuickSummary())) viewModel.initExpenseFormScreenExt() viewModel.updateAmount(EMPTY_STRING) // when viewModel.saveExpense() // then viewModel.exportedExpenseFormDetailsUiState.value.run { errorModalState shouldBe ErrorModalState.Visible(R.string.error_unable_to_addExpense) expenseSubmitButtonState shouldBe ExpenseSubmitButtonState.ENABLED } // and when close error modal viewModel.closeErrorModal() // then viewModel.exportedExpenseFormDetailsUiState.value.run { errorModalState shouldBe ErrorModalState.NotVisible } } @Test fun shouldUpdateCategory() = runTest { // given val categories = listOf( randomCategoryQuickSummary(), randomCategoryQuickSummary(), ) testGetCategoriesQuickSummaryUseCase.willReturnCategories(categories) viewModel.initExpenseFormScreenExt() // when viewModel.updateCategory(categories.last().toCategoryView()) // then viewModel.exportedExpenseFormDetailsUiState.value.run { selectedCategory shouldBe categories.last().toCategoryView() } } @Test fun shouldAddExpense() = runTest { // given val onButtonSubmittedActionMock = mockk<() -> Unit>() val givenCategory = randomCategoryQuickSummary() val time = LocalDateTime.now() timeProvider.willReturnTime(time) testGetCategoriesQuickSummaryUseCase.willReturnCategories(listOf(givenCategory)) viewModel.initExpenseFormScreenExt( onButtonSubmittedAction = onButtonSubmittedActionMock, ) // when viewModel.updateAmount("15") viewModel.updateDescription("description") viewModel.saveExpense() // then verify(exactly = 1) { onButtonSubmittedActionMock.invoke() } coVerify(exactly = 1) { addExpenseUseCase.invoke( AddExpenseParameters( expenseId = null, amount = BigDecimal.valueOf(15), description = "description", paidAt = time.fromUserLocalTimeZoneToUTCInstant(), categoryId = givenCategory.categoryId, ) ) } } @Test fun shouldShowInfoAboutInvalidAmountAndButtonShouldBeDisabled() = runTest { // given testGetCategoriesQuickSummaryUseCase.willReturnCategories(listOf(randomCategoryQuickSummary())) viewModel.initExpenseFormScreenExt() // when viewModel.updateAmount("some invalid amount value") // then viewModel.exportedExpenseFormDetailsUiState.value.run { isAmountInvalid shouldBe true expenseSubmitButtonState shouldBe ExpenseSubmitButtonState.DISABLED } } @Test fun shouldShowErrorStateModalWhenAddingExpenseThrowsError() = runTest { // given val givenCategory = randomCategoryQuickSummary() testGetCategoriesQuickSummaryUseCase.willReturnCategories(listOf(givenCategory)) viewModel.initExpenseFormScreenExt() coEvery { addExpenseUseCase.invoke(any()) }.throws(RuntimeException("XD")) // when viewModel.fillFormWithDummyData() viewModel.saveExpense() // then coVerify(exactly = 1) { addExpenseUseCase.invoke(any()) } viewModel.exportedExpenseFormDetailsUiState.value.run { errorModalState shouldBe ErrorModalState.Visible(R.string.error_unable_to_addExpense) expenseSubmitButtonState shouldBe ExpenseSubmitButtonState.ENABLED } } @Test fun shouldOpenScreenInUpdateExpenseMode() = runTest { // given val givenCategory = randomCategoryQuickSummary() val expenseToBeUpdated = randomExpenseWithCategory( categoryQuickSummary = givenCategory, ) testGetCategoriesQuickSummaryUseCase.willReturnCategories(listOf(givenCategory)) coEvery { getExpenseUseCase.invoke(expenseToBeUpdated.expenseId) }.returns( expenseToBeUpdated ) // when viewModel.initExpenseFormScreenExt( actualExpenseId = expenseToBeUpdated.expenseId.id, ) // then viewModel.exportedExpenseFormDetailsUiState.value.run { actualExpenseId shouldBe expenseToBeUpdated.expenseId.id amount shouldBe expenseToBeUpdated.amount.asPrintableAmountWithoutCurrencySymbol() isAmountInvalid shouldBe false description shouldBe expenseToBeUpdated.description selectedCategory shouldBe CategoryView( categoryId = expenseToBeUpdated.categoryId.id, name = expenseToBeUpdated.categoryName, ) paidAt shouldBe expenseToBeUpdated.paidAt.fromUTCInstantToUserLocalTimeZone() submitButtonLabelKey shouldBe R.string.button_editExpense expenseSubmitButtonState shouldBe ExpenseSubmitButtonState.ENABLED } } @Test fun shouldUpdateExpense() = runTest { // given val onButtonSubmittedActionMock = mockk<() -> Unit>() val givenCategory = randomCategoryQuickSummary() val expenseToBeUpdated = randomExpenseWithCategory( categoryQuickSummary = givenCategory, ) testGetCategoriesQuickSummaryUseCase.willReturnCategories(listOf(givenCategory)) coEvery { getExpenseUseCase.invoke(expenseToBeUpdated.expenseId) }.returns( expenseToBeUpdated ) viewModel.initExpenseFormScreenExt( actualExpenseId = expenseToBeUpdated.expenseId.id, onButtonSubmittedAction = onButtonSubmittedActionMock, ) // when viewModel.saveExpense() // then coVerify(exactly = 1) { updateExpenseUseCase.invoke( Expense( expenseId = expenseToBeUpdated.expenseId, amount = expenseToBeUpdated.amount.withTwoSignsPrecision(), description = expenseToBeUpdated.description, paidAt = expenseToBeUpdated.paidAt, categoryId = givenCategory.categoryId, ) ) } verify(exactly = 1) { onButtonSubmittedActionMock.invoke() } } @Test fun shouldOpenScreenInCopyExpenseMode() = runTest { // given val time = LocalDateTime.now() timeProvider.willReturnTime(time) val givenCategory = randomCategoryQuickSummary() val expenseToBeUpdated = randomExpenseWithCategory( categoryQuickSummary = givenCategory, ) testGetCategoriesQuickSummaryUseCase.willReturnCategories(listOf(givenCategory)) coEvery { getExpenseUseCase.invoke(expenseToBeUpdated.expenseId) }.returns( expenseToBeUpdated ) // when viewModel.initExpenseFormScreenExt( actualExpenseId = expenseToBeUpdated.expenseId.id, screenMode = "copy", ) // then viewModel.exportedExpenseFormDetailsUiState.value.run { actualExpenseId shouldBe expenseToBeUpdated.expenseId.id amount shouldBe expenseToBeUpdated.amount.asPrintableAmountWithoutCurrencySymbol() isAmountInvalid shouldBe false description shouldBe expenseToBeUpdated.description selectedCategory shouldBe CategoryView( categoryId = expenseToBeUpdated.categoryId.id, name = expenseToBeUpdated.categoryName, ) paidAt shouldBe time submitButtonLabelKey shouldBe R.string.button_copyExpense expenseSubmitButtonState shouldBe ExpenseSubmitButtonState.ENABLED } } @Test fun shouldAddANewExpenseWhenCopyingAnExpense() = runTest { // given val time = LocalDateTime.now() timeProvider.willReturnTime(time) val onButtonSubmittedActionMock = mockk<() -> Unit>() val givenCategory = randomCategoryQuickSummary() val expenseToBeUpdated = randomExpenseWithCategory( categoryQuickSummary = givenCategory, ) testGetCategoriesQuickSummaryUseCase.willReturnCategories(listOf(givenCategory)) coEvery { getExpenseUseCase.invoke(expenseToBeUpdated.expenseId) }.returns( expenseToBeUpdated ) viewModel.initExpenseFormScreenExt( actualExpenseId = expenseToBeUpdated.expenseId.id, screenMode = "copy", onButtonSubmittedAction = onButtonSubmittedActionMock, ) // when viewModel.saveExpense() // then coVerify(exactly = 1) { addExpenseUseCase.invoke( AddExpenseParameters( amount = expenseToBeUpdated.amount.withTwoSignsPrecision(), description = expenseToBeUpdated.description, paidAt = time.fromUserLocalTimeZoneToUTCInstant(), categoryId = givenCategory.categoryId, ) ) } verify(exactly = 1) { onButtonSubmittedActionMock.invoke() } } // test na to, że form invalid jak kwota invalid } private fun ExpenseFormViewModel.initExpenseFormScreenExt( actualExpenseId: String? = null, screenMode: String? = null, onButtonSubmittedAction: () -> Unit = {}, ) { this.initExpenseFormScreen( actualExpenseId = actualExpenseId, screenMode = screenMode, onButtonSubmittedAction = onButtonSubmittedAction, ) } private fun ExpenseFormViewModel.fillFormWithDummyData( ) { this.updateAmount("15") this.updateDescription("description") }
0
Kotlin
0
0
68fbe94c6921d26054080f9ad38edd3a11c46ce1
15,027
wallet
Apache License 2.0
pillarbox-demo/src/main/java/ch/srgssr/pillarbox/demo/ui/showcases/misc/SphericalSurfaceShowcase.kt
SRGSSR
519,157,987
false
null
/* * Copyright (c) SRG SSR. All rights reserved. * License information is available from the LICENSE file. */ package ch.srgssr.pillarbox.demo.ui.showcases.misc import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.lifecycle.compose.LifecycleStartEffect import androidx.media3.common.Player import ch.srgssr.pillarbox.core.business.MediaItemUrn import ch.srgssr.pillarbox.demo.shared.di.PlayerModule import ch.srgssr.pillarbox.ui.widget.player.SphericalSurface /** * Showcase how to display a spherical surface to play 360° video. */ @Composable fun SphericalSurfaceShowcase() { val context = LocalContext.current val player = remember { PlayerModule.provideDefaultPlayer(context = context).apply { setMediaItem(MediaItemUrn("urn:rts:video:8414077")) repeatMode = Player.REPEAT_MODE_ONE } } LifecycleStartEffect(player) { player.play() onStopOrDispose { player.pause() } } DisposableEffect(player) { player.prepare() onDispose { player.release() } } SphericalSurface(player = player, modifier = Modifier.fillMaxSize()) }
24
null
1
12
f65758adbf037ffef04861f878a714beac0f8c36
1,409
pillarbox-android
MIT License
app/src/main/java/dev/arkbuilders/rate/data/worker/CurrencyMonitorWorker.kt
ARK-Builders
515,514,394
false
{"Kotlin": 138606}
package dev.arkbuilders.rate.data.worker import android.content.Context import androidx.work.CoroutineWorker import androidx.work.WorkerParameters import dev.arkbuilders.rate.data.CurrencyRate import dev.arkbuilders.rate.data.GeneralCurrencyRepo import dev.arkbuilders.rate.data.db.PairAlertConditionRepo import dev.arkbuilders.rate.di.DIManager import dev.arkbuilders.rate.data.PairAlertCondition import dev.arkbuilders.rate.presentation.utils.NotificationUtils import javax.inject.Inject class CurrencyMonitorWorker(val context: Context, params: WorkerParameters) : CoroutineWorker(context, params) { @Inject lateinit var currencyRepo: GeneralCurrencyRepo @Inject lateinit var pairAlertRepo: PairAlertConditionRepo override suspend fun doWork(): Result { DIManager.component.inject(this) val rates = currencyRepo.getCurrencyRate() pairAlertRepo.getAll().forEach { pairAlert -> val curRatio = curRatio(pairAlert, rates) if (pairAlert.isConditionMet(curRatio)) { notifyPair(pairAlert, curRatio) } } return Result.success() } private fun curRatio( pairAlertCondition: PairAlertCondition, rates: List<CurrencyRate> ): Float { val numeratorRate = rates.find { it.code == pairAlertCondition.numeratorCode }!!.rate val denominatorRate = rates.find { it.code == pairAlertCondition.denominatorCode }!!.rate return (numeratorRate / denominatorRate).toFloat() } private fun notifyPair(pairAlertCondition: PairAlertCondition, curRatio: Float) { NotificationUtils.showPairAlert(pairAlertCondition, curRatio, context) } companion object { const val name = "CurrencyMonitorWorker" } }
32
Kotlin
3
2
850aba354bd508c6016d436ce2efa30419d4d55d
1,809
ARK-Rate
MIT License
workflows/src/main/kotlin/com/template/flows/NewKeyForAccount.kt
kaninkearpimy23814
246,088,380
true
{"Kotlin": 142330}
package com.r3.corda.lib.accounts.examples.flows import co.paralleluniverse.fibers.Suspendable import net.corda.core.flows.FlowLogic import net.corda.core.flows.StartableByRPC import net.corda.core.flows.StartableByService import net.corda.core.identity.PartyAndCertificate import java.util.* @StartableByRPC @StartableByService class NewKeyForAccount(private val accountId: UUID) : FlowLogic<PartyAndCertificate>() { @Suspendable override fun call(): PartyAndCertificate { return serviceHub.keyManagementService.freshKeyAndCert( identity = ourIdentityAndCert, revocationEnabled = false, externalId = accountId ) } }
0
Kotlin
0
0
f92ac047f55cfb53e215e194254c60193f1b4531
694
rubber-blockchain
Apache License 2.0
color/d2v-color-common/src/main/kotlin/io/data2viz/color/HslColor.kt
realdadfish
158,028,324
true
{"Kotlin": 1433243, "JavaScript": 42307, "HTML": 38410, "Java": 386}
package io.data2viz.color import io.data2viz.math.* /** * Create a color in the HSL color space * * @param h hue:Angle in degree * @param s saturation:Float between 0 and 1 * @param l lightness:Float between 0 and 1 * @param alpha:Float between 0 and 1 */ class HslColor @Deprecated("Deprecated", ReplaceWith("Colors.hsl(hue,saturation,luminance,a)", "io.data2viz.colors.Colors")) internal constructor(hue: Angle, saturation: Double, lightness: Double, a: Double = 1.0) : Color { val h = hue.normalize() val s = saturation.coerceIn(.0, 1.0) val l = lightness.coerceIn(.0, 1.0) override val alpha = a.coerceIn(.0, 1.0) override val rgb = toRgb().rgb override val rgba = toRgb().rgba override val r = toRgb().r override val g = toRgb().g override val b = toRgb().b override val rgbHex: String = toRgb().rgbHex override fun luminance() = toRgb().luminance() override fun contrast(other:Color) = toRgb().contrast(other) override fun toRgb(): RgbColor = toRgba() override fun toLab(): LabColor = toRgb().toLab() override fun toHcl(): HclColor = toRgb().toHcl() override fun toHsl(): HslColor = this override fun brighten(strength: Double): Color = toRgb().brighten(strength) override fun darken(strength: Double): Color = toRgb().darken(strength) override fun saturate(strength: Double): Color = toRgb().saturate(strength) override fun desaturate(strength: Double): Color = toRgb().desaturate(strength) override fun withAlpha(alpha: Double) = Colors.hsl(h, s, l, alpha) override fun withHue(hue: Angle) = toHcl().withHue(hue) fun isAchromatic() = (s == .0) || (l <= .0) || (l >= 1.0) override fun equals(other: Any?): Boolean { if (this === other) return true if (other == null || other !is Color) return false if (rgb != other.rgb) return false if (alpha != other.alpha) return false return true } override fun hashCode(): Int { var result = rgb result = 31 * result + alpha.hashCode() return result } override fun toString() = "HSL(${h.deg}°, ${s*100}%, ${l*100}%, alpha=$alpha)" }
0
Kotlin
0
0
4e3c732d44ee94940fa340e5684ea55e8ef05556
2,174
data2viz
Apache License 2.0
auth-cdn/code/Misc.kt
wkmcyz
512,309,921
false
{"Kotlin": 3481}
// 请求返回的对象结构 interface Response { // 返回本次请求是否是成功的请求, 即 200 fun isSuccessful(): Boolean // 返回本次请求返回码是否是 403 ,即需要认证 fun is403(): Boolean fun convertToCdnInfos(): ArrayList<CdnInfo> } // 包含了下载所需的信息 class DownloadInfo // 包含了使用 cdn 所需的信息 class CdnInfo // 下载类的抽象 interface IDownloader { // 下载指定的资源. // 如果下载成功,返回 true , 否则返回 false fun download(info: DownloadInfo): Boolean } interface AuthService { fun updateAuth(): Response } interface CdnService { fun download(): Response }
0
Kotlin
1
0
3aeeeff3383c6f7e1c62dbc9a4b865fcbbfba287
519
refactor-demos
Apache License 2.0
src/main/kotlin/ink/ptms/glaikit/GlaiKotlinScript.kt
TabooBot
445,271,522
true
{"Kotlin": 13016}
package ink.ptms.glaikit import ink.ptms.glaikit.scripting.ScriptBase import org.jetbrains.kotlin.mainKts.CompilerOptions import org.jetbrains.kotlin.mainKts.Import import org.jetbrains.kotlin.mainKts.MainKtsConfigurator import taboolib.common.reflect.Reflex import taboolib.common.reflect.Reflex.Companion.getProperty import kotlin.script.experimental.annotations.KotlinScript import kotlin.script.experimental.api.* import kotlin.script.experimental.dependencies.DependsOn import kotlin.script.experimental.dependencies.Repository import kotlin.script.experimental.jvm.baseClassLoader import kotlin.script.experimental.jvm.dependenciesFromClassContext import kotlin.script.experimental.jvm.dependenciesFromCurrentContext import kotlin.script.experimental.jvm.jvm @KotlinScript( fileExtension = "kts", compilationConfiguration = GlaiKotlinScriptConfiguration::class, evaluationConfiguration = GlaiScriptEvaluationConfiguration::class ) class GlaiKotlinScript(val args: Array<String>) class GlaiKotlinScriptConfiguration : ScriptCompilationConfiguration( { // 因为 kts 无法识别 taboolib 的顶级函数,因此需要在父类中重新定义 baseClass(ScriptBase::class) defaultImports(DependsOn::class, Repository::class, Import::class, CompilerOptions::class) defaultImports.append(GlaiEnv.globalImports) jvm { dependenciesFromClassContext(GlaiKotlinScriptConfiguration::class, "kotlin-stdlib", "kotlin-reflect") dependenciesFromCurrentContext(wholeClasspath = true) } refineConfiguration { onAnnotations(DependsOn::class, Repository::class, Import::class, CompilerOptions::class, handler = MainKtsConfigurator()) } ide { acceptedLocations(ScriptAcceptedLocation.Everywhere) } } ) class GlaiScriptEvaluationConfiguration : ScriptEvaluationConfiguration( { scriptsInstancesSharing(true) jvm { baseClassLoader(GlaiKotlinScriptConfiguration::class.java.classLoader) } } )
0
Kotlin
0
0
36a183814952fe8ebff0ff55f7e323bb9d5cb984
2,024
GlaiKit
Creative Commons Zero v1.0 Universal
ontrack-extension-github/src/main/java/net/nemerosa/ontrack/extension/github/ingestion/ui/GitHubIngestionHookPayloadsUserMenuExtension.kt
nemerosa
19,351,480
false
{"Kotlin": 9309646, "JavaScript": 3062605, "Java": 1043391, "HTML": 507221, "Groovy": 372843, "CSS": 137546, "Less": 35335, "Dockerfile": 6298, "Shell": 5086}
package net.nemerosa.ontrack.extension.github.ingestion.ui import net.nemerosa.ontrack.extension.api.UserMenuExtension import net.nemerosa.ontrack.extension.api.UserMenuExtensionGroups import net.nemerosa.ontrack.extension.github.GitHubExtensionFeature import net.nemerosa.ontrack.extension.support.AbstractExtension import net.nemerosa.ontrack.model.security.GlobalFunction import net.nemerosa.ontrack.model.security.GlobalSettings import net.nemerosa.ontrack.model.support.Action import net.nemerosa.ontrack.model.support.ActionType import org.springframework.stereotype.Component @Component class GitHubIngestionHookPayloadsUserMenuExtension( extensionFeature: GitHubExtensionFeature ) : AbstractExtension(extensionFeature), UserMenuExtension { override val action = Action( id = "ingestion-hook-payloads", name = "GitHub Ingestion Hook Payloads", type = ActionType.LINK, uri = "ingestion-hook-payloads", group = UserMenuExtensionGroups.information, ) override val globalFunction: Class<out GlobalFunction> = GlobalSettings::class.java }
44
Kotlin
25
96
759f17484c9b507204e5a89524e07df871697e74
1,100
ontrack
MIT License
feature-ledger-impl/src/main/java/io/novafoundation/nova/feature_ledger_impl/presentation/account/common/selectLedger/SelectLedgerAdapter.kt
novasamatech
415,834,480
false
{"Kotlin": 7667438, "Java": 14723, "JavaScript": 425}
package io.novafoundation.nova.feature_ledger_impl.presentation.account.common.selectLedger import android.view.View import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import io.novafoundation.nova.common.list.BaseListAdapter import io.novafoundation.nova.common.list.BaseViewHolder import io.novafoundation.nova.common.utils.inflateChild import io.novafoundation.nova.common.view.shape.addRipple import io.novafoundation.nova.common.view.shape.getRoundedCornerDrawable import io.novafoundation.nova.feature_ledger_impl.R import io.novafoundation.nova.feature_ledger_impl.presentation.account.common.selectLedger.model.SelectLedgerModel import kotlinx.android.synthetic.main.item_ledger.view.itemLedger class SelectLedgerAdapter( private val handler: Handler ) : BaseListAdapter<SelectLedgerModel, SelectLedgerHolder>(DiffCallback()) { interface Handler { fun itemClicked(item: SelectLedgerModel) } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): SelectLedgerHolder { return SelectLedgerHolder(parent.inflateChild(R.layout.item_ledger), handler) } override fun onBindViewHolder(holder: SelectLedgerHolder, position: Int) { holder.bind(getItem(position)) } } private class DiffCallback : DiffUtil.ItemCallback<SelectLedgerModel>() { override fun areItemsTheSame(oldItem: SelectLedgerModel, newItem: SelectLedgerModel): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame(oldItem: SelectLedgerModel, newItem: SelectLedgerModel): Boolean { return oldItem == newItem } } class SelectLedgerHolder( containerView: View, private val eventHandler: SelectLedgerAdapter.Handler ) : BaseViewHolder(containerView) { init { containerView.itemLedger.background = with(containerView.context) { addRipple(getRoundedCornerDrawable(R.color.block_background)) } containerView.itemLedger.setProgressTint(R.color.icon_secondary) } fun bind(model: SelectLedgerModel) = with(containerView) { itemLedger.title.text = model.name bindConnecting(model) } fun bindConnecting(model: SelectLedgerModel) = with(containerView) { itemLedger.setInProgress(model.isConnecting) if (model.isConnecting) { setOnClickListener(null) } else { setOnClickListener { eventHandler.itemClicked(model) } } } override fun unbind() {} }
13
Kotlin
6
9
dea9f1144c1cbba1d876a9bb753f8541da38ebe0
2,498
nova-wallet-android
Apache License 2.0
app/src/main/java/net/frozendevelopment/frozenvault/data/AppDatabase.kt
frozenjava
253,601,063
false
null
package net.frozendevelopment.frozenvault.data import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase import androidx.room.TypeConverters import net.frozendevelopment.frozenvault.data.converters.DateConverter import net.frozendevelopment.frozenvault.data.converters.ListConverter import net.frozendevelopment.frozenvault.data.converters.SecurityQuestionConverter import net.frozendevelopment.frozenvault.data.converters.UnLockEventTypeConverter import net.frozendevelopment.frozenvault.data.daos.ServicePasswordDao import net.frozendevelopment.frozenvault.data.daos.UnlockEventDao import net.frozendevelopment.frozenvault.data.models.ServicePasswordModel import net.frozendevelopment.frozenvault.data.models.UnlockEventModel @TypeConverters( DateConverter::class, ListConverter::class, UnLockEventTypeConverter::class, SecurityQuestionConverter::class) @Database(entities = [ServicePasswordModel::class, UnlockEventModel::class], version = 2) abstract class AppDatabase : RoomDatabase() { abstract fun servicePasswordDao() : ServicePasswordDao abstract fun unlockEventDao(): UnlockEventDao companion object { @Volatile private var INSTANCE: AppDatabase? = null fun getDatabase(context: Context): AppDatabase { if (INSTANCE != null) { return INSTANCE!! } synchronized(this) { val instance = Room.databaseBuilder( context.applicationContext, AppDatabase::class.java, "frozenpasswords_database" ) .addMigrations(MIGRATION_1_2) .build() INSTANCE = instance return instance } } } }
3
Kotlin
2
2
e5c2b4b4f82f825d53b5834139ab45812bb9dc03
1,833
FrozenVault
MIT License
src/main/kotlin/me/ddivad/judgebot/util/TimerUtils.kt
the-programmers-hangout
299,355,943
false
null
package me.ddivad.judgebot.util import com.gitlab.kordlib.core.entity.Member import com.gitlab.kordlib.core.entity.Role import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.Job import kotlinx.coroutines.delay import kotlinx.coroutines.launch suspend fun applyRoleWithTimer(member: Member, role: Role, millis: Long, fn: (Member) -> Unit): Job { member.addRole(role.id) return GlobalScope.launch { delay(millis) fn(member) } }
0
null
3
9
31878633fab250a1c72a3fe34d83d2ac14bd1cab
465
JudgeBot
MIT License
jetbrains-ultimate/tst/software/aws/toolkits/jetbrains/datagrip/actions/AddSecretsManagerConnectionTest.kt
JetBrains
223,485,227
true
{"Gradle Kotlin DSL": 21, "Markdown": 16, "Java Properties": 2, "Shell": 1, "Text": 12, "Ignore List": 3, "Batchfile": 1, "Git Attributes": 1, "EditorConfig": 3, "YAML": 28, "XML": 96, "Kotlin": 1102, "JSON": 54, "Java": 9, "SVG": 64, "TOML": 1, "INI": 1, "CODEOWNERS": 1, "Maven POM": 4, "Dockerfile": 14, "JavaScript": 3, "Python": 5, "Go": 1, "Go Module": 1, "Microsoft Visual Studio Solution": 6, "C#": 79}
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package software.aws.toolkits.jetbrains.datagrip.actions import com.intellij.database.autoconfig.DataSourceRegistry import com.intellij.testFramework.ProjectRule import org.assertj.core.api.Assertions.assertThat import org.junit.Rule import org.junit.Test import software.aws.toolkits.core.utils.RuleUtils import software.aws.toolkits.jetbrains.core.credentials.MockAwsConnectionManager.ProjectAccountSettingsManagerRule import software.aws.toolkits.jetbrains.core.credentials.MockCredentialManagerRule import software.aws.toolkits.jetbrains.core.region.AwsRegionProvider import software.aws.toolkits.jetbrains.datagrip.CREDENTIAL_ID_PROPERTY import software.aws.toolkits.jetbrains.datagrip.REGION_ID_PROPERTY import software.aws.toolkits.jetbrains.datagrip.auth.SECRET_ID_PROPERTY import software.aws.toolkits.jetbrains.datagrip.auth.SecretsManagerAuth import software.aws.toolkits.jetbrains.datagrip.auth.SecretsManagerDbSecret class AddSecretsManagerConnectionTest { @Rule @JvmField val projectRule = ProjectRule() @Rule @JvmField val credentialManager = MockCredentialManagerRule() @Rule @JvmField val settingsManager = ProjectAccountSettingsManagerRule(projectRule) @Test fun `Add data source`() { val credentialProvider = credentialManager.createCredentialProvider() val region = AwsRegionProvider.getInstance().defaultRegion() settingsManager.settingsManager.changeCredentialProviderAndWait(credentialProvider.identifier) settingsManager.settingsManager.changeRegionAndWait(region) val port = RuleUtils.randomNumber() val address = RuleUtils.randomName() val username = RuleUtils.randomName() val password = RuleUtils.randomName() val secretArn = RuleUtils.randomName() val engine = RuleUtils.randomName() val registry = DataSourceRegistry(projectRule.project) registry.createDatasource( projectRule.project, SecretsManagerDbSecret(username, password, engine, address, port.toString()), secretArn, "adapter" ) assertThat(registry.newDataSources).singleElement().satisfies { assertThat(it.isTemporary).isFalse() assertThat(it.sslCfg?.myEnabled).isTrue() assertThat(it.url).isEqualTo("jdbc:adapter://$address:$port") assertThat(it.additionalJdbcProperties[CREDENTIAL_ID_PROPERTY]).isEqualTo(credentialProvider.identifier.id) assertThat(it.additionalJdbcProperties[REGION_ID_PROPERTY]).isEqualTo(region.id) assertThat(it.additionalJdbcProperties[SECRET_ID_PROPERTY]).isEqualTo(secretArn) assertThat(it.authProviderId).isEqualTo(SecretsManagerAuth.providerId) } } }
6
Kotlin
4
9
ccee3307fe58ad48f93cd780d4378c336ee20548
2,890
aws-toolkit-jetbrains
Apache License 2.0
app/src/main/java/ca/on/hojat/gamenews/core/urlopeners/CustomTabUrlOpener.kt
hojat72elect
574,228,468
false
null
package ca.on.hojat.gamenews.core.urlopeners import android.content.Context import android.net.Uri import androidx.annotation.ColorRes import androidx.browser.customtabs.CustomTabColorSchemeParams import androidx.browser.customtabs.CustomTabsIntent import ca.on.hojat.gamenews.R import ca.on.hojat.gamenews.presentation.WindowAnimations import ca.on.hojat.gamenews.core.extensions.attachNewTaskFlagIfNeeded import ca.on.hojat.gamenews.core.extensions.configuration import ca.on.hojat.gamenews.core.extensions.getCompatColor import ca.on.hojat.gamenews.core.extensions.isDarkThemeEnabled import ca.on.hojat.gamenews.core.extensions.setAnimations import ca.on.hojat.gamenews.core.providers.CustomTabsProvider import com.paulrybitskyi.hiltbinder.BindType import javax.inject.Inject @BindType(withQualifier = true) @UrlOpenerKey(UrlOpenerKey.Type.CUSTOM_TAB) internal class CustomTabUrlOpener @Inject constructor( private val customTabsProvider: CustomTabsProvider ) : UrlOpener { override fun openUrl(url: String, context: Context): Boolean { // If the context is not activity based, then exit animations // won't work. return if (customTabsProvider.areCustomTabsSupported()) { createCustomTabsIntent(context).launchUrl(context, Uri.parse(url)) true } else { false } } private fun createCustomTabsIntent(context: Context): CustomTabsIntent { return CustomTabsIntent.Builder() .setShowTitle(true) .setDefaultColorSchemeParams(createColorSchemeParams(context)) .setAnimations(context, WindowAnimations.HORIZONTAL_SLIDING_ANIMATIONS) .build() .apply { intent.`package` = customTabsProvider.getCustomTabsPackageName() intent.attachNewTaskFlagIfNeeded(context) } } private fun createColorSchemeParams(context: Context): CustomTabColorSchemeParams { val browserColors = BrowserColors.create(context) return CustomTabColorSchemeParams.Builder() .setToolbarColor(context.getCompatColor(browserColors.toolbar)) .setSecondaryToolbarColor(context.getCompatColor(browserColors.secondaryToolbar)) .setNavigationBarColor(context.getCompatColor(browserColors.navigationBar)) .build() } private data class BrowserColors( @ColorRes val toolbar: Int, @ColorRes val secondaryToolbar: Int, @ColorRes val navigationBar: Int, ) { companion object { fun create(context: Context): BrowserColors { return if (context.configuration.isDarkThemeEnabled) { BrowserColors( toolbar = R.color.dark_colorPrimary, secondaryToolbar = R.color.dark_colorSurface, navigationBar = R.color.dark_colorNavigationBar, ) } else { BrowserColors( toolbar = R.color.light_colorPrimary, secondaryToolbar = R.color.light_colorSurface, navigationBar = R.color.light_colorNavigationBar, ) } } } } }
0
null
8
4
b1c07551e90790ee3d273bc4c0ad3a5f97f71202
3,283
GameHub
MIT License
app/src/main/java/com/suqir/wasaischedule/ui/schedule_manage/ScheduleManageViewModel.kt
suqir
287,276,130
true
{"Kotlin": 726821}
package com.suqir.wasaischedule.ui.schedule_manage import android.app.Application import androidx.lifecycle.AndroidViewModel import com.suqir.wasaischedule.logic.bean.AppWidgetBean import com.suqir.wasaischedule.logic.bean.CourseBaseBean import com.suqir.wasaischedule.logic.bean.TableBean import com.suqir.wasaischedule.logic.bean.TableSelectBean import com.suqir.wasaischedule.logic.database.AppDatabase class ScheduleManageViewModel(application: Application) : AndroidViewModel(application) { private val dataBase = AppDatabase.getDatabase(application) private val tableDao = dataBase.tableDao() private val courseDao = dataBase.courseDao() private val widgetDao = dataBase.appWidgetDao() suspend fun initTableSelectList(): MutableList<TableSelectBean> { return tableDao.getTableSelectList().toMutableList() } suspend fun getCourseBaseBeanListByTable(tableId: Int): MutableList<CourseBaseBean> { return courseDao.getCourseBaseBeanOfTable(tableId).toMutableList() } suspend fun getTableById(id: Int): TableBean? { return tableDao.getTableById(id) } suspend fun addBlankTable(tableName: String): Long { return tableDao.insertTable(TableBean(id = 0, tableName = tableName)) } suspend fun deleteTable(id: Int) { tableDao.deleteTable(id) } suspend fun clearTable(id: Int) { tableDao.clearTable(id) } suspend fun deleteCourse(course: CourseBaseBean) { courseDao.deleteCourseBaseBeanOfTable(course.id, course.tableId) } suspend fun getScheduleWidgetIds(): List<AppWidgetBean> { return widgetDao.getWidgetsByBaseType(0) } }
0
Kotlin
0
0
533f1a36067dbb14dca8d694d4fa86cd021ac6ac
1,673
WaSaiSchedule
Apache License 2.0