1
+ /*
2
+ *
3
+ * *
4
+ * * * MIT License
5
+ * * *
6
+ * * * Copyright (c) 2020 Sanju S
7
+ * * *
8
+ * * * Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ * * * of this software and associated documentation files (the "Software"), to deal
10
+ * * * in the Software without restriction, including without limitation the rights
11
+ * * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ * * * copies of the Software, and to permit persons to whom the Software is
13
+ * * * furnished to do so, subject to the following conditions:
14
+ * * *
15
+ * * * The above copyright notice and this permission notice shall be included in all
16
+ * * * copies or substantial portions of the Software.
17
+ * * *
18
+ * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ * * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ * * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ * * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ * * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ * * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24
+ * * * SOFTWARE.
25
+ * *
26
+ *
27
+ */
28
+
29
+ package www.spikeysanju.jetquotes.app
30
+
31
+ import androidx.compose.runtime.Composable
32
+ import androidx.compose.runtime.remember
33
+ import androidx.lifecycle.LifecycleCoroutineScope
34
+ import androidx.navigation.compose.NavHost
35
+ import androidx.navigation.compose.composable
36
+ import androidx.navigation.compose.rememberNavController
37
+ import www.spikeysanju.jetquotes.ui.JetQuotesTheme
38
+ import www.spikeysanju.jetquotes.utils.Actions
39
+ import www.spikeysanju.jetquotes.utils.Destinations.QuoteDetails
40
+ import www.spikeysanju.jetquotes.utils.Destinations.QuoteDetailsArgs
41
+ import www.spikeysanju.jetquotes.utils.Destinations.Quotes
42
+ import www.spikeysanju.jetquotes.view.App
43
+ import www.spikeysanju.jetquotes.view.DetailQuoteApp
44
+
45
+ @Composable
46
+ fun JetQuoteApp (lifecycleScope : LifecycleCoroutineScope ) {
47
+ val navController = rememberNavController()
48
+ val actions = remember(navController) {
49
+ Actions (navController = navController)
50
+ }
51
+
52
+ JetQuotesTheme {
53
+ NavHost (navController = navController, startDestination = Quotes ) {
54
+ composable(Quotes ) {
55
+ App (lifecycleScope = (lifecycleScope), actions = actions)
56
+
57
+ }
58
+ composable(" $QuoteDetails /{${QuoteDetailsArgs .quote} }/{${QuoteDetailsArgs .author} }" ) { navBackStackEntry ->
59
+ DetailQuoteApp (
60
+ quote = navBackStackEntry.arguments?.getString(QuoteDetailsArgs .quote) ? : " " ,
61
+ author = navBackStackEntry.arguments?.getString(QuoteDetailsArgs .author) ? : " " ,
62
+ onBackPress = actions.navigateUp
63
+ )
64
+ }
65
+ }
66
+ }
67
+ }
0 commit comments