Mark M. | has entered the room |
Mark M. | turned on guest access |
May 22 | 9:00 AM |
Benny | has entered the room |
Mark M. |
hello, Benny!
|
Mark M. |
how can I help you today?
|
Benny |
Hi Mark, how are you?
|
Mark M. |
OK, and you?
|
May 22 | 9:05 AM |
Benny |
I am fine thank you
|
Benny |
I am working FCM on a project now
|
Benny |
what would you use to put changes to the activity form the FirebaseMessagingService, is a localBroadcast a good way?
|
Mark M. |
that can work
|
Mark M. |
what do the FCM messages contain?
|
Benny |
only 2 key value pairs like userName and userId
|
Mark M. |
why are you sending those in an FCM message? is this to trigger your app to make a Web service request to get more data?
|
Benny |
this is actually only a little example app, I just want to update the UI via FCM
|
May 22 | 9:10 AM |
Benny |
but in the future it should also make a request to a Web service, yes
|
Mark M. |
then, if you wanted to use LocalBroadcastManager now, that is OK
|
Mark M. |
eventually, you will want to use WorkManager or JobIntentService to arrange for your Web service request
|
Benny |
okay, this sounds good
|
Benny |
I will do this
|
Benny |
I have one more question about the app architecture
|
Benny |
I will start with a new App soon, what do you think is the best design pattern for now, MVVM?
|
Mark M. |
I cannot really answer that
|
Mark M. |
I prefer MVI, but that is definitely a personal preference
|
Benny |
I thought so :-)
|
Mark M. |
I cannot claim any particular UI pattern is "best"
|
May 22 | 9:15 AM |
Benny |
ok, so I just should compare them in deep and find out what would works good for me
|
May 22 | 9:15 AM |
Benny |
I only used MVP before
|
Mark M. |
if you are the only developer on the project, yes, for whatever level of "in deep" you want
|
Mark M. |
basically, if you are the only developer, so long as you are happy with your choice, you are fine
|
Benny |
I also have a main iOS developer in my team which will also work on this app for time to time
|
Mark M. |
just make sure that this other developer understands how you are setting up the architecture
|
Benny |
ok, thank you :-)
|
Mark M. |
in other words, worry less about what the architecture is and worry more about explaining that architecture to those who need to understand it
|
Benny |
I think I will start with the android Arch eBook
|
Benny |
yes, this is a good point
|
Mark M. |
note that my "Android's Architecture Components" book talks a bit about GUI architectures, but not a lot, as I do not claim to be an expert in that subject
|
Mark M. |
and it is also a first-generation book (Java and Support Library instead of Kotlin and AndroidX)
|
Benny |
ah, okay I understand
|
May 22 | 9:20 AM |
Benny |
do you have plans for an update?
|
Mark M. |
some of the material from it will be updated and included in *Elements of Android Jetpack*
|
Mark M. |
some of that is there now, more will be added in the next 4-6 weeks
|
Mark M. |
other topics from it may get updated in other books, such as a short book focused on Room
|
Benny |
okay, thank you
|
Benny |
do you cover MVI or MVVM in a book?
|
Mark M. |
the app that is being built in *Exploring Android* uses MVI
|
Mark M. |
or, at least, it uses my particular flavor of MVI
|
Benny |
okay, great, I will check that as a example for me
|
Mark M. |
MVI, like MVVM, are "blurry" UI patterns, with lots of variation
|
May 22 | 9:25 AM |
Benny |
Well I think this is it for me today :) thank you for your help
|
Mark M. |
you're welcome!
|
Benny |
see you soon, good bye
|
Benny | has left the room |
trocchietto_Ivano | has entered the room |
Mark M. |
hello, Ivano!
|
Mark M. |
how can I help you today?
|
May 22 | 9:30 AM |
trocchietto_Ivano |
Hallo Mark
|
trocchietto_Ivano |
I just come by, that yesterday I have been a bit in commons ware forum, so I remembered the chat, no specific questions
|
Mark M. |
OK, if you have a question, ask away!
|
trocchietto_Ivano |
mmh apart a really subtle meta-question
|
trocchietto_Ivano |
I noticed you use a backend Kotlin tool httpsomething
|
Mark M. |
http4k
|
trocchietto_Ivano |
yes and I am moderately curious to know if you do not believe in Ktor
|
trocchietto_Ivano |
is what the cool guys like now with Kotlin backend
|
Mark M. |
when I made my evaluation, I looked at Ktor and liked http4k a bit better
|
May 22 | 9:35 AM |
Mark M. |
I forget the reasoning, as this was a year or so ago
|
trocchietto_Ivano |
I see, Ktor was not so popular like today
|
trocchietto_Ivano |
thank you, I wait for somebody to come in the chat
|
Mark M. |
Benny was here earlier but left shortly before you joined
|
trocchietto_Ivano |
OK, 26 minutes of hope then
|
May 22 | 9:40 AM |
trocchietto_Ivano |
hey Mark I have a small question actually
|
Mark M. |
go ahead!
|
trocchietto_Ivano |
well I have this
|
May 22 | 9:45 AM |
trocchietto_Ivano |
View paste
|
trocchietto_Ivano |
is inside a viewModel
|
trocchietto_Ivano |
I need to filter a list before is threw inside an Adpter parameter
|
trocchietto_Ivano |
thrown*
|
Mark M. |
I do not understand what that onEach() is doing, as it does not look like it is doing anything
|
trocchietto_Ivano |
but this snippet does not work, does not filter at all the list
|
trocchietto_Ivano |
yes, is what my senior said
|
trocchietto_Ivano |
I want that takes the list inside listof
|
trocchietto_Ivano |
and check the two "null". and "null - null" conditions
|
trocchietto_Ivano |
so instead to receive back 10 items, I am expecting 7 of them
|
trocchietto_Ivano |
how can I filter this List<InvoiceSections> ?
|
trocchietto_Ivano |
where the interrogation mark is not made to make a joke
|
Mark M. |
is listSection a property of an InvoiceSection?
|
May 22 | 9:50 AM |
trocchietto_Ivano |
View paste
|
trocchietto_Ivano |
sorry
|
trocchietto_Ivano | |
trocchietto_Ivano |
list Section is a member of the interface indeed
|
Mark M. |
"so instead to receive back 10 items, I am expecting 7 of them" -- you have only 3, though
|
Mark M. |
invoiceDetailSectionsList is a List<InvoiceSections>, not a List<InvoiceItem>
|
trocchietto_Ivano |
ah
|
Mark M. |
where are the 7 or 10 items? are those sizes of the possible List<InvoiceItem> in an InvoiceSection?
|
trocchietto_Ivano |
yes they are
|
trocchietto_Ivano |
I have an adapter nested inside another adapter
|
trocchietto_Ivano |
so I used this modelization
|
Mark M. |
are you looking to change the actual contents of the InvoiceSection's list, or are you looking to filter just for the adapter?
|
trocchietto_Ivano |
just filter them
|
Mark M. |
just filter them for the adapter?
|
trocchietto_Ivano |
yes, absolutely that
|
trocchietto_Ivano |
it was working inside the adapter, but my senior asked me to extract outside the adapter
|
Mark M. |
OK, then perhaps InvoiceSection has a val filteredItems by lazy { listSection.filter { it.itemDescription != null } } or something
|
May 22 | 9:55 AM |
Mark M. |
and you reference filteredItems in the adapter
|
trocchietto_Ivano |
yes
|
trocchietto_Ivano |
every single implementation
|
trocchietto_Ivano |
originally was working in the adapter
|
trocchietto_Ivano |
like that was
|
trocchietto_Ivano |
View paste
(5 more lines)
|
Mark M. |
so, you could move that into the InvoiceSection as a lazy-evaluated property (which basically works like a memoization pattern, so we calculate it at most once but skip it if we never need it)
|
trocchietto_Ivano |
I see thanks I am going to examine this opportunity
|
Mark M. |
alternatively, if InvoiceSection and InvoiceItem are model objects, you might create a separate representation (more like a viewmodel/viewstate), and do the filtering as part of the conversion, with the adapter using this separate representation
|
trocchietto_Ivano |
this second case is what was expected by me
|
May 22 | 10:00 AM |
Mark M. |
that is a wrap for today's chat
|
Mark M. |
the next chat is tomorrow at 4pm US Eastern
|
trocchietto_Ivano |
OK
|
Mark M. |
as usual, this chat's transcript will be posted to https://commonsware.com/office-hours/ shortly
|
trocchietto_Ivano |
have a nice day
|
Mark M. |
you too!
|
trocchietto_Ivano | has left the room |
Mark M. | turned off guest access |