Skip to content
GoneDotNet

120: Buffet Style Show

September 23rd, 2024

In this episode, Jon and Allan discuss various topics, including listener feedback, using SQLite for local data storage, changes in Android's page size, creating a personalized video for a Disney trip, and working on a marketing app with custom requirements. In this conversation, Jon and Allan discuss the challenges and best practices of using collection views and bindable layouts in mobile app development. They caution against nesting collection views and bindable layouts within each other, as it can lead to performance issues and difficulties with recycling views. They also emphasize the importance of using cancellation tokens to properly handle asynchronous operations and avoid memory leaks. The conversation concludes with a discussion on the EmbedIO plugin, which allows developers to host a local web server within their mobile apps.

Takeaways

  • Listener feedback is important and should be addressed in future episodes
  • Using SQLite for local data storage can be a simple and efficient solution
  • Android's change in page size will require rebuilding native libraries
  • Creating a personalized video for a Disney trip can be a fun and memorable experience
  • Working on a marketing app with custom requirements can be challenging but rewarding Avoid nesting collection views and bindable layouts within each other to prevent performance issues and difficulties with view recycling
  • Use cancellation tokens to properly handle asynchronous operations and avoid memory leaks
  • Consider alternative approaches, such as lazy loading or logical collapsing, when dealing with large datasets or complex UI structures
  • The EmbedIO plugin allows developers to host a local web server within their mobile apps

People

  • Hosts: Jon Dick, Allan Ritchie
  • Audio/Video Engineer: Jim Heath

Chapters

  • 00:00 Introduction and Listener Feedback
  • 03:47 Using SQLite for Local Data Storage
  • 12:11 Android's Change in Page Size
  • 16:17 Creating a Personalized Video for a Disney Trip
  • 20:12 Working on a Marketing App with Custom Requirements
  • 31:11 Authentication Flows and Security
  • 49:03 Challenges with Collection Views and Bindable Layouts
  • 53:11 Avoid Nesting Scrolling Views
  • 01:01:25 Exploring the EmbedIO Plugin

YouTube: https://youtu.be/MH4bwX3JsNY

Transcript

Jon 00:01

Hey everybody, welcome back to Gone Mobile this week. Alan, were gonna do a little bit different of a format. You listed a buffet of topics, a Buffet, if you will, just like the Jimmy Buffet Margaritaville restaurant that we had the pleasure of eating at in Chicago this past weekend.

Allan 00:16

Yeah, there we go. You know what's funny is that when I put that there and just before we started this podcast, because John's usually like, yeah, I got a good one to open up with. I like, I knew I actually, I actually predicted that joke. He didn't tell me.

Jon 00:44

I also, I never claimed it was going to be good. I said I had something. Yeah.

Read Full Transcript Hide Full Transcript

Allan 00:49

Well, they rarely are, I mean, they're good singers, but anyhow, I predicted that one. I'm getting this. That was almost like me leading the witness here. The buffet of topics.

Jon 01:00

I, and given that experience, you know, I think we might have another Disney episode in the future just because I gotta get the experience of taking younger kids to a city like Chicago out of my recent memory. Cause I don't know, if you're gonna spend that much money, I may as well just go somewhere that everyone's happy.

Allan 01:26

All right well I got a good idea for that one. When we get to the Disney one, when you're ready to talk Disney app architecture again, I got a cool one. All right.

Jon 01:28

Okay. All right. Let's do that. So, but they have topics. we, haven't, there's just been a lot of little things collecting that we haven't taken the time to, you know, really carve out space for. They don't do it. They're not going to fill a whole episode. one of the things we've been neglecting is talking about any listener feedback that we always, you know, solicit everyone for, and then, forget to actually do anything with it. we should, we should probably start with that. So,

One of the listeners, thank you. think it was, no, I'm looking at several of them. We have a couple of things. But one of the listeners was writing in a while back about their app that they're building with Maui. And it sounded pretty cool. They're a tattooist and hobbyist programmer, which is, I don't know. How do you like, I've never thought about being a tattooist. don't, I'm probably not cool enough, but no, no, well, that doesn't help either.

Allan 02:28

Can you draw though? Because if you can't draw it'd be really bad. It'd be like some sort of stick figure on somebody's butt cheek and it would be bad.

Jon 02:35

yeah. And maybe that's why I'm kind of like fascinated by it I feel like it's not unusual for developers to not be the most like artistic, not, you know, creative is one thing, but like able to like do the art thing is another.

Allan 02:53

There's only one guy I can think of in the community that does like artwork because we both have one of his like, cartoon, like he takes a picture of yourself and he converts it into like, I forget what his name was, but I have one. I'm pretty sure you have one.

Jon 02:57

Mm -hmm. I did one just so it matched on the website and didn't have to be like the reality of my face.

Allan 03:11

Yeah. So, I mean, there's not many though. Okay.

Jon 03:19

No, no, I don't think so. So, so yeah, this, this person is, and makes snap. They are storing all of their data in SQLite locally, with, think an option to backup, you know, basically the encrypted database somewhere. so like manage your own backup and stuff, but otherwise like the thing on your device is the data that's there. And you know, they're, they're kind of like asking and telling about this approach and like, Hey, is this, does this seem like reasonable? And it's like,

keeping most of the stuff client side. It's like we've kind of come full circle in some ways to the old, you know, old days where, yeah, yeah. So we're kind of moving back to the like, hey, let's offload more work onto the client side now, right? Like with web assembly and stuff too, that's kind of what I think. That's why one of the reasons I chose to kind of do that in pool math too was like, I don't know, I don't want to run the server for some of this stuff. Like I have a server, but.

Allan 03:55

Thick Client.

Jon 04:15

you can do all the processing of stuff locally. I think it's a really kind of simplistically neat and tidy, nice way to do it, you know, just to have it like there's, there's no, there's no server stuff involved because you don't kind of really need it in this situation. Everything just happens locally. Everything's on the app, on the device. It's neat and tidy. Like I, I'm a fan of the architecture for certain scenarios that require that not require, but that can

work that way. I'm curious what your thoughts are on it too.

Allan 04:49

The easiest thing to say is that if it works for your business, it works for your business and that's. That the sum of it. What he's saying is it works well for for what he's done. If people are using the app then. Nothing else really matters, does it like? That's awesome and and frankly he's saving money on the server costs anyways. Right, all that chatter that you don't have to pay Azure for, which yeah, it's inexpensive, but still.

Jon 04:53

Mm Right. And yeah.

Allan 05:19

I mean, it's a couple hundred bucks that you don't have to pay. Yeah.

Jon 05:21

And it's more stuff to set up, right? It's just, it's more things that can go wrong. So like, yeah, if it's working for you, I think it's a great way to go. and yeah, you're, you know, he's right about the, processing power on devices these days. Like there's so much on tap potential. Like every year the iPhone is the fastest iPhone ever that's been released. And it's like, these things can do so much more than most people do. Yeah. I know.

Allan 05:35

Yeah. They can play AAA games, John. I got that iPhone Pro, finally. You were trying to convince me, but I didn't bend. But they didn't bring me my foldable phone. So I got the iPhone 15 Pro and it plays good games. Like good.

Jon 05:54

Yeah. Yeah. And that's like such a fraction of what most people use these things for. like throwing up a local database and doing some more like reporting and processing totally, you know, I think the way to go and I'm, you know, pool math is not just client side, but like I've, I've leaned more into this and actually I it's kind of a timely thing to talk about. I've been working on,

Allan 06:05

Yeah.

Jon 06:24

changing up a little bit about how I store stuff in the app and doing more stuff locally. So when I first started the app, I, I would, you if you had like test logs and stuff, I have the concept of this like overview and the overview is like the latest, you know, different records from here and here and here, like pieces of data from them, like a couple, like a value and a timestamp, basically the actual record contains more information, but I don't care about it in this context. And so

Allan 06:35

Okay. Okay.

Jon 06:51

I used to, whenever you saved that record, I would go update the overview record, right? And then that would get pulled down. it's not normalized database stuff, right? But it's kind of the whole document DB idea of like, you can write more stuff to more places if it means faster reads or more aligned to how you're using the data kind of thing. So I've been changing.

Allan 06:58

Okay. Yep. Yep. And again, still works for your business. That's right.

Jon 07:22

yeah, yeah, yeah. And it works, but at the same time, you know, I've started being like, can simplify a lot of my logic and stuff. If I have a database on the client side now too, I can just query this data. Like these phones can do that. It's not a big deal to do that. And so I have this massive query for SQLite. That's like a whole bunch of like some queries and it runs in like 10 milliseconds. Like it's fine.

Allan 07:44

Yeah, mean, SQLite though is a pretty, I don't think people realize that, well, it's not really multi -threaded, which is fine. from its queries, first of all, the query that you're writing was probably pretty jiggy if it's got a lot of subqueries anyways. And it just chews it up like nothing. So it's amazing how far it's come. It's like SQLite and Postgres, they're query parsing engines and all that stuff.

Jon 07:52

Right. it's horrible.

Allan 08:12

It's awesome and the sequel light runs literally everywhere. I mean, I can't think of anywhere where it doesn't run these days, so.

Jon 08:17

Yeah. I think you'd be really hard pressed to come up with a situation in your app that you're like, no, SQLite's not gonna cut it. You really need to offload this to the server. Certainly there's cases, but yeah, like you said, if it was working for you, embrace it, it's good.

Allan 08:35

Yeah. I have heard of people using SQLite on the server though. That sounds a little scary but I have heard of it. But hey, good job to this guy, the tattooist and the app maker. Yeah, great job.

Jon 08:41

Yeah, I think I've done that. Yeah, thanks for writing in too. If I ever want a tattoo, maybe we can figure out where you're at and I can get a tattoo. I've never been able to get one. I don't know what I would get a tattoo of. I'm too indecisive.

Allan 09:03

Yeah, I don't even have a comment for that one, John. I was trying to think of something clever. just don't.

Jon 09:06

Okay, yeah, we probably shouldn't dwell on it then. Don't need any more time to think on that one. We had some other listener feedback too on the X, whatever we call it now. Yeah, people are still using it. mean, you gotta be where you gotta be.

Allan 09:20

On the X, the excrement, excrement, the Twitter, I don't know. Yeah. I still like it. I mean, it's I still see a lot of tech news. It's harder to see tech news these days. But.

Jon 09:36

So yeah, feedback on Mediator. Seems like Rodney's on board. I didn't follow the full thread before the show yet. I think there was some more replies. You can film me in.

Allan 09:40

Yeah? I think he was just pretty happy with the overall approach. Rodney Littles, the second, he goes back. He's big into architecture. He's one of the reactive UI guys. think he still is. I'm not sure if he. Step down when he was also part of the net foundation and. All that great stuff, so Ronnie's been around for many, many years. He's pretty vocal guy, but yeah, he said he was really happy with the.

with what I'm doing with mediators. So thanks for that Rodney. He's got more feedback coming he said.

Jon 10:22

Yeah, good. Well, and hey, like, you know, as, as you continue to evolve the, library and pattern, like, you know, the more people that kind of notice it and are like, yeah, this actually makes a lot of sense to me and I want to use it. yeah, who knows? You might have a hit on your hands here. We'll see. I mean, I haven't, I haven't done it yet. I've been too busy, you know, hanging out, drinking margaritas in Chicago before the, before the city got crazy.

Allan 10:36

Maybe. Have you converted yet, That's true. Did you get a deep dish pizza there?

Jon 10:49

My one kid doesn't eat pizza. Like what kid doesn't eat pizza, right? this is part of the problem. It's like, can't even go anywhere. So it's like, okay, you're at like the Navy pier, which is everything's like a million dollars just to be there. Like you just to set your foot in the door anywhere there is like, there are a couple hundred bucks. And then you're like, okay, we got to eat. Where, where can we eat? well this place has burgers. So I guess, I guess we're safe. Great.

Allan 10:53

I don't know man. You should just So you did not get a deep dish pizza while you were in Chicago. Yeah, but it's something you do again and again.

Jon 11:18

I've done that before. I know. I know, I know. We had hot dogs, so there's that.

Allan 11:26

All right. All right. So what else we got here in our buffet of topics? Do we have other feedback? Because you're usually the one that collects all the feedback. You get all the notifications.

Jon 11:31

Buffet of topics. Yeah, what do you want to pick next? I think that we've got the feedback covered. I could be missing some off to check again later. But as far as the stuff I am aware of today, so keep sending it in folks. We will talk about it sometime. Promise. See? Yeah.

Allan 11:42

Okay. All right. Yeah, he's got to got to hound John sometimes. He's the keeper of all the information. Anyhow, I noticed that there's some stuff going on with Android, the Android developer community. I'm kind of interested to see why why you're excited about Android because you know it is a.

Jon 12:01

So what's next? Yeah. No, I'm not. I'm not excited. It's more of a, a loathing of the change. So Android's doing this weird thing, where they're, they're changing the page size on their platform essentially. So the, the historic page size, I believe currently is four kilobytes on, on Android and their CPUs and everything's built and aligned to that, you know, that page size.

Allan 12:18

Yeah.

Jon 12:41

Well, they're changing that. They're changing that to 16 kilobytes.

Allan 12:46

Why does this concern you? Fatter pipe, more data.

Jon 12:48

Well, because once this starts happening, the world has to be rebuilt for this, which is going to be the pain. So anything that's, if you're shipping a package with a native library component to it, not just a jar or AAR file, well, maybe an AAR file. If you have like actual like SO files, right? Like actual native libraries.

Allan 13:18

yeah.

Jon 13:19

That's all going to need to be rebuilt.

Allan 13:23

does make sense.

Jon 13:25

Yep. So that is coming and just, you know, I wanted to raise awareness to the three people that listen to this. Maybe one of them build something that has one of these in here. And largely like, I think a lot of what we see in like the Maui ecosystem is more bindings and stuff around these things. Certainly,

Allan 13:27

because it is a different.

Jon 13:49

like .NET, know, the Android team has their own set of native libraries for mono and know, runtime and everything. But they'll have to deal with this as well too, right? Like they're going to have to rebuild all those things and that probably means at some point we're going to have to ship both of them side by side because you know, presumably you're going to be in a world where you want to support both of them because not every device will be able to do this right off the bat. And I haven't really dug super far into all of the different, you know,

aspects of this and like where support starts and stops and like what device like do current devices can they support it? Is it just OS? I truthfully have not dug into the details.

Allan 14:30

You know what, I bet you it won't be a big deal because there'll probably be like a emulation mode of some sort, right? You know, like running 32 -bit processors in 64 for the longest time. I don't think this is going to be quite as big of a kick in the groin as you're concerned.

Jon 14:38

I don't think so. -maybe. I know the Android team is not excited about this because I think it does break the world on some level for them. And I think, like I said, know, library authors and stuff will eventually have to rebuild and everything. So it's, I think it could be, it's going to be impactful. Just, just a heads up, you know, keep, keep an eye on it. I'm sure we'll say more about it in the future too. Like this is starting in Android 15, but I don't think it's a, like, I don't think it's like everything suddenly

goes this path in Android 15, it's like you can start getting the tooling and stuff to start thinking about building this stuff for your app.

Allan 15:23

It'll certainly be a performance bump though, right?

Jon 15:25

Yep, that's the idea why they're doing it. I think they kind of generally say 5 to 10 % performance increase. So hey, free performance. Sure, great.

Allan 15:34

Yeah, I'll tell you. I mean, if all I got to do is recompile,

Jon 15:35

More memory usage though, right? Because you're kind of, your lowest size is now bigger. Yeah. yeah. Yep.

Allan 15:41

Yeah, well, it was the same with when we went from 32 to 64 bit, right? Like it's just, part of it. Fatter pipe, fatter landing strip? I don't know.

Jon 15:53

Yeah. Okay. Yeah. Let's go with that one. It's the quote of the day.

Allan 15:54

Yeah, you know where I'm going here. That's all right. Yeah, okay. I'm a little slow today. Listen, you opened with Buffett of topics, so I don't feel too bad.

Jon 16:01

All right, so yeah, I know. is, yeah. I mean, if we haven't lost everyone listening yet, we will in short order. Yeah, there you go. I guess that does it, right? That's all we can end there.

Allan 16:10

They just did. We just did. Yeah, that's great. Thanks for reading. Okay.

Jon 16:18

All right. What, so we, we, yeah, I think generally, I don't know if we're going to do this every episode. We'll probably figure out, you know, some changes here. We know what we need is some like really catchy jingles for each, each kind of section of the show. I don't know how we're going to do those AI of course.

Allan 16:32

Yeah, I feel like, well. yeah, that's a good one.

Jon 16:38

Like an AI doing the jingle. don't mean, I mean, maybe we want an AI section. Who knows? Everybody has AI now.

Allan 16:43

You did get, you should talk about the AI you used for your kids when you did the Disney trip. Yeah, that was good.

Jon 16:49

yeah, that was fun. It was a little creepy. I'm not gonna lie. did I sent you the video? Did I? Yeah. Yeah. But you know what? That's after the fact they were both like, how did you do that? How did you get that voice for that? For this? And I'm just like, I know Mickey duh. Yeah. No. I guess.

Allan 16:55

Yeah, I saw it. It was definitely creepy, but it was hilarious. Hey. So are you going to tell everybody what you did? Or do want me to tell them what they did? Yeah.

Jon 17:15

Yeah. So like we, we, we wanted to do the, a reveal for the trip before we went. and, part of this has been like, you know, personal reasons had kind of a crappy year. wanted the kids to have a win, wanted us to have a win. And so we, we were like, let's do the Disney thing and we're going to like reveal it to them. Like, how do we want to do that? And I'm just like, I'm just going to make a video. I'm going to get stock footage of like Disney, you know, shots for like the visuals, right?

And then I started thinking, I'm like, could I get, you know, Mickey to like say, you know, my kids names and, you know, give them like a personalized message. And there's some services that you could like hire someone to do that, but I'm pretty sure they're just doing the same thing that I did. I'm like, no, I'm sure there's a way to do this with AI and there is, there was. And so I found, looked through a couple of different voices and, you know, I found actually the easiest way to do it was to record.

own voice and then use that to overlay AI on top of. There are some that let you do like type out the text but they never could quite get the intonation of the whole thing right and it was much creepier sounding when when you don't get that right. So there were some that you could

Allan 18:32

Well, I mean, it took your voice, high pitched it quite a bit, and it just sounded like a wrong sounding Mickey. But hey, you know, it was the thought that counts.

Jon 18:37

Yeah! Yeah, like kind of the the uncanny valley sounding Mickey right like it was close enough to be like almost believable But you're like there's something just not right about it

Allan 18:48

you Well, there's it's not quite it's pretty much fully not right Mickey, but hey man, listen, that was pretty cool. Your kids thought it was awesome. mean, seeing your daughter, was it your daughter that lost? Yeah, she lost her mind. So once she fixed it. What?

Jon 18:55

Yeah. It was a model. Yeah. Yeah, yeah, and Gavin, the other one was just kind of like, what does, what does this mean? Does this, are we, what? Yeah. yeah. Yeah, probably. Yeah. He's like, I have to go to that, that Disney world. That doesn't sound good. That Mickey sounds scary.

Allan 19:14

He was so traumatized by the Mickey voice that he just didn't know how to process. But yeah, it was. You

Jon 19:25

But it worked out well. So yeah, there was a site, you like upload the WAV file to and you know, of my own recording and it did the, it applied the whatever Mickey model I chose that was kind of cool. I don't, I wonder if I canceled that subscription. It was like a paid for thing. Yeah, I'm probably paying some service, you five bucks a month out there still. well. So yeah.

Allan 19:27

So that's a pretty cool project anyways. my gosh. There you go, John. Good job.

Jon 19:54

We got there from talking about making jingles for different sections of the show. So we're a little lost, but...

Allan 19:58

Well, making cool things right now. So probably more focused on apps, but you know, I thought that one was pretty cool anyways.

Jon 20:06

Okay, okay. So yes, this is the making, the cool things we're working on section.

Allan 20:12

Yeah, I mean, I feel like this is more my department because you get to work on a single project and you find ways. You find different ways to... I think this year will be more interesting for you, but yeah.

Jon 20:16

That's fair. What about, mean, there's, but there's different aspects to it, right? Like there's stuff. Yeah. So what are you working on? That's cool.

Allan 20:30

This week I did a marketing app for one of the companies I'm working with and they had some they had some custom requirements you know they wanted it it's like a kiosk thing that goes and basically there's this motor you're gonna press on a button and it turns motor I mean it sounds pretty easy right the difference is is the marketing people are gonna want to change that website all the time and it's got to communicate through either Bluetooth or serial

Now there is a web serial specification. But it's not very like with all things web even web Bluetooth is like, can we just finish the spec already guys? Like, let's get on with it.

Jon 21:11

So what are the different device components to this setup? Is there just one?

Allan 21:18

Well, the main premise though is that they've got to get a marketing materials. So some sort of HTML website to be viewable. Okay. And then the second is they want to click on a button and have it spin a motor, right? It's, basically a marketing material to show one of their products in store. Right. So it's, it sounds pretty cool. So

Jon 21:38

So what did you use as the hardware thing to drive this all?

Allan 21:44

Well, I used I use Maui and I have nice little web view. Nothing too complicated. Now, the cool thing here is that it's not you can't use your general kind of web view and interop stuff because they want the marketing marketing people change their minds and colors every other week. Right. I don't know you've ever. Right. So it pulls in the web content zip file.

Jon 22:06

So you're loading the web content from a server somewhere. Okay.

Allan 22:13

It has its own local copy of what it was right like to start but then it goes out to the web it downloads a new one unzips it you know if they want to run a react site or hey if they want to run flash I don't know if they still can. Can you still run flash on Android? think so. I don't know. Not on iOS. Anyhow so they can run all that cool content bundle it all up and ship it.

Jon 22:16

Mm -hmm. Mm -hmm. Hmm. Hmm. Maybe on Android. No.

Allan 22:37

Movies the whole nine yards it'll run now I've got a little local web server, which I'm not going to mention yet because well, it's gonna be our package of the week as well, but This little web server called embed IO It can basically run static code like here's my WW root here's here's an API Here's some it's got the ways to do web sockets and stuff. So it's pretty it's it's a pretty powerful little web server

And so because I needed to update the content, right, you can't just use like a Maui asset because it's a string build, right? So you just stick it in the app directory, ship the big giant zip file there. And wow, there's a loud, I'm not sure if you heard that, but I could hear it through my headset. Anyhow, we needed because we needed to update it. Basically the app data directory becomes the WW root and

Jon 23:23

You Right.

Allan 23:37

do what you want to do and marketing can put whatever they want. And then I've given them two little API endpoints that they can call for the device to do things. So it's pretty cool because.

Jon 23:44

OK. So it's like API endpoints like JavaScript kind of things they call it from and you're hooking into or OK.

Allan 23:52

Yep, just like a traditional, well, if you want to call it Ajax, a fetch call, right? So just like if it was on the web, it was calling to remote server. It just happens that that URL is local and it calls into our C sharp code to say, do something. So that's how I've done the interop is it's not really interrupt, it just call the website, call the API, tell the motor to turn on whether it's through Bluetooth. Yep.

Jon 24:05

And... the website is, local host, whatever, right? So you...

Allan 24:21

turn it on through Bluetooth or turn it on through serial, whatever we're using and it just works. It's pretty cool.

Jon 24:26

Okay, that was what I was gonna ask is like, how is the app communicating with the motor part of it?

Allan 24:31

Yeah, it just depends. Because on iOS, there's no such thing as a serial cable. Really? They do have ways to interact with like, like you've got one of the SanDisk USB keys. But guess what? They need that whole MFI made for iPhone junk. Yeah, you know, they're so annoying about stuff, Apple, just let us plug in and ask the user if it's all right.

Jon 24:36

right. So there's no access to anything like USB like that without the whole certification.

Allan 25:02

No, without sending a pint of blood praying to Steve Jobs grave.

Jon 25:06

Right. Yeah. hey, mean, gotta do what you gotta do. Or Bluetooth it.

Allan 25:10

How about making the money? Well and that's just the thing but then Bluetooth yeah there's this little it's hard to do in a kiosk mode but anyhow

Jon 25:21

Yeah, well in a kiosk you want it to work perfect, right? So that kind of sucks. What if you, I mean I guess at this point you don't really need Maui in the mix, it's like what if you had like a raspberry pie or something that you were communicating with instead?

Allan 25:24

Right. I mean, technically I could, the whole point is that this kiosk isn't going to be attached to any network, right? So it's not going to be on wifi or cellular or anything. So, you wouldn't really be, you'd either have to connect to it through, mean, there's a number of ways to still communicate with the Raspberry Pi. I mean, as it is this, this device that I'm talking about already has some Bluetooth on it that's used by the actual app and

Jon 25:42

Right. OK. I mean, back to Bluetooth or something, right? So no, no savings. Right, okay.

Allan 26:02

all that nine yards right so I can kind of piggyback that stuff but where was I going with my thought here yeah you don't really need a Raspberry Pi to be in front of those it's just straight basically for the motor it's you issue it two bytes and it goes it's on a timer so that's pretty cool hopefully it doesn't chop anyone's fingers off while it's running or anything but you know

Jon 26:22

Yeah, yeah. Well, that's fun. Well, I mean, yeah, that's why you put it all behind like plexiglass and, you make it so people can't get too close and touch it.

Allan 26:32

Alright. I don't even know what it's gonna do. They haven't sent me the toy to actually play with, because I was like, I wonder what I could do with this. It could probably scare the crap out of my cat. But maybe my kids? What's that?

Jon 26:40

Okay. Yeah. Or feed your cat. Maybe you could run the motor to like do something cool to give your cat some. Yeah.

Allan 26:48

to feed the cat. except, yeah, well, it'd be messy, but yeah, it could.

Jon 26:52

I don't know, can you like, I don't know, hook the motor up to whatever?

Allan 26:56

Shoot food at the cat. Are you hungry? So yeah, that was it. That was one of the cool projects I'm doing. It's done in Maui, works for iOS and Android. I mean, it's Maui in terms of hey, here's some UI other than the web view, but still, still counts.

Jon 27:13

Yeah. I mean, I'm still always very partial to the whole world of like interacting with something like physical from a software perspective. Right. So I, that's a lot of fun. That sounds like a, pretty interesting project to work on, let alone to do it for, you a company that you're, that is presumably paying you to do it too.

Allan 27:35

there you go. And what's cool, like all the permission stuff that I needed is mostly built in. So it's still a win project with dot net on mobile one way or the other. So. Wicked.

Jon 27:45

Mm -hmm. Yeah. Well, that's cool. That sounds more fun than some of the stuff that I've been looking at lately. I was trying to think of it. Have I been looking at what have I been doing that's fun? Maybe less fun, but still, you know, I'm a glutton for punishment. We've talked about this stuff too, right? Like we've worked in some really weird areas of mobile and just the ecosystem that you're like, why would you punish yourself by doing this? Right?

Allan 28:14

You

Jon 28:15

And so one of the areas that I've over the years learned a fair bit about has just been authentication. Like, auth, all the different ways that you can do authentication flows. And especially with an eye towards mobile. like, I don't know if you remember way back in the day when we had Xamarin auth, that was a library.

Allan 28:39

I do remember that one, yes. I never used it personally, but I did. I had heard of it.

Jon 28:42

And Yeah. So it was, you know, it was a library. and in early days, just like everything else, like you got, when we started doing stuff, you used what was available to you. like when the idea of doing these, like, you know, off type flows from mobile was first can kind of a thing. You're basically only way to do it was like, here, I'm going to stick a web view in my app, right? I'm going to load the page, the login page that I'm, I'm targeting.

from whatever server and then I'm going to just listen for the web view, the navigation event. I'm just gonna watch that and when it has a URL that contains like the right pattern that I'm looking for, I know that it's come back to me and presumably there's like a URI fragment that has the token or whatever value I'm interested in obtaining and then I can get rid of showing the web view. that's like, Xamarin .auth did that a bunch.

and, and of course the problem with that, and it took years for like Google and others to really try and stamp out, you developers from doing this and they probably still haven't fully, cause it is kind of hard to detect every scenario that does this. Right. But if you haven't figured out some of the problems with doing it this way, right? Like, okay, I have an app, I'm asking you to log in with your Google account in a web view.

that I can inject JavaScript into. I might steal your Google password. Thanks. Right. so, so like that, that, know, very reasonably quickly became a, shouldn't do this. Not that people listen to that advice quickly as well, but you know, Xamarin auth eventually kind of went away. One of the reasons being it was like founded on doing this as part of your flow. And it's just like, no, you, can't have our customers doing that.

Allan 30:20

Yep. They've got clever ways of doing it, that's for sure.

Jon 30:43

We, and, and, because also like our customers, customers are still our customers kind of too, right? So we don't want to like enable developers to do something that's going to be harmful potentially to their own customers. by proxy, know, we've, we've enabled this, right? So, enter Xamarin essentials where we, figured out like, okay. Well, there's different ways to do this. iOS has an API. and there are several APIs that they've changed over time that allow you to basically say, I need to start an authentication flow. Here's the URL that I want you to go load up for the user. And they will do that in like a, you know, separate kind of instance of the browser that I don't have access to in my app. That's kind of the foundational feature, right? So as an app developer, there's no way for me to inject JavaScript and spoof your, you know, your

get your password and username and collect that or anything like that. And I'm going to also give you the callback URL or URI, I guess more accurately of when that flow hits this URI pattern, you know to come back to me. And so you kind of gave it like those two pieces of information and then off it went and showed the user the thing, the user did the flow and. eventually maybe if it was successful, you got back the pattern and the URI that they called back to and you could parse it and get the information you wanted. UWP had, you know, basically the same API. Android was the weird one out, but it still kind of worked that way. and, and Chrome custom tabs and that was, yeah, there's a bunch of different iterations of it too. And, and, but you know, both of those platforms and UWP too.

Allan 32:22

What's it? It's Chrome TabClean or whatever now. and things of pain in the earth.

Jon 32:35

kind of relied on the fact that like they could validate and know your app was the only app that was allowed to handle that, that URI pattern, right? Otherwise, like I could go build an app that handled, you know, whatever custom scheme too, and hope that somebody, you know, launched a flow and when you, on the Android, you know how it pick, like, let you pick like, which app do you want to handle this intent and be like, let's pick that one. Yeah.

Allan 32:46

Mm I don't know. That one sounds good.

Jon 33:04

Yeah, nefarious sounding, you know, duplicate of this app. that was, you know, part of it too. and then, yeah, UWP had the same thing with like packaged apps and stuff, but now enter Maui and we don't, we don't have that everywhere anymore. We, still have it on Android. We still have it on iOS, but windows when app SDK actually does not, it just doesn't work. Like those APIs exists still because they came from UWP. But if you call them, it just like,

Allan 33:07

Ha ha ha.

Jon 33:33

it throws exceptions and stuff. Like they just don't work. so we've had this constant. yeah, I know. I mean, part of it is like, because when app SDK doesn't have to be packaged apps. And so there's like the way that they figured out like single instancing of the app and sort of like ownership of things, for like registering hand, protocol handlers and stuff. Like it just doesn't map correctly to unpackaged.

Allan 33:37

I have no comment because it's Windows.

Jon 34:01

By default, mean, not saying that they couldn't figure it out on windows, surely they could. So it's been a kind of renewed area of interest of like, what are we going to do with the windows stuff? And, and, know, it's a cool thing from the perspective of it's a hard problem to solve. And it's kind of fun to try and think of how to solve it. But so far, the unfortunate reality is there's not really a great one solution to solve it. There there's some, and we'll have to put them in, I guess it's a community links projects or just, you know,

whatever section, put it in the show notes, like Dot Morton has kind of his own take on it. There's a few other people that have kind of done similar things and there's different suggestions of like, you could start up, you know, your own local web server. could use embed IO and set up your callback server with that, which might work in some cases. Or, you know, maybe your, your corporate machine policy doesn't allow apps to open ports and it doesn't.

Allan 35:00

If not, something will block it. Some firewall in front of it will get in front of it.

Jon 35:03

Yeah, something will block it or like the, the authentication provider doesn't allow you to specify local host as a pattern of your callback URI. That's, that's something that can happen. Not all of them do, but some of them do. so there's all these different like reasons why that might not always work. It's not a, you know, one size fits all solution. on, on windows, you could, you can still do like the whole protocol handler callback thing. but kind of similar problems.

one like, okay, how do you know that that's the right app for it? guess like, I think only one app can register. But at the same time, like Windows doesn't, Microsoft doesn't like enforce like, yeah, you own that scheme and we're good. And we're only going to open your app that uses it kind of stuff. So, problematic there too. and then there's the whole thing of like, you know, man in the middle type attacks and though you've got to make sure you send like state objects around. And that's sometimes not even really enough to do it properly. So,

It's been a cool, frustrating, still not found a solution yet. So I am kind of curious too, if there's any listeners that have ideas in that area. I feel like there's not anything too new to learn yet, unfortunately, but maybe I'm wrong. Let me know if I'm wrong, if you have a suggestion.

Allan 36:23

Well, you got to figure there's apps out there kind of doing this stuff, right? Like like VS code, for example, you hop out of the app and it, you know, it says click here and hop back to your app and.

Jon 36:29

Yeah. So. What I always have kind of, well, and yeah, so the way that a lot of those apps will do it is kind of the polling thing, right? So you might launch the authentication flow and it, but your auth provider has to support this scenario where it's like, okay, I logged in and now my app is pulling the provider's URL with some session information or whatever. And keeps asking it like, you received the authentication yet? So I'm contacting them instead of them calling back to me essentially, right? So that would be a way to do it. But again, I don't know if everybody is super happy with that flow or if it'll even work for the provider yet that they're using. Probably some of the big ones like Google has the device off flow kind of thing where they do that. Others do as well, but maybe it's not universally used either.

Allan 37:11

Yeah. if it'll even work for everybody's flow. So that's what you've been working on. Window stuff.

Jon 37:37

Yeah. Windows stuff and the other Windows thing and not me working on it, but we talked about collection view handler two for iOS the other week. I don't know that it'll make it for net nine, unfortunately, but we're kind of doing a similar thing for Windows as well. So yeah, there's a lot of interesting things going on and that was that's another member on our team, Mike, that is working on that. And we should see some stuff coming in the future for that. All good stuff.

Allan 37:49

Yep. It'd be nice and fast. Not that I build Windows apps.

Jon 38:09

What's that? Yeah, nice and fast and just work better using newer APIs that weren't available when we did the original implementations of things,

Allan 38:20

when UI has come so far, I don't want to say that. We'll cut that out of the episode. Don't get yourself canceled, John.

Jon 38:26

One, two steps forward, one step back, let's call it. Yeah. So.

Allan 38:34

Alright, so normally this is why I think your jingles are right because this is what this is our section where we're to do the Tales from the Crypt. We did an episode on this. I don't know. I want to say a couple months ago. And it was about kind of some of the dark things that John and I have had to witness myself as a consultant. I've gone in and seen some doozies. You know when John gets a support case, I'm sure you've seen some fun stuff.

Jon 39:00

Yeah, there's things that are special.

Allan 39:05

And sometimes they're not meant to beat up on people for sure. Sometimes it's a case of knowledge and sometimes maybe I am trying to beat up on some people because they thought they knew better.

Jon 39:18

Well, yeah, I mean, you know, listen, we're, we're all, I think we all want to, to, to make sure that we are able to learn and grow in our careers and what we do. Right. And so I, we were both, you know, much junior developers many years ago too. And I made tons of really stupid decisions and mistakes that, know, current me would be like, what the heck are you thinking? Like that was really, really dumb.

Allan 39:29

Yes. Exactly. Learn from those who have made more mistakes than you have.

Jon 39:49

Right. And, and, and a lot of this is, you know, stuff that I think you and I both see often enough that it's worth calling out and talking about it. And yeah, we can poke a little fun at it being like, you know, what are you doing? Like, don't, don't do this. Right. And we'll, do that because what else? Like nobody wants to listen to just say, this is the best practice, right? We got to have fun with it.

Allan 40:13

No. Well, unfortunately, I can't do do you remember the show The Tales from the Crypt with a guy that I can't do his voice and it probably sound like screaming into the microphone. Like I said, if we get into Yoda or something, then fine, we'd be good. But I can't do his voice. So we might rename the section. But this week, the fun part is, is that I think I get to beat up on you a bit about this, John, because I'm pretty sure we talked about this recently.

Jon 40:18

Yeah, yeah, yeah, yeah. Nah, me neither. Yeah. Mark, good. Yes.

Allan 40:38

That's why I posted it first because I wasn't gonna make fun of anybody even though I have seen people doing this. But I know well that's that's how it goes.

Jon 40:40

buried the lead. But no, I mean, you're right though. And like, think that if you found, I'm sure you, they're not hard to find things that either I personally wrote that are really bad. That's a good example of the like, everyone does it. Let's just figure out how we all improve from it,

Allan 41:03

Well, this one is this one is true because a lot of people don't do it. A lot of big businesses don't do it. And that's fine. And at least you're not doing dot get result dot wait. If you're waiting a task in a mobile app, bad things are going to happen. Just don't do that. I am going to make fun of you if you do that. So so far.

Jon 41:19

I mean, yeah, I've, I've, I've probably done that. I probably have code somewhere still that does that. I'm sure. know, why either I knew better at the time and did it anyway, or, you know, I really didn't feel like figuring out how to get out of the situation that I wanted to use it in.

Allan 41:25

Okay, I haven't caught you yet, but I will call it if I catch you. So there's always a situation you can get out of that. So don't hear John on this one. Don't do it. Don't do don't do result. Just don't. Fair enough. I know what you're saying. So the specific topic in the roundabout way that we got to it is cancellation tokens. I either see most apps don't use them. John. Yeah, he knows do. We talked about this already anyways. Or they simply abuse them. Right. So

Jon 41:43

I know there is, it doesn't mean I wanted to figure it out. That's all I'm saying. Hmm.

Allan 42:10

they're canceling all the time or you know, they're canceling when they don't need to or they're not canceling them at all. Right. So they a lot of times even today too I see people put cancellation token dot none who cares let it run off into space. So in a mobile app it's not the end of the world but a lot of tabbed apps you know if you're swapping between tabs constantly you start really loading the guy up right.

Jon 42:24

Yeah. Yeah.

Allan 42:37

And chances are when you come back to that tab, if the data is old or didn't finish loading anyways, you're to call fresh load again anyways. So don't let it finish if it's not, if the user doesn't even care, just cancel it out because what can also happen too is if the, let's say the page went away or something, you know, can start calling out to other things like render this UI. And it's like, there is no more UI dude. What are you doing?

Jon 42:51

Yeah. Yeah, yeah. I was going to say like that's, that's one of the, you know, side effects that's going to bite you if you don't kind of think this way, right. As you might end up trying to do stuff and causing crashes that are kind of hard to figure out why they're happening sometimes in a production app when it's something as simple as like, well you're that request, you know, finally finished, but you already moved on and now it blows up.

Allan 43:24

Well, I mean, it's gotten better now because you guys are very strict about killing the binding context, like splitting it off right away, right? So no matter what things get it now, not in tabs, but certainly when a page is, is destroyed, I'm pretty sure one of the very first things you do is binding context is null on the page. Now start cleaning up all the junk. So there's nothing left.

Jon 43:44

Yeah, there's more stuff coming by default. think we talked about that last time too, right? Like where we've taken a more opinionated approach coming, you know, going forward. but yeah.

Allan 43:50

Yep. But in any case, if the view model continues to run its stuff, it doesn't matter. It's yelling into an echo chamber at that point. But you've used that memory. You've tried to call out to things that are now just kind of yelling into the trees falling, but nobody is there to hear it fall in the middle of the forest. So.

Jon 44:08

Mm -hmm. Yeah, or like you're duplicating, you know, some event that gets called that shouldn't, doesn't need to be, you know, best case you're like just doing more work and using more resources than you should be.

Allan 44:24

Yep. Exactly. So what I try and tell people to do is there's two points where you want to cancel depending on what your workflow is. One is you want to cancel it when your page is going to the background. Right. You can always reload it when they come back. Chances are you're going to anyways. Right. So if the page goes to the background and there's another page on top of it just cancel it out. Right. It's no point. But certainly if the page is being destroyed so like a disposable

Jon 44:54

Yeah.

Allan 44:59

type event, that's like a cancel everything. The page is dying. If there's something running, it doesn't matter. Again, it's yelling into an echo chamber. The echo chamber doesn't care. You can scream in there all day and you only hear yourself just like in John's room right now. They only hear his echo. If you yell, only you hear?

Jon 45:06

Yeah, that's not gonna happen anyway. I mean, there's other people in the house currently, so they might too, but I would hear. Yeah.

Allan 45:22

They might hear you. Fair enough. So use the cancellation tokens. They're there for a reason. They can do you a lot of good. It's very easy to put in your base view model. I've seen some people use lists of them. You don't need to do that, right? You really don't. Pretty much all the async tasks are.

Jon 45:42

So you're kind of saying like create one for your view model essentially and then have everything check it.

Allan 45:46

Yeah, just use one. Right, because what are you going to do cancel like all 60 of them? If you've got a list, just just cancel the one and then they all go because they're all now useless, right? They're all null and void. Cancel them all and move on. Use cancellation tokens. They're good.

Jon 45:53

Right. Yeah. So, know, the one thing that I know I always kind of feel too, like, yeah, one per view model sounds like a good idea. I think the other, yes, the other thing that I always find is like, that's maybe good for that, like layer of your app. If you have, you your services and stuff, like that, obviously they need to support, like accepting a cancellation token, right? If I've got a call to my web API, I'm gonna need to...

Allan 46:12

That's opinion based, obviously. Yep.

Jon 46:34

take that into consideration, which isn't that hard to do. But one of the things that I think maybe why people don't do it as much as they should is like, it's one of those things that kind of permeates like the whole chain of everything you're, you're, you're hitting code path wise, right? Kind of like async, right? You know, it's like,

Allan 46:51

Well, the general rule when you do async though is you've heard the term async all the way, right? So that's like the task all the way through, then all the way back. So I think when that's implied, it also means also pass the cancellation token. If you're feeling lazy, stick a default on it and let that go through. But somebody has to pass the cancellation token. So presumably from the start all the way through.

Jon 46:56

Mm Yep. Yep.

Allan 47:20

And if you just went with cancellation token none or the default, so be it. It just flew into space, you still just async all the way and include the cancellation token all the way. It's not hard.

Jon 47:30

Yeah. And that's, that's kind of what I'm getting at, right? Is like, you know, almost when you're, when you're building these APIs and stuff, like stick it in there. All right. Like you said, if, you don't use it from whatever's calling it right away, at least in the future, if you fix your mistakes, you know, it's not as hard to do that.

Allan 47:33

Yep. Well, and the funny thing is, is if you're generating any of your APIs right through Swagger or NSWG or Refit or Kyoto, if you're using that unfortunate thing, then it puts the cancellation tokens in that generation pattern anyways. So they're good. Don't be scared of them. They're friendly little guys.

Jon 47:52

Mm -hmm. Yeah, so you've already got it. They are pretty handy. And I think we've gotten better APIs over the years in .net too to like do other things with them, right? Like I feel like it used to be difficult to, what was it, like do like timed, know, cancellations and stuff like that. There's like all the different cancel after, yeah. So that stuff's all gotten quite a bit nicer. Cause I know I've done some stuff where I've, I can't recall the exact scenario, but where I'm like, I want to like,

Allan 48:25

Yeah, for timeouts. Right.

Jon 48:38

tie these things together so that when this condition occurs, it's gonna fire the cancellation, but if it doesn't occur by such and such time, I want it to fire anyway and all that kind of thing, right? So there's some pretty cool stuff you can kind of wire together with them as well, if you just start thinking that way.

Allan 48:55

sufficient. Yep. So that was it. That was my tales from the crypt. I see John's got one coming. Let's hear it. What really grinds your gears?

Jon 49:03

Yeah, I've got one today. So, you know, again, in, in, in the spirit of, of, know, trying to like do things in a way that's going to help yourself be successful, right? you know, one of the things we see time and time again, and this is what I was saying earlier is this, this kind of learning opportunity is more about the, we keep seeing this. Like why, you know, one question when we see patterns over and over, it's like, well, are we

doing something wrong with how we either document things or show samples of things or build the API around things. Is there something we can do better from that perspective? Probably, and we should be digging in and learning those things. one pattern I see over and over again is, well, two common things. They're separate, but they're similar. One is putting collection views inside of collection views. So like if you have a...

a collection view and it scrolls vertically in your data template, in your item template, you might put a another collection view that scrolls horizontally, right? Right. And, and you know, like, this is why I kind of say like, well, maybe, maybe part of it is we're not giving the right kind of information around these scenarios, right? Like that actually might be a valid thing to do.

Allan 50:13

Like Netflix. I can't do that.

Jon 50:29

there are some scenarios that I could imagine that maybe that's okay to do. It's still, I'm still gonna err on the side of saying like, probably not. Like, you really have a view of data that is like an infinite scrolling list of vertical, know, scrolling list of horizontal collections of things? And if you do, is that the best way to display your data?

Allan 50:54

Well... Technically, technically, it's not infinite scrolling horizontally in Netflix anyways. It's like a carousel of repeated. I you get about what about 20 items? Well, you've done come on, you've done the Netflix. You've done the Netflix scroll like now, now, now. Right. So eventually it's like, okay, dude, you said no enough times. We're starting over.

Jon 51:12

Yeah, it's not infinite, yeah. Yeah. Yeah. It's the same in, what app? guess it's like, yeah, maybe it's Netflix. Maybe it was like Apple TV. I'm thinking of two where I'm like going through shows. Yeah. It's like, it's not, not ever infinite. So one, yeah. And I don't know if that's better or worse in this scenario necessarily. Like in, in, some extent, if it's enough items, it's still may as well be infinite. You know, like if, if you've got

Allan 51:28

they all do the same thing now. Here's category 20 shows, infinite carousel.

Jon 51:48

like 30 items, that's still, if I was going to hard code 30 views, like 30 instances of the thing I'm showing, is that going to be lighter than loading five up and then potentially loading more or reloading stuff as I go? It's hard to say. this is part of my, I guess my, my tail here is like, it's not always obvious, like what the right answer is either for these situations, right? The answer could be,

a combination of maybe we shouldn't do it this way, right? Like, is there a different way to approach the situation for the user interaction? If the answer is no, we must absolutely do it this way. Like, okay, well, you know, yeah, start thinking about, what if we limited the number of items in each section? Even if it's like an idea of like lazy loading, right? Like maybe that's a way to go is you've got five and

when you reach a threshold, you know, scrolling through them, maybe I add more if the user did that, but most of the time the user is flying through the list and isn't going all the way over. So maybe I don't need that heavy of an approach on every single vertical item, right? Like there's different ways you can think about doing it. And so.

Allan 53:05

What about a vertical collection view within a vertical collection view?

Jon 53:11

so that falls in the territory of no, don't.

Allan 53:18

know which one's scrolling.

Jon 53:20

Yeah, well, this is the problem, right? If you actually try and do that, like on iOS, if you nest two of those together like that, it's, it's chaos. Like I think it might crash or it might just not work how you want it to. It's.

Allan 53:31

It doesn't crash. tried it once for fun because I had seen it and it was crazy. I was like, can you fix this? No. No. It's got scroll region that's trying to render to some height and it's just like, you can have this space. Good luck reading anything in it. It kind of makes it all squished and well, it's crazy.

Jon 53:37

Yeah. And no, no. It's not fixable. Don't do it. And same goes for like. Yeah. Well, that kind of goes for like scrolling things within scrolling things, right? Like never nest a thing that scrolls within another thing that scrolls of the same orientation. Just don't do it.

Allan 54:00

Don't do it. The web does it all the time though, John.

Jon 54:14

I know. Well, so, but here's the caveat though. The way the web would do it is, I mean, you've got constraints on the size of the thing that scrolls within the thing that scrolls, right? So like in theory, you could put a collection or you could put a scroll view within a scroll view if the inner scroll view has a fixed, you know, height of or size of the direction of scrolling, right?

Allan 54:25

Yeah. I also didn't say that the web did it well because if you've ever hit the point where if you've got an infinite scroll, what happens is you scroll down and it hits that new scroll bar and it starts scrolling through that and you're like, no, no, no, I want to scroll further.

Jon 54:39

Yeah. Yeah, and then you gotta find the right place to like touch just enough to scroll back out of there so you can keep, yeah.

Allan 54:54

And everybody's got those like invisible scroll bars. Now it's not like the old days of the gray ugly thing that's still there. It's got to be pretty and hidden when you're not scrolling. So you're like, bring that stupid thing back up. I want to scroll on the big page. So.

Jon 54:58

Mm -hmm. Yeah. Yeah. Yeah. And, and on the, the, you know, final note of this one is like collection view inside the collection view and also almost the same problem, slightly different, but pretty much the same bindable layouts within, you know, a collection view. Like if, if you're, if you're data binding some virtualized or not virtualized even some list of, you know, things within a list of things, you're, probably asking for a little bit of trouble. So, you know, in this case, like,

The one that I, and I might've said this one on our last episode too. It's like, okay, I have a data template for my collection view. And then I have a bindable vertical stack layout inside that data template because I might want to show one sub item and I might want to show a thousand sub items. Well, you again, first of all, is a thousand, like what's your, what's your actual limit? Like Do you think it's a good experience to show a thousand of them sometimes and one sometimes if you do, then maybe like you're, you're doing the list the wrong way. Like maybe your actual item type is, you know, an item and, and you've got to do a data template selector and figure out like, you know, I have a, I have top level item that has a thousand sub items. Well, maybe I need to kind of figure out how to logically collapse those so that like they're all items, right? But they're different data templates, something like that.

so that I'm recycling, you know, the sub item data template instead of trying to squish it all into one item template. I know it's a lot of item templates. So there's that, right? You could do it that way. But the problem is like, if you're doing bindable layouts, every time the binding context of that cell, that is the parent of them changes, we don't necessarily know what you want to do. So we got to just recreate everything. So if you've got like,

you know, a bindable layout, is showing, I don't know, a bunch of labels and images and stuff in each one of its item templates. We're going to recreate that whole thing. The moment that you change the binding context. So for every new item, you've, you've kind of just taken away your ability to virtualize and like recycle these things, right. in, in a sense, cause you're, you're not saving yourself the view, inflation time, basically.

Allan 57:31

So I have done the Netflix lookalike as a challenge and it was a collection view, virtualized collection view of carousels. Now collection view going up and down carousel was 20 items and I was able to obviously the carousel view needs a you know a width to defined otherwise it's like right so by giving it a height I knew the height the height was the same for every cell. the width was the same for every cell. It didn't have any problems with it. It just kind of did his thing. Yeah.

Jon 58:05

Yeah, and it can be done that way, right? It's more like, and this again, it's not every scenario is going to work the same for you. like at the end of the day, you kind of got to figure out how to help yourself and understand what you're doing so that you know where to look for the problems when you run into them.

Allan 58:25

Well, normally if the collection view is going to be a problem for you, it's when the cell sizing changes because everything changes with it, right? It forces everything else to recalculate. When you're saying this is your place base, that's it. Just do your thing here. It doesn't generally tend to choke. And if it does, it might be one little blip as it loads.

Jon 58:46

You, you might've been okay. Yeah. Yeah. Like you, might've been saved by like part of it is like how things get recycled on the native level. Like for iOS, in the past, we had some, some bigger issues with how data templates were recycled. like you, like you said, if you're not changing the size, like you might, my main thought is okay on your carousel view every time. every time the item, the binding context for the parent data template. So the data template for the vertical scrolling thing, right? Every time that changes, it's going to then change the, the item source on your carousel view. And at that point, essentially recreate all of the cells in that carousel view. Now you might get lucky in the sense that, because like you said, you kept the sizes and stuff the same.

Allan 59:24

Yep. Yeah.

Jon 59:44

that it might have some of those in kind of the recycle bin to pull back out and use and be able to just reuse them. I'm not 100 % sure, but knowing a little bit about how that code is implemented, I suspect you might get performance benefit from that, which is kind of a cool thing.

Allan 1:00:00

And the thing is that we didn't, there wasn't anything other, the occasional blip if you were trying to turbo scroll, but you just don't really do that. Right? So you'd scroll down. Okay. Sometimes you'd see a load. The only problem I ended up having was I had to preload the images in the carousel because the carousel, wouldn't, it wouldn't make the call for the image until the image was viewed. So that was, and I was like, yeah. Okay. Cause I got to go and get it. So all I did was, okay, get the data.

Jon 1:00:07

Yeah. Mmm.

Allan 1:00:28

Start putting there, but start preloading, start forcing all the images to load right in the background. So when it gets there.

Jon 1:00:33

So, cause the images wouldn't load because the cell hadn't appeared yet. So it didn't know to even ask for it. Okay. Yeah.

Allan 1:00:37

Yeah, so didn't know to actually go out and call. So you had to wait for it to call and then the image to load. Now it was usually pretty quick, but you know those product people, they're like, you know, Netflix does it right away. Okay, well, we can do it right away too. We just got to do some extra stuff. No problem.

Jon 1:00:52

Yeah. Yeah. And you know, at the end of the day, I would love for all those scenarios to just work super well out of the box. And that's, that's always the goal, but you know, we're not, that's not the reality.

Allan 1:01:02

Well, FF image loading. just take out an image service, you tell it, here's an image, go preload this, and then when it gets there, it's already, I've seen that URI, here it is, this image is already here, It works great, piece of cake.

Jon 1:01:14

Yeah, exactly. So that's my, that's my, my tale from the crypt.

Allan 1:01:20

your tales from the crypt? All right, well... That was a good one.

Jon 1:01:25

I think that might do it. So you did mention before embed IO. that is our plugin package and product of the week.

Allan 1:01:30

Yes, it's pretty old, but it's still very relevant. It works with newer .NET. Yep. Yeah, it's been fantastic. It's a little...

Jon 1:01:37

And it works fine on Android for you and iOS. What are the rules on iOS around hosting?

Allan 1:01:46

No background, which is fine. Right. This one's going to have a keep alive anyways. Right. Like keep the screen on. Right. Because it's a kiosk. So it doesn't matter. Right. So no big deal. It is what it is. I mean, I don't know if you remember back in the day they used to have those little you you wanted to bring a Web key or a storage. So you turn your phone into a Web server and you could upload and download files.

Jon 1:01:48

Right. Yeah. Okay. Yeah, yeah, kiosk mode the app will always be there, right? Mm

Allan 1:02:14

through just like a website on your phone over Wi -Fi. So that was pretty cool. They don't, you never see those anymore.

Jon 1:02:16

Yeah. Yeah. Yeah, well, some like, yeah, and like emulators you do sometimes, especially on iOS and tvOS, right? Cause they're like, I don't, how was we gonna get the data on there? They just launch a little server and you go to it and upload. Yeah.

Allan 1:02:25

that's... I forgot about that. Yes, the emulators. We're not supposed to talk about those things, though, John Loser.

Jon 1:02:38

They're okay now, right? For iPad. Apple allows them now.

Allan 1:02:41

Well, no, but... to make the games.

Jon 1:02:46

Well, yeah, of course. If you haven't seen like the, think it's Delta is the app. It's like, it's pretty slick. It's pretty nice. I'm waiting for the TVOS one, but I think there was a reason why they haven't gone there yet. I forget the reason, but I was like, that makes sense when I read it, but that'd be great.

Allan 1:02:48

Hey, Yep. Yep. I've just been signing my own for years. I'm still signing my own. I just have to do it every every year. And then when you do it, usually you have to reload the app, which means you have to download all the ROMs to it again. That's so anyhow. Anybody that's thinking about writing an emulator or anything, check out embed IO. I think it's more at the dot net standard level or dot net like base dot net level, so it just works with pretty much everything.

Jon 1:03:08

Yeah, I did that too, but it's such a pain. Ugh, such a pain. Exactly. Yeah.

Allan 1:03:33

I'm using it on Android and iOS successfully right now. It's pretty cool for allowing like a website without interop because interop can be no offense to the web view in Maui, but it's just a difficult thing. But if you can call an API that's right there on the device, you can call native code right there in your API. That's pretty rad.

Jon 1:03:55

Yeah, that's a cool project. It's one of those ones too that I'm like, I almost could expect that to not work on Android or iOS. Like there's so many things that could just have gone wrong and using like the .NET APIs and stuff there because it's just not a scenario that's like well tested or used, I think. But it works.

Allan 1:04:14

I'm not sure if you can open these to to more than local hosts now, like if you can open it up to a Wi Fi network. But that's obviously not my test case. Anyways, I tried it just for this one and I was like, cool. Yeah, this is good. It's good.

Jon 1:04:18

Sure. Yeah, it's nice. All right, well that is the pick of the week. That'll do it this week. Be sure to head to our website, gonemobile .io. We are on YouTube again, sorry again. Like and subscribe. Actually that was one of the other feedback notes is that, I joked about it, right? Like searching Gone Mobile on YouTube and it's like some dude in a van. So somebody had mentioned too, like, it's not really that easy to find the channel. So I added a whole bunch of links to like the website and I went back and added some links to the YouTube video on like the show episodes on the website too. So maybe that'll help our SEO type stuff too, you never know. Maybe we'll actually be seen. So if you're looking for the channel, go to gonmobile .io, the link is on there in a bunch of spots. I'm sure you'll find one of the spots that it's on.

Allan 1:05:21

follow our excrements and then that way you can you can tell that we're what we're doing.

Jon 1:05:24

Yeah, go on the X and the Twitter and the other places if we remember to post them and give us those five star reviews on the Apple podcasts or Spotify or, know, I don't know what all the platforms are these days. Those are the two I know. So take them. All right, we'll see y 'all later. Thanks, Alan. We'll see you listeners next time.

Allan 1:05:41

Nice. Have a everybody.

Download Transcript

Episode Hosts