1 00:00:01,480 --> 00:00:05,890 All right, so in the previous section, we started improving the structure of the project and worked 2 00:00:05,890 --> 00:00:08,170 on top new screen and two categories. 3 00:00:08,440 --> 00:00:10,620 Now let's look at the source's screen. 4 00:00:10,630 --> 00:00:13,270 So the screen here in particular. 5 00:00:13,450 --> 00:00:17,320 And after that, we need to take care of our search screen as well. 6 00:00:17,590 --> 00:00:24,310 So therefore, the first step will be to modify the update request methods in our new service cut file. 7 00:00:24,610 --> 00:00:27,760 So let's go over to news service. 8 00:00:28,630 --> 00:00:29,230 Katie. 9 00:00:29,470 --> 00:00:31,780 So that's our interface, right? 10 00:00:32,770 --> 00:00:37,900 This one here and we were using suspend functions in the last video. 11 00:00:37,930 --> 00:00:41,380 So we changed those functions to be suspend functions. 12 00:00:41,650 --> 00:00:45,370 Now we need to do the same thing for our other functions as well. 13 00:00:45,400 --> 00:00:50,230 So here for resources, for example, as well as for the search query and so forth. 14 00:00:53,160 --> 00:00:54,270 So let's just do that. 15 00:00:54,480 --> 00:01:00,480 Let's go and call this one to suspend function, get articles by sources. 16 00:01:00,630 --> 00:01:03,170 And here we need to still pass in the source. 17 00:01:03,180 --> 00:01:08,790 We're going to still get a top response, but our top news response, but this will not be a call. 18 00:01:09,360 --> 00:01:11,220 But we're just going to do like so. 19 00:01:11,790 --> 00:01:12,980 The same goes for this one. 20 00:01:12,990 --> 00:01:19,020 So we're not going to return a call because now we're going to use to suspend functions here, which 21 00:01:19,020 --> 00:01:20,610 will be called routine functions. 22 00:01:20,910 --> 00:01:26,700 And they, well, they will directly return a top news response as we want it. 23 00:01:27,180 --> 00:01:28,500 Instead of using a call here. 24 00:01:30,790 --> 00:01:33,280 And then we need to go to our news manager. 25 00:01:33,430 --> 00:01:42,060 All right, so here, news manager, that's where we also had those functions get article by source. 26 00:01:42,100 --> 00:01:47,110 For example, you see now it's not happy with it anymore because, well, we changed how it's going 27 00:01:47,110 --> 00:01:47,410 to work. 28 00:01:47,410 --> 00:01:49,600 So we're not going to use retrofit here anymore. 29 00:01:49,960 --> 00:01:53,650 So this one will now be also is suspend function. 30 00:01:53,800 --> 00:01:57,040 So get article by source and. 31 00:01:58,190 --> 00:02:03,230 It will return a top news source now, so here. 32 00:02:04,010 --> 00:02:07,200 Top news of news response, that's what it was. 33 00:02:07,880 --> 00:02:13,140 So I'm going to basically do the same thing as we've done before here with context. 34 00:02:13,160 --> 00:02:18,200 The dispatcher I owe and going to simplify this significantly. 35 00:02:18,200 --> 00:02:23,350 So we don't need to do all of this on failure and queue on response and so forth. 36 00:02:23,360 --> 00:02:24,530 We don't need to do any of it. 37 00:02:25,100 --> 00:02:27,500 So now instead, we're going to call the get. 38 00:02:29,210 --> 00:02:37,550 And she was articles by source says kind, and here, instead of passing the category itself. 39 00:02:38,000 --> 00:02:39,800 We can get the source. 40 00:02:41,610 --> 00:02:44,250 Name that value. 41 00:02:46,520 --> 00:02:52,190 OK, so this source name, this variable here that we have in our news manager, which is a mutable 42 00:02:52,190 --> 00:02:54,200 state which knows which. 43 00:02:55,450 --> 00:02:56,170 New source. 44 00:02:56,470 --> 00:03:00,400 We want to use OK, and this will be to get articles by source. 45 00:03:00,490 --> 00:03:06,100 Now let's get searched articles as well, and therefore we need to make it to suspend function as well. 46 00:03:06,730 --> 00:03:10,510 And let me actually do the same thing as we've done here. 47 00:03:11,320 --> 00:03:16,900 It will return a top news response based on. 48 00:03:17,440 --> 00:03:20,620 And here we need to make a couple of changes. 49 00:03:20,740 --> 00:03:24,790 So this will be state still a query with context dispatchers. 50 00:03:24,790 --> 00:03:25,360 I'll. 51 00:03:26,960 --> 00:03:28,700 Like we did and then. 52 00:03:30,060 --> 00:03:34,200 It will call them get searched articles or get articles. 53 00:03:34,830 --> 00:03:35,860 I think I call it. 54 00:03:36,180 --> 00:03:36,490 All right. 55 00:03:37,020 --> 00:03:44,460 And here we're not going to search by source name, but here we need to search by whatever we entered. 56 00:03:44,880 --> 00:03:47,860 And we get that from the query. 57 00:03:47,910 --> 00:03:54,450 So whatever we entered in query, which is this query here, so we can just pass the query to get articles 58 00:03:54,450 --> 00:03:59,220 because if you recall, query just needed a string, which will be our query. 59 00:03:59,220 --> 00:04:01,050 So our search keywords, so to speak. 60 00:04:03,470 --> 00:04:12,500 So we're just saying run it on the dispatcher's I own basically on this thread, and once it's done 61 00:04:13,100 --> 00:04:16,760 doing this stuff, give me the return, which will be a top news response. 62 00:04:17,540 --> 00:04:19,820 OK, so you were just saying in which threat? 63 00:04:19,820 --> 00:04:22,310 We want to run it and this is what we want them to run. 64 00:04:23,000 --> 00:04:23,330 OK. 65 00:04:23,360 --> 00:04:30,170 And now actually, we need to make sure that in our repository Katy file, we prepared these methods 66 00:04:30,170 --> 00:04:31,640 for access to the view model. 67 00:04:31,940 --> 00:04:36,080 So he and repository Katie, we get articles by category. 68 00:04:36,080 --> 00:04:38,660 We get articles like So. 69 00:04:39,020 --> 00:04:45,890 So here we need to get articles by source as well as get articles by search. 70 00:04:46,580 --> 00:04:55,160 So these will also be suspend functions here, suspend fun, get articles by source, and we need to 71 00:04:55,160 --> 00:04:57,530 pass the source, which will be a string. 72 00:04:58,370 --> 00:05:07,590 And here it will use our manager to get articles by source where we set the source to be the source. 73 00:05:07,970 --> 00:05:13,970 So we set the source of this get articles by source to the source that we are passing to discard articles 74 00:05:13,970 --> 00:05:14,720 by source here. 75 00:05:16,170 --> 00:05:18,120 OK, so this will be an equal sign here. 76 00:05:18,490 --> 00:05:26,940 And let me put that into the next line so it will be working flawlessly and see how that I call it actually 77 00:05:26,940 --> 00:05:29,100 get article by source there. 78 00:05:29,100 --> 00:05:33,360 I realize that we probably should also use the source here. 79 00:05:33,600 --> 00:05:41,160 So let's just set the source as string and use that source then and not the source name value. 80 00:05:42,660 --> 00:05:43,110 All right. 81 00:05:43,200 --> 00:05:44,580 So get articles by source. 82 00:05:46,120 --> 00:05:47,590 And now in our repository. 83 00:05:48,430 --> 00:05:52,900 So over here, we can now set the source. 84 00:05:53,500 --> 00:05:58,630 OK, so this will be the source that we passed to this good article by source, but we then can pass. 85 00:05:59,500 --> 00:06:06,190 OK, and then at the same time, we can also set up our search function for of our search feature, 86 00:06:06,190 --> 00:06:06,880 so to speak. 87 00:06:07,180 --> 00:06:15,010 And I'm just going to call this get searched articles, and it will need to query which will be a string, 88 00:06:15,310 --> 00:06:19,510 and it will pass that query to be the query. 89 00:06:19,810 --> 00:06:24,190 And we're here going to get the searched articles, obviously. 90 00:06:24,460 --> 00:06:29,050 So we're going to call this method here from our news manager in our repository. 91 00:06:29,860 --> 00:06:34,120 We're preparing it, so to speak, for our view model via our repository. 92 00:06:36,700 --> 00:06:39,130 OK, now we can go over to our main view model. 93 00:06:41,750 --> 00:06:48,260 Here, and we need to prepare the holder for the source name with setters and getters. 94 00:06:48,530 --> 00:06:51,160 So we had that four hour news response. 95 00:06:51,170 --> 00:06:56,060 We had that for our articles by category selected articles and so forth. 96 00:06:56,330 --> 00:07:00,800 Now we need to do the same thing with those letters and stuff for our source name. 97 00:07:01,220 --> 00:07:03,470 So here, Val source name. 98 00:07:05,600 --> 00:07:13,970 Will be a mutable state flow, which I'm going to set by default to and gadget, which is one source. 99 00:07:14,270 --> 00:07:16,280 So there is the source code and gadget. 100 00:07:16,790 --> 00:07:26,270 And then I'm going to have a private vol get article by source here, which will also be mutable state 101 00:07:26,270 --> 00:07:36,440 flow, where I'm going to pass a top news response item or object, and then I'll get articles by source. 102 00:07:36,530 --> 00:07:44,630 So article by source, which will return, aced or will be of typed state flow. 103 00:07:46,850 --> 00:07:53,510 And specifically of type top news response, and we need to pass a or have a get here as well, which 104 00:07:53,510 --> 00:07:59,950 will be on the score, get article by source and I have a typo here, so let me get rid of that typo, 105 00:08:00,440 --> 00:08:01,760 then it should look a little better. 106 00:08:01,970 --> 00:08:07,370 So now we have the source name and then we have the article by source variables. 107 00:08:10,260 --> 00:08:13,920 Now we need to do the same thing for our query, so for the search feature, right? 108 00:08:13,920 --> 00:08:18,960 So we have this we're setting up the source and then at the same time, we're setting up the search 109 00:08:18,960 --> 00:08:20,010 feature here at the top. 110 00:08:20,280 --> 00:08:22,620 So this is part of the source stuff. 111 00:08:23,010 --> 00:08:25,950 And now we need to do the same thing for our search feature. 112 00:08:26,250 --> 00:08:34,110 So here we need to have a query, which will be also a mutable state flow, and I'm going to set the 113 00:08:34,110 --> 00:08:35,850 default value to be empty. 114 00:08:36,270 --> 00:08:38,039 So the search will be empty by default. 115 00:08:38,340 --> 00:08:41,760 And then we also need to have these getters and setters in the same fashion. 116 00:08:41,760 --> 00:08:43,890 We just need to change the name. 117 00:08:43,890 --> 00:08:55,080 So I'm going to call this one searched news response, and this one will be searching used response 118 00:08:55,440 --> 00:08:56,790 without an underscore. 119 00:08:56,940 --> 00:09:03,660 And we're going to get it with first searched news response so we could call it get search news response 120 00:09:03,660 --> 00:09:04,830 to be more precise here. 121 00:09:05,250 --> 00:09:07,860 And while the general idea will still be the same. 122 00:09:10,510 --> 00:09:14,500 All right, now, we need to create a method to launch, get articles by source. 123 00:09:15,070 --> 00:09:20,330 This one here and then set the response to its center. 124 00:09:20,470 --> 00:09:23,110 So to a visitor here. 125 00:09:23,980 --> 00:09:27,420 OK, so also in our main view model, let's go and create a function here. 126 00:09:27,430 --> 00:09:34,690 We see we have created a on selected category or changed function before, but now we need and get article 127 00:09:35,170 --> 00:09:39,520 by source or get articles by source, something like this. 128 00:09:39,700 --> 00:09:46,150 And then first of all, I'm going to set the highest loading to true again or to value the true, to 129 00:09:46,150 --> 00:09:46,840 be precise. 130 00:09:47,110 --> 00:09:49,820 So this will make sure that our educator. 131 00:09:49,990 --> 00:09:52,530 So our progress indicator will be displayed. 132 00:09:52,540 --> 00:09:56,660 And then we set up the view model scope to launch. 133 00:09:56,680 --> 00:10:00,640 So this will be the core routine where we just say, OK, well, want to run this on the dispatcher's? 134 00:10:00,640 --> 00:10:04,480 I o this, but sure start i o thread. 135 00:10:06,840 --> 00:10:08,470 And what do we want to launch? 136 00:10:08,490 --> 00:10:11,010 Well, our get article by source. 137 00:10:12,270 --> 00:10:20,700 The value going to set that to repository thought good articles by source. 138 00:10:22,140 --> 00:10:27,330 And here we need to pass to source, which we get from our source name, but value. 139 00:10:27,990 --> 00:10:28,650 So. 140 00:10:30,990 --> 00:10:32,700 There's variable up here. 141 00:10:34,030 --> 00:10:35,980 Which is going to be this miserable state flow. 142 00:10:37,290 --> 00:10:41,160 So by default, it will be Engadget and then we are going to set it. 143 00:10:42,030 --> 00:10:47,730 And obviously, we also need to make sure that we are overriding this value to false because then we 144 00:10:47,730 --> 00:10:52,830 are done with the loading of the source or the article by source. 145 00:10:54,130 --> 00:10:54,520 So now. 146 00:10:55,890 --> 00:11:02,460 We also need to set up the Get Searched Articles fund, get searched articles. 147 00:11:09,020 --> 00:11:13,610 Which I'm going to get by a query, which will be of type string. 148 00:11:16,020 --> 00:11:18,630 And then we also need to do the same thing. 149 00:11:18,870 --> 00:11:25,560 So we're going to set the value to wait and hear instead of setting the article by source, we're going 150 00:11:25,560 --> 00:11:32,790 to set the search and reduce response to call our get searched articles with the query. 151 00:11:33,030 --> 00:11:37,770 So not with the value here, but with the query that we're passing to the function. 152 00:11:38,010 --> 00:11:42,120 So whenever we call this function, we're going to pass the query into it and it's going to take care 153 00:11:42,120 --> 00:11:50,760 of all of this background stuff, like taking care of the call routine here, and it's going to set 154 00:11:50,760 --> 00:11:52,110 the value accordingly. 155 00:11:52,200 --> 00:11:57,630 And in between, while this thing happens because this is going to take a while, which can be half 156 00:11:57,630 --> 00:12:01,530 a second or so, it's going to display the. 157 00:12:02,790 --> 00:12:03,930 Progress dialogue again. 158 00:12:06,260 --> 00:12:13,160 All right, now, we can go over to our sources, and if we look at our sources class here at the top 159 00:12:13,160 --> 00:12:14,780 we were using. 160 00:12:16,350 --> 00:12:23,730 While we're in the bottom menu screen, I wanted to go to the sources close, so sources Katie. 161 00:12:27,030 --> 00:12:32,550 Here you will find that we were using a news manager, but now we want to always use our new model instead, 162 00:12:32,550 --> 00:12:32,880 right? 163 00:12:33,090 --> 00:12:39,110 So let's go ahead and use our view model instead of our news manager in here or pass it accordingly. 164 00:12:39,120 --> 00:12:44,700 Obviously, we will need to make a couple of changes here, so we need to now not use the news manager 165 00:12:44,700 --> 00:12:46,530 anymore, but our view model here. 166 00:12:46,710 --> 00:12:53,370 So if you model that source name and we're going to collect the state, so because we cannot just use 167 00:12:53,370 --> 00:13:00,300 the value we need to collect as a state and then we can get the value from it. 168 00:13:00,600 --> 00:13:02,520 And we're going to set that as the source. 169 00:13:03,680 --> 00:13:08,870 OK, and then accordingly, further down, we need to make sure that we are not using our new manager 170 00:13:09,080 --> 00:13:13,340 name value here, but our view model, that source name value. 171 00:13:14,120 --> 00:13:19,420 And then in our items here in the careful missy. 172 00:13:19,460 --> 00:13:22,400 So here when we're setting the title, yeah, we did that. 173 00:13:22,470 --> 00:13:23,270 OK, that's good. 174 00:13:23,810 --> 00:13:30,680 Then we need to go further down here in our sources, and that's in the scaffold still. 175 00:13:31,100 --> 00:13:33,080 But here in the IT padding values. 176 00:13:33,080 --> 00:13:38,480 So when we're getting the padding values here, we're going to use our view model instead. 177 00:13:38,570 --> 00:13:45,440 So here, view model, don't get articles by source and I think a called it article by source. 178 00:13:46,010 --> 00:13:49,400 And then the articles are going to come from the view model as well. 179 00:13:49,580 --> 00:13:56,360 So you see, we're really replacing our manager or our what was it news manager all the time with our 180 00:13:56,510 --> 00:13:57,690 new view model here. 181 00:13:58,100 --> 00:14:01,040 But again, we're collecting it as a state. 182 00:14:01,190 --> 00:14:05,750 So here collect as state, that value is what we need to do. 183 00:14:09,330 --> 00:14:11,070 OK, and in the search bar itself. 184 00:14:11,220 --> 00:14:15,290 So search bar and the search bar. 185 00:14:15,300 --> 00:14:18,180 Katy File, that should be it here. 186 00:14:18,330 --> 00:14:19,950 We also need to make a change. 187 00:14:20,820 --> 00:14:26,430 So our news manager that we used before will need to be replaced with a view model again. 188 00:14:27,060 --> 00:14:31,400 So you model and once we do that, we should get a couple of arrows here. 189 00:14:31,410 --> 00:14:37,590 So one this year at the bottom where we are checking the query and then we're calling the news managers 190 00:14:37,890 --> 00:14:39,110 get searched articles. 191 00:14:39,120 --> 00:14:45,540 Instead, we're going to use to view models, get search articles and view model that gets searched 192 00:14:45,540 --> 00:14:49,260 articles and at the bottom here in our. 193 00:14:51,540 --> 00:14:57,450 Point while here we just need to pass our review model object, we could just pass an empty view model 194 00:14:57,450 --> 00:14:59,190 object and import its. 195 00:15:02,700 --> 00:15:10,170 For now, in our top news file, we get an error, right, because here when we're using the search 196 00:15:10,170 --> 00:15:11,940 bar, we're passing a news manager, right? 197 00:15:12,330 --> 00:15:15,870 But instead, what we need to do is we need to pass our view model here as well. 198 00:15:16,320 --> 00:15:22,230 So instead of using the use manager, we're going to entirely get rid of it and replace it with our 199 00:15:22,230 --> 00:15:27,360 main view model, main or view model as I'm going to call it, and pass that instead. 200 00:15:27,810 --> 00:15:29,670 So now let's pass that to our. 201 00:15:30,650 --> 00:15:34,790 Search bar, and we couldn't be more specific and say the view model should be the view model if you 202 00:15:34,790 --> 00:15:38,780 want to really make sure that you are using the named parameters correctly. 203 00:15:39,070 --> 00:15:46,760 And then if search text here is not empty, then we want to use our view model that search news, response 204 00:15:46,760 --> 00:15:53,600 value and the value itself is going to get what we're going to get that through collecting it as a state 205 00:15:54,140 --> 00:15:54,620 again. 206 00:15:55,160 --> 00:16:01,190 So collect as a state which collects the values from the state flow and represents its value by US state. 207 00:16:01,730 --> 00:16:01,970 Okay. 208 00:16:01,970 --> 00:16:06,470 So before it was a state, but we are using a flow state, right? 209 00:16:06,470 --> 00:16:09,740 So we need to collect the flows state as a state. 210 00:16:10,220 --> 00:16:13,700 So that's why we're using this collect as a state, which we have done before, right? 211 00:16:14,690 --> 00:16:17,300 So that will be our top news. 212 00:16:20,550 --> 00:16:23,550 Now we need to go over to our news app. 213 00:16:24,900 --> 00:16:27,630 And then we should see some errors as well. 214 00:16:27,660 --> 00:16:32,790 So here at the very bottom, you will find some errors because our composable thought that the top news 215 00:16:32,790 --> 00:16:35,670 clause would get a news manager and we overrode that right. 216 00:16:35,700 --> 00:16:37,890 So here we need to use our view model instead. 217 00:16:38,340 --> 00:16:41,610 So you model will be of type main view model. 218 00:16:42,660 --> 00:16:50,490 And actually, let me see the graph builder already uses that, so let's not screw you, create a new 219 00:16:50,490 --> 00:16:52,920 view model, but actually passed the one that we are getting. 220 00:16:53,430 --> 00:16:54,660 All right, that should be fine now. 221 00:16:55,260 --> 00:17:00,600 So we're passing the new model that we're passing to the bottom navigation to be used for our top news 222 00:17:00,600 --> 00:17:03,930 screen, as well as for our source of screen. 223 00:17:05,569 --> 00:17:09,440 So here, let's not pass a. 224 00:17:11,630 --> 00:17:16,780 Thingy, a news manager, but the view model, because if we look at our sources, you see it needs 225 00:17:16,790 --> 00:17:17,630 a view model now. 226 00:17:20,980 --> 00:17:27,800 All right, and now we need to go over to our news app and make a couple of changes here, so the first 227 00:17:27,800 --> 00:17:31,220 one will be in our index, let here. 228 00:17:31,760 --> 00:17:34,610 I'm still checking if news a query value. 229 00:17:34,940 --> 00:17:38,660 So here what we need to do is we need to get the value from the query state. 230 00:17:39,170 --> 00:17:41,120 So here query state. 231 00:17:41,900 --> 00:17:43,790 So what will this query state be? 232 00:17:44,510 --> 00:17:50,690 So the query state will be a variable that I want to use, and this variable will be existing inside 233 00:17:50,690 --> 00:17:58,400 of our navigation, specifically in the nav hose to me, see, instead of this nav host here. 234 00:17:58,970 --> 00:18:01,910 So I'm going to create this. 235 00:18:02,500 --> 00:18:06,320 Think it should be in the curly brackets? 236 00:18:06,320 --> 00:18:06,760 Yes. 237 00:18:06,770 --> 00:18:13,580 So up here before I used in button navigation, I want to create a variable that will hold the query 238 00:18:13,580 --> 00:18:14,000 state. 239 00:18:14,480 --> 00:18:19,700 So the query state will just be the state of whatever is the current query. 240 00:18:19,700 --> 00:18:25,850 So whatever we're currently searching for and this will be a mutable state off and it's going to get 241 00:18:25,850 --> 00:18:27,310 it from our view model. 242 00:18:27,350 --> 00:18:30,590 So the default value will be you model that query the value. 243 00:18:32,360 --> 00:18:38,750 Came at to import midtable, stayed off here for this to work, so now it can use to query state here 244 00:18:39,230 --> 00:18:45,040 and we're going to get the career state value and we're going to check if it's not empty. 245 00:18:45,050 --> 00:18:47,120 So this is one way of checking if it's not empty. 246 00:18:47,120 --> 00:18:49,790 The other way would be to check if it's not an empty string. 247 00:18:49,790 --> 00:18:54,860 So I would like to check if it's not an empty string because it could be empty, but this could not 248 00:18:54,860 --> 00:18:56,480 be empty, but still an empty string or so. 249 00:18:56,480 --> 00:18:59,030 So I'm really making sure that it's not just an empty string. 250 00:18:59,780 --> 00:19:05,230 And if that's the case, then we're clearing the articles and then here, instead of using the news 251 00:19:05,240 --> 00:19:09,740 manager that search and use response, we need to use our new model here as well. 252 00:19:10,490 --> 00:19:10,940 All right. 253 00:19:11,120 --> 00:19:13,010 So at this point? 254 00:19:14,940 --> 00:19:22,600 Let me see here at the bottom in top news, I also need to make sure that I am passing the view model. 255 00:19:22,620 --> 00:19:24,270 Yes, I think we set that up, right? 256 00:19:24,450 --> 00:19:28,020 So here we're passing the wall here. 257 00:19:28,020 --> 00:19:30,070 I don't want to pass in the news. 258 00:19:30,960 --> 00:19:32,400 Manage a query. 259 00:19:34,060 --> 00:19:40,960 But the query, which I'm going to set up inside of my bottom navigation, so we're not using the news 260 00:19:40,960 --> 00:19:47,440 manager anymore, is you see instead what I want to use is going to be the query, which will be a mutable 261 00:19:48,040 --> 00:19:48,520 state. 262 00:19:50,170 --> 00:19:50,890 Of type string. 263 00:19:52,180 --> 00:19:58,240 OK, and we need to import mutable state here and use that query now for our top news, because if we 264 00:19:58,240 --> 00:20:05,380 look at our top news, it needs a query of two type mutable state that can then use to set that as the 265 00:20:05,740 --> 00:20:11,770 search text and check the search text and add all of the searches that we have. 266 00:20:12,400 --> 00:20:14,470 Now let me see here in my news app. 267 00:20:15,720 --> 00:20:21,210 I need you obviously need to make a change to this news manager because I'm not using the news manager 268 00:20:21,510 --> 00:20:28,130 at this point anymore, but instead I want to pass the query here. 269 00:20:28,140 --> 00:20:34,710 So the query will be our query state that we just set up here. 270 00:20:35,010 --> 00:20:43,890 So this query state and I'm passing it in here and then I can use it and it will be passed down to our 271 00:20:44,190 --> 00:20:45,870 composable where they need it. 272 00:20:46,080 --> 00:20:51,360 And here for our bottom navigation or didn't have graph builder. 273 00:20:52,920 --> 00:20:59,220 And then one final thing that I only realized after testing it is that in some of our sources, we are 274 00:20:59,220 --> 00:21:05,440 setting the view model source name value, but we are not getting the articles by source. 275 00:21:05,460 --> 00:21:14,430 So here what I should do is I should use view model dot, get article by source and then I should be 276 00:21:14,550 --> 00:21:14,910 good. 277 00:21:15,720 --> 00:21:21,410 So let's run our application and see if it's going to work so that we are. 278 00:21:21,420 --> 00:21:22,820 Let's click on this dog. 279 00:21:22,830 --> 00:21:23,250 OK? 280 00:21:23,280 --> 00:21:24,240 That seems to work. 281 00:21:24,480 --> 00:21:24,960 Let's click on. 282 00:21:24,960 --> 00:21:26,640 This one seems to work. 283 00:21:27,030 --> 00:21:30,930 So let's search for what this one looks a little more positive. 284 00:21:30,930 --> 00:21:32,280 So let's search for Apple. 285 00:21:32,790 --> 00:21:34,950 So let's look at Apple News specifically. 286 00:21:35,040 --> 00:21:38,400 I'm going to search for Apple and then Apple quietly. 287 00:21:38,400 --> 00:21:39,480 This continues. 288 00:21:39,510 --> 00:21:40,680 All right, then. 289 00:21:41,160 --> 00:21:43,160 Pentagon set up a year office. 290 00:21:43,170 --> 00:21:43,710 That's nice. 291 00:21:43,710 --> 00:21:45,180 Apple, fixed mobile and so forth. 292 00:21:45,510 --> 00:21:47,040 So now we have a bunch of Apple news. 293 00:21:47,280 --> 00:21:48,570 Let's look at the sources. 294 00:21:48,720 --> 00:21:49,950 So weird and gadget. 295 00:21:49,980 --> 00:21:55,640 Now let's change that to talkSPORT Sport, and you could see it displays the different news. 296 00:21:55,650 --> 00:21:57,960 Politico doesn't seem to have very nice news. 297 00:21:58,410 --> 00:22:00,870 Business Insider source still works flawlessly. 298 00:22:01,050 --> 00:22:03,920 And then a problem that we have with our categories. 299 00:22:03,990 --> 00:22:07,590 So if we look at our categories, they're not changing, right? 300 00:22:07,710 --> 00:22:13,580 And that has to do with us just using state and nuts or a state flow and not using the state. 301 00:22:13,590 --> 00:22:20,220 So here in sort of our categories, when we have a category tab selected, we are using our View Model 302 00:22:20,400 --> 00:22:21,510 Select category. 303 00:22:21,720 --> 00:22:27,540 But here we are, just calling the value or getting the value without before that collecting it as a 304 00:22:27,540 --> 00:22:27,990 state. 305 00:22:28,140 --> 00:22:34,290 So now we need to do that here, collecting that as a state as well as the article content itself here. 306 00:22:34,680 --> 00:22:36,570 We also need to collect it as state. 307 00:22:37,740 --> 00:22:38,100 All right. 308 00:22:38,100 --> 00:22:40,980 And then check if we need to collect it a state anywhere else. 309 00:22:42,190 --> 00:22:44,800 Actually, I think that should be that should be good. 310 00:22:45,130 --> 00:22:51,520 So let's test this again and now let's see if our categories are going to work as intended as well. 311 00:22:51,640 --> 00:22:53,350 So we're going to go over to categories. 312 00:22:53,350 --> 00:22:55,330 And yes, it seems like it's working. 313 00:22:56,650 --> 00:22:57,070 All right. 314 00:22:57,400 --> 00:23:00,670 So, you know, our application is back at working flawlessly.