1
00:00:00,500 --> 00:00:01,250
Welcome back.

2
00:00:01,580 --> 00:00:06,890
At this time, we can go ahead and prepare everything that we need for the board to work.

3
00:00:06,900 --> 00:00:14,120
So the idea is that we have a data model which allows us to create boards and we can then use that data

4
00:00:14,120 --> 00:00:16,970
model to store the boards in the cloud.

5
00:00:16,970 --> 00:00:18,530
And that's exactly what we want to do.

6
00:00:18,530 --> 00:00:18,770
Right.

7
00:00:18,780 --> 00:00:22,560
So we need to know the details about the board.

8
00:00:22,850 --> 00:00:25,090
So I think let's just get started with it.

9
00:00:25,100 --> 00:00:31,700
You can post a video and think about what would be the things that have to be in such a project board,

10
00:00:31,700 --> 00:00:32,390
so to speak.

11
00:00:32,670 --> 00:00:39,470
OK, so if we look at this here, what we can see, it has an image, it has a board name.

12
00:00:39,800 --> 00:00:46,610
And then what else would we want to display about the board or know about the board in the backend?

13
00:00:48,320 --> 00:00:54,020
All right, so I'm going to tell you what we will start with, it's not everything that we will do for

14
00:00:54,050 --> 00:00:59,930
board later on, but I think it makes sense to start with a name for the board, then with an image

15
00:01:00,230 --> 00:01:04,129
or at least a string for the image or the your eye to link, so to speak.

16
00:01:04,519 --> 00:01:07,490
And then we need to know who created the board.

17
00:01:08,090 --> 00:01:12,410
And then we also would want to know who is assigned to the board.

18
00:01:12,440 --> 00:01:16,090
So this would be the information that we need to know for now.

19
00:01:16,640 --> 00:01:22,940
Later on, we also potentially want to store the information about the different cars that are in the

20
00:01:22,940 --> 00:01:24,440
board and all those kind of things.

21
00:01:24,470 --> 00:01:27,630
So let's get started with a basic model first, though.

22
00:01:28,100 --> 00:01:28,460
All right.

23
00:01:28,470 --> 00:01:33,530
So therefore, I'm going to create a new class in here in the models.

24
00:01:34,460 --> 00:01:40,550
So create New Cutline file class and I'm going to call this one board.

25
00:01:41,830 --> 00:01:49,410
All right, so this board is going to have or it's going to be a data class, so we keep it super simple.

26
00:01:50,140 --> 00:01:52,630
We don't need to have any additional information in there.

27
00:01:52,630 --> 00:01:52,930
Right.

28
00:01:52,930 --> 00:01:59,320
So let's make it the data class, no functions or anything, just the basic data, and we will make

29
00:01:59,320 --> 00:02:00,860
it past a little bit later on.

30
00:02:01,480 --> 00:02:12,130
So what we need is, as I said, the name, which will be a string, then we need the image, which

31
00:02:12,130 --> 00:02:13,240
will also be a string.

32
00:02:15,460 --> 00:02:19,900
And by the way, we need to separate them with a comma, of course, because that's as if it was in

33
00:02:19,900 --> 00:02:24,640
the one line, then I want to know who created it.

34
00:02:24,880 --> 00:02:27,580
So created by which will also be a string.

35
00:02:27,580 --> 00:02:31,330
And this should be the unique user ID or the user name we will see later on.

36
00:02:31,930 --> 00:02:40,990
And then we need to know who is assigned to so assigned to array a list of strings, because now it

37
00:02:40,990 --> 00:02:42,220
could be multiple people.

38
00:02:42,220 --> 00:02:44,290
So it needs to be an array list.

39
00:02:45,090 --> 00:02:45,460
All right.

40
00:02:45,470 --> 00:02:50,740
So I'm going to say that it's an empty array list for now.

41
00:02:51,670 --> 00:02:52,030
All right.

42
00:02:52,060 --> 00:02:53,950
Now, let's make it passable.

43
00:02:54,640 --> 00:02:57,280
So far, so lovable.

44
00:02:57,530 --> 00:02:59,140
And we need the colon here.

45
00:03:00,370 --> 00:03:07,360
And of course, it's with a capital P here, once we have that, we can import parts of the book and

46
00:03:07,360 --> 00:03:09,450
then we need to make adjustments here.

47
00:03:09,460 --> 00:03:11,800
So add harvestable implementation.

48
00:03:11,800 --> 00:03:15,610
So it adds the constructor right to pozole creator and everything.

49
00:03:18,790 --> 00:03:30,640
And here we need to add Passell, not create string radost just like that.

50
00:03:32,350 --> 00:03:38,950
Also, we still need to make some changes here, so I'm just going to say it should directly return

51
00:03:38,950 --> 00:03:39,340
zero.

52
00:03:39,370 --> 00:03:41,770
Well, that's a fine way to do that, actually.

53
00:03:46,370 --> 00:03:53,370
Right to Passell is lacking one thing, so it's still missing our list here.

54
00:03:53,930 --> 00:03:57,470
So right string list.

55
00:03:58,520 --> 00:04:00,740
With our assigned to.

56
00:04:01,730 --> 00:04:06,560
I'm going to say that it should to do with the parcel.

57
00:04:08,340 --> 00:04:09,330
All of those things.

58
00:04:09,870 --> 00:04:15,930
All right, so then the arrow disappears and things seem to work, but here a parcel of red string.

59
00:04:16,110 --> 00:04:20,519
Well, we can also say Passell, that red string list here.

60
00:04:23,110 --> 00:04:30,340
And then here we need to force it here with a bunch of exclamation marks.

61
00:04:31,030 --> 00:04:32,920
OK, so this is going to be our board.

62
00:04:34,780 --> 00:04:42,880
And we need to do that, by the way, because restring is at Nullable, so you can see it returns a

63
00:04:42,880 --> 00:04:47,140
nullable, so a variable that could potentially be null.

64
00:04:47,290 --> 00:04:52,910
And I cannot pass a null to control constructor because it always expect something.

65
00:04:52,930 --> 00:04:55,570
That's why we need to use exclamation marks here.

66
00:04:56,830 --> 00:05:02,590
OK, so that was step number one, our board is prepared now, we will have to adjust accordingly if

67
00:05:02,590 --> 00:05:07,120
we ever want to store more information about the board, but for now, it's going to be fine.

68
00:05:07,150 --> 00:05:09,040
Now, let's go over to the main activity.

69
00:05:09,310 --> 00:05:18,010
And here I want to create a new variable, which will be a light in it variable, and it will store

70
00:05:18,010 --> 00:05:19,210
the user name in here.

71
00:05:21,630 --> 00:05:29,050
And where I'm going to set the username is in our update, navigation user details.

72
00:05:29,070 --> 00:05:29,970
So here.

73
00:05:31,470 --> 00:05:38,380
I'm going to set up a user name is user dot name.

74
00:05:38,400 --> 00:05:39,120
Why is that?

75
00:05:39,390 --> 00:05:41,720
Well, the thing is, at that point, we get the user name.

76
00:05:42,000 --> 00:05:51,150
So as you might have already noticed, we put all of our database relevant code directly into our Floribert

77
00:05:51,330 --> 00:05:58,320
Firebase class or Firestar class here, because if Firestar, for whatever reason, shouldn't work in

78
00:05:58,320 --> 00:06:03,930
the future anymore, we want to just replace the class and do all of the stuff that the class does instead

79
00:06:03,930 --> 00:06:05,360
of having to replace everything.

80
00:06:05,730 --> 00:06:13,140
And that's why we create functions which are not directly related to Firebase in here, where we're

81
00:06:13,140 --> 00:06:19,290
not dependent on Firebase, but we are just depending dependent on a specific variable.

82
00:06:19,290 --> 00:06:19,560
Right.

83
00:06:19,770 --> 00:06:25,680
So here we're just waiting for a user object that is passed to us so that we can then get the name from

84
00:06:25,680 --> 00:06:29,100
the object and stored in our variable username.

85
00:06:30,570 --> 00:06:37,230
Now, at that point, we can pass in the user name to the create board screen, so here when we click

86
00:06:37,230 --> 00:06:42,270
on the five create board on UNCLICK, that is where we start the activity.

87
00:06:42,270 --> 00:06:42,530
Right.

88
00:06:42,840 --> 00:06:47,340
And it would make sense to send some more information with this intent.

89
00:06:47,370 --> 00:06:54,510
So what we're going to do is we are going to create a new intent here, VUL intent, and then we will

90
00:06:54,540 --> 00:06:55,950
add something to the intent.

91
00:06:56,010 --> 00:06:58,000
So intent put extra.

92
00:06:58,590 --> 00:07:04,110
And here I'm just going to say at the position of name, so constants

93
00:07:06,510 --> 00:07:11,910
name and it's this one here I want to pass in the username.

94
00:07:12,480 --> 00:07:14,100
So my user name.

95
00:07:15,530 --> 00:07:18,830
All right, so then start activity.

96
00:07:19,760 --> 00:07:26,750
With the new intent that we prepared, so why can we do that, why can we already pass in the user here?

97
00:07:26,750 --> 00:07:29,770
Because uncreate the thing that is called first, right?

98
00:07:30,260 --> 00:07:36,920
Well, what is also called is Firestar class load user data and load user data is called.

99
00:07:38,090 --> 00:07:44,650
And inside of here, our update navigation user details is called in, which we set the username.

100
00:07:44,960 --> 00:07:52,460
So basically in our uncreate, this line of code is executed before this one, which means that the

101
00:07:53,570 --> 00:07:59,780
load user data function is called inside of our store, which then calls, of course, does update navigation

102
00:07:59,780 --> 00:08:01,700
user details in which the user name is set.

103
00:08:01,700 --> 00:08:09,740
And then we have the user name prepared and ready for our set on Click Listener with our fap button.

104
00:08:09,920 --> 00:08:12,080
So our floating action button.

105
00:08:14,130 --> 00:08:20,820
Now that we sent over the name, let's also retrieve the name, and that is an hour create board activity,

106
00:08:20,820 --> 00:08:23,370
so let's go ahead and catch it here.

107
00:08:23,820 --> 00:08:31,950
First of all, we need a late and it avar, which will be my M username type string.

108
00:08:33,490 --> 00:08:34,150
And then.

109
00:08:35,570 --> 00:08:44,090
We can catch it in our set in our uncreate, actually, so here after the set up action bar, if intent

110
00:08:44,600 --> 00:08:49,610
has extra details for the constant thought name.

111
00:08:51,520 --> 00:08:57,760
Then do something and in this case, just assign to username, so set the username that we prepared

112
00:08:57,760 --> 00:09:05,620
up there, which will be intent, get a string extra at the position constants that name.

113
00:09:08,140 --> 00:09:12,790
So now we sent over the username to the create board activity and we have it here.

114
00:09:14,640 --> 00:09:22,860
This way, we don't have to get the username here again and have another database request, because

115
00:09:22,860 --> 00:09:26,580
what we try to do is to have as few requests as possible.

116
00:09:28,400 --> 00:09:36,800
All right, so now that we use the boards, let's also go to our consultants and add a new name for

117
00:09:36,800 --> 00:09:38,230
the boards here as well.

118
00:09:38,240 --> 00:09:39,470
So we have users.

119
00:09:40,130 --> 00:09:42,860
This is our collection of users.

120
00:09:43,130 --> 00:09:44,600
And now let's create.

121
00:09:45,910 --> 00:09:54,190
The same for our collection of boards, contact wall boards will be a string called boards.

122
00:09:56,130 --> 00:09:57,900
So now if we create a collection.

123
00:09:58,830 --> 00:10:04,050
Here in our database, it will be the sports correction, so here will be called Bortz.

124
00:10:04,350 --> 00:10:10,680
OK, but we don't need to do it here in our firebase interface, but we will do that in the code itself.

125
00:10:12,140 --> 00:10:20,540
So let's move over to our create board activity and let's also create a function here which will let

126
00:10:20,540 --> 00:10:29,840
us know that the board was created successfully, so fun board created successfully, and it will pretty

127
00:10:29,840 --> 00:10:31,130
much be the same.

128
00:10:32,770 --> 00:10:40,930
Information here as our user created successfully so height progress bar and that, well, of course

129
00:10:40,930 --> 00:10:42,520
only work if our.

130
00:10:43,730 --> 00:10:50,360
Create activity is inheriting from our basic activity or base activity.

131
00:10:50,390 --> 00:10:51,450
Yeah, that was the one.

132
00:10:52,100 --> 00:11:00,050
Now we can go ahead and use to highlight progress, dialogue and then we can call finish so we close

133
00:11:00,050 --> 00:11:01,000
this activity.

134
00:11:03,170 --> 00:11:11,660
OK, so this was a little prediction or preparation, so to speak, for the actual creation of the board.

135
00:11:12,170 --> 00:11:12,710
All right.

136
00:11:12,710 --> 00:11:15,320
And now at that point, we can go ahead and create the board.

137
00:11:15,570 --> 00:11:16,790
And where would we do that?

138
00:11:17,450 --> 00:11:22,450
Well, the creation of the board, of course, we would think it's in the create board activity.

139
00:11:22,700 --> 00:11:28,670
But as I said, I try to put everything that has to do with the data by base connections and creating

140
00:11:29,210 --> 00:11:32,950
database entries and updating them in the faster class.

141
00:11:33,220 --> 00:11:37,580
So here we created one where we loaded the user.

142
00:11:37,610 --> 00:11:39,830
So this is how we get the information.

143
00:11:39,830 --> 00:11:42,110
But then we also had one where we created the user.

144
00:11:42,110 --> 00:11:42,470
Right.

145
00:11:43,080 --> 00:11:45,100
So here, document update.

146
00:11:45,110 --> 00:11:46,310
Well, that's updating.

147
00:11:46,310 --> 00:11:47,660
And this is registered user.

148
00:11:47,690 --> 00:11:49,350
This is where we created the user.

149
00:11:49,700 --> 00:11:52,900
So now we're going to create a function which is going to be very similar.

150
00:11:53,300 --> 00:11:55,640
So you can see we need an activity here.

151
00:11:55,640 --> 00:12:00,140
In this case, it was to sign up activity, but we're going to use to create board activity, of course,

152
00:12:00,470 --> 00:12:05,240
then we don't want to have a user but the board then we don't want to use constant users.

153
00:12:05,240 --> 00:12:10,970
But Constance boards, we still want to create a document, but not with the current user I.D. Then

154
00:12:10,970 --> 00:12:13,750
we want to set it and have at Unsuccess listen.

155
00:12:13,820 --> 00:12:15,910
So let's go ahead and just build that code.

156
00:12:16,340 --> 00:12:17,760
So it's going to be very similar.

157
00:12:17,930 --> 00:12:26,480
So create a board which will need an activity which will be of type, create board activity, and then

158
00:12:26,480 --> 00:12:29,240
we need to have a board which will be of type board.

159
00:12:30,650 --> 00:12:31,210
All right.

160
00:12:31,220 --> 00:12:35,710
So then we can now go ahead and use that same approach and focus to a collection.

161
00:12:35,720 --> 00:12:38,190
So let's do that and faster.

162
00:12:38,330 --> 00:12:39,920
And by the way, we need to import board.

163
00:12:40,430 --> 00:12:46,040
So Empire Store Collection, we pass in constants dot boards.

164
00:12:46,040 --> 00:12:50,970
So we are going to give this collection a name and it's going to be Bortz.

165
00:12:51,260 --> 00:12:51,730
All right.

166
00:12:52,280 --> 00:12:52,820
So then.

167
00:12:55,320 --> 00:12:58,530
We can now go ahead and add a document.

168
00:12:59,850 --> 00:13:05,160
Which I'm not going to give any further details here, so it's going to generate a document for me with

169
00:13:05,160 --> 00:13:13,300
random numbers and values or just a random ID, so to speak, and then I want to set it.

170
00:13:13,320 --> 00:13:20,180
So I want to set a board with the set options so you can see data, any any type of data.

171
00:13:20,190 --> 00:13:27,060
In our case, it's going to be a board object that I pass into the database and then we can add the

172
00:13:27,060 --> 00:13:30,150
set options and I want to merge the data.

173
00:13:30,690 --> 00:13:34,220
OK, so there are multiple different options here.

174
00:13:34,620 --> 00:13:38,190
What I'm saying is merge the data if they already exist.

175
00:13:38,190 --> 00:13:40,110
So don't overwrite directly, but merge.

176
00:13:40,710 --> 00:13:43,250
So then I have an add on success.

177
00:13:43,260 --> 00:13:51,840
A listener here in which I of course want to run some code, which is going to be for now a log entry

178
00:13:52,200 --> 00:13:54,300
and a make text.

179
00:13:54,450 --> 00:14:01,170
So here we created successfully is what I want to write there and then.

180
00:14:02,890 --> 00:14:10,780
On top of that, I would also like to run activity that board created successfully, which is going

181
00:14:10,780 --> 00:14:15,280
to be this function here, which is just going to highlight the progress bar at which we'll finish it.

182
00:14:16,520 --> 00:14:20,520
OK, so that is the creation of the board if it worked.

183
00:14:20,540 --> 00:14:22,340
So what shall we do if it failed?

184
00:14:22,460 --> 00:14:26,360
So we had an on failure listener here as well.

185
00:14:26,960 --> 00:14:28,940
So we need the debt here.

186
00:14:28,970 --> 00:14:32,520
Add on failure listener.

187
00:14:33,620 --> 00:14:36,080
Now, here we get an exception.

188
00:14:37,880 --> 00:14:42,730
And what we want to do with the exception, is our decision.

189
00:14:42,740 --> 00:14:45,080
So first of all, I'm going to.

190
00:14:46,110 --> 00:14:54,710
Run, hide, progress, dialogue for that activity, and then I'm going to add an entry for the Lochhead,

191
00:14:55,650 --> 00:15:03,300
so log an error saying error while creating a board and here it's called exception.

192
00:15:04,610 --> 00:15:09,140
So then we know at least what the information is, what the area is about and everything.

193
00:15:11,290 --> 00:15:14,860
OK, so this was just the preparation of creating the board.

194
00:15:16,230 --> 00:15:22,110
The actual testing of that is what we will do in the next video, because we are getting to the point

195
00:15:22,290 --> 00:15:30,300
where the individual versions of finally seeing something new, finally testing something, are getting

196
00:15:30,300 --> 00:15:37,140
bigger and bigger or a code that we need or the steps that we need in order to achieve something visible

197
00:15:37,140 --> 00:15:39,660
in the database are getting longer and longer.

198
00:15:39,690 --> 00:15:46,020
So I need to have multiple videos and to the point where we actually finally see something.

199
00:15:46,290 --> 00:15:53,100
OK, so I'm sorry for that, but otherwise I would have to create 30 to 40 minute video sometimes because

200
00:15:53,100 --> 00:15:54,030
this is advanced stuff.

201
00:15:54,030 --> 00:15:54,350
Right?

202
00:15:54,360 --> 00:15:58,230
So we would need to do all of that in one video.

203
00:15:58,240 --> 00:16:01,210
And I think it just makes sense to have these little breaks in between.

204
00:16:01,470 --> 00:16:03,090
So see you in the next video.

