Xamarin & Firebase: Authentication and Firestore for Xamarin (Plus GitHub & Mobile DevOps) | Eduardo Rosas | Skillshare

Xamarin & Firebase: Authentication and Firestore for Xamarin (Plus GitHub & Mobile DevOps)

Eduardo Rosas, Software Developer. Finance YouTuber.

Xamarin & Firebase: Authentication and Firestore for Xamarin (Plus GitHub & Mobile DevOps)

Eduardo Rosas, Software Developer. Finance YouTuber.

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
42 Lessons (7h 12m)
    • 1. Introduction to the course

      3:25
    • 2. Welcome!

      3:44
    • 3. Initializing a Local Repository

      6:23
    • 4. Commiting Changes to the Local Repository

      8:29
    • 5. Working with Branches: Adding, Switching and Merging

      9:22
    • 6. Remote Repositories with GitHub

      8:11
    • 7. Introduction to Xamarin: How to Get the Tools and What You Will Need.

      4:27
    • 8. Installing the Xamarin Tools on Mac

      4:42
    • 9. Installing the Xamarin Tools on Windows

      4:40
    • 10. The Source code for this Section (available on Github)

      1:59
    • 11. Creating a New Xamarin Project on Visual Studio 2019 (Windows & Mac)

      12:36
    • 12. Introduction to XAML: The Language to Define the UI

      8:47
    • 13. Code Behind: Using C# to Code the Logic for the Application

      10:00
    • 14. Data Binding: Powerful XAML Feature to Enable MVVM

      11:44
    • 15. The INotifyPropertyChanged Interface: Enabling View-ViewModel Communication

      14:14
    • 16. The ObservableCollection<T> Class: The Ideal List for MVVM

      5:45
    • 17. The ICommand Interface: How to React to User Interaction in MVVM

      9:59
    • 18. The Register & Login User Interface

      13:12
    • 19. Configuring our iOS App to use Firebase

      10:55
    • 20. Configuring our Android App to use Firebase

      5:19
    • 21. An Interface to Enable Dependency Services for Multiplatform Firebase Code

      11:32
    • 22. The Android-Specific Implementation of Firebase Authentication

      14:16
    • 23. The iOS-Specific Implementation of Firebase Authentication

      12:45
    • 24. Using the Platform-Specific Implementation in Shared Code

      25:58
    • 25. The App's Navigation: Adding the List and the "Add New" Page

      16:11
    • 26. Cloud Firestore Setup & Dependency Services Interface

      11:21
    • 27. Inserting to the Cloud Firestore Database (Adding Documents to the Collection)

      16:42
    • 28. Testing the Insert Functionality on Android and iOS Devices

      17:26
    • 29. Creating a ListView to List the Subscriptions

      13:52
    • 30. The iOS Implementation for Reading Cloud Firestore Documents

      17:29
    • 31. The Android Implementation for Reading Cloud Firestore Documents

      18:12
    • 32. Creating and Navigating to a Details Page

      22:01
    • 33. Updating Cloud Firestore Documents

      13:59
    • 34. Deleting Cloud Firestore Documents

      5:58
    • 35. Introduction to App Center: A Tool for Mobile DevOps

      3:42
    • 36. Creating Android and iOS App Center Apps from Github

      8:43
    • 37. Enabling Automatic Builds (Continuous Integration) in App Center

      8:54
    • 38. Sign Android Builds to Enable Distribution

      6:40
    • 39. Sign iOS Builds to Enable Distribution

      9:39
    • 40. Continuous Delivery to Distribution Groups

      9:08
    • 41. Installing the Android and iOS Apps on our Users' Devices

      8:45
    • 42. Congratulations!

      1:12
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

65

Students

--

Projects

About This Class

2dd4cc69

Welcome to the Xamarin & Firebase: Authentication and Firestore for Xamarin course, in which you will learn to Create Android and iOS Apps that use Firebase Authentication and Cloud Firestore Services, and use Mobile DevOps (CI/CD)

I created this course because Mobile App Development is about so much more than just learning a language or a tool such as Xamarin.

  • It is about working in teams and have source control in your projects

  • Working with authentication services

  • Working with databases

  • It is also about delivering your app to your users, preferably automatically

Which is why I have created this course, which covers all of this and more. In this course, you will learn

  1. The basics of Git & Github for version control

  2. The basics of Xamarin Forms so you create native apps that share C# and XAML code

  3. Powerful Xamarin Forms features such as Data Binding and Dependency Services

    1. Data Binding so that you use the MVVM architectural pattern

    2. Dependency Services so that you implement platform-specific code and use it in the shared code

  4. Firebase authentication for registering and authenticating users with email and passwords

  5. Cloud Firestore for real-time databases in the cloud

  6. The basics of App Center so that you implement Continuous Integration and Continuous Delivery in your development process

    1. CI so that you create automatic —signed— builds of your code when you push new commits to Github

    2. CD so that you distribute the signed builds automatically to your users.

With 7+ hours of HD video, you will learn the step-by-step process of using each of these tools in your Xamarin development process.

By the end of this course, you will not only feel more comfortable using Xamarin to develop Android and iOS apps, but you will also have a complete arsenal of tools under your belt!

Don't waste your time

Don't waste your time looking through the entire internet for all the things you need to learn, spending weeks learning a tool just to figure out that there is another tool to learn. This course is designed to be self-contained so that everything that you need to know about developing Xamarin applications is here.

Why you should pick this course among many others?

This course is unique in the way that it covers so many tools individually. Sure if you watch the entire course you will learn all of them, but if right now you only want to learn one, you can do that too! And when you are ready to learn another tool, there is no need for you to go looking for another course, this one already covers it! Learn how to use Git and GitHub with your Xamarin apps, then how to create powerful Xamarin Forms apps with MVVM, then how to use Firebase Authentication, then how to use Cloud Firestore databases, and finally how to use Mobile DevOps with App Center, or one topic at the time! It is all in here.

See you inside!

Meet Your Teacher

Teacher Profile Image

Eduardo Rosas

Software Developer. Finance YouTuber.

Teacher

I am a Software Engineer and Xamarin-Certified Mobile Developer.

I have been developing mobile apps for 7 years now, I started when iOS 5 had just been released!

During this years I have created apps for clients, both for private use and for public use. I have created some apps that I wanted to release to the app stores, and have created a lot of apps just for fun. The main platform I use is Xamarin, so I can code Android, Windows, iOS and macOS apps using my favorite language: C#.

I have helped literally thousands of students to learn how to code, both online and in-person, and it has become my passion.

I also love to design apps, whenever I get a little bit (or a lot) stressed when coding, I design apps, either out-of-the-blue concepts, or the next app... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. Introduction to the course: Hi. I am very excited to see that you're interested in taking occurs on Samarie in with far base, whether you're new to someone or not definitely these currencies for you because not only in the skirts are we going to be covering the basics of some rain, some very powerful features off Samrin and fire base. But it is designed to be self contained so that everything that you need to learn to create amazing salmon applications with fire base east instead of whiskers. So, for example, if you're new to Samrin, you can take this salmon section in which you're going to learn the basics of it, how to define interfaces with Sammo and defined a logic for those interfaces with C sharp. You will also learn how to implement the M V P M architectural pattern so that you feel comfortable throughout the rest of the curse. After that, we're going to cover two very important services from fire base authentication and cloud faster. That means that throughout two different sections, you're going to learn how to raised her and indicate your users with email and passwords, as so many applications do. You will also be implementing riel time databases so you can insert, read, update and delete from that database that exists in the cloud. But that isn't it. Because developing applications is not just about creating the functionality connecting databases and authenticating users, it is about so much more that goes beyond the idea itself. For example, you want to have source control so that you have the versions, all of your application, very well organized. And you eventually also want to distribute to your users, preferably automatically, which is why one of the sections of this girl's isn't get and get hub so you learn how to commit changes, creates branches, merced them on Bush, a local repository over to the cloud. And finally, another section by the end of the curse is about mobile develops with a tool called AB center, which will allow you to implement continues integration and continues delivery. That means that without further interaction from your part, the developer absent there will be able to automatically generates new builds off. The new versions that you have, and those builds can be automatically signed as well, and when those bills are signed, it means that your users can install those bills, which, by the way, leads to continue delivery, which means that app center again automatically, without any further interaction from you. The developer he's going to grab that signed bill, the A, P K or the I P A file and distributed automatically. But even better, if you don't want to learn one of these tools, do you need to? Because each and every one of these sections is the sign to be self contained so that if you don't want to learn, get her. You don't really need to learn that If you just want to implement firebase or if you don't want to implements Mobile develops, you don't have to. If you want to learn the basics and the powerful tools of salmon forms, However, I do believe that with everything that you can learn with this curse, you're going to cap a lot of amazing tools on their belts so that you can become an amazing mobile developer. I hope to see you inside 2. Welcome!: Hello and welcome to these samurai and close firebase cars. My name is Laura Rosa's, and I am going to be your instructor throughout intact Er's. I want, first of all, to thank you for enrolling in discovers. I can assure you that you're going to learn out loads now. I have been developing seven applications for years, and even before developing seven applications, I developed Windows applications back when Windows seven was being released. That was a long time ago, bought throughout all these years, I have had to learn many different tools through many different, Kerr says. Many different research says. And so what I wanted to achieve with this kers discreet one that I myself would have loved to have had back when I first started developing seven applications and mobile applications in general. So that is why, throughout this girl's, you're going to learn three tools in addition to salmon itself. So for those of you who are not entirely familiar with search control and with someone itself, I have two full sections for you to learn, get and get how first. So you can have search control, which is super important for you to use throughout the entire development process and, of course, the basics of salmon so that you feel comfortable moving forward throughout the rest of the curse. So you're going to start by learning things like committing changes, creating branches and pushing those branches. Words who are remote gets repository accosted by get home. You're also going to learn the basics of Samrin like Samel and see sharp through code behind, of course, but also the basics of the TV and pattern, which means that you will be implementing some very powerful interfaces, such as the anger defined property changed interface, so that the view can automatically update the code and the other way around. I command so that you can react to clicks or two different events directly from the logic and not from the view and many more things. And they were going to dive right in into a couple of very important firebase functionalities, the 1st 1 being authentication. You're going to learn how to register and low your users and and then fire store, which is a real time database. They will allow you to, of course, insured. Deletes update and read data from your databases. All of these, of course, is going to be implemented on both Android and IOS. Both I didn't want it occurs to end there because yeah, you have to develop your applications, but you also have to distribute them. So the last section is about continuous integration and continues delivery being able to in the cloud or a magically generate signs builds that are ready to be distributed to your users. That is why, in addition to far base and give up and summer in, you're going to learn. Absent er, how do you stop center to again? Automatically Trigger builds in the cloud that are, by the way, going to be signed and distributed to your users without you really having to do anything. All you have to do is Bush Your code toe are a mold repository. That is why you're going to learn and get her, by the way, and that center is going to handle everything else is going to build your project. It is going to sign the bills and it is going to be distributing those bills all automatically. So I hope that you are really excited to start this curse and I really, really hope that you take advantage of it and learn a lot in each and every one of the sections. Both enough Talking enough of my face lets you birds and next section and really, really start getting our hands dirty by learning gets and get hub. 3. Initializing a Local Repository: So in the previous section, they mentioned how he said they were going to be using, get and get have throughout the Attackers. We're going to use get Huff mainly for you to easily access a code that we're going to be creating throughout. The Cure's also to access the issues that may arise once occurs, is published. Because, of course I am human and make mistakes. You'll probably find one mistake somewhere. It is easier for you to find the updated code on get help, Dan. And most importantly, get heart is going to be crucial for Rose to work on the last section of this occurs in which we're going to learn how we can distribute our application. So because of that, these section exists a section for those of you who are not familiar at all with gets or would get help. For those of you who are feel free to skip this section and tally, jump over to the next one bought for deserve you who, Ahrens, I do want to get you up to speed. We're going to cover the very basics of Get and get Hub, starting right here on the terminal with GIF So why the terminal get is actually going to be available through visual studio itself? Bald. I really feel that the terminal is a better way to interact with get. And I know how. These can be a little bit daunting for those of you who don't use the terminal often. But let me tell you, it's going to be very easy to use. Get right here. So the only thing that we're going to be doing right now he's greet get repository. Like I mentioned in the produce section, it is going to be that repository that contains the versions off our code that we have committed. And for that I will start by listing all of the folders right here after opening the terminal on my computer. Now producer view on Windows. You're going to have to do this from the get temporal that he's a terminal reticence told with get itself produce of you and Mac producer view on Lenox. It is likely almost 100% sure that you already have and get for those of you on windows, that is not necessarily the case, so you will have to come to get dash SCM dot com. Four slash downloads Off course clicking windows are It's your case, Micro Meso Lennox, in case you need it on, download their latest source release. Now, this is going to be fairly straightforward. Often insulation, Once you have it, own windows. You're going to find the get terminal where you will be able to use these commands because normally in windows you use there the i r instead of s and there are a few differences. But once you are there and, of course, feel free to pause the video. If you are in marriages, yet you will be able to least all of the folders and files inside of the main directory using alas, and what we want to do now is navigate to a place instead of our computer, where we want to greet a folder that is going to contain our entire project. Eventually, visual studio is going to do that for ALS. Visual studio is going to create a project somewhere in our computer and hold the entire product. But for now, let me just focus on create and you folder from the temporal and then initialized get repository. So I want my project to exists inside of my projects folder. So I will have to see d into that projects folder, and this is just changed directory. So I want to change directory to the Projects folder and noticed that in my terminal I can notice that I am now instead of the Projects folder and again, I can list everything that he's inside here and I can see a bondage of projects that I have worked on. So I want to create a new one right here again. Usually you will do this through visual studio. You can create a new project and select where it is going to be saved. You can select these directory as well, but let me just greed a folder using the terminal. And for that I have to do is execute em que there for make directory. And I'm going to call this and get example. And now if I at least the projects again, I am going to find that there is a new Geats example folder so I can change directory into that new get example folder. And of course, in here there is nothing I haven't greeted anything inside of these folder. It is at this point, Once the project is created in this case, so far only the folder that you want to initialize get so that any change that you make within this folder and he changed that you make to any file or any directory inside of these folder can be tracked on DSO. What I am going to do is simply execute. Get in it and get in it. It's going to initialize an empty get repository in this directory. In fact, if you were to execute, ls you will still see nothing. But if you were to execute L s dash A So everything is shown, you're going to see a new dot get folder. This is actually a folder where get were this repository He's going to contain off its files. Now we are ready to start tracking versions off our Koth through get because the repository has been initialized. Now, of course, so far we have no files to drag at all. But that is what we're going to be doing in the next lecture. We're going to be creating new files and we're going to start tracking the versions off those files using it 4. Commiting Changes to the Local Repository: so far, we have a really greeted a new folder somewhere instead of our computer. We have also initialized get inside of that folder and we found that if we execute ls that a We have these new dog get folder, which means that we are ready to start tracking versions of our code. But so far we have no coath at all. Now, I don't want to greet a new visual studio submarine project in here just yet. All I want to do is show you how I said that you would track changes. So what I'm going to do is just greet a simple txt filing here. Now, do that. I can actually execute open space and daunt to open the current directory on my final explorer. And here, just greed a new file in which you're away. You find best again at the moment we are going to be using at txt file Nothing fancy just yet, and again with whatever program you have, installing it on your computer and what I want to do ease adit days file, of course, and start adding some content. So let's say that these ease the title, I'm going to save the changes. Sure, I hear on my editor. I have saved the changes. Now, if I go back to the terminal, I will be able to execute and get status and get the statues. Is now going to be aware off that new file. So it means, Dad, the reason new version off Aren't Koth Horan thes gays? Just the content off the folder to be committed to be tracked by get And so every single time that you have new changes and you can find them in thes way by executing gets stances . You can start by executing, gets and and passing the name off the file that you want to add. So as soon as we add this to get it is now on staged file. The fact that it is and staged file doesn't mean that we have a new version already committed to get. But there is a new version ready to be committed. Let me show you something through this example makes perfect sense right now. I have already staged a first version off the example dot txt file, which so far only contains this is the title. But if I come back here to the text editor and add these. Ease the content and safe it changes. If I go back to the terminal and execute get status again. I am going to see two different versions off example dot txt one which is staged the staged version off the example The TXT file Remember, Onley contains the title But then there is these new version of the example dot txt file that already contains the content. So there are a couple of versions in here. If I were to commit the changes right now Onley this staged version will be committed, not the new changes just yet. So if I want these changes to be part of the commit, I will have to execute, get at example dot txt again. And this time, if I execute, get status, I only see one version the one that it's a staged ready to recommit it, which now contains the entire code. And finally, what weaken dune ones that we have. All of these changes staged is commit them. So all we have to do to do that is execute get commit Now, every single time that we execute, get commit, we have to pass a message inside of the ball quotes the comment or the name for desk. Um, it in which, of course, normally you want to describe wants is it that these change did? What is it that you have added or removed between these case? Let me just commit by setting the message to ath example dot txt press enter. And now these has been committed. This is our first get commits. And if we execute, get status again, we see that there is nothing to commit. The working tree is clean Now, if we were to execute and get the law, we're going to be able to see the history off. All of that commits, and you will find a commit that I have jobs created these one right here that I, of course myself created in these particular date with these particular text to this particular branch. Now hold on. Want is that branch? We're going to talk about branches in the next lecture. For now, I want you to notice that days is how you will find the entire get history. Now, before we move forward, the Reese at Chan's that these failed for you or that you're seeing a bids, more text every single time you execute, get commands and Dad's may be related to defy that. So far, we have no identify her for ourselves with gets the reasonable name. And there is no email now. Sometimes GID can actually provide with some default values that you can actually execute all of this commands. Sometimes it can't. So what you have to make sure off is that you provide to get information about yourself. If you were to execute, get come fact, that's dash list that's does show dash origin. That's quite a mouthful. You're going to see all of the gate configurations, which are a lot, ah, lot off them. And if you use your arrow keys to navigate somewhere around this, get configurations, you're going to find you, sir, That name and yusor adult email. These are, of course, those that give uses to identify whoever ease committing to a repository. So you were able to see when they executed in geared law that the author contains both of those values, the name and the email. But if you hadn't set those just yet, you either wouldn't be able to commit or get is using some random default information here . So what you want to do? Ease right here from the terminal. Execute, Engage Comfort Dash, Dash and Globo User The name, which is one of the configurations that were setting you, sir, That name in space and instead of all quotes your name and then get conficker Does that global yusor daughter email And this one not instead of all quotes, for some reason And just have your email address now the next time that you execute get config dash dash list That's that show that's origin. You're going to find those settings well, already set. So this time you would be able to execute off those gate commits. And by the way, to get out of this last, all you have to do is press Q on your keyboard. So in case you were having some issues when committing perhaps these waas and the issue that you needed to resolve, let's now jump to the next lecture and start working with branches 5. Working with Branches: Adding, Switching and Merging: Now let's say that you want to have that from versions of your code, one version that is ready for you to distribute your users. One version that is only for your testers. One version only for developers. Well, if you wanted to have those versions just bag commands, it would be very difficult, because each of those versions may have their own commits. Now, While each commit does mean that there is a new version of your code, it doesn't necessarily work to have the from versions off the entire project. There is where branches come in so you can have a branch with its own commence its own version of the code, and another with some different, commits its own different version. And of course, eventually you can merge them together. So, for example, that say that you have a branch for developers and the branch for testers. While developers work on adding a new feature, the testers don't need to see that code. It is only when developers are ready for testers to test the prospect that they may merge their branch into the testers branch, and the same goes for a branch for developers and the branch for users. You don't want your users to receive any version of your code that hasn't been fully tested . So tester skin test the code on their own branch. And eventually, once they're ready to release Merce into the user's branch, and we'll talk about how is it that you can distribute the code from the user's branch later in the last section of the scars? But for now, let's have an introduction. Do how you can work with branches right here in the terminal. So we actually have already committed to one branch by default whenever we initialize the new repository. There is a new master branch now because of the way I have configured my terminal, I said, Right here we can always find it by executing Get branch and you will see a list of all of the branches that accessed within the current repository. And, of course, by default, Therese always won the master branch. So, in fact, everything that we have committed so far has been committed directly to that branch. How do we create a new branch? How is it that we can merge that new branch into master again is something that We're going to quickly take a look in thes lecture. So let's start by creating a new branch for there. You have to execute. Indeed, check out Dash B and the name off the branch. Now, check out this Actually at get commander works for many things, but using the dash being here means that we're going to be checking out our codes to a new branch. If we don't add the dash B, we would be checking out to an existing branch both. Since there is only one, we have to have this one and the name of the branch that I'm going to be using right now. He's just going to be branch to now. At this point, a new branch wants created. We switched over to that branch as you can also see here in my terminal or by executing get branch, you will notice and asked risks to the left off. The current French and brunch to is actually a copy. All the master branch. It is a copy off that branch because we wear inside of Master when we created branch to If we were to greet branch tree from branch to Branch three would be a copy off branch to Hopefully, Daddy's not too complicated, but how is it that we start working with branches? Well, we can make changes and committed changes, just as we did before. If I were to come back to my file. These is actually the version that exists inside of brunch, too, because that is the version that get he's making available so through the finder through the final Explorer. What we currently see ease the contents off branch too. So if I were to answer more coding here or somewhere text that say that this is some or text or whatever, just save the changes, go back to the terminal, execute and get status. We, of course, see those changes we can execute get at example to have those changes and get commit dash am new changes to commit the changes and everything east. Now, instead of branch to if we execute get law, we indeed see that the first commit was made inside of master, but the second commit he's being made inside of branch to So if we were to navigate back to master, we wouldn't see this new commit and hands we wouldn't have those new changes. So let me go ahead and do that. I am going to check out, get check out again, but this time to an existing branch master. Now, the version that is available to the fine explorer to the entire system is the one that exists within master. Which means that if I closed the editor because the editor has some memory and reopened the file, I now on Lea si the text that exists within master, not Jet that which access within branch to it isn't lost. It is just not currently active. But if we get a check out back to branch to which already exist so we don't need that that should be commended and again closed these editor because it has some memory and reopen the file. We see the content. It's is still there. We just changed the version that waas active. So Okay, that is how we can commit to different branches and have different branches switch between them. But how? He said that we merge branch to into Master if we are now ready for master to contain the entire version. Well, for that first we can to check out back to master back to that branch that is going to receive all of those changes from another one. And finally just execute Geet, merge and pass the name off the branch that we want to merge into the current branch in this case Branch to and we see that there were some insertions and some delish ins instead of these one file. And if we execute and get long, we see that both master and branch to have these new changes commit, which means that if we reopen this file even though we are inside of master now, we now see these texts as well. So, finally, because we have already merged branch doing to Master and the master contains the exact same code, there is no longer I use for branch too, so we could delete it. You could, of course, have many branches and in fact you may want to have more than one branch active at the time . But right now we have no use for branch to anymore. So because we know that branch to is fully merged into master, all of its gold already exist. Instead of master, we can delete it. And for that So we have to do is execute kids Branch Dash D for delete and well used branch to off course branch two watts elite it And if we execute, get branch again We only see Master so excellent we now have the basics off gets We now know how to commit how to stage, how to greed new branches Switch between them Merge one into another These is more than enough about geared that you need to move forward with occurs However, the reason additional tool that I want to present to you which is get up. So in the next lecture we're going to take these local repository and publish it on a new remote repository which is going to be still get repository today is going to be hosted by it hub. 6. Remote Repositories with GitHub: So we have these local repository and it is very useful to have gets bought because we're going to eventually need a remote repository for us to be able to share that code easily and easily distributed to our users. We're going to need get up, which is like a remote get host. A server that can contain get repositories born. Of course, it has some features off its own. We're going to weekly Take a look at those features the ones that were mainly going to be using. But most importantly, we're going to get our local repository over to a remote repository hosted blanket hub. It's everything stars right here on Get hub. Don't come. And of course, if you don't have an account, just dance. It is going to be very easy for you to set. I used her name and email and password right here. But eventually, once you are able to signing with your new account, you're going to see something absolutely different than this because you may not have some recent activity here. No repositories Over here, board somewhere inside here you will find a new bottom way to allow you to greed any repository and what we're going to be doing right now he's just a bloating that single txt file that we create it. So this repository name Dawson's matter, We can just do something like it. Example this apparently East available instead of my account. No need for description. I am going to make this private because there is no use making this boat like no one is going to learn anything from that txt file and just go down and create the repository. By the way, don't worry. If you don't see these section right here, even if you don't see any repository templates over here, that's OK. That is expected. That is no really necessary either. Celestial screed repository. And here we go. We have a new repository before exploring Get hub. I do want to upload the local repository here, and in fact, we see the entire code that we need to execute right here to push an existing repository from the command line, which we do have. We have an existing repository and in fact knew is that we have something very similar to what we created over here. We greeted a file not using echo and it wasn't gold read meat or m D. But we created Maxxim. We initialized get we added Earth that txt file and we committed it. We've even done some extra things after committing that. But now if we want Dad's local repository here, we need to execute these couple of commands. So I am going to grab the Eurail that is over here. The https. Your l never get back to my terminal. Make sure that I am steel inside of them. Repository and execute gets remote at the origin. Origin in here, by the way, can be something different. It is just a name that is going to help you identify this particular remote. The origin is simply the most common used name. Forget covering modes. But you could change this definitely. And just based that give your l. And now you're going to have that remote. All there is not forced to do is spoons. The changes from here from the local repository over its to that new gets remote repository and as you were able to see back and get heart can be achieved by executing Gate Bush origin, which is the destination and master, which is the name of the branch that we want to push. Of course, we have more than one remote. We can change this. If we have more than one branch, we can change this. But this is the thing that we need right now. Now, by the way, it will seem Get help that they are adding these dash you flat. That is going to be very helpful that you is going to set these remote and its new master branch as the upstream for the local master branch. The upstream just means that the next time that we have to push changes from the local repository to the remote, we don't have to specify over and over the destination and the branch. So if we said that you and we execute this, of course the local repository will be boost over to the remote. And we can confirm that by never getting back to get, have reloading the page and noticing dies. Our file is right there with all of its incredible content bonds. Also, if we never get back to the terminal, you will see that the branch master was set up to track the remote master branch from origin. So indeed, we now have a master branch over on the remote as well. And our local branch is going to be tracking it, which simply means that if we execute and get Bush again, if we have any changes to Bush, we can actually execute it. Just like this. We are having to establish Origen Master And in fact, if we execute, get pool which is the other way around getting changes from the remote to the local repository again, we wouldn't need to establish Origin master either. So this is how you push your local repository to the remote repository for really straightforward and notice that here on get hub, you still have the same get commence. The couple of commits that we added the branch that we create it. And of course, as we have already seen that txt file. But notice that there are way more things here. You can, for example, at contributors you can add issues, so if you find some issue with your code, you can keep track of those right here you can create pull requests which, because get have is tailored to working with teams. It is a better way of doing merges mergers between branches because, of course, you want the entire team to be aware of that and approve that merging. So there is an additional protection to the merging of branches through pull requests. And you know there are actions are projects, so you can keep track of how you're progressing when developing an application. And the more important things that were going to be using are those issues does pull requests and some settings over here to the right, we will be able to work with protection for branches in here. Eventually we're going to see in the last section of how we have some integrations and services in here. But so far, I don't want you to get overwhelmed. Get how is simply, get Honda Cloud so you'll be able to create commits directly from here. If you want to create files, upload files, create branches, merged them together and so on. In addition, you'll be able to list some issues and have those pull requests. So hopefully this section has been useful for those of you who were new to get and get Hub and waas enough to get you up to speed with what we're going to be using from get and get half throughout the curse. Now in the next section, we're going to take a look at the basics of Samrin For those of you who are new to summary in just like this section that is optional. For those of you who are pretty familiar with a tool volition, forward to the next section and start talking about how you can define the interface for your summary and applications. 7. Introduction to Xamarin: How to Get the Tools and What You Will Need.: So just like in the preview section, we covered the basics of gets and get hub produce of you who are familiar with those tools in this section. We're going to cover the basics off Semoran. Now, I assume that most of you have at least some familiarity with a tool because these curses actually for dose of you who are already using summer in and only want to implement fire baseball just a these curves can be as standalone occurs without the need for you to learn summering somewhere else. I wanted to include this section on the very basics off Samrin. Now, if you already have some experience with summer and feel free to skip this section entirely on, jump over to the next one to fully start working with firebase implementing look and functionality. However, for those of you who are new to the tool, we're going to start by installing visual studio, which is that the idea that we're going to be using and from the rising ourselves way, the summer in project. We're not going to be coding any fancy thing in this section. We are just going to familiarize ourselves now. I do want you to know that you can work on summary applications on both Windows and Mac. However, for those of you who do not have a Mac computer, you unfortunately won't be able to wrong your application on an IOS device because for that , you actually need a Mac because the simulators would wrong on that system. Even if you have a NYRA's of ice, you still need a Mac. And in the last section of discussing which we're going to be distributing or application, we are also going to be needing a Mac. So in case you do not have a Mac, I want to present to you a tool that could be quite useful. Now, of course, this is optional. This is, of course, not sponsored. I'm not selling you this tool. It is just an option that you have. So you don't have to actually buy a Mac. So Mac in Cloud will allow you to have access to a Mac computer. That, of course, he's hosted in the cloud bone that will allow you to welts as your application on IRA simulator and eventually create some keys, some specific files that we need a Mac to create to be able to distribute application. In fact, Mackin Cloud itself promotes itself. Thus, a visual studio for Mac Gross Platform and Development Tool s you can see right here directly for some rain again is not necessary. In fact, most of the code that we're going to be creating throughout occurs is going to work for both Android and IOS. So in some of the cases, you will be able to assume that the Irish version of your application works if it works on Android, but just something to keep in mind. Of course, the best thing would be to have a Mac computer available so you can actually test the iris version either through making clouds or you borrow one from a friend from your university from your work. Or just purchase one, I guess both. Anyway, let's get started by installing visual studio on either Windows or Mac. No matter what system you have, you will be able to install official a studio directly from visual studio dot Microsoft dot Come once you are here. As you can see, you have the download visual studio Bolton for Windows. And of course, they're free. Community Edition is going to be more than enough And the download visual studio for Mac Option as well now, because I am on Mac right here. I have to select this one. Now I'm going to walk you through the steps needed for you to install visual studio on both Mac and Windows in the next couple of lectures. Just make sure that you first down will the installer from Dad, visual student of Microsoft that come wet bays and jump over to the video that suits your needs. In the next video, I'm going to recovering installation in visual studio for Mac as I've just downloaded file , but also in the lecture. After that, we're going to be covering visual studio on Windows. So whatever system you're using, jump over to that video. Feel free to skip the other one. If you're not going to be installing for a particular system 8. Installing the Xamarin Tools on Mac: right. So let's install all the tools that we're going to need to develop salmon applications. Owner Mac Computer. Now you may be wondering why the heck a mine on the APP store on the Mac App store? And the thing is that before we go ahead and install visual studio that will have unloaded in the previous lecture, we're going to have to find X Code right here on the Mac APP store, and we're going to download it because X Code is the tool that will also install the iris as the K, which, of course, we need. So, of course I have already installed X Code bought. You're definitely going to need a few minutes to install it because a C turn south, it is almost eight gigabytes. So it's definitely going to take a while least, in my case, with my Internet speeds. It took a while. Make sure that you doing stole X gold and lunch yet the first time once it has been downloaded because it is going to show you these message that X Code needs to install some additional required components. So make sure that you do click on install so that All of the tools needed for iris development are on your computer and on Lee. Once you have installed off those things, are you going to now be able to open the visuals to installer? Well, you could have opened it before, but I really recommend you install exclude first. Or you may run into some issues ones you install visual studio or a view install visual studio before installing X Code. So let's just leave excluding selling off those components and jump over to do visual studio installer. All right, so let's cover installing Visual Studio four back and enabling all the suffering tools that we're going to need. So after downloading the installer directly from visual studio that Microsoft that come and clicking on the file, you're going to see these window up here. All you have to do is double clicking days. Install a visual studio for Mac. I can, and you're going to see your Mac start toe work in the installation. After a couple of seconds, you should see these visual studio for making Stoller pop up. Of course, Hogan clicking continue here to begin the installation. Now, in my case, I have already installed all of the tools. Your computer. Of course, these may not be the case, so just make sure that you select dot net core android and IOS add the very least now a summary and also as you do develop for Mac OS, But we're not going to be covering that in. These cars were not going to be using the Mac OS version, So just make sure that you install these three targets doesn't core Android and IOS directly from your Mac. You're going to be able to develop for both platforms android and IOS. Now, you also have this option down below gold stammering workbooks. This is a very interesting tool for you to test some Semmering code or even creates from the comment ation, maybe some well war books about something that you're learning. So if you want to explore a little bit more about summering world books, I think that these can be a very helpful tool for you, too. Can, like, have some notebook about a particular subject that you may learn throughout this occurs. We are not going to be covering the usage of summary in workbooks in these currents boats. If that is something that you want to take a look at. Make sure that you also install the tool from here. Eventually, you will just click on install. Apparently, I have a couple of updates in here, so I will just click on install updates. But after a few minutes off course, depending on your Internet speed and how fast your computer can install all those things, you should see everything ready and visual Studio shoot open now. Visual studio for Mac, as I have right here is going to be the only i d e that we use. Although we have Joe since told X Code, we're not really going to be using it. We only open it that first time. From now on, we're going to be using visual studio for Mac and visual studio for Mac on Lee. So in this electoral installs the tools on Mac. If you're going to be working with Windows as well in the next lecture, Win stole the tools there. But if not, feel free to skip the next lecture and jump over to the next one 9. Installing the Xamarin Tools on Windows: so you're going to be insulting visual The studio on your Windows computer. Now do keep in mind, as I said that if you do not install the tools on a Mac computer, if you did not have my computer, you won't be able to develop for IOS or at least test and and distribute older. Of course, your code is going to work there as well, but definitely tried to at least test it on a computer that you borrow. But anyway, let's go ahead and stole the tools here in Visual Studio 2019. So I have here the visual studio installer and I already have visuals to installed on this computer. I do have an update available. I have 16.3 point 10 16.4 point five is available at the moment of recording these video bought when you will likely see he's as green similar to this one after selecting to install visual studio to the 19 whether it be the community edition, the professional or the enterprise, and when I want you to select easy option available down below in the Mobile Plus gaming section where you will find mobile development with dot net. This is the option that you are going to need now. There are many more options in here. Definitely the visual studio 3 19 for Windows in Stoller. He's a bit more road bossed than the one for Mac. But, Dad, easy on Lee. One that you're going to need unless you also want to develop for Windows. So universal Windows platform applications that run on Windows 10 are coded. We'd samel and C sharp the exact same technology that we're going to be using for Samrin. So, in fact, you can share the code from your summary application to a you WP application. So just in case you want to develop for IOS and Android with some rain and for windows with you, Dolly P, make sure that you select this option right here as well. No, this Sorry. We're not going to recovering windows from these cars bought The option is right there. There are also some individual components, Dad, you may want to consider so somewhere along these huge list inside of the development activities section, you're going to have a couple of options that I do recommend some rain, of course, and a summary re moated simulator. This one. For those of you who do have a Mac available or going to rent one in Mackin Cloud so you can actually see the IOS simulator on your windows computer it is. It's still going to be running on. The Mac body will see the window directly in here. Now, another option that you could install either Samarie workbooks. We are not going to be using its bought in case you do want to make the research on how so many were books work. This is actually a very good tool for you to document. Whatever you're going to be learning throughout occurs. So someone in war books is going to allow you to create some sort of notebooks with some marine code for you to save, like a simple filed on an entire project. So you can easily document the things that you're going to be learning and all the way down below, you're going to find a few more options. Eve, you do want to develop for Windows. Stand here. Some s a case that you can stall but down low on the own particularized section, the get hub extension for visual studio is also one that I recommend we are going to be using. Get half that while the cure's so in case you want to use it directly from the I. D. These ease the extension to install Now, most of the time we're going to be using the terminal bolts. Nevertheless, the option is right there. Finally, some language packs, and here I have both English and Spanish is told. Feel free, of course, to install whatever other language you may need. But once we have selected everything that you need, simply click on Install over here, Teoh bottom right scenes. I am making no changes. I'm just going to click on close, but I am going to have to update my visual studio version once the installation is complete , of course. Elation over to the next lecture and start working with Samuel 10. The Source code for this Section (available on Github): Now let me briefly talk about where I said that you will be able to get the source code for the curse is starting. Of course, with a project that we're going to be creating right in the next lecture, the entire source code is going to be instead of these get help repository. So, like I mentioned at the beginning of the cure's learning it hub or knowing it have is going to be very useful because one you're going to have access to the code directly from here. And if you ever find any issue, it is going to be very easy for you to grease and you issued directly into this repository , and I can update it a little bit easier. So anyway, you're going to be able to never get over to get a hub dot com forced last la loco four slash sam fire That's in summary Empire Base. Underscore example. And here you're going to find the code for the rest of these particular section with the example project that that we're going to be creating, and you're going to find branches for each and every one of the lectures in which we actually code something. So, for example, right now, I already have a couple of branches for the lectures that come after these one. So if you want to take a look at the code as it is at the end of a particular lecture, you can jump over to that particular branch. For example, a couple of lectures. From now we're going to be talking about Samuel. And so you're going to find Osama Branch soju. Simply select it and you're going to have access to the code as it was by the end off that lecture. So just a quick lecturing here to explain how he said that you would be able to access a code for the section again. Get help that going for worst last la loco for flash sand fire Underscore example. You can, of course, always fork these repositories. There you have it on your own. Get her account. Let's now jump over to the next lecture and create the project. 11. Creating a New Xamarin Project on Visual Studio 2019 (Windows & Mac): Now that we have got a visual studio 2019 installed on both a Mac system and Windows operating system, it is time for us to get started with summary. So in these lecture, we're going to start by creating the project. Of course, we're going to explore the options that we have Wayne creating it from both Mac and Windows and exploring how a summary in project ease conformed. So I want to start right here in visual studio for Mac. But in just a couple of minutes, I'm going to show you how to create a submarine projects from Windows as well. So just in a single lecture, I'm going to cover them both because the creation process is going to be fairly easy. All we have to doing here in visual instituting and team for Mac is Glick on new go to multi platform select AB and in here we're going to have some samarie informs options. Now. You also have some native sovereign options, so this is a different flavor of suffering that is going to allow you to more easily use native libraries. But summer informs is pretty much the used technology. Nowadays, you can also use whatever you can do with Native, you could do with some reforms, and it's just easier to create. Summer informs applications, so that is what we're going to be using. And while you have many different templates in here, I usually like to start with a blank forms application. This way we start from scratch and everything that we boots inside of the application. It's actually something that we added ourselves, so we know exactly one week after on. So I'm simply going to select blank forms AB click on next and said a name. This is going to be a quick example. We're not really going to be coating the application that we're going to be using throughout the Kurds just yet. This is just a quick example to get us up to speed. When it comes to suffering forms, notice that you can greet the organisation, identify her. It is very important for you to use a unique domain here, reverse domain so that eventually the ABS identify there is also unique in the case off macro as we have the option to greet applications for both Android and IRS, and we also can select between .net standard and shared library for the shared code strategy. We are really, always going to be using Darknet standard. In fact, you're going to notice Sure, the library is no longer an option in visual studio on Windows. So sympathetic, dominant, standard shared library was some old option that we had. That is really not that used anymore. Never, never really, Woz. But let's just elect doesn't standard clicking. Next we see the summary of what we're about to create. Where is he is going to be created? Very simple stuff. What I do want you to supplant ease in these two options inside of version control because the 1st 1 is going to initialize git repository for ALS. In fact, notice that thought get folder is going to be created. Jones, as we saw in the previous section or, you know, just as you know, happens whenever you initialize a kid repository and also scenes were at it. We're going to be greeting automatically at daughter getting nor files self that certain unnecessary files can be ignored and they are not part of our repository, just like those couple of options and bleak on create. And that is it. That's for visual. Studio 2 19 here on Mac. Now let me jump over to my windows computer and show you that process, which is going to be fairly the same over on Windows. So here I am on officials to determine 19 call for you can excuse. They're very noisy fans because I am running. Both systems have the same time. So my computer is Carla keeping up. But let's just quickly greet from here as well. Osama in project. We're going to have a very similar process by clicking on create a new project. But in this case, because he sees much more road bossed Andy, we're going to have way more options. We can always see police search in here for Samrin and you're going to find the mobile app , Samarie informs again. You may find some Onley Samrin options in here for IOS, android, even android wear and some others. Which would mean that you started working with native sovereign bonds again. It is, Sammer informs, that one that we're going to be using this one will allow you to create an applications for Andrew. I was with Osama while and by the way, this is still native. The fighter it is not called native summering doesn't mean that a summary forms warns greed . Native applications. It's steel wheel, create native applications. So let's just select it. Click Next, said the name as well. I will use example again. So, like the location and click on create. Now it is in these window where we're going to have the templates. As you can see, there are very similar templates. The user interface is completely different than the one on Mac, but we do have the same options. So I am going to be selecting the blank optioning here, which is the exact same template that I selected back on my quest. And I am also going to be selecting. Android and IOS also notice. Here on Windows you have the ability to also select. We knows you WP, which is never an option over on Mac OS, so I'm not going to be selecting this one. We're not going to be working with windows on these kers. We are only going to be working with android and IOS. But just keep that in mind. If you want to create you WP applications, you do need at Weiner's computer. Jaws lying if you want agreed IRAs projects you need a Mac older Do keep in mind that even if you do not have a Mac computer, you can create the iris product and you can have code to it. Do you just want to be able to test that or distributed for those things? You absolutely need a Mac. So it's just like this couple of options in here. Click on OK, and now we're going to see the exact same example be created. And no matter what system you're using, either Mac OS or Windows, the template, the structure of the project is going to be exactly the same. Now the classes maybe slightly differently named. So let me now just close windows in here. Maybe that way the fans won't be so loud. And let me explore the project right here for Mac again. It is going to be exactly the same on both systems, so let's start by exploring the very basics off this solution. Now. The solution is these container for many different projects, and usually if you're working with Jaws toe one project at the time, there is one solution so there might be some confusion as to what is what, but in summary in the differences are very clear. The solution contains three projects at least right now. In my case, it may contain four projects or more. If you're targeting my quest or you WP or older operating systems bolt essentially, then the solution contains the projects. And we have three projects because one of them, the one that right now we schooled example, is the dog net standard library through the library that is going to greet packages that eventually are going to be used by Android and IOS and anything here where we're going to goat most off the functionality and most of the user interface. It is in this project where we're going to spend most of her time. But eventually what happens is that this project the example daughter named Standard Library he's packaged, and that package will be used by both the Andrew Wood and the an US projects that we have right here individually. So take a look in both of these projects to the references in the references. You're going to find the reference to the example project again for both platforms IOS and Android. It is in these way that both the Android and Iris projects are going to be aware off whatever code access inside of the example project on. By the way, both this Andrew. The nine US projects are native native projects. Now. We don't see Java or cuddling in the case of Android or Swathed or JavaScript in the case of Iowa's right here, but eventually they are compiled to Java and Objective C respectively. Notice, in fact, that these projects are confirmed in a very similar way to how they would be created on android studio or ex code. You have the exact same files, the exact same folders older, for example, the APP delegate East North and Objective C filed on a street file, but a C sharp file off course, because that is the language that we're going to be using bought. Do keep in mind that the CO that we're seeing here is barely going to be used. We may open the Abdullah gauged once in a while. Same goes for the main activity over on the Android project, but most offer efforts are going to be right here. Instead of the example project the adult net Standard Library. So I want to focus in these project right now. Notice that it is conformed by default in these particular blank template by two main classes the app, glass and the main based class, both of which are defined in two different files, the samel dot CS and the samel file Notice that booth contained those two files. Now, the way these works is that C sharp can have Barschel glasses, which means that you can define a class in more than one file older. Those finals do have to be chr file. So how do we have a Cemal file? This is not C sharp. So the way things work is that samurai and behind the scenes is compiling these coat the samel file, which is essentially defining the user interface, especially in the case of the main invasion of saddle into a CHR file. So, in fact, when these Samel File East compiled label C sharp object is created inside of a Stackley out inside of a continent page and noticed, by the way, that this C sharp file is also a content page, a main page which inherits from gaunt and page. So this class main page is defined on a couple of the friend C sharp files. One of them is automatically generated by summary Nguyen compiling these samel file. So this is the main structure off the project. We're going to have these main base class that we're going to be using in the next lecture to the fine some user interfacing Here I am, by the way, going to split these views so I can immediately take a look at the user interface. Walt is being rendered from these samel code, and then we're also going to take a look at these c sharp file which essentially is going to define the functionality for these user interface. We have a Porton. We make oath in here. What is supposed to happen when we press that button? So now that we have the project created, we understand a little bit more about how a summary project is conformed in the next lecture. Let's start working with Samel. We're going to be learning how to define elements from the ground up. So in fact, let me just delete the default code that we see here. So we have a blank slate. And of course, we're going to add some basic functionality to this application, so we familiarize ourselves with a tool. 12. Introduction to XAML: The Language to Define the UI: So we have created these new summering project, which contains the main page class, which is defined instead of a couple of different files. In these lecture, I want to focus on the Samel file, which is going to ours to define the user interface. Now, Before doing that, I do want to get out of the way. The fact that these Abdel Tsemel file is slightly different. These is no defining, no particular page, no particular user interface that the user will eventually well use. These is simply going to be useful when we want to define some global research, says researchers like colors or styles that the entire application will use. And the same goes for the Abdul samad dot CS. This is this is not the logic for any particular page, and here we simply have the constructor for the entire application and a few lifecycle methods. So the way that the entire Semmering project is greeted, it's actually through these ab glass. Notice that from here on initialized component method is cold and the main beige is assigned to a new main page, which happens to be the class that we have now, the way that These method is cold from the Andrew and the animals projects ease in the case of Android from the main activity. Notice that in here we have a low the application method that he's initializing a new app. Instance. So this is how on draw is the Android project initial isis the entire application using the CO that exists over here on the .net Standard Library. And in the case of IOS, there is something very similar over on the AB delegate. We have these load application call as well, creating a new instance off AB. So that is the AB class. But we're going to be focusing on the main page, defining the user interface that the user will immediately see when they launch the application. I want to start by talking about the container that he's going to be most common and that he's this stack layout. You want all of your elements to be contained inside of a container and the most useful one ? Is this exactly out? Although it is not the only one. In fact, over to the right here in my tool box, you're going to be able to see some content view and grave relatively out. But the Stackley out, I find is the easiest to use, the easiest to understand, and that really gives excellent results, especially when it comes to mobile applications, because you usually just have everything from top to bottom. So what exactly out is going to allow us to do is attack every element that would define inside of it. So, for example, if I were to define our label first and notice how I defined the elements in a very similar way to how you would find them, for example, on HTML, by opening the definition tack with his angle bracket and either closing the definition in a single line with these forward slash and the closing angle bracket or like I did for the Stackley out like this, the reason why I do this in two different lines for the stack layout is because I want elements to be defined instead of the stack layout, which, by the way, notices the exact same way the contents page is find now. I don't want anything to be defined instead of label, so I can just define it in a single line. Balt I can establish the values for the properties off the label. For example, it's text property unless just grind. This is an example and notice that immediately we see the resold for these code over on these window. No, the way distinctly out works, I was saying, is by attacking all of the elements. So if I were to define an entry down below, which is a text field or at textbooks, it is called entry here on Samrin. It would be defined below the previews element. The fact that these artists tact in this way is because we have to find them inside of the stack layout. If they weren't defined instead of the Stackley out, we would have problems because, as I was saying, everything has to be contained inside of, ah, container because the counting pace can only define its continent ones. And in these cases we have two elements. This can easily be resolved by the finding one container, so we only have one element instead of the content Page bought. That container can contain many elements itself, So that is how we solve the issue off the condom page on Lee being able to contain one element by the finance container and drawing a bunch of things inside of it so we can see that the elements has started to attack one below the author. Off course the same would go. We find a fine, for example at Bolton notice that as soon as I add the text for the poultry in this is a button, it is going to appear down below. Now, this is how it works on IOS. Noticed that this immediately is a Bolton, as it would be defined natively. These means that this Botton is going to be rendered has an IOS native element. Eve, we're running the application of Iot on IOS. But remember that this code is shared. So when these Bolton reaches the android application, well, android is going to render these Bolton as a native android bottom. So right here in the summer in Forest Reviewer, I can change between the two operating systems to take a look at how my application would look on them both. And so, as soon as the application has been rendered on Android, we see that the interface is not the same. We do have the exact same elements, but they look different. They look native. So this is not some samarie inversion off the labels and the entries and fortunes. Everything is being rendered to eats native form. So there you have it. This is how we can start defining these elements here on Samel off course. There are many, many more control, many more elements that you could be defining here. These is going to be more than enough right now for us to familiarize ourselves with summary in before jumping over to the next lecture and actually adding some functional to the Bolton and knowing Walt is entered instead of these entry on changing the text for this label, I want to improve these. You I just a little bit by adding a margin to this tackling out, which is containing everything. So if I add a margin with one single value, let's say 16. These margin is going to be applied on all sides to left to the top, to the right and to the bottom. If I used to values, let's say 16 and 32 the first value is going to be applied to the left and to the right, and the 2nd 1 is going to be applied to the top and to the bottom. And if I used four values, let's say 16 32. Another 16 and zero. The 1st 1 is the left one. The 2nd 1 is a top one. The 3rd 1 is the right one, and the 4th 1 ease the bottom one. So they're having this looks a little bit better. It is not pushed all the way over to the edges of the screen. Now we have some nice margin to the science of the stack layout. So now on, let's jump over to the next lecture. ADSs. Unfortunately to the Botton, get the text that a user is going to grind instead of the entry and change the text instead of this label. 13. Code Behind: Using C# to Code the Logic for the Application: So we have to find these very basic user interface. We have abortion and we have an entry and we have a label all defined inside of a statically out. So they're actually stuck together, and they can all exist inside of a content based which I mentioned can only contain one element. Although the element can contain many elements. Ive it is a container. So let's now in these video on some functionality. To win, the Bolton is pressed. Get the value that the user may have Britain instead of the entry and opened eight the text instead of the label. So what we're going to do, he's say hello to the user, A very simple example that is going to be enough Rose to do all these three things. I'm going to start by changing the tanks instead of the Bolton here, which is going to be say hello. The text instead of the label is simply going to be a pillow at first, and the entry is not going to have any text. Won't can have a placeholder, which is going to be very useful for the user to know exactly what we expect for them to write in these cases and it's just right. Enter your name. So what we have to do is make sure that whenever the user could leaks on the bottom, we update the label to say hello and the name that the Yusor growed instead of these entry . So we need a few things in here. First, we're going to need to know when is thes bottom going to be glib? It. And for that, we're going to be using events. So the bottom itself contains a clicked event which, which is going to need an event handler, which is simply a method that will be executed whenever this event is fired in visual studio can help us greed these new even handler notice that I can just click entering here and a new Bolton underscore clicked. Even Handler would have automatically being created on both off the files. So of course we see the C sharp method right here on the main patient, Sam old off CS. It is inside of these methods that we will be able to execute whatever functionality that we need when the Bolton eats breast. Now I do want to make packable off changes in here because thes bottom clicked doesn't say a lot. So let's just change this to say hello. Bolton clicked. These makes a little bit more sense now because I change this. That means that I have to update the name off my method. Notice that it is Gold Joe spot and clicked. But it now has to be say hello. Bottom clicked because that is the event handler that I am setting for the collect events over here on the samel file also noticed how these method is created because it is very common for some recent that whenever Microsoft releases a new visual studio update that these automatic creation off the even handler is broken. So for some reason, this is actual Syria bark That is very, very common. So just in case when you see these video, there is variation official studio that has that issue notice that you can just write it down manually, and it has to be avoid method that he schooled exactly in the same way as what you growed over here manually as well. And over here you have to define ease an object sender. In fact, I don't need system that object this can just be object and it has to receive also some event arguments. Now he's got me named whatever you want. Of course, I actually like to name this Rx for even better event arcs. Of course, the name doesn't matter. Just make sure that you receive both an object and an event Rx our commands. So now I was saying instead of these method weaken, do whatever we want and what we want is first to get the user name which by now should be inside of this entry. But how do we access this entry? Well, to access that entry when we have to do is define its name. So name Miss. Of course, The name for these particular property which is of type entry just like use her name is the name of these particular variable which is of type string. So let's say that this is going to be name entry just like this. And now back from the chr file, we can assign these new string variable to whatever ease inside off name entry dot text. So, of course, name entry itself doesn't contain the strength because name entry He's an entry. Both entry has a text property which does contain the text that is greeting inside of it. In fact, you can actually said the value from here, notice that the value over here changes and we no longer see the placeholder bought with entries. What we usually want is for the users to write something down. So there it is. We have the user name. All we have to do now is sad. The value for these label Likewise, we're going to need its name just like we needed a name for the entry. To get values from it, we need the name of the label to set values to it. So this is just going to be the greeting label. And similarly Baggins, chr file weaken set and greeting label dot text again. Not the label. No, the value off the label itself, but the value to its tax property to some string. And we can easily format as string with these syntax migrating dolar symbol before did double quotes. And so now in here we can just grind hello space and instead of Coley brackets the name of whatever value we want to use. For example, the user name variable and just an exclamation mark at the end. So now the way these text is going to be for Mitt, it ease Hello space and the value off this variable and the exclamation point. So let's save the changes and test this out over here to the top left or somewhere in the middle of your initial studio on Windows, you're going to be able to select the project that you want to test. In my case, let's start with Android. We can select whether we want to debo or release this. We are still testing. So let's just use Tebow and select one of the defaults Andrew devices that would have been created. So just lay one of these devices. He here and Glicken run off course. I will have to wait for the Android simulator to start, but once it does our publication shoot lunch here I have the under application but running . We, of course, see the default values that we said directly from Samel residence. I enter my name in here and click on to say hello Bolton. We see the label be updated so excellent now, because this is summer informs the exact same code works on IOS. So I have to do now is a lengthy IOS product or here so legs and IRS simulator and wrong the application. The result is going to be exactly the same again. The user interface is going to look native because the values are being rendered as native controls bought. The functionality is going to be the same. So here we go, we have the IRS application. I may need to add some more margin, at least in the case of IOS. But let's just enter my name in here. Click Say hello. We see the label be updated. So indeed, both applications or the same publication in both operating systems works exactly the same . Now, in the next few lectures, I'm going to introduce to you to an architectural pattern that is very common when it comes to summon applications and that we're going to be using throughout the rest of occurs. Don't worry, it sounds complicated. It is not that complicated. Whenever we talk about architecture patterns, it sounds like we're going to be using some super fancy stuff, super difficult bald. That is not going to be the case. Now. We are going to be tapping into some very powerful Cemal features, and we're going to try to remove the code behind so that we actually divine the view from the logic. So right now, in the same view, this is the same class. After all, we can have all of the code. What we want to achieve is the view to be separated from the logic, and for that we're going to need to implement a few interfaces. 14. Data Binding: Powerful XAML Feature to Enable MVVM: So we have already learned how to use Sam Ally, how to use C Sharp, at least the very basics. So we know how to greet the user interface for the particular page. And we know how to coach the logic for that particular page. What I want to doing these lecture is start working with one of the most useful and powerful Samel features, which he's data binding. And for that I am going to be using at least view at least view. Of course, he's going to allow me to least elements inside of it, different to how a Stackley, Otto said, because the least view can have many elements inside of it created based on the single template. So as long as we define one template, the least view is going to be able to create as many items as needed based on that template . So what I want to do is start by defining the least view so dumb below the Bolton itself. I am going to be defining the least view, and immediately you're going to be able to sit least it down Blow Now the least view contains some margin off its own already So because I am adding a Stackley out margin, I want to define some margin for the least viewed. That overrides the margin for the stack layout, for instance, there is some margin to the left that I don't want. I will just add a minus 16 margin to the left. Let's leave the margin to the top, another minus 16 to the right answer to the bottom. Which, of course, means that I can live with justice. Couple off values set so wechsel and this is my least you know. Eventually, I will have to access Teasley's view from the code behind, which means that I will have to set a name for it, just like we did with the entry and labeled It is going to be my example least view. Now I know that I mentioned that our purpose in thes few lectures is going to get read off the code behind. So we separate the logic from the view. But bear with me for now, we're going to have an additional thing in the code behind. So this is the least view itself. Excellent. The next thing that we need is a template. Dad Elise, view is going to use to display any other element. So for that I am going to have to define an item template right inside of the least view. We need the item template, and every single item template is going to need a data template. So the way data templates work each other a bit outside of this, cope off these lecture. I don't want to focus on that functionality too much, but what I do want to let you know is that these that template is going to enable data binding, which is a thing that we're going to be learning in these lecture. And so instead of the data template, we can define whatever we want. We, for example, could define drastically out we could define a label. We could define the border, and we could define anything we want. But it turns out there is already a very good breathe assigned template forced to use gold text cell. In fact, there are a few default cells and we could use instead of at least view text cell. It's only the most common one. So this is the template, every single item that the least you will eventually display in each and every one of these cells. He's going to be at text cell. Now notice that the text can be set. Let's say that this is some example. It also contains detailed. This is also attacks, but it's a detailed text at school, this detail example. And now then every single item that the lease view would display will have a text cell that has an example, text and a detail example detail. But how do we tell the least view that it needs to create four or five or 100 different cells with these particular template? Well, for that, we're going to be setting eats itim source. So notice that the least view contains an item source property, which is going to let the least you know, what is the source of all of the items that had to be leased It. I am going to say that value directly from the C sharp file, and I want to do it as soon as thes page shows up, and there is a very useful method that we can use that executes every single time. These main page is displayed, which can be overridden, and this is the own appearing method. So as its name suggests, this is executed. When the page is appearing so down below the call to the base on appearing method, I am going to set the example least view item source to be equal to a new list so any innumerable that you can think off can be assigned as an item source for the least view. And it turns out that these least type he's going to be implementing the I innumerable interface, as we can see right here, which means that it can be used as an item source. Now the least is going to require the type of elements that it contains. For now. It's just said this as any object, and so we now have a brand new list created. However, so far there is nothing inside of the list. No single element. If we want elements inside of it. What I can do is create the list in a different variables. What say that this is going to be the list variable, which is of course, going to be equal to a new least off objects, and to these viable, I can ask new objects on because it is an object I can have any objects, including a strength so eventually I can just assign the least itself as the item source for the least Butte. So by now, the least already contains one item, which means that by setting it as the items sores, the least view will have to display this item using the template that we set. So let's go ahead and test this out and see if this is actually working according to our code. We should already see one text cell displaying the default values that we have here in the template inside of our least view. So here the application launches, we see the values that we had said before. And indeed, we see a text cell that has a text example and the detail detail example, because that is a template so excellent there is indeed one item. In fact, if I were to add a second string to the least, I should now see two items as we can see right here. But so far, our template is really a static. We don't really have any way off using a different template or setting different values instead of these properties for each and every one of these elements. These is where data binding comes in because as he turned south from here, from the template itself, we would be able to access the properties for the items that are being displayed Now, Right now, I am just greeting a list of objects, so there aren't really any properties to be displayed, but what I want to do to show case this functionality is create a new public class that is just going to be my contact glass, for example, which is going to have a couple of properties. Let's say the 1st 1 is going to be name and the 2nd 1 is going to be email. So this is my contact. What I what I do now East creates al East of contacts like this instead of creating a list of objects, which means that when I add a new item to the list instead of a string, I have to are a new contact which of course, will have to contain both a name. Let's say that the 1st 1 is myself and an email so a value for each off its properties and the same thing for these other item that I am adding a new contact. We've a name and an email like this. However, this is not enough because so far, yes, well, we now have a list of contacts and years. We're setting the values for its properties. But the least view so far doesn't know what to do with those properties. As you can see, it is still simply using the template. Well, we have to do is navigate back to the template and in the text, start using binding. These ease data binding so binding instead of these Kohli brackets is going to allow me to tap into the properties off the item that is using these particular template in our case, the least mucus. It's item source in a list of contacts, which means every single text cell created from these template is going to contain one off the contacts, which means that we can access both the name and the email properties, and we would do it simply by writing that so binding. And let's say that this is going to be binding to the name property and the detail is going to be binding to the email property. This is how we create data binding to any property that we know exists inside of the class of the object. Daddy is being used in this case, each and the Rue one off the contacts instead of the laced. So now we run this again. We should see the values for the properties, the names and the emails instead of these texts, which we do. So there. Have it. This is a very quick introduction to data binding. How is it that we will be able to tap into the properties into the values off the items that we are accessing from Samel through data binding? These is going to be very powerful in the next couple of lectures in which we are really going to be moving our code behind logic over to a new class so we can actually separate the view from the logic 15. The INotifyPropertyChanged Interface: Enabling View-ViewModel Communication: now that we have started a war with data binding here, instead of these least view, we are ready to start working with data binding a little bit more in the context off the M V V M architectural pattern. Now I know that sounds super difficult, Super daunting. Bought with Rive introduction to data binding that we had in the previous lecture, I think it's going to be easier to understand. So so far we're tapping into the property's off at class that we have already created. That is exactly what we're now going to be doing. Bought greeting another class in a different file. Now, usually scenes. We're going to be using the M V P M architectural pattern. You want to start by creating a new folder that is usually called view motile, and few model is simply the name instead of the M V M architecture pattern for the logic, and instead of the view model, I am going to have the class that we're now going to be using, similar to what we just did with a contact class. So this is going to be an empty C sharp class that is going to be main V. M. This is the normal naming convention that that I use. Of course, you can come up with your own, but this is simply the name of the page in this case, Main and adding V dams and I click a new And now we have these new public class Excellent. We are now going to be tapping into this class over here in the main page. However, first, we're going to need its properties. Now, the properties that I want instead of the main VM are the ones that will enable my logic to work. So the logic that we currently have inside off the on appearing and the logic that we currently have inside of the clicked event handler that means that we're going to need at least view inside of the main VM. But that is going to be something that we will cover in the next lecture. For now, I want to focus on the collect event. We are going to need a way to get the text from the name entry into one property. So let's start by simply creating that property that is going to be the user name property so right here instead of the main VM. I am going to use the prop full snippet to create a full property like this That is going to be a strength and that is going to be used her name like this. So by now we would already have access to the user name property from the main page. However, we're going to need an additional one. And that is going to be the greeting the string that should contain these text applause, the user name. So I'm going to be creating an additional property, full property. That is also going to be extreme. That is going to be greedy. And these actually doesn't really need a center. We can simply return the same string that we have over here. So I will just copy this a string from the main page that sample dot CS on based it right here. Of course. In this case, we should use the name of the property, not the name of the viable. So there you have it. These greeting is always going to return. Hello, Applause. Whatever is inside off the user name property excellence. And now we have enough to implement the functionality that we currently have over on the clicked event handler. It may not look like it bought Bear with me. It is going to make a bit more sense in just a minute. However, for data binding to work with classes that are not the code behind, we're going to need an interface. Remember that we could access all of these properties from the main page because thesis, after all, the exact same class. But because we are now in a different class, I'm going to have to implement the I notify property changed interface. The centre face, as its name suggests, is going to notify anyone including, for example, the main page when the value for any of these properties changes. Now, to be able to access these interface, we need the using directive to system that component motto. So I asked that using over here, and we also have to implement the interface. The interface needs these event. So this event has to be triggered whenever these properties change, which means that we have to raise the property changed event inside of the center. And I know we don't have a center for the greeting, but that can be easily solved. And by the way, let me just change where the property changed has been defined. The most common way to raise the event in the case of the I notify property changed. It's actually by creating a private void home property changed method that is going to receive a string with a property name. And instead of this method, I will simply raise the property changed event trouble first evaluates if there any subscribers to the events, any classes, anyone listening to these events and in case there is a will just invoke the method. The method is going to require a center. The center is this and it is going to require a new property changed event arcs that requires a string with a property name, which we already have. So just like this. So these method is going to raise the property changed for a particular property or we have to do now is from the center off the user name. Call this new on property changed method and pass the name of the property itself. Use her name now because the gritting should also change because the user name has changed . But we do not have a centering here we can do is co the in property changed again instead of user name this time using greeting on By the way, I just noticed that I don't need these variable in here. So now every single time the user named changes the user name itself, of course changes, but also the greeting and this event is going to notify anyone. So what is it that we have to do now? Well, we have to make sure that the user name is updated with whatever the user is writing inside of the entry which automatically shoot now update the label for that, we first need an instance off the main VM class instead of main page. Now that is going to be fairly straightforward. But we do need to learn some new syntax in here. In the contemplation of is that some main spaces are being defined similar to how On c sharp, we have these using directives over on Cemal. We have these XML name spaces. So what I have to do ease access a new XML names base that I'm going to be calling the M for view model, which has to be pointing to my example dolled view model that is, the entire folder, their view model folder that we have inside off our project. So that is the View model folder, which, of course, contains the main VM class. Which means that now we will be able to create that instance off, maybe m. And we're going to do it instead of the Contin page Research says. So we're going to need to create that instance as a resource instead of the research says I am going to create a resource dictionary. I believe this is no longer necessary. But this is just how I learned to do things and the inside of the research dictionary. I am going to create a new maybe an instance, which of course, exists inside of the VM name space, which is pointing to the View model folder. And this is going to need a key so unidentified air, which I'm just going to coal main V m. There you have it. We now have the instance off main VM. The next step is to let this entire content for the content page know about that instance because notice that so far, the Stackley out is a difference element than the research says It is. No aware of those, research says, to make it aware of those resources here in the Stackley out, I am going to set the binding context, and the binding context in this case is going to be a research that we have greeted ourselves, the main VM static resource. So these binding contexts is very related to the binding that we created down below. It turns out that it is going to set, well the binding context for the Stackley out and any off its Children. This is exactly the same thing that the text view is setting, or in this case, the data template is setting for the text cell to a particular contact. So at contact would be the binding context for a text cell. In the context off this list view, just like now, the main VM is a binding context for the entire stack layout, which means that just as we did for the text on the detail over here in the text cell for the label, the text can actually be binding to the gritting. In fact, notice that we have or a completion functionality which means that the binding is actually working. We didn't have that order completion functionality over on the text sale because least views work a little bit differently. Brought in this case, we do have that functionality. Indeed. We see greeting in here and also over here in the entry, we can set the text to be binding to, and you see it's writer as well use her name. However, this is a bit different because the entry is going to be setting the value to use her name , not getting the value like the label is doing. So the label is getting the value from greeting. But entry should also be able to set the value for user name. That means that the mode has to be said to two way, because by default it is just one way from the seizure file to the Sammo file. But setting these 22 way means that we're also going to be able to send information from the Samo file, do the seashore file. So let's see what is going on now if we run this application at the beginning, because by default the user name has no value. The greeting should be just Hilo and space and an exclamation mark, which it is. As we can see over here, both astronauts high changed the user name. Dad should obey the user name itself off course, But you will also update the greeting. So if I type e, notice that immediately, immediately we see that updated in the greeting as well. And let me just grind my intern name. We see that happening immediately. We don't even have a need for the say hello Bolton anymore. So hopefully you can take a look at these code to understand really well what is going on. I understand it at first it doesn't make much sense. In fact, I understand if by now you feel like this is unnecessary, this is way too much code your for that simple functionality. But keep in mind that eventually asked, an application becomes more robots with more functionality. This is exactly what you need because it is going to make your code easier to maintain because everything is where it belongs. The user interface is on one place. The logic he's on another place, which, by the way, reminds me that over here on the code behind. We can actually get rave off these code because it is already working over on the view model, which means that back in the Sammo file, we can get rid off the clicked event. Now. I don't want to get rid of the ports in just yet because I am going to change its functionality to be clear value, which simply means that should return the value inside off the entry back to an empty strength. But that is something that we're going to be implementing in the next couple of lectures. For now, we have already removed some of the functionality from the code behind. Let's jump over to the next lecture and remove the rest of the code. 16. The ObservableCollection<T> Class: The Ideal List for MVVM: to get rid of the code that we have instead of the on appearing method, we have to create a new property over in the main VM class that he's a list because that is exactly what we're using inside of it. Now. A list works excellent when we have the code behind, but not very good when we have the view model using these notation, these syntax. But there is another class that is going to be very similar and that he's going to make things work really easy. And that is the apps Terrible collection class, Just like the I notified property changed interface helped us in the previous lecture, there is a nine notifying collection changed that can work for the lists, which, as its name suggests, works very similar to these particular interface that notifies when properties change. Both. That in that case, notifies when the collection changes. Thankfully, we did not have to implement the interface instead of at least your toe or do some weird things because there is a class that already implements that interface that again is called observable collection. So I have to do is instead of the main VM, create a new property. And this can be a simple property, not a full property that is going to be an observable collection off a particular class. More on that. In just a minute, I'm going to call this contents. Now, of course, that means that this is going to be an available collection of contact and I can write that down already. However, the contact glass currently also exists inside of the code behind. So what I want to do is move these class to another file. This is also a very important file off the MVV and pattern, just like the view model exist. Instead of the View Mortal folder, I want to create a new folder that is going to be called Model, which is shows the name that the MVV Empire uses for all of those classes, just like the contact class. So I'm going to Crete and you see sharp file instead of the model folder, and I am going to be pasting my contact class in there. Now, back in the main B m, I can at the using directive to the name space where the contact class is located, which is example dot model the name of the folder and also, by the way, I need a using directive to system that collections thought objects model so I can access the observable collection class during habit. We now have the new way off greeting this list over on the main VM. What we can do now similar to what we're doing here, is atthe new contacts inside of it. So I can just copy this go from here. In fact, I am going to delete all of these methods already. I don't need it anymore. And over in the main VM instead of the constructor, I am going to be first initializing the contacts property. So contacts he's going to be equal to a new office. Horrible collection, off contact. As soon as I have this, I can have new contacts to it. So I just pays the code that I used to have in a code behind off course. I don't have in least anymore, but I do have the contacts off cerebral collection so I can add new contacts to it, just like we did before. The last thing that we have to do East said the item source and by the way I will just close accord behind scenes. It is now clean. So there remains that he should that we are not saying the item sores just yet. But just as we saw previously, we can set it directly from Samel and the item source east. Now, of course, you may have guessed it's going to be binding to that contacts observable collection that we in fact can now finding here. So we just said the items source from Sam Old, one of the properties off the main BM that we already have over here in the resources for the content page. And we know that we already initializing the contacts with a couple of values. Still, these are contact objects, so the template can remain exactly the same were same bindings. We are just now also binding the item sores. So if I were to run this on the simulator, I should see exactly the same resold, which indeed I can seeing here. So there you have it. This is how we can use the lists directly from the view model. Finally, in the next lecture, we're going to learn. How is it that we can react to the click of Important. For example. Previously we were using event handlers. Now there is no such thing because they, even Handler, has to exist inside of the coat behind. Seems we are no longer coding anything. Instead of the code behind, we're going to need to learn a new way. 17. The ICommand Interface: How to React to User Interaction in MVVM: the last little bit of functionality that we have to move to view model Easy one for these Bolton that we're going to be changing their bed. So previously we needed the Bolton to greet the user with its own name. But now that it's actually happening automatically, thanks to data binding by the way and notice, another very neat feature of their binding is that it works on the sign time. So because of a wrong, the main view model directly inside of the constructor, we're adding the contacts. We see those contacts right here in the designer without having to wrong the application. These other great advantage off working like this with their binding and M v P m. Which make things easier for the signers. But anyway, let's move forward by implementing the functionality for the click of the button, which should simply clear the string that we may have inside of the and three. So what I want to do right away. He's CO that functionality worry about the data binding after the functionality is ready, and for that I am going to create a private void, clear user name methods that should be called whenever that button is pressed again, we will worry about No, we went the bottom expressed in just a little bit. For now, let's just clear the value and s a c c as changing the value for the user name because we know that as soon as we said the value that is going to update both the user name instead of the entry and the greeting itself So all I have to do he said, use her name to be an empty string. So let's say string dealt empty. There we go. So we need these method to be executed whenever the Portuguese breast to know when the Botton expressed, we're going to need another interface. The I command interface. Now we don't need to implement it into any class we can do is simply create a new property that is going to be of type. I command off course to be able to use. I command. We need a using directive in this case system that windows don't input. And I am going to call this property clear command because we're clearing the user name value and we have to initialize the clear command property inside of the constructor for the main VM. So clear command is going to be equal to a new command in these case command as he turns cells, he said. Class that somebody has created to make working with I commands much easier now to use these class. I am going to need to have the using directive to samarie dot forms. But notice that the constructor for the command has a few different versions. It has four overloads. The 1st 1 requires only the action to be executed. The 2nd 1 requires an action with a parameter the 3rd 1 the action and can execute function and the 4th 1 the action with the parameter and they can execute function. Now they can execute function. It's actually going to be very, very useful because we don't always want these commands to be able to be executed. If the user name is empty, there's no needles clearing it, because here it is already cleared, so we're going to be using can execute function as well. The way I'm going to do this is first by passing kill ear user name as the action to be executed. Bolt after the executed sell the action that we see right here. We have to pass. It can execute. And I'm simply going to go right in here. The name off, a new function that is going to be clear can executes just like this. Now there are a couple of things that the command is going to need. The clear user named the action. It cell has to always receive a primer like this, so he has to receive a primary object. It's okay, we don't use it. We absolutely need the action to contain it. And of course, we also have to create the clear can execute method. With this structure, it has to be a private bull method because this has to return either true or falls. Either these can or cannot execute, also receive an object which I like to call parameter. And, of course, it has to be called clear can execute. Now what I want to return is whether or not the user name is an empty string. So using is no or empty evaluating a king's user name. This is exactly what we're going to return. However, if it is no or empty, it means we shouldn't be clearing it anymore, which means that it should return false. So let me just deny these expression. Essentially. Then we are initializing the clear command with a couple off methods. One that he's going to let us know ive the command itself should be executed or not, and won their functionality itself, the one that has to be executed. So let's now never get over to the main page in the bulletin. We can actually now set at command which by now you should expect Watt. It is going to be assigned to We have to bind a property off the main BM which in this case of course, is the clear command and that's it. Now, if we run this application, notice that if the user name is no or empty, their command shouldn't be executed and hands the Bolton is actually disabled now. So far, even if I grind something down, this is not being updated. That is because we need the second part off the command, which is the command parameter. Now the command parameter has to call the I notify property changed because that is going to let the command know that clear can execute has to be evaluated again. So far, this is only evaluated the first time and it is working. We saw it working, but currently the clear commanders and nowhere to call this method again for us to let it know about it. We have to call the property changed. Then we have to raise this event. And in fact, we are already doing so instead of the user name. So what we can actually do and makes a lot of sense for the context. Off our bottom is set the commands parameter to be binding to the user name because whenever the user name changes, we have to evaluate again if it is empty or not. So we know whether or not these command shoot or shouldn't be executed optionally. By the way, you could be receiving the command parameter in here like this. And by doing so, the parameter for these two methods would actually be the command primer in this case use earning. But we don't really need that its command instead of this class anyway, so we have access to it anyway. Both since we have that another option would be to evaluate parameter instead of user name . Although of course, we would have to cast this assets drink. However, I will just leave the functionality as it is. I don't need access to the parameter. I have access to the property. But what we did with Waas said that command parameter So now Because that command parameter the user name is racing the property changed event. Now the command would be able to evaluate can execute again. So the first time, of course, this is still working. We see the bottom disabled port. Now, as soon as I grind something down, that bottom is enabled because the evaluation was made again on these time the method returned true that these can be executed. And now if I cleared the value, I see the value being cleared because indeed we are calling the clear user name which is setting the user name to an empty string which of course, also results in the clear can execute evaluating again this time to falls and hands. We see the Porton been disabled so excellent. These is how you would react to events. For example, the click of a Bolton through commands inside of the MVV n pattern. Now you can all of the tools necessary to use this planner. You have data binding. You have the inner fiber birth. He changed. You know how to use the absorbable collection. And you now know how to use the I command. You are now entirely ready for the rest of the curse. You can familiarize yourself with Sam Marine and some of the very amazing features off Samel in the next section. Then it is time for us to start implementing Logan functionality, which means that we will finally start working with fire base. 18. The Register & Login User Interface: hello and welcome to these new section when we're finally going to be starting to work with fire base. So in this actual working to start, first of all, by defining the user interface for the application at least so far, the user interface for the look and functionality. So we're going to be creating both their Larkin Page and the Racer Page, which should actually be the exact same page shows with different views, depending on what the user ease. Intending to do more on that in a minute. Now what I have already Dhoni's come here over to visual studio and created any project. This is a black project. I have done absolutely nothing to it. However, I have already bushed everything over two days. Get help repository right here. So, just like in the previous section or in case you didn't see that section while you're going to be able to do is come here to these repository take a look at all of the branches. Currently I only have a master branch, but eventually there will be a branch for each and every one of the lectures in which we coz something. So, for example, eventually you will find the create you. I branch in here selected and see exactly what with they've in these particular lecture. And the same goes for all the lectures throughout the rest of the curse. Eventually, you may also create or see issues because, of course I'm human. I may make some mistakes, so you may eventually see them right here instead of the issues tab. And, of course, you will be able to come here to this repository. Fork it over to your own get up accounts. So you have your own version off the repository again, and the seas, instead of being Hamburg, get help. Calm forwards. Last local, which is my user name. Forced last. My subscriptions here is the entire code that we're going to be greeting throughout the rest of the curse again, navigating back and forth between several branches. Eventually, master will contain the entire project and any updates that may be created. You do some issues bought. The other branches will always contain the code that we create instead of a particular lecture. So with that out of the way, let's never get back to visual studio and start reading the user interface now, in the case of these particular view, because this is the look and functionality, I want everything to exist instead of some sort of logging beige, not main page. That means I have to make a few changes. In fact, I am going to go ahead and delete the main page entirely. So I'm going to remove this from the project, which means a couple of things first over on the abduct samel dot CS file. We were using that class, and that class doesn't exist anymore. So we have to greet a new class a new page. But also I want to greet off the views inside of the Views folder to view. So the preview section we were using the M. V P M pattern. That is exactly what we're going to be using throughout the curse. Now, in the previous section, we didn't actually greet have Views folder because we only had one view the main page. Bring these one. We're going to have more than one view. So what I'm going to do is right. Click on my doesn't standard library the project and add a new folder that is going to be in views actually just view. And instead of these folder ease where I am going to be adding a new page. So hearings have forms, I will be able to find the content page. Now you notice that there are a couple of different content page templates, the one that we want Is these one this samel template, that one that also creates Osama file. Otherwise, we will only have a C sharp file. So we select this one and we're going to start with a lucky and change. And we're going to click on new now. Eventually. I don't want the looking page to be the default page to which the user is navigated to bars and just for the sake of being able to immediately navigate to it. As Wheat says, the application I am going to use look impatient here now because Logan Page, he's on a different main space. The AP classes easy inside of my subscriptions name, space and the logon page East instead of my subscriptions don't view name space. I am going to have to our eye using directive to that new name space which is created inside of that folder. So now if we were to wrong the application. We never get over to the logon page. Hopefully, so far, so good, nothing new, nothing too complicated. We're just creating a new content page. Now it is instead of this content page, of course, that I'm going to be creating you. Why? Because currently we're Onley coating the view. We don't need any view. Model and immortal weaken work entirely inside of these couple off files, so we'll start instead of the continent pages content. By creating grid now, the great is going to be using the entire beautiful space. But instead of the great I am going to camp a couple of stack layouts, however, both off the stack layouts are going to be on top of each other because it turns out I want one stack layout to be, well, the content for the Logan and another one to be the content for the register page. So I'm going to have both you guys inside of the same page. I am just going to be displaying one or another depending on context. So for that I am going to need a couple of things because this is still the view I will be able to have some code behind in here. This is, after all, just view no logic bought. I will have to name the Stackley out accordingly. The 1st 1 is going to be the Logan Stack layout and the 2nd 1 is going to be. You may have guessed it. The register Stackley out and I also want the restart Stackley out to be hidden by default . So I am going to set is visible to falls. So if I were to set the background color for this exactly out you any color, you don't say it. But if I were to delete these east visible property, you do see these Asher color, which is very hard to see. Let's change this to read and use it right there. But let's live this as is visible and with no background Gore Now I don't want to bore you with the details of how I'm going to be creating the user interface. Hopefully, you already very comfortable using Sammo. So we'll just speed through the process off adding the interest and the Boltons hopefully again. That is hazy for you to understand. All right, here is the result Now, there are a couple of things that I do want to explain for those of you who are not entirely familiar with Sammo, which comes to just global research, says. But first notice that I did said the vertical options to center. I greeted some entries at Fortune and a couple of labels here on the horizontal Stackley out for they don't have an account raised her now notice a couple of things that even though the Bolton has no styling here, each does have a style or here in the designer. That is because, over on the ab dot samel file, ANC created a style for all Barton's so it doesn't have a key. It is applied to all Barton's. We've background color center and attacks, colder center Boat said to some resources that I created over here, some cola research says, with some colors that I just came up with and next in color that it's pinkish, a main core that is bluish and a light colored alleys entirely white and the dark color that is entirely black. Are you also notice greeted US style and named style for labels. These doesn't apply to a labels because it does have a name, so I have to specify that, which is exactly what I do over here on this label. Notice that the 1st 1 doesn't have a style Sweeties Jones that default label. But the 2nd 1 does have a style pointing to that research that I created. So it does have that cooler. And if I go ahead and make this not visible and the second Stackley out visible, I have something very similar, although these one has a couple more entries for the name and confirm it. Password. I changed the tax for the Bolton and a text for these label down below, hopefully so far, noting too complex. Now what we have to do These make sure that whenever these label right here is tapped, we hide the look in Stackley out and show the race to Stackley out and the other way around when these label down below is pressed. Now you may know that labels do not have some event that we can trigger, similar to how bottoms have the clicked event. However, we do have access to gesture, recognize er's so, for example, these label over here for the user to register instead of logging in can have a week. Read the definition like this gesture. Recognize Erso. We access the gesture. Recognize er's for the label and we can access a tab gesture. Recognize er and it ourselves that as you may have cast because of the name, these has a tapped event So we can create a new event handler in this case, the default value ease tab just to recognize er let's just call this register label Underscore Tapped. Of course, because I changed the naming. Houston, here I have to change the name off the method that wants automatically created over here. And I don't really like this syntax. I like this being a simple object. I don't need system here, even our eggs like school days arts. And of course, we now know what to do in here we can to make that raised Staggolee out is visible to be true and the Le Guin staggolee out is visible to be false, and something very similar is going to happen for the author label. So I am going to just copy and paste the same method except this one is going to be the lugging label. Underscore tapped which means that we're going to be hiding the race. Ter Stanley out and showing their look in Stackley out. I am just going to copy the name of these event handler so I can use it down below in the or the label ones we creat the tap gesture recognized her so again I am going to access their gesture. Recognize er's for this label, going to be creating at tab gesture. Recognize er and I am going to be setting it's tab event. Today's new look in label tapped even handler and for some reason, I am seeing these message. Come on, visual studio. I know you couldn't have created it. I just dead. You indeed showed it to me, but that we go now by default. I do want the Logan Stackley out to be visible, so I'm going to set this back to true and these visible for the other styling out back to fulls board right now I should be ready to test this out. So if I run this on naira simulator or an android simulator, it doesn't really matter. I should be able to see these working. So I see the simulator launch the application in here, I see the Logan's tackle. Yeah, by default excellence. If I click on register, I see the order in Stackley outbid this blade, and if I click on Le Guin, we can go back and forth. So excellent disease and their user interface for this logging functionality. Notice that we see the exact same thing on Android at the change the appraising system that we're using here in the preview where so we see that the resold is very similar. Now let's jump over to far base and greed the application that will allow us to actually readies to use er's. 19. Configuring our iOS App to use Firebase: Finally, it is time for us to start setting up the five s application for us to be able to implement everything about fire base, from the authentication functionality to the databases. As you may have guessed it throughout this section, we're going to start with the register functionality. We already have the user interface. So the next step is to come here to console that fire base, that Google don't come. And the first thing that we will have to do these greet and you brought it. So this project is going to be the one that holds the an tabliki Asian here on five days. So essentially, we're going to be creating an application. A couple of applications really want ride toward one for Iris in here, and eventually our summering application is going to tap into based application. So I'm going to start by naming discipline, cation, my subscriptions and clicking on Continue. This is what we're going to be creating by default. Some free Google NL FX like a B testing, reporting, predicting user behavior, things like this. So we can live this enable This is recommended, not necessary, though we can continue. And then we're going to have to choose at Google Analytics account. Now, I already see a few options in here, but let me go ahead and create a new one in case you do not see any options. So our will simply going to be naming this Curses, Quicken, save, Select where the analytics location is going to be, as well as setting some default data sharing settings, accepting the terms and clicking on create project basis, of course, going to go ahead and greet the firebase project. But again, we will have to greed so many different things inside of this project itself. I will just let firebase finish off the creation of the project. And as soon as it is ready, I can click and continue. I am going to be directly navigated. Two days application. Now notice that to the left. You already see some authentication tab in here. These is where we will eventually seal of the users for our application. And there are actually a lot of ways in which we could implement authentication with the application. If we actually click on view the dogs, you're going to find the of course, the documentation for the methods that you can use. And as you can see, both Iris and Android are supported, although we do not necessarily see Samrin. So that means we're going to have to figure out how to use the native libraries in a summary informs project, which is, of course, entirely possible. Now notice all of the methods that we have. We can use five days you I authentication, which works on both IOS and Android, the Zika authentication and the one that we're looking for, which is email and password based authentication, which again works in IOS and Android. We could also use identity provider integration with Google, Facebook, Twitter or get hub phone number of Indication costume off system medication, anonymous authentication balls Again. The one the work going to be working with is the traditional one email and password based authentication, which is actually the one that we already have the user interface for. We are already asking the user to feel email and passwords to attend IC eight themselves, so that is the one that we're going to be using now, instead of these authentication tap, we actually have to set up a sign in method which, of course, in our case is going to be email and password, so we'll select it and enable it. I notice that you could also enable a password less signing with an email link. I am not going to be enabling this. I will just click on Safe now to prepare board for applications. To connect these new far based application, we need to navigate back to a project overview and have each individually now. Eventually, we're going to code everything with salmon. Of course, Bald Fire Base is not really going to be aware that we're cutting with Samarie in. So we're going to be configuring the applications as if they were native after old. Sam Marin is native, although we use a different language to co the functionality. Let's start, for example, with the IRS application here, notice that the first thing that we have to do is raised or the application, and it is going to us for the IRS bundle I d. Now these bundle I D is the unique identify air that was created for our application when we set the name. If we expand the IOS project and navigate over to the info dot policed file you will likely see something similar to this which contains upon the light and the fire conformed by our reverse domain and the name of your application. This is the one that you have to copy and paste over here for the bundle I d. You can also only set and that nickname and an abstract he also optional. So I'm going to go ahead and raised her the application. Now, the second thing that we're going to finding here isa the least file an additional people least file that we will have to download. Once we have downloaded it, we're going to have to navigate back to visual studio, find that file inside of horrified Explorer and drop it inside of our Paro Jeanette's instead of the IOS Project. By the way, make sure off that once we have done that, let's never gave back to the fire Base Council. Click next and these s actually going to ask girls to install the fire base as he came. Now, in this case, it is, of course, going to show the steps needed for an entirely native project, one that we would be creating over on ex code. However, that is not our case. So what we will have to do is navigate back to visual studio, never get over to the packages over IRAs projects and select managed newjack packages in here. We're going to search five days and actually, to make things a little bit easier, let's already search for fire base of IRS. Since we are in the iris products in here, we're going to have to find Iris out. Sam Moran dot Firebase Don't IOS out. This is, of course, the package that will enable authentication. Eventually we will need another Samarinda out firebase don't hire US package For now, it's just at this one. I will click on at Prankish which of glory will make sure that these new package is now available instead of the Iris project and notice that it comes with Iris, the core package as well. So some Rando firebase that I rest without depends on Sam rendered firebase that iris adult core. So that is what we would have to do in Samarie in instead of the steps that we see here next, we're going to have to live in thes code. However, of course, this code again is created for swift or Objective C, and we are coating on C sharp. However, the functionality that we have to add is pretty much identical. Now, if you're not very familiar with native sleeved or objective C code that we see right here , essentially there is at did finish lunching with options method inside of the Abdellah Git on Inside. All that is happening is that far based app dot configure. He's being cold, as you can see. Easy, exact same thing on both, of course, in its own syntax. So what we have to do is exactly that of cores adapted to Samarie in for that. Then we're still going to be navigating over to the up delegates, and we still find the finished launching method in here after initializing summer informs. But before loading the application, I need to access Firebase Daughter Core, which I was saying is one of the packages that Waas just imported. And instead of core, we're going to find amp and anything's head of ABB that we find the configure method. As you can see, it is not exactly the same thing that we see over here books. It's ease firebase AB and configure method. The syntax is, of course, the friends, but we still find the firebase app and the configure method. So there we go. The final step is to wrong our application to verify installation. Now, this, of course, is very straight forward, right? We're going to run our application, which is going to make sure that these finished launching method is called. Which of Gore's in turn is going to execute the configure method that we have just added? And because this is actually going to identify the firebase application thanks to the bundle i d. These may Hellfire based identify our application. Now I seem to be running into a very long issue here. The Visual Street is having some problems identifying if I do okay, Yeah, It says that the Google service in photo police file could not be found. And, yeah, I know why I forgot to set these file as a bundle research. So you actually have to these Billy's to found that we added to a project that Firebase Tomatoes download has to be a bundle research, so just right click on it. And so, like the build action to be bondable research. Otherwise, as you saw the project wouldn't be able to identify that file correctly. So let's try one more time. And this time the application dolls launched successfully. We stump the application from roaring and navigate back to firebase. However, we don't see anything happening. These is expected with some Marine. Do not worry about it. It is eventually going toe work perfectly. So for now, it's just us. Keep these final step. But we now know that the iris application is configured. We were able to run and we didn't see any particular thing happening here on Fire base. Both we now have the IRS application right here. Now, in the next lecture, we're going to be doing the exact same thing for Android. Of course, following this tabs a specific for the Android project. 20. Configuring our Android App to use Firebase: in the previous lecture. We already configured our iris application here on fire base. Now it is time to do the same with Android and the same process is going to be followed. We have to come here to the project overview for our firebase application. Click on add in this case because we already see one So we don't see the options but Glicken at AB and select Android. No, it is that this process is going to be fairly identical. We first have to raise their our application with the and road package name. Now to find that package name we're going to caf to navigate over to visuals. Do do you again. Let me close the iris application file and these time, expand the android project, expand properties and open the android manifest. Either you will see on interface similar to this one, or you're going to find the source code which he's these xml file. In either case, somewhere instead of the file or somewhere instead of the user interface, you're going to find their package which is very similar to the name that we saw for IOS. This is some reverse the main and the name off our application. Older. In the case of Android, it has to be lower case. So simply copy that value and pasted back here on the firebase console again optionally we can add in the APP nickname. And in these gays some D book signing certificates Glicken register the AB and similarly, we will have to download at Come thick file similar to the police to find that we downloaded in the previews lecture. This time we have to download at Jason file now off course again, we will have to navigate back to visual studio, find that file on our computer and make sure that we added to our android project this time . So now we should find the Jays from file inside of the Antwerp project. So let's never get back to their farms, go solo clicking next. And similarly, we will have to add the far base as a K. Although again, we are not really going to be following this taps that we find here because we are not using Android studio. So we are not using grade all. However, we will have to navigate back to our Andrew projects. Ryan clicking the Packages folder similar to what we did on IOS. So like to manage new J packages and these time search for far based Don't out in these cases. Bankers. Is your school Samarinda Firebase daughter out? Not something that fire based on Andrew with daughter out has 1 may have expected for a minute there. So it's just elect this one clicking at Package. And similarly, we're going to see two packages be added toe a project Sam rendered Farm raised without and some ran that far base adult coming as we can see right here. So it's click on Accept and the baggage will now be added to our project. As soon as we do that, we're going to be able to right click on the Jason Father. We have just handed to a project and change the built action to Google Services and Jason. So just like Friar, as we said it to be a bundle research in this case, it has to be Google Services. Jason. However, that option wouldn't be there before we have the fire base package. As so, make sure that you change that build action for the Jason file now never gave bag to the firebase console clicking next, and we don't even have to have any code in this case, like with that for IOS, we simply have to run the application. So again, let's never gave back to visual Studio changed in the project that we're going to be running select one off our virtual devices and wrong on the application, as you can see, the application cast successfully launched. So that should mean that the Jason file is working now again. If we never gave back to the farm is console, we see nothing happening bars as we did for IOS. We can just escape. This is step. These two applications should now be successfully connected to days Far base project. So finally, we can start working with some authentication now because far basically has packages for IRS, native IOS and native Android, although summering has indeed helped us poured those libraries for summary in. After all, we have imported those firebase packages already. These are still instead of the native projects there are in any packages in our shared project, so that means that we're going to be using native functionality, which means that we're going to tap into are very powerful feature off summary forms called Dependence is. So in the next lecture, we're going to start to implement that out functionality natively on both Andrew and IOS in a way that allows us to use a functionality from the shared project. 21. An Interface to Enable Dependency Services for Multiplatform Firebase Code: So we already have the user interface for our Logan and restore functionality. We have also created applications over on the firebase console. And we have connected to those applications right here from the native projects from the Android and the iris projects. However, that means that we're going to have to implement the functionality over there on the Andrews and Iris projects and to use them right here on the shared code so we can actually react to, for example, the breast of the Logan. The press off the raised her Boltons. For that, we're going to have to need the functionality to be here. And I was telling you how we're going to be using the pendency services to make that work. Now the name is not that important. What I do want to start ease by creating a new folder that is going to be the view model. So the view model is, of course, as we saw in the produce section, or as you maybe aware from the MVV N pattern where the logic is going to live and I am going to start by adding another folder that he's going to be helpers. So instead of the Helpers folder. I want a class to excess that is going to, well, help me with the entire authentication functionality connecting do far base. So in the view model for the pages that I'm going to be creating, I don't have that logic because it's not really depending on that you model, these functionality should accessed by itself. So instead of the Helpers folder, I am going to add a new class that is going to be off helper. There we go. Although the name of the finally is going to be both helper, I actually want the class to be called just off like this. And so these classes going to contain all of those methods that eventually will allow me to register and north indicate a user's. In fact, let's go ahead and that those methods already, I am going to greet a new public. Let's make this ecstatic. I don't really need an instance off this class to make use of these methods, and this is going to be bull. Let's start with the register user and I'm making these bull Josemi returns true or falls depending on whether or not the user was actually registered and only I'm going to asking here. He's for this dream name, this dream email and this dream password. So the functionality of whether or not the password is equal to the confirm password is something that I am not going to be a value eating in thes method. By the time I call this method, I should already be sure that the password is equal to the confirmed pass worth text that the user should have. Gritting here is that we do have a couple of entries. So I wanted you inside of this method. These actually raised her the user. Now, right now, we don't really have the functionality. So by default, I am just going to be returning through. And I'm going to do something very similar for the Logan or authenticate user method. So the log in functionality, these internees Onley going to require this string email and the string password as well. We do not have the functionalities yet these he's going to return through, and the reason why I don't have the functionality in here just yet or that I am not really going to be implementing the functionality here is because to be able to register and authenticate users. We need the off packages that we imported into the android and the iris projects. And as you may imagine, those packages are different. They are used differently. They exist in different projects, so we don't actually get to use them directly in here. What we will do is implement the per platform functionality in those projects and use them here on the shirt code independently off what platform is being used there. These were dependency services coming to play because we can create an instance of AL. It's a dependency service here instead of these class. But that instance is going to be initialized differently for Android or for IOS, depending on what version of the code is actually running. So I know it may sound a bit confusing built. I am certain that it will make sense by the end off these section. So first I will need an interface, as you may know, when interface is going to allow me to greet a sort of signature that has to be used by classes so we can create the authentication class on Android and the authentication class on IOS, they are going to be different classes balls if they implement the same interface. I know that the implement the members off that interface, so at least I know that the members of those off that interface accessed on both classes on the Android class and on the iris class again it will make a bid more sense by the end of the section in the next few lectures. So that's a start. By creating a public interfacing here that I am going to be calling I off just like this. These is a interface. I would have to be implemented on both projects, the Android and Iris Project, and I can define all off its members. Let's a star by defining the bull. And actually, let's make this a task already task of bull A test because this is going to be making requests to the Internet, so we will take some time. I need this to be and a task, and because of that, I will need to add a using directive to system that threading dot task. And this has to be bull, and I am going to add the raised user method Dad has to receive the exact same. The strings that we have required down below and again something very similar for the authenticate user. Except it is only going to require the email and the password. So eventually, any class that implements these interface will have to have this couple of methods. The implementation off those methods can be different and maybe different, because one is for android, one for IOS. But eventually those methods success. Those methods receive these values, and those methods return Ah, bullion. So, in fact, what we can do is incentive. Far out class, create private also static variable that is off time. I out that I will just go out and eventually these will be initialized differently. Whether the Andrew or the Iris applications are running, however, we should now be able to use from out there. Raised the user method, of course, passing the values and because that he said times, we should await the coal. And because we are awaiting, we should make these method at task as well. So let's make this a sink. The same will go for the authenticated user. This will be a sing task off bowl and will be using the off authenticated user passing the email and the password. And of course, we have to await the school again. Eventually, these methods are going to be executed differently, depending on what these out viable This initialized to, however, we are not ready to initialize this out variable. This is something that we will have to do in the next couple off lectures. And by the way, there are a couple of other methods that I should add in here the 1st 1 a bullion method that he's going to return, whether or not the user is authenticated already. So I know if I should display the logon page or if I can Jaws to start least ing their subscriptions and a method that he's going to return a string with the current user i d. To get current user I d. These method is going to allow me to get a unique user I d. That's whenever I am ready to start. Inserting into a database can help me identify which subscriptions belonged to what yusor. And because I have these couple of methods, I will need the methods down below in this class, so I will add a public static boo ees authenticated to simply use the Method East authenticated from the south variable and again something very similar with a public static The string Get current you sir, I deem you see the all's get current user i d. So I know that by now these made not make a lot of sense bought. What we're going to be doing is using the methods from days glass. However, instead of this class, we're actually using the methods off these variable which is eventually going to be initialized differently. For example, it is going to be equal to a new and draws out glass Ive were running on android or it is going to be equal to an IOS out Class IV. We are running on IOS. These glasses, however, will have to implement I out. So we know that these members exists, However, that implementation may very well bit different. However, we don't actually code it like this. We will need to use dependency services. The dependency services through dependency injection is the one that will actually initialize the variable Accordingly, we don't actually have to make evaluations evaluations about what's application East currently running the Andrew or the IOS de dependencies service is going to do that for us . So in the next couple of lectures were actually going to be creating those glasses, the class over on Android that implements out and the class over in IRAs that implements I out. So let's do that. Let's move over to the next lecture and start creating the actual functionality for raised during on authenticating the user over on Android. 22. The Android-Specific Implementation of Firebase Authentication: So we have a really greeted these new file where we created an interface, an interface that I mentioned. It has to be implemented in a class above the android and the iris projects for eventually a dependency service initialize. Is these viable accordingly, depending on what application is currently running. So let's have started in the Andrew with Project by greeting the class that implements the I out interface and implements the functionality for all of these four members in the way that android works now. Usually I like to create a new folder instead of the and with project that he's going to be called dependencies and instead of the dependency, the classes that are eventually going to be used through dependency services. So instead of these folder, I am going to Greece and new clients. That is simply going to be the out glass. But these one has to implement the I out interface that were defined previously. For that, I am going to need the using directive to my subscriptions w modeled of helpers, which, of course, is the name space where the eye out interface exists. And of course, we have to implement these interface all off its members like this. And it is inside off these methods once they are implemented, that we're going to be using fire base out the package that we have imported previously inside of these Androids pro shanked and notice that, of course, these methods are going to have the exact same signatures that the methods the members that we created in the interface and the same thing would happen for IOS. That is why we know that these methods exist because of the classes implementing the interface. It contains those members. So that's a start, for example, with the raised her yusor functionality that it's actually going to be quite straightforward rumor that we have the fire base dog out package already imported into our android project. And these one actually has a firebase out class, which we can get an instance from through its instance property, so we don't have to create it. These already has a created instance inside of it, and it has a create user with email and passwords method and in fact, there is also an ace ing version of this which we are going to be using. And of course, the only thing that we have to pass is an email and the password just like this now, because this is an a sink method. I want to await this goal and because I am awaiting it, I need to make this and any think method as well the race. Their user has to be on a sing method now. So far, we already raised during the user. These would actually do the trick, however, so far it wouldn't have any name and we're already receiving the name. So we may as well you said For that we're going to be updating in the user that is actually being inserted. So I am going to greet and you variable that I'm going to be naming profile updates that is going to be equal to again firebase out. And in these cases, user profile changed request, which has a very descriptive name and using the builder class. So we actually need a new instance off of these class profile updates, then is going to be a builder that will allow us to request changes to the user profile. For example, profile updates now has a set this plate name notice that, for example, the results. So I said photo you are I But we're not going to using that. We are going to set a display name off course to the name variable that this method is already receiving. Then what we need these, um, build viable that is going to be equal to those profile updates and their build method. So the build method from the profile updates is going to generate a user profile change request variable. And finally, what we can do. He's update a user now. What? You, sir? Well, actually the one that wants us created as soon as it is creative or or in fact, when we log in as well their current instance for firebase out these glass and this instance right here will now have a current user. Seems we have just created one. We can create a viable cold user that is going to be equal to far bays dolled out farming's out dot instance and current user. And from these user, we can update the profile notice that we could hope they the email, the password phone number in case you want to implement the functionality. For now, let's just update the profile using the A sink version off this method off course, passing the build variable that we have created previously Because this is a thing. I should also await this goal. So by now our method would already create the user with its email, and it's password. And using the code right here would actually update the profile off the user with the name . If all of these is successful, finally, we can return true that we were successfully able to register the user. However, there are many things that could go wrong in here, which is why usually you would want to wrap all of these code instead of a dry block and catch a bond off. Different exceptions. Now I do want to catch a bunch of different exceptions individually because I eventually want the off helper to receive a normal exception with a message, because keep in mind that we're working here on Android board, we're going to be working on IOS. The exceptions may not be identical, so EADS may make it hard for us to get the information over here on the shared code. What we can do is catch exceptions that only exists on Android and simply throwback, an exception that can exist on both platforms. Let me explain, for example, in here I can catch the far base. OWS Week buys worth exception. This is actually a very neat feature of using fire base. You can actually deny the user from using weak passwords, but these exception exists inside of fire Base that out, which means that it does not take sales instead of our shared code. Which means that if we actually throw these exception, we wouldn't be able to use it balls if we catch this exception, and what we do is throw a new exception. Exception is a class that, of course, exists over the shirt code. It's a simple exception, but what we can do to actually know what exception was caught? He's passed the message, which can eventually be displayed so we know what is going on. And similarly, I am going to catch a few other exceptions. For example, there is a fire base out invalid credentials exception, which again is simply going to greet an exception and passing the message from that particular exception. Another important one Fire base out of coalition yusor collision exception in case someone wants to register with an email that is already restart. We can let him know that they already have an account and finally any any other exception. And for these we can actually create our own message, for example, and unknown error occurred. Please try again or something like this, but now says we have a lot of these exceptions called individually. We can actually get the message over to the shared code. So this is the implementation for the restore user. Very similarly, we're going to greet their functionality for authenticating the user. However, this is a bit more and straightforward. I am, however, going to just copy off these goat because I am going to be catching pretty much the exact same exceptions. Instead, off firebase off you circulation exception. After all, we're not creating a user were already looking them in. Instead of this one, I am going to be catching far based South Invalid Yusor exception. This is different from the Impala credentials because this is going to just let the user know that their credentials are in Bali. The password is wrong, but these one is going to let them know that the user doesn't accessed. The current email hasn't being used to register anyone, so we're going to be catching similar exceptions in here. However, the co that we're going to be using is different. We are still going to be accessing fire based off. How's that Farmers out there instance, bought what we have to do. E school The sign in with email and password and the ace inversion off these method, which, of course, requires the email and requires the password on. Because this is a sing, I will have to await it. And if this is successful, it means that we can return. True now, of course, because I am awaiting a call. I need to make this method a sink. So there it is the functionality to authenticate users. Finally, let's see e. The user is authenticated disease sec as accessing far bays dot elf dog firebase out the instance and evaluates the current user, which we have a really used, by the way, is different. And no, if it is different than no, it means that the user is authenticated. If it is no, it means that no user is authenticated, so we can actually return these value right away. As for the get current user, I d. Well, it is very similar to this. We can access the current user again and the current user has a u I. D. Which is unique for will simply return this value, which is a strength which again is going to help me. Once I am ready to insert into a database, identify which subscriptions which items that were going to be inserting belong to the current user. So this is it. This is how we implement the functionality for android. This is how you register, authenticate. Get Karen user I d. And check if the user is authenticated on Android again. These functionality right here is the one that will be used back on the shared code when the android app is running. Now there is one additional thing that we have to do. In addition to actually implementing these on the U. S. As well. We have to export these glass as a dependency. So eventually, through dependency services, we can assign these out variable. And while it sounds a bit weird, all we need to do east after attack to these name space. So instead of these owls Don't CS file when that What? I can actually do these grind instead of these square brackets assembly and mark this as a dependency. Trouble dried dependency here Now to be able to use this time, I am going to need a using directive to Samarinda. It forms Be careful in here because there are a couple off name spaces that contain a type named dependency. But we need the one that exists inside of summering forms. Now we simply have to establish what type. But we're going to be exporting as a dependency and that is the outclass and that we have just created these one right here, so excellent by now, we already have the implementation, the android implementation off all of these methods and we are already exporting the dependency. We still have to use a dependency over here. It is currently exported. Let's say that it is not currently imported in the shared code. However, before we actually used these code, we have to implement the same interface on an iris class. So do the exact same thing that we just did here by adding the android specific functionality. But this time on IOS, that is exactly what we're going to do in the next lecture. By the way, by the way, before finishing up this lecture noticed that I have here hours class bought It is currently pointing to the out glass over instead of the shared go. So these outclasses is not the one that we want. We want this one right here, that one that exists inside of my subscriptions, that droid or dependencies. So I actually have to specify that by grading the entire name space. Just a quick thing that I was missing here to clarify that we are exporting these class, so we need to specify it through the entire name space. 23. The iOS-Specific Implementation of Firebase Authentication: So we already have the android implementation for these out with class. And we're already exporting these dependency, which means that eventually over here on the shared code, we will be able to get off that functionality through dependency injection. More on that in the next lecture. For now, we still have to implement the same functionality bought for Iowa's so very similar to what we did on Android. I want to start by adding a new folder instead of the Iris project. This is still going to be gold dependencies. And instead of these new folder, I am going to be creating a new class that I am also going to be calling out, just like on Android and just like an android as well. These is going to have to implement the eye out interface that I defined over on the helpers name space for the shirt project, the one that we have right here. Of course, that means that I have to implement all of the members. Great. So now all we have to do is implement the IOS a specific functionality for each and every one of these methods again because this is implementing the interface We know that it has to contain all of these members, which means that we can access those methods directly from the shared code, given that these variable east of Type I out and this glass is implementing that into phrase. So let us start by implementing the functionality for raised during users. On IOS, you hear we also have some firebase name space fire based out similar to what we have on Android, but it works a little bit different. So first we have to get the outclass and get the default instance and creates a user known is that there is a creed user, and it's a sink version. Notice that the method then is cold differently than the one over on Android and Bond. It also requires the email and the password scenes. We start to see some differences and, of course, from the very basics this is actually using the functionality from a different package. These may start to clear things up as to why we need implementation in the different projects. But once we have created these user and by the way, because this is a thing, I should await this goal, which means that I have to make this method a sink as well. We have to do something very similar toe up with it on Android, updating these user with name. So similarly, I'm going to create a change request. So I will create a new variable called change request that he's going to be equal to fire base and got out. Does out again. Also, I need to the default instance and get the current user and the Korean user has a profile change request so we can start to configure the change request itself. One thing that we have to do these change the display name. So will simply assign this to the name that this method is receiving right now. This is really everything that I need to do. But notice that instead of the change request you could change the description. You also have something like the photo you're l. So you would said those values in here if you were to change them for now or we have to do is commit the changes in an a sink way. So I will use the ace inversion. And of course I wait this goal and finally, if all of these EEZ successful, I will return true. However similar to what we did in Andrew is many things could go wrong in here. I'm going to wrap all of these code instead of a try catch block, and similarly again, I will have to catch some exceptions. However, here we only have to catch one particular exception we are going to catch and as error exception and we will need a using directive to the foundation named Spain's. These type of error is actually going to contain all of the information that we need. However, for us to create a common exception that can be send over to the shared code, we're going to have to get the message so we'll create a string message variable in here that he's going to access the message itself. But this message can actually be quite different, depending on what error actually happened all of the time, we're going to get the exact same type of Exception board. The message is going to be formative a bit different. Of course, you could start to explore what this message is about bought. You don't need to because I have done that for you. What we can do is extract as so string off these message so that it works for either off the exceptions that may be caught. So that is started by gripe. Grabbing the message again and finding the character instead of this is strange for the actual exception which is an N s localized description equal. So somewhere, instead of the message itself from this exception, we're going to find this strength. Each exception is going to have this in a different place. So this is why we're using index off. And also we're going to be using the string comparison current culture for this just to make sure that we get the actual message and we have to do now is get the text that is immediately after these string until, ah, final period. Because after that period, there is going to be a lot more things that we don't need. So I can update the message to be equal to the message itself. But replacing these same string that we just found four and empty string and again because after these there is going to be a period when I can do is a split the text through a dot with a period and grabbing the first string off this plate. So basically there is going to be, ah, message a sentence right after these strength that is going to end with a period. And after that, there may be another periods. There may be some other sentences. We only need the 1st 1 which is why I am using the 1st 1 the index zero in here and of course, optionally. This is not necessary balls. Since we have removed that period from the end, I want to ask the period again. I don't know if these make sense, but let's say that the message is going to be something like this on This is the message and there is a period in here and there is so more text after that. These girl right here is going to allow us to find this string. And by the way, there may be some code before these as well. What these goat is going to allow us to do is first grab the string where we find these particular text nothing before it. But also it is going to grab it all the way to the xperia. So in this case will grab these strength right here. However, because we're splitting by periods, the period wouldn't know to be included. So we are adding it again. Hopefully, it is not too complicated. We are just grabbing the message for these exception itself. Scenes. We already have the message what we can do. He's through a new exception, a normal exception. We've these message just like this. And now, no matter what exception, we can't we have successfully sent a message on intelligible message over to the shirt code . And finally, we can also catch any other exception that may happen. Also, TRO an exception with a message boards. I am going to be using the same strength that I used for Android. Then below that an unknown error occurred. Police try again. So this exact same message is the one that I'm going to be using here on IOS. So this is the functionality for registering the user. Let's now add the functionality to authenticate the user. Similarly, we're going to have to access far bays and out and out and the default instance. But this time I will have to use the sign in with password, a sink this one right here, which means that we have to pass the email, of course. And the password. And because this is a sing I shoot await this goal. And because I am a waiting on a sing method, I have to make these method facing as well. If this is successful, I am going to return through. However, just as with it with the android version and with the race there, you, sir, I am going to wrap thes code inside of a try catch block because of course, things may go wrong. So what I will do is something very similar. Do what I just did down below. I am going to catch any Ennis error exception and any exception. The structure off the error message is going to be identical. So these gold will work as well again getting the message itself without all of the extra information that is not useful for the user. That may even confuse them. Now for the get current user i D, which is very, very easy. We just have to grab out dot owls the default instance, which, of course, has the current user and just like an android, the unique i d. So we returned at and for his authenticated we can't return whether or not the far bays that ows dot owls dot default Instance that current yusor is different. I don't know if it is different. It means that the user east authenticated if it is equal to know these were returned falls , which is exactly what we need, because it means that the user is not authenticated. Finally, just like with their own Andrew, would we have to export these glass as a dependency And again, we're going to be doing that instead of these square brackets using assembly Cohen dependency. To use these type, we need a using directive to Samarinda it forms. Make sure that you select summering that forms no the other name space that is no, the one that we want and passed the type off the class that we want to export using type off and in parentheses out. However again, just like conundrum would make sure that we are exporting these glass right here because if we just grind is down, noticed that there one over on the shirt code is being used. So we need to specify the name space like this. So there you have it. We are now exporting the functionality for authentication directly from the android and IOS projects. Or there is left Rose to do. He's import. Does dependencies through dependency injection through the dependency services that summer informs, is going to make things really easy for ALS when it comes to use the pendency services so that they out variable that we have right here is initialized accordingly, whether with the Android version off the code or the IOS version. And once we have that, we can actually implement the functionality. So when the ball turns are clicked, we call these methods. 24. Using the Platform-Specific Implementation in Shared Code: we haven't really implemented the register. You serve the authentic, gave user the east authenticated and get current use ready methods on a class on that board and on the class and IOS those glasses already being exported as dependencies. All we have to do now is use them. Let's say import them into these shared code and literally all we have to do is assigned these out variable that we already have to dependency service. To use these type, we need a using directive to Samrin dot forms, and it's get method. The get method is going to request at time that we want to get in our case that he's army out. So what is happening is that these method is going to search the classes exported by the current application that implement these interface. For example, if the Andrew its application is running, it is going to search for any dependency that was exported by the end with Project that implements these interface on the same ghost. If the IRS application is running, it is going to go ahead and get any dependency. Dance implements this interface, and, as it turns out, we already have them both off the Androids and humans projects already exporting a dependency that implement these interface so that he said, This is everything that we need about dependency services. Now these variable is going to be initialized Accordingly or we need now is to implement the functionality itself for our logon page. So to get the values are entered instead of the entries and to react to the clicks off a porton for that instead of the view model, I am going to be creating a new class. This is going to be the Le Guin V m. So just like we have the logon page, this is the Logan V. M. And if you saw the previews section or you are familiar with MPP and you know what we have to do first we have to implement the I notify Property changed interface, which is going to require using directive and a member of these property changed event, which I like to define before the constructor because we're going to have to raise that event every single time a property changes. It is a good practice. Agreed a private void on property changed method that he's going to receive the property name off the property that has just changed and inside were going to raise their property change, defend ive There are subscribers. So in here I will call the invoke method with these as a center and a new property changed event Rx that receives the property name that we already have like these and we're going to need a few properties that are going to be calling this method. We're going to need the email, property and the password property. And we're also going to need the name, property and the confirmed pass worth properties. So let's go ahead and create them. I am going to be defining before the event a full property using the pro full snippet, and he's going to be of time String. Let's start with name flew up. We've the email. This is also a string. After these, we can set the buzzword, and finally they confirm password. And of course, just like I mentioned in the centers for each and every one of these properties were going to call the on property changed method passing the name of the property. So in these one, we're going to pass name in the 2nd 1 we have to pass email, then password and then confirmed by his word. So whenever these properties change, we are racing the event with the corresponding name off the property that has changed. That means that all of these properties can now be bound over here in this ammo file. So, of course, we will have to start by adding a new XML name space all the way to the top of this file. Sold right XML and Nance Colon. Let's call this B M for view, model and, of course, work with we pointing to our view model just like this. And then instead of the content pages, Research says, we're going to be creating a research dictionary. And instead of the research dictionary, we're going to need a Logan VM instance that is going to have a key off Logan B. M. Or let's just call this V M. Since we already have these bm we can set their binding context for the entire grid to be these new static research called the M that we have chose created. And so the entire grieve and off its Children have the exact same binding context, which means that if we come over here to these entry, we can set the tanks to be binding. Do the email and we actually get some order complete functionality in here now because this is an entry and the entry has to set the value off the email, not just the other way around. We have to said the most to be to weigh and the same will go to all off the other entries. For example, these password entry. He's going to have its text binding to the password also in a two way. Most these is actually going to be the exact same thing for the email entry that we have down below and the passwords entry as well. It is okay for these to be binding to the Excite same property. That means if we update the email e while the use of returning to again and they realize that they want to register, they simply click and re stir and their emails are already filled up. However, we do need to set the text to be binding to name for these other entry and the mode East balls are going to be two way and finally the same thing for the confirm password entry. We're going to set the taxed to be binding, to confirm password with most two way excellent. So now, whenever the user grinds instead of these entries, the values of those properties over on the VM are dated. Now we have to make sure that whenever the Boltons are pressed, we actually called the Logan or register functionality Accordingly. However, keep in mind that we do not want the Logan message to be enabled. Ive email and or password are empty. So for the look important to be disabled when either of those whose strings are empty I want a couple of things off course you may see it's coming. I need a command balls. I am also going to greet a new full property that is going to be bullion that is going to be cold, can logon that is actually not going to require a center, which means that we do north nif variable. It is simply going to return whether or not password or email are empty. So it is going to return and string east no or empty for the email, and the string is no or empty for the past words like this. And actually, I want to deny these evaluations. So if the email is no or empty, this is going to return True, but in that case, can logon should be fools. That's why I want to deny this. And both of these would have to be true, meaning that both the email and password cannot be no nor empty for the can logon to return . True. And what I will have to do is actually co on property changed again whenever the password changes bought sending the name off the can looking password. So whenever the password changes, we make this evaluation again, and the same goes for the email. Whenever the email changes, we want to evaluate if the user should be able to look in again and something very similar is going to happen for can register. So I mean fund going to copy these can logon property rename it to can register and similarly, I will have to evaluate another couple of strings. So I want to evaluate if a string is no empty. Four confirmed has word and remember that we are denying these evaluations. So the Opel said value is returned and we will have to evaluate again is no or empty for name. So we are doing the evaluation for role for values and name the password. Confirm password and the email which, as you may have guessed, it means that we have to call the on property changed again. Four that can register in these gays for all four properties whenever any of these properties changes because the the evaluation has to be made again. So these is now going to be the parameter for our command. In case you are not entirely familiar with commands, I suggest that you go back to the preview section to the commands lecture. So you understand where this is going. But then, below all of these properties, I want to greet a new property off type I command, which means that I need the using directive to system that windows start input to be able to use these interface, and these one is going to be logging command. And I am also going to need another property also off type I command that is going to be raised their command on both have to be initialized. The constructor for the Logan B. M So Logan Command, for example, is going to be equal to a new command and command. It's another type. This is not the interface. This is a class coming from summary informs told me the using directive to some marine dot forms. Now he here I am going to need a couple off methods. First, the actual log in functionality, the method that is going to help us longer the user in, but also they can log in that is going to return, true or false. Now the functionality were We already have that over here in the properties so we have to do is return these properties. But this is important. So I need to first greet the Logan method down below. I am going to rename this to be parameter and the Logan method. All it needs to do is go from the hour glass, which we created earlier, the authenticate user method which requires the email which is instead of one of the properties and the password, which again is one off our properties on. Because this is an facing method, I should await this goal, which means that these method should be a sink as well So this is the functionality that the command is going to execute. However, I also need a private bullion method that is going to be the can logon that is going to also receive the object parameter. And what these method is going to return is simply the can Logan property which of course, reminds me these cannot be called in the exact same way as the property. Let's say that this is them Logan can execute. So let me rename this method down below, just like fast, so that looking can execute if you remember, will be executed every single time that the parameter that the command receives changes which will have to be, they can logon. Which means that back in the look in Bolton that we have up here, we're going to have to say that command to be binding to that command, the log in command. But also we will need the command parameter to be binding to the can Logan property. That means that every single time the can log in property changes, which is the parameter they can execute, will be evaluated again. Now we're going to need something very similar for the register command. So register command here in the constructor is going to be equal to a new command again. This is going to require a raised to method, and Regista can execute method as well. So I can simply create the racer method like this again. I am going to rename this to be parameter and similar to what with the Logan. All these needs is for us to use the out glass that we created and use that raised the user method which requires first the name that we have in the property in the email that we also have and finally the password, all of which are properties instead of these class. Now I need to away this goal and make these methods a sink. Finally, we need the raised can execute which your return bull and this is going to be parameter as well. All these has to do is returned, can register joes like down below, in the lowing can execute. We return can look in and again over on the other bulge in here on the register button, we're going to have to bind their command to the radius that command and down below sat they command parameter to be binding to the can register property. So again, every single time these property changes because it is a command parameter, it will trigger they can execute to be evaluated again. So let's go Hand has this. How'd I am going to never get over first to the android Project dependencies on the owl chr file. And the first thing that we want to do is registered users. So I will set a break point right here, and I am going to roll my application on an android simulator. We see the ever been running. We see, by the way, that these Bolton is not enabled. And I know that we're going to be registering. But let's write something down in here. This has to be on email. It has to be formative as such and a password. These has to be a complicated password because otherwise we're going to get on exception that the password is not secure. And that is that now the log important ease enabled. However we want to register, so lets navigate to register. And we see that days. This is steel Field ob. So let me confirm the password that is you to me 2020 and said my name and click on register, which, by the way, notice has bean enabled. So if I click on register, notice that the method is actually executed, these one right here instead of the Android project. And if I let these continue, we are actually getting an exception. Which reminds me, by the way, let over on the off helper were not really catching any exceptions. We should be catching the exceptions and displaying them to the user. So whatever message we receive when we register and when we authenticate. So let me actually wrap this instead of a try catch blanc. And this time we only have to catch one type of exception, and in this case, I will have to return falls. But before returning fulls, I want to display something striking Access the ab that current that main page Daut This play alert to display some ever message with the message that we have already said inside off the exception and some cancel Bolton and we have to do the exact same thing for the authenticated user method. So grab this inside of a try, catch blanc and display the error message. Now let me evaluate. Why is it that we're getting an exception over here when authenticating? Apparently it wasn't a known exception, So I can set a break point in here to evaluate what is going on. So let me hear, Try again. I am going to click and raised it with the same information. And I am not seeing any message. And the error message, perhaps thes finally succeeded. So it appears to have worked this time. Now, of course, we have to improve these in a few different ways. Actually, we have to make sure that these entry eats an email entry. We also have to make sure that the past words are the same before we actually evaluate if the register button should be enabled. But eventually, once we raised her, we should navigate to a page that we do not have just yet. However, let me never get back to my fire base counseling here, over to authentication hand in the noticed that we have a new yusor in here, which means that that I should be able to log in with user Now let me evaluate back in the out helper Eve this is going to be returning true. I am not really going to be doing anything. But let me just create a bully and variable in here just to make sure that this is successful and I am going to be returning. Has he has locked in and I am going to set a break point in here. Jones to test if these were successful. So I will run this again on the Android simulator. Although by the way, by now we should also be able to look in from I always with the same credentials boat. Here I am going to grind the same email and the same password and click on Logan. We heat the break point and has logged in easing the true so great we can't successfully logged our user in. Let me return the value immediately in here and update a few things inside of my code. But hopefully you see how we have now implemented everything. Now I do want to never get over to the Logan VM and over on the can raised her. I have to evaluate if confirmed has word and password are the same or actually let me do it over here on the raised method so I can actually display something to the user. So here, when the register method is evaluated, it means that the name they email, the password and the confirm password entries halfs from text balls. I want to evaluate Ive. They confirmed Pass worth blooper team is equal to the past worth property. Or actually, let's make this not equal. And if it is not equal than something must be executed. Let's say that we're going to access AB that current the main page and we're going to display and alert something like pass words do not match balls. If they are identical, then we can go ahead and execute these code. Also, let me go ahead and navigate over to the logon page and make sure that these placeholder email has a key ward off email through these easier to enter the emailing here on also these entry up here. So there we go. Excellent. Finally limit testing sounds over on IOS. We should, of course, be sold in the exact same thing now. Currently, we do not have any success alerts boards. If I try to looking with the same credentials, I shouldn't see any errors which right now would mean that I succeeded when Logan in. So I mean, go ahead and try that. Notice that now we do see the email keyboarding here that's entered the same credentials. Click on Logan and apparently we are running into some issue. By the way, let me show you the message for this exception. So it makes a bit more sense the code that we created notice that we have these end as localized description all the way down below. So we are ignoring all of these texts and just focusing on this. Then we get all of these text bonds managed to split it after the xperia right here. So it seems that we have a never when accessing the key chain. This is actually I us related. No related of fire base. So let's fix this. We actually have to open the entitlements, don't pee least file, navigate over to key chain and enable key chain. These should make things work. Balls, unfortunately, notes on a simulator Onley on advice. So what I'm going to do these says that's on that device to show you that things are working over here instead of selecting a simulator. I'm going to select my iPhone. Now, if I run the project on my iPhone, there is actually some key chain access, not on a simulator. So when these runs on the device, these will actually work. So unfortunately, yes, we're going to have to test on the device from now on. We now have the application of running here in the device. So let's go ahead and test this out. Same email, Same password, click on Logan. And it seems that we're not catching and exceptions. We're not seeing any error messages, so we're going to assume that these worked. Now, let's go ahead and raise their a new user. I am going to change this to be just don't co. This should be enough for this to be a thing to fight as another user. I am going to set my name and my last name and confirmed the passwords. Same password as before. Click on register. We do not see any error messages. So that means that if we never get over to our firebase console and reload this, we should now see a second register user, which we do with a difference I tend to fire. That means that either on IOS or Android we should be able to logon with any off these users. So there you have it. Just how you implement authentication on Iris and on Android with fire base. Now, this is just the beginning off the application. We actually have to code their functionality. So what I told you at the beginning of the Kurds were going to be creating an application for us to keep track of some subscriptions. So in the next section, we're going to be implementing that functionality along with firebase databases. So those subscriptions are actually in here enough Arby's data race that we can access from both IOS and Android. 25. The App's Navigation: Adding the List and the "Add New" Page: So we have already configured the functionality for registering, and we're dedicating our users. But of course there are a lot of things that we still have to do. For instance, right now, we're not even displaying some other pages to the user. There is no way for them through even seed, at least of subscriptions and talking about that we didn't even have, at least of subscriptions. So throughout this section we are going to be implementing the functionality to ath read and update subscriptions from a database that we are of course, going to have over on fire base. So where I want to start East right hearing, said official studio, by implementing the navigation. Because, Hank, currently we only display the logon register user interface to a user's. So what I want to do in these lecture East actually first never gave over to the least of subscriptions by default when the users opened the application and right there, as soon as we never gave to that page evaluates ive the user, ease authenticated. If it is not, then we never get here to Logan Base that we already have, and they can raise their or they can look in boards once the register, once they, Logan or if they were already looked in. We should just go to this aggression page or stay there and eventually re the subscriptions . And also from the subscription space, we should have a applause Bolton and after Bolton that navigates the user over to the new subscription beige. So before actually jumping in and implementing the functionality to wear with databases, I want to do that. I want to implement the navigation in here. So let's start by creating a new page I'm going to be closing for now. The logging paged samel file the oath helpers, which we are not going to be modifying anymore. We have a live off the functionality there, by the way, from the oath helper. We are right now going to be implementing their or using rather, the East authenticated method, which we have to use to know if we should never gave the Yusor back to live in pace. I do want to keep the Logan VM open because I eventually want to navigate back to the page that I am about to create from either the Logan or raised her methods. But First I have to navigate over to the view and as and You Page, I'm going to select the file. I am going to go to forms, forms, Contin Page Sam, old template that we used before us well, and this one is going to be the subscription Spain's and click on New now here in the subscription space. We are, of course, going to have at least view that we are going to be implementing throughout the section. But for now, I don't really want to focus on creating the least view and creating the functionality. I want to focus on the navigation side of the application, which means that first and foremost I should be able to navigate back to the log in page. Either you sory snow is not looked then, which means that first and foremost, I have to navigate over to the abduct samel dot CS and update how the main page is being initialized. First of all, I now want the subscription space to be the 1st 1 to be displayed, and again, only the user east notes already look, then navigate them over to look and b m otherwise just to stay in the subscription space, but also since we're going to be navigating back and forth between different pages, the main base should actually be a new navigation beige, which allows us to actually implements navigation in, Samarie informs and the navigation pay. She is going to require a route space, the one that displays immediately the navigation base for duty of you who are not familiar . Are is also going to help me display back ball turns and titles instead of each and every one of the pages, which is particularly important on IOS because, as you may know, there is no physical or software back Porter and as Aries on Android. So the navigation based then is going to require the roots page, which, of course, as I said, is going to be the subscription space. So I'm going to be initializing a new subscription space as the route for the navigation beige. So right up the bats E. This is going to make these space bit displayed and there is going to be a title. So what I can do is actually said that title in here. Let's say that this is going to be my subscriptions and also it is going to help me navigate over to a different page right here from thes view. Now, because this is the steel view functionality, I can keep these co that I am about to create right here in the code behind these is also going to make things a bit easier for me by overriding the own appearing method which we have used before in one of the previous sections. These is going to of course, be executed as soon as we navigate here to these particular subscription space. And what I want to do is evaluate right here if the user is already authenticated and this is going to be very easy because over on the out glass, for which we need a using directive to the helpers name space, we already have the East authenticated method that does everything for us. So all we have to do East Golden method. If the user ease authenticated, then we can remain here. But if it is not so, I am going to the NY. Whatever these authenticated method returns, I want to never gave the user over to the logon page so they can actually race there or authenticate themselves. So what I can do is from here use the navigation property for the counting beige and bush to another page. So it's use Bush a sink. And what I want to do is pushed to a new Logan Bache just like this. And, of course, back in the logon page, the user can register, can logon. And in the view model, we are already implementing the functionality for looking and raised during what I want to do. These navigate users back to the subscription space ive they have already either raised, heard or looked in. So what I can do is here for the race. Ter Method Evaluates Wad was the result over a stirring the user. So let's say bull result. Remember that raised her yusor. He's going to return a Boolean so Eve Resold is true. I want to never gave the user back to the subscription space, so I can do that through AB the current main page navigation and use Bob a sink to navigate back to the previews view. Now, since this is a thing I will want to await, there's something very similar is going to happen on the low in method so I can actually just copy these evaluation based it down below. Of course, I am going to need the bull resulting here as well, because authenticate user does return a Boolean with the result of the operation as well. So this is the basic navigation. Let's go ahead and says this out. Check if this is actually working, I am going to test this on Android, one of my android simulators. Click and wrong. We see the device now Broening here. Let's way for the application to open here. The application is launching and we didn't even see them. My subscription space because we immediately we're navigated in here. Now notice that the navigation page that we now create from the Abdul tsemel dot CS is heading these back Bolton. In fact, if I were to click in it, nothing seems to happen because as soon as I click in this, we get navigated back to the subscription page, which means that the owner appearing method is executed again. These evaluation is executed again and we navigate back to the logon page. So nothing seems to be happening. I will be removing these Bolton. But for now, let's go ahead and log in. So I know that I have used these email for race during along with the spice word click on low gain and were Oh, all right, Yeah, we're getting an exception here because he turns out that when we never gave the log in page from this description space, we're doing it so quickly that the subscription space is not really ready. So what I want to do is just at a bit about the laying here. I know this feels a bit hacky bought. This is actually going to make things work a bit smoother. The user is actually going to notice that we are never getting first to the subscription space and then over to the logon page because they are north authenticated. So we can do something like task for which we will need a using directive to system the threading the tasks and simply delay this ball Its A 300 milliseconds, which is 30% off a second. Of course, we will need to await the school, which means that this method should be a sink if we are awaiting this and the navigation will only happen after this. A small DeLay. And by the way, let me await the school as well, since I have made in these method facing. So another thing that I have to do, by the way, is delete the application. It turns out that far base is so useful and so great that it is actually already aware that the user has 10 tick ated. And because we don't have any love out functionality in our application, we can the elite, the application. Otherwise we wouldn't really be navigating over to log in page because he's authenticated will already return. True. So to be able to test these out fully, I will have to delete the application. That way, everything is the leader at Firebase has no way of knowing if the user is authenticated hands the uterus notes authenticated and hands we get navigated back to the looking page. I don't know if you noticed there for just 30% off a second. We wearing the subscription space we were able to see in a title there for just a teeny tiny bit. Let's go ahead then and test our functionality out. I am going to set their credentials Silicon Logan and this time we are successfully navigated to my subscriptions because it was successfully created so excellent. And Asali was saying, even if I closed the application, I have stopped the application from running, and I combined to the device and I open and the application again. This time I am no longer navigated bank to log in b m the logon page because they use their and it's already authenticated. So it persists that authentication we could, of course, at some functionality to love the user out these functionality is is already working. I know it is the title, by the way. Now the next thing that we have to do. He's never gave the Yusor over to a new subscription page. So that means that first, I will have to greet that change. So over on the view as well, I'm going to add a new file that is going to be a foreign scones and page sammo that I'm going to call new subscription beige click and knew we have these new subscription base. Eventually we're going to the sign it's and we're going to be inserting to the database from here. For now, all I want to do is never gate to that page whenever an ath Bolton East clicked inside of these subscriptions beige. So I will have to add that at bottom first and then the navigation functionality. For that, Bolton and I will do it instead of the continent pages toolbar items, which is an additional parameter off the content page, not its content. This is outside of the content. And instead of rubber items, I can add, of course, a new tool or item. And this will Brian saying he's going to caps from text. Let's say that this is after and just for the sake of simplicity for now, before we actually have the view model I want to set aka leaked event handler. Eventually we will have to change this for a command. But for now, I have the functionality right here in the cold behind says we're eventually going to be changing ways. I don't even need to change the name. This is the only event handler that I'm going to happen here. Bought from thes method. I want to again use navigation and push ating this time to a new new subscription beige like this. So when the user clicks and these two are item. They get navigated over to the new subscription page. And by the way, in this page I am going to say that title just really is clear that we are inside of that page. So I will say that title to new subscription like this. So let's does this sound. I'm going to run the application again. We see the application launching just before we are not navigated back to the logon page because the use of steel authenticated. But we now see these asked Bolton these again easing the title bar because he sees not a button instead of the contents. This is actually a Tober item And the toolbar well, it is thes title are which wouldn't be here, by the way, just in case you are not entirely familiar with summer in ive we had in creative over on the abduct samel dot CS file the main page as a navigation pane showed that is very important. How very we duke llegan these Bolton. We get navigated to the new subscription page and we see these back Bolton off course and android. We also have their software back putting down blow or the physical Bolton in some devices. But there you have it. This is the basic navigation for application. So eventually we still have to add on additional beige, which is going to allow us to add it as subscription. But for that we would actually have to cap at least of subscriptions. And for that we will actually have to have some subscriptions in some database. So in the next lecture, now that we have these new subscription page, we are going to start implementing that functionality we're going to have to navigate over to fire base, set up a database here on the salmon application. We're going to have to create these air interface and said, Of course, the functionality for android app for IOS through dependency service is very similar to what we did in the previous section with the authentication functionality 26. Cloud Firestore Setup & Dependency Services Interface: once we have the user interface and navigation already set up that the user could really navigate over to a new subscription page in his time for us to prepare the databases. So right here, back on the firebase, Consul, for our my subscriptions application, we have to navigate over to database. Remember that by now we already cab the authentication implemented. We even have a couple of users registered. Well, we have to do is go over to database and llegan create database here on the cloud fire store option. These is Goto's degreed database that allows for automated scaling and real time updates. And it is This is a couple of steps that we have to follow. We could start Nets s most. We can immediately start reading and start writing, but we actually already warned us to be in production mouth. This is going to allow read Body is not going to allow our grinds. We are going to change this in just a minute. So let's go ahead and click next and said their location for our database. So I suggest that this is ask close to most so for you, your users. That's possible. So there is a little bit less lack when it comes to making this requests. For example, if most of your users are in South America, you would select this one ive. They are mostly in the East Coast of the United States. You may select one of these East US options. There are also some options over in Europe in the West Coast of the United States. Let's go ahead and select U. S Central. In case your users are all everything that it states, perhaps central us. It's going to make it ideal for both your users over on the East Coast, over in the West Coast and, of course, in central us. So let's like this one and click on zone. These is going to create our database. Excellent were again going to have to implement a per platform functionality similar to what we did in the preview section for authentication. Because, as we will be doing in just a minute, we are going to need package similar to the packages that we need for We need it for authentication. That is a specific for each off the projects now, before actually going ahead and adding those packages I want to instead of these database never get over to the rules. No, it is that in here we have these code that is not allowing neither read nor write That is assigning both of them to falls. What I actually want to doing here, he's changed its code. So seems we are already authenticating our users so that we can grow right read over dates and the Leeds ive the user east authenticated. So instead of the code that I have right here, I am going to set allow for read for update four deletes and for right ive their request itself to read to update delete or two right has a user so we can access the authentication for this request which has a unique 80 for the user. If this is not no, it means that the user is already authenticated, which means that I will enable read up the delete and right I will click on publish in either way, Eve. These turns out no to war. We can always go back to the previews version. Notice that we have kind of like a history over here. Teoh to the left. Now that we have these set up, then it is time for us to set up the connection over on this summer in project first and foremost, we will have to navigate back to visual studio, of course, and over to both the IOS and Android projects for the Iris project, I am going to add another and shape package. So rightly come packages select management packages and here I am going to search for fire base. Don't IOS dot cloud fire store. So the type of database that we're currently going to be using And it is this one right here some random fire base with IOS don't cloud faster. So I'm going to select this one and at these baggage similarly, for the Andrew Project, I am going to right click on the bandages, select management packages and for this when we're going to search for far base, I thought fire store. So the packages named a little bit differently, bought You should be able to find these ones. Samarinda Fire based off faster from recently I can It's not appearing here. Just make sure that the author is Microsoft and you should be good to go again. For some reason, we cannot see the ICANN, but I'm confident that this is a package that I'm looking for because of the name. And because the author is Microsoft's select Samarinda Farm, based of Forrester, and at the package to the Android protect so excellent that is going to allow me to Eventually, from the Android and diverse projects creates another dependency very similar to A with it with the both classes. Which means, of course, that we're going to need a new interface. So let's go ahead and create that. Now the interface is going to be very similar to the old interface that we already have. So we're going to capture Created also instead of the Helpers folder right here. Then I am going to our new class that he's going to be an empty glass. Let's go this database helper. Now what I want to do, similar to what we did with all helper ease creates an interface that eventually classes of Run, Android and IOS are going to use. I am going to create here a new public interface that is going to be I fire store. After all, we are using fire store from fire base. Now, these Glass is going to have the method for us to Reeve to update, to insert and to the lead subscriptions. However, so far our code doesn't really know what a subscription ease. So before adding the members for these interface, let me go ahead and define what a subscription is, and I am going to be doing that in a in another folder. So we're going to have the third very important folder for the Ambien pattern, which is the model. So we have the view, the view model. Now we have the model, he said of the model folder. I am going to add a new class that is going to be the subscription class, which again is going to be defining what a subscription is. So the model and I'm going to have a few properties in here. Let's start by the finding the string, You, sir, I d. So this is going to be crucial because they use right. He's going to help me identify what subscriptions belong to which you, sir, Which is why, by the way, are both helper class. Has these get current user I D Method bullets full along. Let's greet the rest of the properties. I am also going to require a string name off the subscription. Perhaps I am going to need a daytime subscribed date, Roberti and perhaps Bullen property defining whether or not this is still active. So he's active. I don't know. You can come up with your own subscription model, but once they have the class, I can go back to the interface that I was grating and created. Members, for example. Bullen Insert subscription, by the way, because this is going to be a request to the Internet. These should probably be at task. And, of course, when inserting, we're going to need the subscription. So I am going to be asking for a subscription parameter, which, of course, is now being defined by the model. So I add a using directive to that name space. And, by the way, I need a using directive to system. Don't threading the tasks to use the task type and something very similar I am going to need for the elite subscription for updates subscription. Now, when reading the subscriptions, I, of course, do not need this subscription, and instead of being a bull and he's actually going to return at least off subscriptions. So something like this I will need a using directive to system. That collection is so generic to access the I list interface. By the way, this is the interface. This could also be a list or a natural collection or something like that. I am just going to be using i list bought. This sits This is the interface that eventually classes over an android and IOS have to implement now again very similar to a With it on both helper. I want these database helper to already have a private static I fire store viable that I'm going to go fire store that he's eventually going to be initialized with dependency services. So far, this is not going to be initialized now, something that I could doing here too quickly at all of the methods is implement for just a minute. Are far store because implementing the interface is going too well out of all of these methods. Now, I don't really want this class to be implementing the interface. I just want the methods in here. But it made things easier, didn't it? I already have a lot of these methods now instead of all of these methods, all I am going to be right now, a school from fire store, the corresponding methods from, for example, that the lead subscription is going to be passing this subscription. Remember that eventually we may want to also cat some exceptions. He here for now. I am simply going to be returning the value immediately. So I am going to do the same on all four of these methods, simply calling the method from the interface which again eventually is going to have its own implementation, depending on the application that is currently running. So there it is. We have the interface. We have these database helper eventually. Of course, these methods can be called from the subscriptions view model and the new subscription fee model. But we don't have those us yet. In fact, before actually adding those view models, what it wants is the actual implementation for Android than IOS. So a new dependency. So in the next lecture, we're going to be implementing the fire fire store in a new dependency for Android and implementing the android specific functionality. Then we're going to be doing the same for IOS because once we have all that. We can finally make our application work dilating in setting, reading and updating subscriptions from the fire store data ways that we created in these lecture. 27. Inserting to the Cloud Firestore Database (Adding Documents to the Collection): So we already have these new database helper with its I fire store interface that we have to implement in a do in a new dependency very similar to a with it with the off classes over an android and IOS for that over on both of these applications, we have already added a new package the Semmering, that fire base of Fire Store in the case of Android And in the case of IOS, the summer in the fire, raise both IOS dot cloud fire store. That means that we are ready to start using fire store databases on both of these projects . So what I'm going to do is navigate over to the Andrew Project and add a new class instead of the Dependencies folder. These is going to be my let's go days, Fire store. And of course, this is going to implement the I Friar store interface that I created in the previous lecture. For that, I will need the using directive to my subscriptions of you more Soldat helpers. And of course, I will have to implement the interface itself with off its members All four methods now, right now, what I'm going to do a simple Amanda functionality for Rose to insert. Once we have inserted, we will eventually be able to read Was we have red We have. We will eventually be able to navigate over to the detail space, which we do not have just yet. And it is from the delts page that we will be able to that leads and update. But for now, this shows implement the insert subscription method. So that means that the rest of these methods will remain with the Stroh new, not implemented exception. Just so we have that reminder in case we ever need it. So right here, inside off the insert subscription method, I will have to start by using fire base, of course. But these time, differently to what we have been doing, we're going to be accessing fire store. So fire store indicates of Android is going to have a firebase fire store class and an instance, and at collections method. Now the collection method is going to be It's going to make him a bit more sense. Ones we see this over on the database would essentially instead of tables what you may be familiar with if you use SQL or SQL Alliance or my SQL, for example, In these cases, we're going to have collections, and we're going to need this subscriptions collection. So these is the collection that we want to get. So I'm going to name this collection now it is to their collection that we want to insert new documents. So in the case of these fire store data, bays were going to be inserting and documents inside of the collection similar to how you would insert items inside of, ah, table. We're going to be inserting documents inside of a collection. So they're item. The documents that I want to insert is going to be created in these new, viable Let's go this subscription documents. So essentially we're going to cast or or convert or create a document based on the subscription that we're receiving. So the subscription document is actually going to be a new dictionary, so these dictionaries is going to have a string as the key and an object as the value. However, in the case off android, this has to be a Jabba object. So I will have to access Jabba Lang object for these dictionary, and instead of the dictionary jewels like any other dictionary, I am going to have the key value pairs on. I know that I'm going to be using the exact same properties that the subscription has. So if I go to the model, I'm going to need one key for each and every one of these properties. And, of course, the values that we already have. So, for instance, I am going to need a user I d key. And actually, what I can do to make things have it easier and I'm going to call this author is not even assign it to the subscriptions. Use a righty because I actually have access to that. You, sir? I ve through fire base and the out of name space and the far based outclass which you should be very familiar with. Remember that we have the n stands on. We have the current yusor, and the Green User has the unique I. D. So we can actually do this. In addition to the offer, I am going to need the name off the subscription. So an additional king here would be name that he's going to be equal to the subscriptions and names. So the subscription that we are receiving that this method is receiving and its name. We are also going to require the East active. I will mention the subscribed dating just a second. So let's create a new Key East active, which is going to be equal against subscription thought East active. Now, when it comes to the daytime, we actually have to cast this to be a native date. The date for android because the daytime that we're using over on the shared code is a date Time a c sharp, They time. Let's call it that way. And over here, we need a Java date time, Jabba date off course coded. We'd see sharp, but it should be off a different time. So, in fact, what I can do is I am going to create a private method and below that is going to be static . I don't need any instance that is going to be a type they'd bought not off type date time, which is a C sharp object bought off in java dot util dot date. So these type of date and it's cool days daytime to native date method that is, of course, going to receive a daytime as C sharp daytime and it is going to cast that value as a Javert eight. So we can actually do this by first greeting a long variable in here. Let's go this daytime UTC as milliseconds. So we're going to get the milliseconds from the date, the date, time that IHS as a long viable which is going to make it easier for us to cast it into a Java date. So the date variable has to universal time method and from these UTC value, we can substrate the new daytime as milliseconds. So starting in 1970 on the first off in January with zero hours zero minutes and zero seconds, I also need the daytime kinds, which is of course, going to be UTC. So I know this seems a bit off, but this is going to help me converted to the total milliseconds. And now these milliseconds can easily be converted over to a judge ever date initially now return a new date, which is the jab adult ordeal date. Dad can be creative notice through a long variable which we already have in the form off the daytime UTC as milliseconds. So now they seize our daytime to native date converter, which means that over here on the insert subscription, we can insert the other property which is gold subscribed. Date by using that method day time to native date, passing the daytime that we have over on subscriptions. So subscription has this subscribed date and now these will actually be, as you have a time, which is exactly what we need. Now that we have the subject in or we have to do is add the document to the collection. So collection has an at method which can receive at dictionary which we already have over on subscription documents. So there were this we would have already incented So if everything was successful up until this point, I will return true so that the insertion waas successful balls. I should also try and catch any exception that may happen. So I am going to grab this goat inside of a try catch block and I am going to be catching any exceptions. Any case, something happens, I will return False that the insertion waas not successful on By the way, I am not actually using any a sing methods, so I don't need this to be a task. Which means, by the way, that over on the database helper, these inserts subscription can just be a bullion methods and building member not at task. So that small changing here now these is a functionality for Android. Something very similar. We have to add over on IOS. So instead of the Dependencies folder, I am going to add a new class. But he's also going to be called fire store That is also going to implement I fire store, which means I need the using directive and I need to implement or for members again. I am going to start with the insert subscription method in here. I am also going to need a key value pair. However, initializing a key value pair for IOS, which has to be native, has to be an in this in dictionary. So not a dictionary, but an end. This dictionary which is an I O. U S type, I have to do things a bit differently. I am going to start by creating first the keys, which is going to be a new array, and these are all going to be string keys. So I am going to be creating, for example, the new N s string. So notice that we were using native IOS types in here. That is going to be the offer. So it's just copy the names, all the keys that were using over an android. So we know that it doesn't matter whether we're inserting from my us or from Android were inserting the exact same thing. By the way, I need a using directive to foundation so I can use. And it's a string in here. In addition to the author, of course, I am going to need three more keys. We're going to need name is active and subscribed dates. So again, I am just going to copy all of these values. So I know that they are called exactly the same way from either off the operating systems. So that is for the keys. Let's now create the values. So this is also going to be a new array. The author is also going to be an N s a string that is going to be equal again too far. Bays, in this case out dot our daughter default. Instance that current user dot you i d the name again and then it's a string. This is going to be equal to the subscriptions name. We are also going to be using bullion born in us. We're actually going to capture nationalize this as in s number passing the subscription daughter is active and by the way, because this is going to have many different types, we actually have to specify that this array is going to be and the rate off Ennis objects. So previously we didn't have to specify that because these are all string. So this is son array of strings. These contains very different types hands. We have to specify that this is an array off end as objects. Now for the dame time, we're going to need something very similar to what? With a run android. We need the daytime to be in this case and an estate on IOS native date. No, the C sharp daytime, which means that will have to also create private static and s date method that is going to be daytime to N s and date which is going to receive the daytime, the C sharp date, and he's going to cast it in 29 states the native the IOS type of late. So we're going to start by evaluating if the kind off date that we're working with is equal to own specified, in which case we have to specify the kinds. It's just something that we have to do for IOS. So even the kind of data were working with is on specified. Then we're going to set the date to at daytime. We've a specific going through the specified kind method, which of course receives the exact same date but allows us to specify a kind which is going to be local notice that we could also set UTC. Now that we have done this, we can easily cast as an Ennis date their date itself, since it already has, um, specify kind off local. So that means that subscribed date is going to have a value off. Whatever these new date, time to end estate method returns when it receives their subscriptions subscribed date. So we have the keys we have the values or we have to do is create the key value pair and inserted into a collection. So let's create their subscription document, just like with their own android. So this is going to be inserted into our collection in a minute. This is going to be an honest dictionary off anuses strings and and it's objects initialized with the keys and values that we already have. And now, through far bays and the cloud fire store name space that we have already imported, we can access the fire store class which has a shared instance property that has the get collection methods similar to what we have on Android again. We're going to get the collection. Dad has to be the exact same collection that we are getting over on Android. So we know that we are inserting into into the exact same collection the exact same table. Notice that this is not a table. This is a collection when it comes to firebase, but just it makes sense. And to this collection we have to add a document. We have these at document method and we can pass the subscription and documents notice that in this case I am not actually storing the collection on a variable. I could definitely do that said these collection to a variable and then from the variable called the document like we did on Android after days. However, I am going to return True Ive everything succeeded. We can just return true, however jewels like we've been doing so far. I want to rob all of these code inside. If I tried, try, catch block. So if anything happens, I can simply return fools. So there it is. This is the functionality Now in the next lecture were actually going to be using this. We will have to agree the user interface for the new subscription page because we currently have nothing in it. It's empty and we will have to call these methods. Of course, we actually have to export these dependencies imported them over on the database helper. But we have done that before. We know that that is going to take us a couple of seconds. In the next lecture, we're going to focus on implementing the functionality for the insert subscription, which, by the way, is not a task. I should open date this method right here as well 28. Testing the Insert Functionality on Android and iOS Devices: So we already have the android and the IRS implementation for the IRA fires. For interface we have here the finest or class for android. And here, the firing stroke glass for IOS. Now what we have to do is export these dependencies, import them over here in the database helper class. But most importantly, start using these inserts subscription method from the new subscription beige till it's a star. By exporting these couple of dependencies, that is going to be rather quick. What we have to do is dried intent of the corresponding files assembly colon dependency, using the correct name space, which is summary forms and passing the type off the class that we are exporting. In this case, we're going to be using fire store. But of course, using the name space so the classes actually identifiable because even what when we are in exactly the same file, these code, it's not instead of the name space, which means that we have to specify the entire names base. Now, something very similar is going to happen over an android or we have to do is add, and these tacked to the entire name space off course. We're going to need the using directive to Samarinda forms and also the names basing Here is my subscriptions, daughter droid not dot IOS. So just like that Now, with those dependencies exported, that means that over here in the database helper thesis already in the shared Koth, we're going to be able to assign these variable to dependency service to use this type. Of course, we need a using directive to summer in the forms and it's get method. And, of course, the time that we are getting or trying to get East I fire store just like there's a fire, sir, is going to be initialized accordingly. Remember that by now we already have the insert subscription implementation bought. These should already work, which means that we are ready to create the view moto for our new subscription space. Now, of course, first we have to actually create the user interface, right? So the user is actually able to grind down the name said if the subscription is active right here in the page. So that's a start there in the new subscription based on sample file instead of the content , I am going to create a Stackley out And instead of this technically out, I am going to create an entry with a placeholder for this prescription name like this. I am also, by the way, going to set some margin for the Stackley out to the sides off 16 Antietam bottom off. Zero Actually, you know what? Let me said this a 16 to all of the sides now below the entry. I also want at check box for the user to set ive. This prescription is currently active Now the checkbooks itself doesn't really caps from text. So what I want to do is said this inside of ah horizontal Stackley out In addition to a textbook stand, I am going to have a label letting the user know that these he's supposed to be the East active property. So something like this, of course led me said the vertical options to be center. So this is a little bit better aligned And of course I will also need a safe Bolton. Now there are a couple of ways that we could implement it. Let's go ahead and add a trooper item just as with it before, so too were items and instead of the toolbar items for the space. I am going to add a tour. I'm Tim that is going to have a text off safe bought this time I will want to add a command for this tour item Notice that it works similar to any Borchin. It has a command property and of course, I will need in the binding for these entry and for these check box. So that means that over on the view model, I am ready to create the new subscription VM So we'll add a new class in here that is going to be new subscription the M instead of the nooses subscription VM as usual, I am going to blame anti I notify property changed interface. So I need a using directive to see stem that component model on to implement its member. To raise these events, I will greet a private avoid on property changed methods. I received the property name and a raises the property changed event through the invoke method that is going to ask the center which is this and a new property changed Even Rx which is going to ask for the property name Excellent and right of the bat. I am going to need a couple of full properties. The 1st 1 is going to be the name. And I am also going to need a bulletin which is is active and from the centers. As always, I am going to call the on property changed with a corresponding name for the property. So first name and second East active. That means that over on the samel file, I can already create an instance off that PM so we'll add an XML name space over here with a didn't fire VM pointing to view model. And instead of the content page inside of its resource is I'm going to create a research Dick Suri instead of the research dictionary and new new subscription of the M. Let me go ahead and said, Uh, key, let's go. Israel's VM and this entire V Emily Adams basis in here to separate the resource is from a dollar items from the content. But these key right here, these VM right here is going to be the binding context for the entire stack layout. So it's gold is starting research VM, which we have right there, which means that we can already bind the text of the entry and the value of the textbooks of these is going to have eats Tex binding to the name property that we already have on the check box has an ease checked property that we're going to be binding to the ease active property. And by the way, both of these have to have a two way. Most so the entry on the checkbooks said the most to two way. Finally, I am going to need the command for the Stuber item, which should only be enable ive The name actually has some text. We didn't care whether the East activist true or fools, that doesn't really matter. We want the subscription to actually have a name. So what we can do East creates a new property them below. That is going to be a type I commend for these, I need a using directive to system that windows that input that is going to be saved subscription commands and in the constructor, we're going to initialize the safe subscription commands to a new commend a command class that is coming from someone that forms that is going to require the safe subscription method that we don't have yet and the safe subscription can execute method that we also don't have yet. But we can easily implement them with some help from visual studio by typing out, enter or control daughter on visual studio on Windows. Now the same subscription is going to be rather straightforward, or we need used to access the database helper. For that, I need a using directive and its members. Actually, I didn't make these members of static. This has to be static. So Bollig is static task Boo Pullig, ecstatic bull, public static and public static because I don't need an instance to be able to use these methods. So all right, or database helper? Now we see all of these methods. Let's use insert subscription. Now we need a new subscription, and we already have a lot of the information that we need so I can initialize it from here . It's active, for example, is going to be equal to the East active property. The name is going to be equal to the name property the user I D is going to be equal to. In this case, let's use the hour glass, which has a get current user. I d method and this subscribed date is going to be equal to daytime daughter now. So right now although now that I think about it, maybe the user could select this. But let's leave it like this for now. We are already inserting a subscription so excellent by now remember that we already have the functionality over an android overnight. Us right here. All we are doing is creating the subscription now for the can execute. We actually have to evaluate whether or not the name has from text. So I want to return. Ive name property east no or empty. So I will call the seasonal or MT method from string passing the name now if it is nor empty, it means that this cannot be executed. So I will have to deny these evaluation. Finally, Then we can bind that command over to these to buy items, so command is going to be binding. Now notice that in here we don't actually have access to all of the properties because the door items are outside of this duckling out and currently only the Stackley out has this finding context. However, we can always just said the source to be static resource VM and the path can be now set to our command like this. So we have to specify the source because we don't have a binding context for the tour items . But this is pretty much the exact same thing. The same source, which is the SVM. And the path is appropriately from that source something similar we will have to do for their command parameter which is still going to be binding to that VM. So I will again need some static researching here, pointing to VM and setting the path this time to name why name? Because we want to evaluate again, whether these can be executed or not every single time that the name change is that the user changes whatever is grits and inside of these entry. So even the name is ever empty. Their command should not be enabled. Body fit is not empty. We can enable this back. So by now, all of the functionality to insert into the database is ready. We, of course, react to the click of these two other item. When we are clicking that your item, we are inserting through the database helper database helper itself is already calling the insert subscription from these variable, which is initialized through the dependency service on both on Android and on IRS. We are implementing the functionality. So the time of the truth has arrived. We're going to run this application on our simulators and test this out. So here it is. Application of promoting on Android. Of course, we know that five days already stores the authenticated users so we don't see the log in page. We can just navigate over to add. We see the interviews that we have just created might say that this is Netflix, that this is still active and Glicken safe. Now, that reminds me we don't have any way of knowing if this is successful in the interface. So we are no displaying a success message I will have ever never get over to my subscriptions than my subscriptions application here on fire base. Reload the space and we see the information right here. Notice the structure off these database. We in fact, see the collections here till left Onda collection has been automatically created. We didn't create it big, but because we were inserting something to this collection, the collection was needed. So it was created automatically. Then notice that a document with a particular I t. Has been created. We could have created a document with our own idea or and I d generated by ourselves. But we let firebase do that for us in these scenarios. So these i d was created for us and then for the details for these particular document. Well, we see the author. This is, by the way, the i d for the user note. Is that the same idea that we see over here? He's the idea that we see in the author for these particular document. We see whether or not this is active, the name that we just said and they subscribed Date which is currently being said to the current date. Hello, guys. Just a quick update in here. It turns out that thesis may not have worked for you. So recently there have been some issues reported issues to summering themselves. I myself have run into this issue. Some students of my have told me about it, and it turns out that when you have more than one fire base package in your Semmering android project, you're going to have an issue that says that the fire base components waas not present. If that is your case, there is a solution that summering themselves has released that actually, East is still in preview balls works flawlessly. You'll have to never get over to your android project. Right click in the packages, select managed nausea packages and select down below the option to show prerelease packages . Because again, the package that we have to our east not yet release once it is, by the way, you. But by the time you see these video, you can find a release version, not a preview version. Go ahead and install that way instead, Both right now we will have to search for Samarinda ran Android Manifest merger under the pre release packages, and you can see how, indeed, right now there is only 1/3 preview available. So go ahead and select that one pleading that package that should solve the issue so excellent. Now, the next thing they will have to do he's test this for IOS. So I have my iPhone connected. Remember that due to authentication issues, we have to run this on an iPhone or on a real device, But I will change to the iris project. You're in visual studio. Select my connected iPhone and run this again. We have already implemented the functionality for IOS. So the dependency service will use that particular functionality now that we're running on an iris device. So now you can see here my eye from the screen. Let's just wait for visual studio to launch the application. Three goes, we see the application launching again. I had already logged in, so I don't see the Logan. You eyeballs. I can never get over to add new subscription and I'm going to enter the name. Let's say that this is a Spotify. This is also active Glicken save again. I should add some functionality here, maybe navigate the user back to the least of subscriptions. So I know that these were successful bullets never gave back to the data race over here and immediately without having to reload. Because actually, this is a really time database. We see another documenting here which is a Spotify which is active. So these means that this has just being added from IOS. By the way, notice that over on my IRS application, I looked in with another user. So I see the other user I d. So by now I should have at least one document for each off the authors. Excellent. So now that we have in setted to these databases from both Android and IOS in the next lecture, what we have to do is to start reading from the database. We already have most of the set up ready. But we do have to implement the functionality over on the dependencies. Their dependencies are already being exported. We already have the dependency servicing here. Ready bought. We do not have the implementation. And of course, we also have to ready their subscription base so we can actually display at least view with all of this subscriptions. So we're going to start to you old. That's in the next lecture. 29. Creating a ListView to List the Subscriptions: so we're ready in setting each of the database we have right here instead of the firebase console, a couple of new elements that we have. Jolson set it while I'm from Android one from IOS one for each of the authors that we have also previously created when raised during new users, that means that we are ready to start reading these subscriptions collection. OnStar's gets all of the documents for us to start displaying them in a least view inside of our views. That is exactly what we're going to start to do in these lecture. Of course, the first now we have to do is navigate back to visual studio and actually create the view and start implementing the functionality that is going to eventually call the implementation of the reef method. Now remember that over and the dependencies for either of the projects So far, we do not have the implementation for read subscriptions. But what I want to do is ready the call to these method, just like we are already calling the insert subscription accordingly. Throughout this lecture, we're going to implement everything that is necessary for us to call, read subscriptions accordingly and I am going to start again by creating the least view right here. And of course, greeting the view model for this prescription space which we do not have. Josi it. We have the view model for the Logan, the view model for new subscription not Gaddafi the view model for subscriptions. So here on the continent beige I already have that as toolbar item board I am missing the least view and the least view is off course going to have an item template and the item template is going to have some data templates that in this case, is simply going to be a text cell. So when I wanted to be here is display a couple of things one, of course the name off the subscription and also that they when this description Waas added So the text cell, if you think about it eventually is going to have a data context of a subscription, we're going to have a laced of subscriptions and each and every one of these subscriptions is going to be a text cell. So before we even implemented functionality, we can bind the text, all the text cell to the name again we currently do not have the least off subscriptions. We do not have even the functionality to read them. But we know that eventually as subscription is going to be displayed instead of a text cell so we can implement this already. And I know that the detail is going to be also binding to another property of prescriptions these time to subscribe date like this. So this is the template off what is going to be displayed here in each and every one of the cells. Now, off course, we need the view model that is going to require on observable collection. So we talked about offs, horrible collections, you one of the previous sections where we were learning about the basics of summaries to you're not familiar with resolve A collections. I greatly recommend that you go back to that particular lecture. Essentially, the whole collection is going to implement the I notify collection change just like our view models implements. I notify property changed both. Anyway, what we have to do is here in the view model at a new class. That is going to be the subscriptions. VM the subscriptions. VM is currently on Lee going to have ah, property off type off several collection. The collection is going to be a collection of subscription by away. So in a couple of using directives right now, they're using directive to the model folder so I can use a subscription type and an additional 12 system the collections, that object model so I can use observable collection and he's actually going to recall subscriptions. Now, these property has to be initialized in the constructor for these VM. So I am going to initialize subscriptions to a new also wrote collection off subscriptions and immediately after this, when I wanna do East read their subscriptions from the database. So by now, the subscription this prescription page has already being created, and it has initialized a new subscriptions VM object. First, these objects is going to initialize its own subscriptions property. But after doing this, it is ready to read. So what I'm going to do actually ease going to create a new public voids method that is going to be read subscriptions that all it is going to do is get the least up subscriptions by calling the method from the database helper that we already have So I need a using directive to the helpers name, space and that of his helper. Although these functionality ease no jail implemented on Android, not jet implemented on the U. S. We already have the re subscriptions method which independently Oh, how it is going to be implemented over on those platforms. He's always going to return alleys of subscriptions. Once I waited, by the way. So I need to make this a sink. Now this subscriptions variable that we have right here is a list up subscription which we can actually assign to a new office Horrible collection. But we don't actually want to create a new one, because if we do, we're going to break the binding. We need to always use these objects in here, the one that Waas initialized in the constructor. We do not want the subject to be created again. So the way to solve this is to create for each loop to eat a rate through each and every one off those subscriptions string. Here I am going to be creating a new s variable for each and everyone off the subscriptions inside of the subscriptions viable and that as variable can easily be additive to the subscriptions offs. Horrible collection through the method like this. And by the way, before I add all of these subscriptions again, I want to make sure that the subscriptions off sort of collection is cleared. Joe. So I don't ask duplicates. For example, I May Reeve Ah, first time when I read a second time, I want all of those items from the first red to be the litter to be cleared because I don't want them to be repeated. So there have it. This is how this is going to behave off course. I want the read subscriptions methods to be called from the constructor like this. Now, over on the samel file, what I can do is creates a new XML name, space reference up here, XML anus. I'm going to call the m, pointing to view model so I can create instead of the content Page. Resource is a new research dictionary and inside and new instance off subscriptions the am and I am going to set a key. As always, that is going to be VM. And these VM, of course, already contains that of sorrow collection subscriptions, which means that down here on the least view. I can set the items source to be binding to that object. Now I have two options. He here I can set the binding context as we have done before. For these sleaze view to be these VM or I can set it directly from here when binding, so sores can be actually set to static resource VM. And then over here I can say the path to be one of the properties for these sores, which in this case, it is going to be this subscriptions, property like this. And so we have already said the item sores, which is going to be an arsehole collection of subscriptions. Each subscription, then, as we have said before, is going to be bound to attack cell. It's going to be the binding context for a text cell. Now, one last thing before, um, jumping to the next lecture is that I want these method the read subscriptions method to be called not just the first time that a subscription space is created, but every single time that we navigate back to it. So what I want to do is call that method from the own appearing, and by the way, on Li e, the user is already authenticated. Which makes me think that actually, I do not want these methods to be called from here because the user may not be authenticated right now. When I want to do instead is called at Method right here in these Els when the user is actually authenticated now. Hi. How do I do that? Because that is over on the view model and they don't have access to it from here, do I? Well, either Self that I do because I have access to the view model from the Sammo file and we have talked about it and we have talked about how these samel file is actually just the other part off the subscription space, which is a partial class so somewhere automatically, based on these codes, some C sharp objects are being created, including these VM research sweeter south. There, right here in class level. I can create a new subscriptions VM that I am going to call V m. Of course. And you're using directive to its names base, then here on the constructor for the page. I can assign VM to be equal to some research says notice that just like over on Sam Oh, we have the research says for the constant page over and see Sharp. Of course, we have the research says for the constant beige, and we can access any research through its key. And we know that there is a resource schooled VN now. This, of course, is going to return it as an object. When we have to do is cars this subject as a subscriptions? VM. And now we have everything from the view model right here, including off course it's public breathe subscriptions. So now we're going to be calling the read subscriptions method every single time. We never get back to the subscription space. If the user is already authenticated, l improve this. I am going to set a break point over here in the read subscriptions and in fact, all the way over here on IOS or Android. Whatever operating system you're going to use to test the sounds right here inside of the real subscription method, remember, by the way, that if we continue through this, we're going to see an exception because we do not have the implementation just yet, but At least we should be hitting these Brett points. So I am going to wrong this application on my iPhone. So let me go ahead and show you the screen of my iPhone right here. We see here the application being installed. Remember, by the way, that we are not going to be navigated over to logging in ive fire bases still has the authentication from the user. So immediately, we should see these break points be hit. So here it goes. Application is launching immediately. Notice we're going to hit this brake point right here in the read subscriptions from the view model. So that means that over on the c sharp file for the page, these evaluation has been made in return falls. So we're going to read their subscriptions, calling a method from the view model. And if Weekly can continue, we're going to hit this or their break points already in the implementation for the read subscriptions method. In this case, for IOS off course, we were running on Android device will hit the brake points over on the android project bought we have accomplished through this lecture is create everything that we need here on the shared code for us to call these Red subscriptions method accordingly every single time that we never gave back to the subscription space now. But we have to do is actually implement this logic, this functionality that is exactly what we're going to do. In the next lecture, we're going to implement the read subscriptions from society for both Android and IOS in the corresponding fire stores. C sharp glasses. 30. The iOS Implementation for Reading Cloud Firestore Documents: in the previous lecture we created here in the subscription space a new least view, and we already have the data template that will be used to display all of this subscriptions. And also we have already said these items sores for this list view through a natural collection that we created back in the VM in the VM. We also have these read subscriptions method that it's actually being called from the code behind when we never gave it to this page. And Dad's Method is already calling the method that he's inside of the database helper. And in fact, we noticed how we actually hit the correct point, overhearing the read subscriptions method, the implementation off this method already on IOS. Now we didn't test it on android boat. It's of course, the exact same thing. Now I did remove the break point because throughout this lecture I am going to be finally implementing these couple of methods. So let me start here on the IRS version or the forest or class. What I want to do is first and foremost gets the collection, and we already know how to get a collection because we actually got a collection of here over on the insurance subscription method. In fact, you're going to notice that we're going to do something very similar to what we did in the insert subscription method. But in reverse, for example, here we are grabbing a subscription and casting it or creating on in this dictionary from this prescription and these time around when reading, we're going to have to greet a subscription from on and his victory bones. I'm getting ahead of myself. Let's first go ahead and get a collection. We still have to get this prescription collection, of course. So what I will do to make things a bit easier in here So everything is not in one single line of code is great, a collection for rebel that is going to be equal to these collection that we're going to get. Once we have the collection, we will have to greet a query so that we actually filter this collection. Because if we never get back to firebase console, we know that the collection contains a bunch of documents. Now we don't one off the documents. We only want the documents where the author ease the current user. So we will have to filter the entire collection so that we only get those documents that have the author equal to the idea off the current user. So what I can do here is create a query that is going to be equal to collection. And the collection has aware equals two method that is going to be very helpful in this case because one off its overloads, the 4th 1 to be precise, is going to require their string with name of the field that we want to use to filter on the value that we're going to be comparing. And we know that in our case, we're going to have to be using the author field and the author field is going to have to be equal to these volley right here that we have been using before the unique i d for the current user. So that is going to be the object. Finally, now that we have the query, we can get the documents themselves. So finally create a documents horrible that is going to be equal to query and it's get documents, a sink method. So there is on a sing version off the get documents method now because this is a nation method, I will, of course, have to await its goal, which means that my method here has to be amazing method as well. Now, notice that by now documents is actually a query snapshot. This is still not at least off subscriptions, which is exactly what we need both. It turns out that the document snapshot already contains the documents themselves. So perhaps this is not the best name for the variable boards. It does contain the documents already. Now what are the documents? They're essentially already the enemy's dictionaries. But let's go ahead and take a look at that because, like I said, the documents variable or re contains the documents and this is already an array. So we can do is eat arrayed through the array and grab each and everyone off the items. So I am going to be using the for each loop here, creating a new variable called Dog for each and every one of the items inside of this array . Now, the dog is now still the snapshot board. It is now the document snapshot, which means that just like documents itself contains the documents Doc contains the data and the data notices already the Ennis Dictionary, Venessa strings and in his subjects, which is exactly the type of dictionary that we created when inserting. Like I said, these method is going to be the reverse off they insert. Once we have the Ennis Dictionary, we will be able to create a subscription, which is exactly what we have to doing here. So let me go ahead and create a viable in here that is going to be their subscription dictionary, which is going to be equal to the data from these documents now. These already contains the subscription itself. But I said dictionary, what we have to do is creative subscription as a new subscription. So our actual subscription class now we know that subscription has its own properties, but we will have to extract the values for each of those properties from the dictionary, for example, is active is going to be equal to one off the values instead of the dictionary, and we can get the value for a specific key using value for key, which is going to ask for a new Ennis a string so we can create. And then it's a stringing here and just passed. And the key for which we're going to be getting the value. In this case, incentive is using the East active key. So these were right here. How are so far? This is going to be returning an and this subject. And these is a bullion now similar to what we did before when, in setting where we had a bull in and cast it into an Ennis number, we hear can cast an N s number into a bullion. So we will have to do is first and grab these objects as on Ennis number. Now we have the n s number. All there is left Rose to do is cast this as a bowline. So I can in fact do it like this. You can easily be casted the in this number as a Boolean. Then I can do something very similar for the name property. They say Is it still going to be grabbing a value for a specific key? So I can in fact choose copy the code I have up here. Except this time I am going to be using the name key instead of the east active and again this is going to be in in a subject in this gaze. Name is a string so I can cast this ass and in his strength, and this can actually be assigned directly to adults net string. So I don't need to do any other cast in here. The exact same thing is going to happen for the use of I d. So I'm going to have the user I d be equal to the subscription dictionaries value for a specific key asset and this a string. But this time the key has to be author. And finally, we're going to have to assigned about you for the subscribed date property. However, remember how we needed a method to convert a daytime to one in estate? So we have these daytime to an estate method. Just live with it that previously Now we need on in estate to daytime method because we can indeed get from the subscription dictionary the value for a specific key through on in a string that the key is going to be subscribed date, which, of course, returns and in the subject, and we can cast it as an in this date. But in his date cannot be assigned directly to at a time so similar to how down below we have these daytime to an estate. I am going to be creating an estate to daytime method, which is going to be private. This is going to be static as well. This is, of course, going to be returning at daytime, and he's going to be cold Ennis date to the time receiving instead of a daytime, which we had before an Innis date. Now, to be able to understand how this method is going to work, you have to understand that in this date has a reference date in the first of January over 2001. So after that date for each and every second, we have a positive number for a date. Before January 1st 2000 and one, we have negative seconds. With this in mind, we can actually create a daytime, which has that same reference date. So I'm going to use a daytime. Let's go this reference, which is going to be equal to that particular date January 1st 2000 and one for the current time zone, so I can do that through time zone. Current time zone and use to local time. I am going to convert then a new daytime. With that reference, they eat two local time the reference date again being 2001 January 1st with zero hours zero minutes and zero seconds. So this is the reference date. Now we have the reference date equal to the reference date for date, the Ennis date, That is so. That means that from date we can simply grab all of the seconds and added to this reference So you can immediately return these reference after adding some seconds to it. What seconds? Those seconds inside of date. So seconds scenes reference state right here. Now, up here, I can use the Ennis date to date time method to cast these entire value that has just been casted as an estate. So there have it. This is how we're going to be able to extract all of the data from the dictionary into a subscription. All we have to do now is added to a list and return that list. So before the for each loop, I am going to be creating a new laced up subscriptions that is going to be called subscriptions and that I'm going to be initializing immediately, which means that after creating the subscription here instead of the reach loop, I can to their subscriptions add the subscription that we have just created these one right here. Which means that eventually I can simply return their subscriptions. Now, if anything goes wrong, I should be able to return perhaps an empty subscription instead of a neck section. So what I will do is grab, as I have been doing out of times by now BCE entire code instead of a dry cats block, and we're going to be catching any exception. And if anything goes wrong, we're simply going to return a new list off subscriptions, which simply would mean that nothing gets displayed inside of the least view. So there you have it. This is how we would be able to redistrict trip shins on IOS now, before we before to the next lecture and implementing this an android. I want to test this out. I can set a break pointing here in the catch exception just in case. And I'm going to say that breaking right here when reading their subscriptions and what I am going to do, as I have been doing so far, is wrong this application on my iPhone. So I'm going to select the IRS application in here. I have connected my iPhone Swipe. See, right here. And I am going to run the application now because of my iPhone I already looked then we shouldn't see their log. And you why we should immediately see the subscription space, as has Bean as it has been happening. Board. I should now be hitting one of these break points. Hopefully this one right here already with all of those descriptions ready to be displayed inside of the least view. So here the application is being deployed to the device we see here the application launching. We do not see the first you I and we're actually catching an exception here that it says that an object reference is not set one instance of an object. So one of somewhere along here, we're actually using no value. So let me go ahead and fabric burning here on what I want to do is so I don't have to restart the application over and over. We know that these code is going to be executed every single time we navigate back to my subscriptions because we're calling this functionality directly from the on appearing from the subscriptions page so I can click here on, continue never get over to new subscription and navigate back. This is going to execute Michael again and that we hit this brick putting here and here is actually the problem because it turns out of subscribed. Date is not actually an end as day it is. Ah, fire timestamp. So this is a type from fire base. So we would have to do is instead of casting the value for these particular key to one in the state who would have to get from fire base and cloud far store the timestamp sweeties. These type the one that we're using off course, It means that we will have to change a couple of things first that times them is not a date . The method that we have right here requires a date. So we will have to change this to firebase with clarify store Daut Timestamp that so we solve the issue of here. It should now be greeting daytime. Now I should probably change the name of the method because This is not an estate to daytime anymore. Let's school this fire time to an estate to date time. And so here I will change the name. But also, Time Stamp does not have a time references starting in 2000 and one bought in 1970 And it doesn't have a second since reference date, but it does have a second's value. So just a small change that we had to making here because thes wasn't ondas they it wasa fired times them. I should now be getting the subscriptions correctly. So let me go ahead and test this out again, Running on my iPhone. Here we see the application launching and we had the break points. Now we do not see any exceptions. We now do see these subscriptions list with one item, which is this part If I item so I can in fact just remove these break point, simply heat on continue. And I do see these items now, Now, because again, we're already going to be calling these method every single time we never get back to the space. I should be able to go ahead and add a new subscription that say that this is going to be male champ. I am going to say this as active. I'm going to click and save. I should probably add the functionality to navigate back automatically Assume that this is saved. Both If I navigate back noticed that indeed that item is already there because we are reading this prescriptions automatically as we navigate back. So if I were to add 1/3 item, let's say that this is going to be Asher said this as active, click and safe again should probably never get back automatically. Pull it through it manually and we see this lease reload. And we now see Asher there as well. So there have it. This is how we would be able to from the database in the case of IOS. Now we do have the implementation in here. We do not have implementation in android jobs. Yet through the next lecture, we're going to be adding that so it works for both by firms 31. The Android Implementation for Reading Cloud Firestore Documents: So in the previous lecture, we implemented the functionality to read their subscriptions from IOS. It is time for us to do the exact same thing Overall, Android on Andrew We're going to need a listener, a listener instead, often a sink method. So the a C method, of course, that we have right here when getting the documents is going toe gravel of the documents and one's the documents have been retrieved from the data raise. These method is going to be returning the actual documents over here. We actually need to grab the documents through a listener. This is going to make a bit more sense in just a minute. So what I'm going to have right here again East and getting the collection very similar to what we had gone up here on the insert subscription method. So we'll start by grabbing the collection. Now. Once I have the collection, I will also have to greet a query. So another query in here so far very similar to what we had on IOS, because collection has where equal to method as well, which can also request as string with the field and the Jabba object for the value. And just as we did before, we're going to be evaluating all of those documents. Where Author, he's equal to the unique i d for the current user like this. However, here is where things start to be different from what with it over on IOS. Because notice that query doesn't have get a sink method that actually returns the documents. However, it does have get method that is going to have an ath own complete listener method. This is where I was talking about when mentioning the listener. It turns out that we're going to have to create some sort of event handler that these method in here is going to go ahead and retrieve the documents Balt Onley once it has retrieved it, Is it going to trigger an event that we have to add a listener to so listener? Perhaps you can think about it as an event handler. Now the listen they're actually has to be a class or an object that implements the eye on complete always in their interface, as you can see right here. So what we can do is make our class the fire store class also implement the eye on complete listener interface so different to the fact that classes can only inherit from one class. We can actually implement many interfaces in each glass, Which is why I can do this. Implement I fire store and I own complete Listen there. So of course I'm going to need first to dried these correctly, so lease in there and then to add the using directive to its name space on droid GMs or tasks. Now, before actually implementing these interface, I actually want these fires store class during hear it from a jumper object because by default, this is going to be on adult's net object that is going to hear it from object. But I want to do then is make this in here it from java dot lang dogs object again. I can do this because these two are interfaces to this is only heritage from one class implements young couple of interfaces. So now if I go ahead and implement this interface, I'm going to notice that a new method down below is going to be added the own complete method. So these method is going to be called when these gets method is complete. When it has actually retrieved their documents. Now, by the way, these ultra means that to the iPhone Complete listener. We can pass this as that. Listen there. So the scoring class because he'd already implements interface. But here on the own complete, we're going to be able to get the result. But what I want to evaluate is if task which is the task itself still Waas successful. So we have these these successful property. If it was successful, then I am going to be able to get the result. So finally in here I will be able to access the documents which is equal to task Daut result Now, of course, they're resold itself. Doesn't hold the document themselves because it is a general object we have to do is cast this as a query snapshots which, if you remember, is actually what we received over an IOS. The documents waas a query snapshot Of course, in this case it is on IOS Corey snapshots over here that classic school the same way it comes from firebase bodies. He's an android Snapshot It was very here. We're going to be doing something very similar to what was it on IOS for example, we're going to be able to eat or ate through each and every one of the documents creating a new dock again for each and every one of the documents. And remember, documents contains the documents themselves. So this is the documents a snapshot which contains the documents in its property now for each and every one of the elements were going to be greeting and new subscription. So let me go ahead and create the subscription in here that is going to be equal to a new subscription, and I am going to be initializing off its properties to the values that are contained. Now, instead of the document, for example, we can get the East active method to be equal to the document gets, and the get method is actually going to help us get a value for a specific field. So I know that the East active is contained in the East active field. After this, I can get the name similarly by calling Dog DOT gets these time for the name just contained in the name field. Now, by the way, I am forgetting something in here because get is returning at Java object and I need this to be bullying. I cannot assign it now. In the case off this string, I can simply due to strength, call the district method from the gets to cast the object to a string. In the case of bullying, I will have to do something slightly different. So in here I can simply cast this as a bull in like this. Now, for the user, i d. We're going to be doing something very similar getting in this case author and casting days as a string and finally, this prescribed dates he's going to be equal to dog toe Get in this case, we're going to be getting their subscribed date. Just making sure in here that I cried it correctly, grabbing these value as dates. And here again, something that we did before casting daytime to Native Date we have to do is cast native date to date time. So I'm going to be creating a new method in here that is going to be static as well that this time is going to be returning day time and this is going to be native date to date. Time is going to receive a date that is the never date that we have to cast back to daytime . These is actually going to be very similar to the method that we have over an IOS. So again we can create a daytime referencing here. That, of course, is going to be equal to what we did before. So let me go ahead and just copy this code that I had over here, of course, changing the dates because this time it is going to be 1970 nor 2001. And by the way, it turns out that here on android the resourceful time soon So there are a couple of time zones. I want to make sure that I use system the time zone, not android ice you that you till the time zone or Java Util don't time zone. So this one right here, system dot time zone. So I have the reference No, I have to do is return the reference and this time adding Milli seconds because from the date the Javert eight variable, I will have access to the time property which notice returns these date as a merely second value. So I will simply at all of those milliseconds to these reference states there have it. Now I am casting the native date to daytime, which means that down below I can call the native date to date time, method and pass these native date again. I already have this prescription. All I have to do is greet on laced off subscription initialize it's and to this list, half the subscription that I have just creates it like this. Now, I actually will have to access the subscriptions from the reed method. So we'll have to return that from here. Which means that what I actually want to do is create these variable globally. So up here I am going to be creating the viable in here. Perhaps initializing it in their constructors prescriptions is going to be equal to a new least of subscriptions. Which means that down blowing dad on complete lease in there, I am going to be making sure simply that the subscriptions is clear, just in case we already had some values in here. So I will just go clear instead of initializing it again. And I will be adding this prescription now before actually returning this. All of these East ive the task is successful Boat words. If it isn't, what if, for example, task? He's canceled. Well, I am going to simply add Ailes in here and make sure that this subscriptions he's cleared just like this Now, to be able to return the subscriptions, what I want to do is have, um, global variable that he's going to eventually change and that I want to evaluate for a few seconds here in the read subscription. So let me explain. I'm going to have upped here a new bull and variable that is going to be called has read subscriptions that is going to be by default, false, and that I am only going to set to true after these method has been evaluated. So after either the IV or the L, so I'm going to set has read subscriptions equal to truth. However, these co right here it may, of course, take it's time. We have to first wait for the own complete to be cold, and then we want to wait for these to be extracted or to simply evaluated that the task waas not successful. So that means that up here on the reach subscriptions, we're going to have to evaluate that value perhaps every few milliseconds. And we could do this inside of a while. Loop, while True, but this sounds like problematic. Like there might be some scenario where these is always going two wrong. So what I'm going to do is sets a maximum time that we're going to be waiting for that return. So I am going to greet ah four looping here. Initializing an I valued zero and I am going to be doing this for 10 times. So while I IEA's Lesson 10 and implementing I on what I want to do in here is used, the task bought the test that is coming for sit from system the threading the tasks, not the andro de ascend the tasks. And this task has a delay method that we can make wait for perhaps 100 milliseconds. So if I am going to be waiting maximum 100 milliseconds 10 times, I'm going to be waiting for a second man. Perhaps we can make this for 25 times, So I waited 2.5 seconds tops bought. I also want to make sure that if these value is certainly true, I don't have to wait the entire time I can simply up here. Evaluate. If has read subscriptions is true. Then I can break out of these loop and finally return this subscriptions now because I am going to be returning the prescriptions themselves and the task. I have to make this a nascent committed. Which means, by the way, that I can await the coal to delay like this. So again for a maximum off 2.5 seconds. And, of course, we can change that by either in implementing hors d commenting this value or these one over here. We're going to be evaluating these Bullen. If it is ever true, we can break out of this loop, return the subscriptions or write a maximum of 20 have seconds. And by the way, TV's certainly is true. The next time that we try to reef, this is again going to be true. So this would actually only be executed ones. So what I want to do is make sure that the next time that we never get here the next time that I tried to read the subscriptions I have has read subscriptions equal to falls again. So there we have it. This is the implementation for Android, which means that we should now be ready to says the sound. I'm going to wrong this application over here on the android simulator. And of course, what is going to happen is that we are immediately going to be reading because the user should already be out syndicated. So let me go ahead and set a break point in here right before returning the subscriptions to take a look at what is being returned. So we see the application launching in here. And indeed we're going to hit the break point and notice that we now see account off one we the item off Netflix, which is the one that we can't added before two likely gone continuum and navigate back. I now see that item here in the least view because, of course, we already had that functionality. The least view would its template and you're sober collection over on the view model and everything. But now, because I am also calling that read subscriptions method every single time that I never gave it back to the subscription space, what I can do is navigate to have a new subscription and perhaps add in here I cloud and said that this is still active. Glicken safe. I should probably navigate back automatically once this is saved balls. If I never gave back notice that we heed that break point again. And this time the subscriptions has now account of two. Because I now see I cloud as well. And if I click and continue, I see those two items. In fact, let me go ahead and navigate over to the new subscription VM The new subscriptions. VM is where we are in setting new items. So we have here safe subscription and we have this insert subscription method that is going to be returning a bold and value. So what I can do is create a boolean value in here that is going to have the result and evaluates ive resold ease true. Then I am going to be navigating back to the preview space, which in this case would be the subscription space. So I can do that by accessing the main pace from the current application and net navigation and pop a sink. And perhaps also add on Elsa statement in here that instead of navigating back is going to this play an error message so also axing main page, but these time accessing the display alert method displaying on their message. Something like this. And this, of course, is going to work for IOS as well. So let's try this one last time before moving forward and let me actually go ahead and get rid off the break point over here. When reading the descriptions, we know that it is working. We see the application launching in here. We see the first whitens being populated in here, and if I add 1/3 item, let's say that this is going to be Kam, Bam said. It's us active Glicken safe. We are now navigated automatically because these were successful and we see these least view now being populated automatically. So there have it. The seas. Now the implementation for reading from fire store on both Android and IOS In the next lecture, where we have to do is to start implementing the functionality force to update and delete these items. Now, when deleting, there are a couple of ways in which we could achieve this. We could actually long press one of the side times delete Bolton may appear over here and click on delete, but what I want to do is actually navigate to a detail space. So whenever any of these items are selected, we navigate toe a detail space from which we should be able to update the values. For example, said a subscription as inactive and also delete. So that is exactly where we're going to start in the next lecture by navigating to a new detail space because we do not have that page Josi at. 32. Creating and Navigating to a Details Page: we are already reading this rescript tions that we have been in setting to the database. That means that we're ready to start implementing the rest of the functionality. Now the rest of the functionality, of course, ease editing and deleting these items. But I want to do it from a details page, a detail space that he's going to be actually very, very similar to the new subscription beige. It is going to have an entry where we're going to be able to edit the name and also these checkbooks where we can Is it ive? The subscriptions is still active off course. Instead of a safe Bolton, we should have an update fortune and we are also going to have a delete Bolton down below. Now the creation of these base is going to be very straightforward. But what I want to focus on on these lecture Eastern navigating do that details page after selecting one of these items. And of course, that details page should be populated with information from the selected subscription. So, back in visual studio, let me start by simply glow single of these files that I had open. We're not going to be using them throughout this lecture and I want to start by creating a new view. So I'm going to instead of the views folder going to add a new file and from the templates I, of course, have to select from forums the forms gaunt in page, making sure that it is a sammo content beige. And I will call this subscription details beige again. This space is going to be very similar to the new subscription based. So I'm not going to focus a lot on the creation process. Let me just show you the end result. And here we have the result Notice that I first have these tour item off here That is going to be the update portion. And I, of course, have instead of the content exactly out with certain margin that it starts with the entry still has a placeholder. Although this is always going to be pre field with the data from the selected item, it does still contain the placeholder. Then, just as before, we're going to have to label and the checkbooks instead of fun horizontal Stackley out. And then he also added these the elites Bolton now notice that these Bolton has his style, a style pointing to these destructive fortune style that I created back in the Abdul Samah file. I greeted these style for Barton's that those container key so these would have to be referenced for it to be used. Contrary to this style over here that does not have a keys release apply to all Parton's. All I am doing in here is overriding the background color for these default style now, before going ahead and implementing the view model. When I want to do ease, navigate to these details, page accordingly. And that is going to happen from this subscription space whenever one of the items from the least view he's selected. So what I can do is actually bind one of the properties from least view over to a new property. In the view model, the least you contains a selected item property. That, of course, is going to change when the selected item is different. When the user select another one, which means that we are going to be tapping into the functionality from the I notified property changed to know When is it that these changes so over in the subscriptions VM I am going to be implementing the I notified property changed which we did A having these classes yet. So I add the using directive. I implement the interface with these events and as always, I am going to recreating the private void on property changed string property name. And from here I am going to raise the property changed event by calling the invoke method passing vases, a center and the new property changed event Rx which of course, is going to receive the pro pretty name. And as I was saying, I am going to need a property. So here I am going to create a full property that in these cases going to be of type subscription and it is going to be their selective subscription like this. So that means that I will have to call the M property changed from the center and pass the name of the property. Now the selected subscription being a subscription has to be bound to the selected item of this least view. Remember that the item sources already analysts or, in this case and operable collection off subscriptions so they selected item is simply going to be a subscription So let's do that. Select that item. He's going to be binding to death Selected subscription. Now, since we're going to be using binding a couple of times, I want to remove the source from here and define it outside as the binding context. So wind in context is going to be the aesthetic research that we have, which is the VM like this. That means that I don't have to state it once the anthem source and another one in the selected item, because both already have that same binding context. So I can simply point to the path. So I don't even need to specify that this is the path. And this, of course, is going to be these selected subscription from over here like this. Now keep in mind that these will have to have a mode off two way because both are we going to be setting the selected item from the Mosul. But also we're going to be setting the value from the samel file back to the view model. So, excellence, now, finally, when I want to do is make sure that whenever the center is cold, I navigate over to the subscription details beige. So after racing the, um, property change what I want to evaluate first ease If selected subscription is different than no, because if it is no, there is no select designed to him. So I shouldn't be navigating. But if it is not know, then I am going to access the current main base and use the navigation to Bush over to a new subscription details Space for which I need a using directive to eats name space. So excellent. But so far we would yes, already be navigating over to the subscriptions detail. Page bought that page wouldn't be receiving any information from the selected item. So lastly, what I have to do is over on the C sharp file for the subscription details page, make sure that I have another constructor. I can quickly use the C T. O. R snippets to greet a constructor. I always have to go initialize component from within the constructor, but these constructor is going to ask for a subscription. So I need a using directive to the model and let's go. There's selected subscription. That means that back on the view model, we want to use that version off the constructor passing in here. The selected subscription and that's it. Now, every single time that we never gained over to the details page, this elective subscription is going to be there, ready for roster. Started using it. So let me go ahead and create the view model for these subscription details. I only want to keep the page itself. But if it's files open and over in the view model at a new class, that is going to be an empty glass gold subscription details VM like this. These is, of course, going to be implementing the I notify property changed interface for some recent event. It's always add it after the constructor. It should be before it, but that doesn't really make a difference. What I do have to do the is create the private void on property changed myths, as we have always done and invoke the property changed event like this, and I'm also going to need a few properties in the 1st 1 is going to be a full property of type subscription. So I need a using directive to the model name space like this, and, of course, from the center, I am going to call the improper T changed, Making sure life has a name off the property. Now, you may think that this is the property that we can bind directly to the entire view. And you wouldn't be wrong. It would make sense because subscription already contains off the properties. However, notice that this is our notify bra. Pretty changed interface. It is going to raise the event when a property changes. And yes, this is a property for these class, but it is itself a complex object, which means it contains its own properties, which means that we wouldn't be able to raise these events. Property changed when the properties from subscription change. We would be able to execute or raise this event when the entire object changes. Because this is a property for this class bought the object really only changes when it is reassigned to a different object or delete it or create it again north when its properties change. Because if you think about it, it is still the same object pointing to the exact same place in memory. So what this means is simply that we're going to need the properties themselves that we're going to be binding back to the view. So we're going to need the text and we're going to need the bullion. So back here we're going to create a couple off additional properties, the subscription name, which of course, is still going to be calling the improper T change from the centre and I'm below their Bullen and just as well, calling the in property changed. These are the couple of properties that I combined back in the view from here. The first thing, of course, would be to us the name space reference of XML anus colon. Let's call this V M pointing to view model and creating the resource is for the content. Peixe, he said of the resource is a research dictionary and it's have the research dictionary Ah vm pointing to their subscription details PM and let's go ahead and set a key for this one . Let's call this V M and we're going to make these exactly out have a binding context off that static research. The VM, which means that 40 entry where we will be able to set a text binding to the name and we have so much to completion functionality but also set the most to two way as the very same thing for checkbooks were going to need the East checked to be binding to East active with a two way, most so great those values are being bounds to the appropriately seen here bought. I also want those properties to update this subscription, so don blow when I want to do after ascending the name here on the center. He's also access the subscription property, access its name and said, It's to the name that we have Joe set in here and just for good measure, I am also going to be racing the property changed event for that subscription and similar down below. I am going to also raise that event in the East active and, of course, for the subscription property and going to set the SEC tive to the value that has been just said in here as well. These way, these description Property east, always up to date. Additionally, before adding the commands that you're you probably see coming. I need the values that the detail space receives to be said over here, and that is going to be quite straightforward. I am going to need in here just like we did in one of the other views. The view model, the view model Instance. So I am going to create a subscription details VM viable in here, which means I need the view motile name space and let's Gold is VM now from the constructor . After initializing the component, I can access the VM to one of the research says So Joe's like on Sam. Oh, we have access to the resources in here. We, Connexus any research through its key. So by doing this, I am essentially accessing these resource right here, which means that I will be able to access all of the property soul of the public methods and so on. Of course, this is by default an object, so I have to cast it as as subscription details. The M and I, of course, want to do this from both off the constructors and from these second constructor, I can actually said to values from the selected subscription. For example, I can access the PM's subscription on Assign It to them selected subscription. At this point, we would actually be racing this event because this description is actually changing the entire subscription not just one off its properties, which means that we could from here, be setting the name through the subscription name. And the East, active to their subscriptions, is active like this. So essentially, when we navigate to the detail space, we said the value for the subscription property and we're also going to be setting the value for these couple of properties. But from there on out, we would have to rely on the's couple off properties which are already binding to the view . So when the user updates the values, sure, we update the properties themselves. But we also update the value C inside of the subscription property, which means that from and the delete and from the update methods, we can work directly with this subscription instead of having to create anyone. So let's go ahead and create those methods already after the constructor. But before the in property changed, I am going to create a private void delete method that will have to receive an object because this is going to be a method for a command. Let's go this parameter, but from inside these method when I want to do is access the database helper So I need a using directive and the delete subscription method. And to hear I can simply pass the subscription because I know that the subscription object is already up to date. And just like this method, I will also need private void or date method that will also be a metaphor command. So I need this to receive a parameter and from within it is going to use the database helper pulpit, eight subscription methods and Justus Well, we're going to be passing this subscription and now off today commenced themselves. So I am going to need a new property, simple property that is going to be of type I command, for which I need a using directive to system that windows. That input. This is going to be the update command and I will need yet another property off type. I command that he's going to be the elite command, and I am going to initialize both from the constructor. So updates command it's going to be equal to, and you command these glass. He's coming from summering forms. So I add that using directive, it is going to require the action itself. So for update, it is going to be the update method, and I am going to make sure that this can only be executed when the name is not know or empty. So I do need can execute method. I am going to greet an update can execute method. I can simply use out enter control daughter McKeever to sell it to create that method. And from here, let me just change the name of these arguments parameter. When I want to do is evaluate Eve. The name is no or empty, so name the name property if it is no or empty this year, richer and false that we cannot execute. So let me go ahead and deny this evaluation if it is not known or empty than we can return . True for the delete commands is going to be equal to a new command as well. But he's only needs the delete method. This can always be deleted. No matter Aries. That name is empty or not, we can delete, so we don't need the can execute now. This means that back in the Samel file, we can bind the couple of Parton's the button, and it will wear item. Let's start with a lead to ports and this is that the easy one? We can set the command to be binding to Deb delete commands, and that's it. We're already binding to the delete comment. We don't need a command parameter because it doesn't have a can execute. However, for the tour item, we need a couple of things. First, we're going to have to set the binding context because this is outside of the Stackley out , so it doesn't have a pint in context right now. I will set it to the VM static resource And having said the binding context, I can easily set the command to be binding to the update Command. But also, I want the command parameter to be binding to the name property so that every single time that the name property changes, we re evaluate the update can execute. So if it is, ever know her empty, these returns false. So I know that this lecture has become quite a long lecture. We have done quite a few things in here navigating to the details page, making sure that everything is ready here with the view model. Now, your next lecture, we can quickly simply implement the functionality for both Android and IOS because we are already calling the update and delete. In fact, let me go ahead and over on the database helper. I am going to set a break point right here inside of the update method and inside of the delete method as well. Just to make sure that these is already being executed, I am going to run this on the seamy layer board. Do keep in mind that right now these methods are not implemented. So yes, I should hit the break points. But when I heat continue, I should see an exception because over on Android and IOS, I am throwing and north implemented exception. So if I go over to the dependencies too far store right now, both the delete on the old A methods are drawing an exception. So to make sure that both break points are hit, I would have to close the application and reopening again. So let's first select one of these items. We are correctly navigated in here, so that works and we can, of course, navigate back. But if isil like one of these items and click an update, I do see these updates Subscription method Break point B hits. Like I said, if I could even continue, I see an exception because we're throwing it. So let's go ahead and stop this application and run it again. This time you would have to test that elite Bolton. So here the application launches again. We can select one of the items, and if I click on delete, I also see the break point behaved. But of course, again, if I click on continue, I'm going to see this exception. But yeah, it works. So that means that we're ready to move over to the next lecture and actually implement those methods are currently throwing those exceptions, so implementing the functionality for updating and deleting for android and for IOS. 33. Updating Cloud Firestore Documents: So we already calling the delete and the update methods directly from the new details page that we created in the previous lecture. Throughout this and the next lectures, I want to implement the functionality for both methods. So what I want to do is first delete the fact that currently we are throwing some exceptions from both of these methods on both of the platforms and start implementing their functionality. So I want to start in this lecture with the update functionality, and I'm going to do it for both platform and sports to start here on the Android project. Now, just on my application runs in here, I want to make the delete subscription a sink and return true by default off course. Keep in mind that the functionality is not there yet just now. But down below, over on the update subscription method is the method that I want to implement right now. Now, for these, we have to touch on something that we haven't done just yet. And that is a fact that the subscription will need an I d. So just like over on the fire based council, we see that every single one of the collections has a name. Of course. Right now we only have one bulls. We can identify it by the name. And that is exactly how we access the collections back here in our code, we have to do the same thing for the documents. And sure, we see all of the documents have an i D. But this idea is different to any field that we have, so we don't actually have those I ds. We'll have to do is update the way that we are reading those subscriptions and the model itself. So let's just start there. I am going to never get back to the subscription glass, and here I am going to add a new property. This is going to be a strength, Al. It's gold is I d. Now this idea is not going to be incented. So we do not have to update the insert functionality we only need in these fields. However, when reading their subscriptions, we do want that value because eventually through that i d. It is that we will be able to update ah, particular subscription and eventually also delete a particular subscription. So in the case off Android, I will have to do it over here on the own Complete where we already have access to the dock valuing here. And it is the one that we have been using to get the value for each of these keys. Similarly, Then I can set the i d for the subscription that I am creating in here By accessing the dogs I d. So these I d will actually contain the value that is being created by by fire base right here. Because remember that when we are inserting, we don't create these I d ourselves. So we let fire stir, do the work for us. However, we do need this, I d they seize how we get it. And so here in Android we already have the i d. We should already be able to update and delete the subscriptions back on Iowa as we have to do the same thing right here. When reading this subscriptions and creating this subscription, I want to get the I D, which is going to be equal to the dog, which again has an i. D. So the docket cell has the data on which he is the one that we have been using, but it also has the I d, which is going to be very important. Now. All of this subscriptions inside of our code or inside of the application are already going to contain the I D. Which means that we can go ahead and update the first thing that we will need. Ease the collection as always, which I am going to get like this like we have done before through firebase fire store, looking since the collection and getting the name. Once we have that collection, we have to get the document that we want to update and notice that a way to get the documents is through the document path inside off these collection and the document path, it turns out it is going to be that I d and that's it. We have the document. Now the document has an update method. Now, the Allstate method notice that at least the first overload require something very similar to the ab method that we use when inserting. So when we use these, admit that we needed the dictionary which we could create, But there is, I think, an easier way to do this. Notice that the second and third overload off. These methods can receive Honore off fields and objects or Field Path and Jaffa objects. So actually, what we can do, he's passed all of the fields that we want to oblate and the values And really the only feels that we're going to be updating our the name on the East active the offer this describe eight. These are going to remain the same. Those are not things that we can update from the view. So, for example, if I want to update name, I can simply pass the name of the field and then the value. So subscription adults name and these would be a perfectly valid goal for the update. Now, if I want to open the second field, all I have to do is pass a second field name and a second value. So, for example, for these active, so I pass is active. And, of course, its corresponding value in this case, that would be from this prescription there, East active. These is another perfectly valid coal now, Eve. Everything here goes correctly. I can simply return true now, to be able to return this, I will make sure that these ease and a sink method. And I should also wrap all of these coatings that if a try catch So I catch any exception And in case an exception, he sculpts, I will simply return false. So this the functionality for Android for IRAs it is going to be quite similar. We have already made sure that we get the ideas themselves first. By the way back on the delete method, I want to make this a sink and I want to return true by default. For now. Now down below in the old date subscription again, I first need to make sure that I get the collection so I can get the collection. As I have done before, I will simply copy and paste this coat. So I have the collection. But again, the collection has get document method in these gays that again is going to require that document path and the document path is going to be the i D that we already have inside of this subscription and these Smith it having returned, the document has on update data, a sink methods of these doors have on a sing method and notice that very similarly it can get a dictionary similar to what we did for the insert method. So in this case, we do have to create a dictionary. Let's go ahead and do that. So before calling this method, in fact, before even getting the collection, I want to create that dictionary now. By the way, that dictionary doesn't have to contain all of the information for the subscription, just the information for the fields that we want to update. But I do want to go ahead and copy the way that we creates it. The dictionary over here in the insert subscription method so down below in the pulpit eight subscription method, we're going to have something very similar, except we do not need the author, and we do not need this prescribed eight or we need is the name and the East active. But still, the name is going to be coming from the subscription dot name and Ace, active from subscription daughter is active as an anise number so I can remove so I can remove these value for the date. We're not going to be using it as we did before. We're going to be creating DNS Dictionary and Finally, we can simply pass the subscription dictionary to the update method. Howard. By the way, these method has to receive an in his dictionary off. Ennis objects off in its object as the key and in the subject as the value. Of course, being these dictionary offenses strings that can easily be used as a picture me off in its objects. Now, this is an ace ing method, so we'll have to await its goal. And if everything goes correctly, I can return true now because this is a sink. This means that I will have to make this an ace ing method as well. And as always, I will have to rab all of this code inside if a try catch block again, catching any exception. And if anything was wrong, I will return fools. So there it is. This is the functionality for updating on IOS Little Head and says this out. I am going to be updating first over an android that so let's go ahead and launch simulator in here. Here we have the application open running. We see the values in here so we can select either of them. Let's say that this description is no longer going to be active. So let's the select this value. Click on updates. I still have this break boarding. Here, let me go ahead and remove it from the database helper Glicken continue. By the way, we should do the same thing that we did for the safe Borchin that whenever this is completely navigate back automatically. But let me go ahead and navigate for now back to my console and identify iCloud, which is the one of the top and notice that indeed these value has been updated to false. Now, for example, I know that these value for Netflix is also for the same author and it is currently set to true. So if I never get back to the application, navigate back. I do see Netflix selected. I do see that this is still active. So let's go ahead and be selected. Click an update. Navigate back. I noticed that in real time these has been updated. So there is for android. Let's go hand says the same thing on IOS, so I mean selling it on my device which is connected to my computer. Here we see the application launching. We do see all of its values. We have some mail chimp optioning here. So let me go ahead and find it over here in the database, which it is right here. This is the mail chimp option. And here in my device, then I am going to select it, and I do see that this is still active. So let's go ahead and the select it, click an update and notice that on riel time that is being updated. So I should definitely had the functionality to navigate back automatically. But before I do that, let me go ahead and change the naming here as well, making these see lower case, click an update. And I see that change on back in the database on real time as well. So yeah, let me go ahead and navigate back to them. Subscription details V m. Glass. Here. I want to make sure that whenever the updates or the elites methods return true, I navigate back automatically. So both the update subscription and the delete subscription are going to return a boolean. Now, these are actually a zing methods. So we'll have to make this a sing as well. And I'm going to get the bull resold by awaiting the school. But once I have the result, I want to evaluate if it is true, and if it is, I will simply access the main page navigation and pop back to the previews page. And also, if this is not true, I should probably display and message to the user again through the main page through the display alert methods. So let's say that this is the error message, and since these two methods are facing as well, let's go ahead and the way them both. And actually the exact same thing will have to happen over on the older methods. So let me go ahead and copy all of this basted down below off course, this method has to be a sing as well. We'll also need the result by awaiting the colt to the lead. So there you have it. So let's go ahead and says this out again. I will change over to Android will run this, and this time when we update, we should see the navigation happen automatically. When you go ahead and finds when I come over here, for example, I clothes and let's see if it updates automatically back in the database. So I see the application open running. I see. I clothing here. I can select it. I can set it to active. I can click an update, I navigate back automatically, and I see the value updated in real time. So there have it. This is how you update from both IOS and Android. In the next lecture, let's implement the delete functionality, which we will be able to do quite quickly now that we have all of the rest of the functionality here. 34. Deleting Cloud Firestore Documents: So we have implemented the update functionality. All there is left for us to do is implemented the elite functionality that is going to be quite straightforward. So, as always, we're going to start by grabbing first and foremost the collection. So here I am going to start here in the IRS version or with the subscription, I'm going to get a collection. As always, I am going to store these in a variable to make things easier. And from the collection, I will be able to get the document the same way that we got the document went operating. We need to get a document, Wendell it, and we need to know which document to dilate, which we already know is contained inside of the I. D. For this description in the previous lecture, we updated the read functionality. So we are now saving the i d for the document, not just the fields. And once we have that's documents, we can simply cool the delete document, a sing method. These, of course, requires no parameters because it is simply going to the leads the document that we are getting. So I have to do this. I wait this goal and if everything goes correctly, I will return true and it's always I am going to rob these gold inside of a try catch block . So ive any exception, he sculpts. I will return false veces for IOS For android it is going to be very similar. We're going to start by getting the collection so I can just copy the code that we have been using to gets the collection from the collection. I have a document method which is going to retrieve a document. These requires the path which we know by now that it is going to be the i d for the subscription. And once we have this weekend cool dill leads just like face evil of these succeeds, we're going to be returning true and back here we're going to be wrapping all of these instead of trinkets. Block us always going to be catching any exception. Even exception is called I will return false and that's it. This is the functionality for android and for us all there is left for us to do is test it . So let me start with the android version. I am going to run this on my android simulator, and I want to check back here on the database if things aren't going to be updated automatically. So I see by here the iCloud document which belongs to the user that has looked in here on my android application, and we see I clearing here. So if I click on iCloud, I, of course, get navigated back to the details. And if I click on delete notice that he has just being deleted because I had that document selected, I see that it does not exist. And I no longer see it by here. So it is working. If I were to find over here another one of the items, for example, Netflix, which is also for this user, I will select it, click until AIDS, and it has been deleted as well. So there have it, Andrew. He's already working. Let's no go ahead and test the Irish version on my device. So I'm going to run the application. The device here we see the application building and the application being installed. Now, similarly, I am going to go back to the database. The remaining items, except for these one camera, are from the user that is locked in overnight us. So let's start with this one that is called mail chimp here on the application. Then I am going to select male chimp, and I am going to click until it immediately. It has been removed back on, by the way, we already automatically navigating back to the subscriptions page. Seems we implemented that functionality in the previews lecture as well. Now I have here Apple music so I can select apple music. Click on delete and I see that happen in real time back on the database. So there you have it. This is how you would implement fire store functionality on both Android and IOS. We have implemented the functionality through the late to insert to read and to update to the database for both Android and IOS. Through dependency services. We have learned a lot about Samrin and far base. Throughout its curse, we learn how to authenticate the users. We learn how to implement dependency services so we can use native packages and still have shared code back in the dot net standard library. You perhaps learned a little bit about navigation and about M V M. But we're not done yet in the next section, we are going to be learning how to distribute these application. We're going to be implementing some, continues integration and continues delivery through another service that he schooled App Center. That section is optional in case you only wanted to learn about fire base authentication on fire store bought. It is going to allow us to automatically build the code that we bush over to our get have repository because, as you may remember, we are using it hub any here, we're going to have all of the source code. The next lecture we're going to be triggering automatic builds in the cloud for the code that reaches its repository, and we are also going to be triggering automatic distribution to some users. That is known as continues integration and continues delivery. So let's go over to the next section on the started. Working with that 35. Introduction to App Center: A Tool for Mobile DevOps: so far, we have already accomplished throughout occurs triple event. A couple of far based services, authentication and databases through fire stir Now in thes last section, what I want to do is introduce to you a new tool that is going to help you automatically build and automatically distribute your application. Essentially, what we're going to be accomplishing is that as new versions of your code are made available and you build is automatically going to be triggered in the cloud. Why in the cloud you say? Well, because in the cloud, your certainly ones that builds succeed going to have an I. P. A. And on a PK files, we charge the installers for your Iris and Andrew applications, respectively. Being does files available in the cloud we can automatically trigger after that automatic distribution to your users. So we're going to be using a tool that I have right here. App center, now absent there is going to help you do at the corner of things, but we're going to be focusing on those two things. Continuous integration, the ability to build automatically and continues delivery the ability to distribute dose bills automatically. So we will have to do is navigate here to ab center adults M s and make sure that you can sign in me here. Perhaps we're get help account your Maxfield account, even a Facebook or Google account. So, as you saw just a minute ago, I was already signed in and you would be able to find something very similar. Today's, of course, within applications is yet in the next lecture, we're going to be creating the applications in here to implements, continues integration and continues delivery. But to be able to do that first, we have to make sure that our code is already here on get hub. You may remember how at the beginning of the far based sections, I talked to you about being able to grab all the code from here from get, huh? So what you will have to do is make sure that your code that you've been working with throughout this couple of sections is available in a nuke. It have repository. If you are all familiar would get hub. I suggest that you go back to the get up section from this cars so you can push off your code that you have currently locally on your computer over to a remote repository. This is steady is going to be crucial because once you have the CO right here on get Hub, you can easily, very easily create the applications and Havel of the code available here on that center so that APP center knows when there are new versions off your code. In any case, in the next lecture on going to walk you through the quick process off, making sure that all of your code that you currently have locally, perhaps on the local git repository he's over here on get hub so that once it is here, you can create the Kabul off applications, essentially then backing up center. You're going to have an IOS and Android applications. That code is going to be coming from your get a repository. That code is going to be compiled built, so there is a new I P. A and a new A P K files, and we're going to be configuring some groups from distribution groups instead of up center so you can register your users and distribute your application directly to them. Let's start then in the next lecture by creating the obligations here in the center so that we can trigger those automatic builds whenever we make some changes to our code. 36. Creating Android and iOS App Center Apps from Github: So currently, you at least already have the source code for your application here. Initial studio. So somewhere locally. Well, we want to make sure is that the Cody's over on the Gate of repository so that we can easily create applications over here in that center to make sure that you have all of this already, you will have to navigate over to get help and create a repository. Now, the detailed process off how to do this is over on the gin hub section for discovers. But essentially, you come here to get hub, create a repository, and you're going to receive a U R l on Http as you, Errol, that you will have to copy next, you'll have to open the terminal or they get bash on windows again. The details on how to get the git bash on windows are on the get section bought from the terminology will have to navigate over to the folder where your visual studio projects Waas treated. For example. In my case, I know that that is inside of my projects folder on inside of the my subscriptions folder in here. You should already be able to execute, get branch and see a Master Brent that was greeted by default when you created the project over official studio. The verily that you will have to do is make sure that you execute gate at dot to make sure that all of the files from your project are added to the repository and then execute, get commit that stem and at a message, for example, entire project. Now, I won't be able to execute this because there is nothing to commit, as you can see right here. But you should be able to commit all of your files. Then what you will have to do is execute gets remote atthe origin and based the http, you rail that you go from the new kit of repository now in my case, origin again already excess. As you can see, if I execute, get remote. That V or resent is already right here. But in your case, you should be able to at that age did tpu around. The last thing that you will have to do is make sure that you boost everything from your local repository over to that. Getting a repository may executing get bush origin, which is the name of the remote at Master, which is the name off your branch. In my case again, everything was already up to date breast. Unless you do this, all of your code, your entire project will be here on your get have repository. Once you have this, you are ready to create the AB center applications. Now, there are a couple of ways in which you could achieve this. You could come here to up center and create a new application from here. Bought the best way to do that Easter navigate back to get hub and app, center to your account on more specifically to this repository to navigate over to the marketplace. Here on get hob and searching here for ab center. You're going to see these one right here, the one that is verified. This one is from Microsoft. So if you go ahead and select it, you're going to be able to configure some access. Now, I already have my planning here, but you should be able to select your free plan so that now app center has accessed your gift of repository. So you would see something like this. You can just click and set a plan. Select the free one. Click on, Install it for free and Glicken complete order and begin installation. Of course, you're not going to be charged anything in here. I do recommend that you install it on Leon. Certain repositories. So in here, we're going to be selecting the repository that we want. Now this is my other get have accounts where APP center wasn't installed. But here just elect that repository and quickening stole DC's If you had an installed app center yet if you had already installed up center, as I have in my original get have account, you can navigate over to configure access and here in the install, get applications absent Tory's already listed you can configure it and both of falls are going to see something very similar to this both from here. You have to make sure the use of your new repository in my case, the my subscriptions repository. As soon as I select it and click and safe now up center knows about these new repository and he's going to read direct me here to APP Center to create the applications and snow days. We will have access to these repository now because we have just granted that access through Get hub. So I'm going to select my repository. Notice that I can change the name and select the applications are going to be created by default. It is already identifying IOS and Android and that this is Sam Marin. This is exactly what I want. He released I but I don't really have to select anything Anchalee can create. These is going to agree to applications one for us and one for Android which we have to configure right here. So let me go ahead and click on configure IOS first. And by the way, I can close the so there we know from here I am backing up center and notice that I am already instead of an iris application on app center iris application and back here I can already see off my branches. Now I have all of the branches that I talk to you about at the beginning of the fire base section because that is how I am sharing with you the code. But I don't need all of those branches. Notice that I am here configuring the master branch. That is the only one that I'm going to need. Really? And he here I am actually already configuring continues integration All very easy to follow right here in these blade. I am already configuring how the application the code is going to be billed for now. I don't want to focus too much. And there's so I am going to do is click and safe. And as soon as this is saved, we're going to be able to notice a couple of things first, right here in my least of branches, I will be able to find master and notice that there is already at trigger more on that in the next lecture. On also that I can go ahead and configure the same thing for Andrew as well. So I clicthat small notification. I see that there is another my subscription application. These work for Android that I can also configure for continues integration again. I am going to focus on this a little bit more in the next lecture. For now, I just want to click and safe. And as soon as this is saved up again, I can find the Master branch listening here and the trigger. So what exactly happened well, back on up center. What happened is that a couple of new applications where created which I can see right here my subscriptions one for android, one for IOS and each and every one of this. Even we never get over to the bill. Tab now has a continues integration process already in place. This is for both Android and IOS. That means that as soon as new coach reaches this branch over on, get Harb and new build is going to be triggered More on that in the next lecture. But for now, we already see these configuration ready. What we are also going to using from here is these distribute tab. We're going to be configuring some groups so that our users, instead of these groups, can receive automatically the builds that are created by here. So let's jump over to the next lecture and learn a little bit more about how we configure continues integration to these couple of applications because so far the configuration is already there. Bread waas quite default. Let's dig a little bit deeper in towards exactly that configuration is doing. And how is that going to be careful to automatically creates new builds As soon as New Coz reaches our get her repository 37. Enabling Automatic Builds (Continuous Integration) in App Center: we already have these couple of applications created on the app center we'd we creative thanks to the fact that over him get hub. We already had our source code. So here we created every mold repository and we pushed everything from the local repository over here. Now here in up center. What we have to do is figure out what exactly happened when configuring continues integration and I will start by never getting over to the android application. And what happens is that over on the bill tab, we already see circum some configuration for the master branch. So if we go over to this branch and select this configuration bolts into the right, it means that we're going to be configuring continues integration for these particular branch, which simply means that as soon as new code reaches that's branch over here on the repository that we connected, a new build is going to be started. And that build is exactly what we're configuring in here. Notice that we can change this to B debo or release. Seems what I'm going to be doing is distributing this application. What? I want to do the cell like this ass release I notice that I can also select the SDK version usually want to select the latest stable version in here, but we have some others available down there. You could also set some build scripts which are a little bit outside of the scope of this curse. But these options right here build frequency is very important. Currently, we have build these branched on every boost. Having the selected is what actually enables continues integration. They find that we don't have to come back here to up center and trigger the bills manually . But the fact that app centuries going to know when new code reaches a master branch and automatically triggered this bill this is exactly what we want to build a branch on every push. We can also said this to automatically incremental version Koth by build i d, which is simply going to make sure that every single time that a new build is triggered that has a different I d. For example, the next one is going to be one because I haven't built it is just that. And then we have some other options that we're going to be enabling later on because we're going to be distributing and to be able to distribute, we have to sign and to be able to sign. We need some kissed her files, but that is for a little bit later in this section. For now, I simply want to click on safe. That means that the next time that the bill this trigger now this is going to be creating a release a PK because we're currently on the Andrew Replication. Now, if I never get over to the author my subscriptions application they want for IOS, I have something very similar you find navigate over to build. I have the Muster branch, which I can configure to be instead of Debo release as well noticed that I also have different ASIC versions. Of course, these are for IOS. I even have some exclude versions available. Build scripts. If this is going to be a simulator, build or other by spills, eventually, I want this to be a device build for now, to Joe's quickly test continues integration. Let's live this asking little built and the option for continuous integration to build these branch on every push. Also, the ability to automatically incremental build number by build i d, which is what I just did over an android and some other options as well. No, I don't want to sign the Bills just yet, so I will disable that. I will have to do that if I ever want to change this to device build. But for now we can move forward without signing the bills. Notice out because we don't have the build sign we cannot distribute just yet. So that is something that we have to take a look at throughout this section. But for now, let's just simply click on safe. Now we have configured continues in degrees from for IOS. So are released. Build an i p a file ready for release East created. So how are these bills going to be triggered? Well, just like Rachel said, these are going to be triggered as soon as new code is available in the master branch in this remote repository. And there are, of course, at one of things that we could do to enable that. But the most common one is to simply make some changes by here. Hoener i d. So let's say that, for example, over on the view, I want to change a little bit about how one of these views in is being displayed. For example, let's say that over in the subscription space, in the least view that we have, we want the detail to have at different color one of the colors that we have over on Abdel Samel. Let's say that it is going to be the accent core. What I can do. Then East come here and made that small edit, said detail color to be a static research that we already have, which is accent color. And now that is going to be the core used to display this test. I am not even going to test this out bought. What I do want to do is booze that recent change over to the remote because, of course, so far that changes not hearing it hobbies just available locally. So what I have to do is go over to the terminal and snow days that if executed statues, there is this new change. The subscription spaced out. Several file has just changed. So what I can do is execute Gates, add period, which means that if I executed statues again, I now see that this has been staged these same file, which means that I can now commit these change by executing, get commit dash. And because I have to set a message and let your school this change Detail text, color and execute. Now, if execute get statues. I see that the current branch, the Master branch, is ahead off the remote branch by one commit. So I have to bush thes change. Well, I have to do is execute gate Bush or regime which is the remote and master which is my branch. And this change is going to be added back here on get hub. No, it is that if I never get over to the commits, I see these new change. Now, what is interesting is that back on ab center, you find navigate over to the master branch. Notice that there is a new build that waas automatically triggered because there is new code back here in the remote repository and this is both through for IOS and Android. So I see these build right here on IOS. But if I navigate over to the other my subscriptions application that one for android navigate over to build and navigate over to the master branch. I also see a bill right here currently already building any of these Build succeeds. I am going to have a new A P K and the new I P A file, respectively. These these right here East continues integration The fact that now right here on this cloud service, I am going to be building that code. This build these, of course, not happening here in my machine. It is happening on machines available in Microsoft servers used by AB center on. Once these bills complete ive successful, those files are going to be available. I will, of course, have to wait for these bills to complete to show you the results. Hopefully successful results balls what I want to do. Ease in the next lecture, make sure that I complete the configuration for those bills so that I can start distributing these bills which are going to require a couple of things different for android. Different for IOS. But that will enable us to ath continues delivery. So far, we already have continuous integration. It is ready. It was quite straightforward, but of course, there are a couple of things that we will have to change. So listen ports in the next lecture and configure the Androids build so that it actually creates an a p K file that can be distributed to our users. 38. Sign Android Builds to Enable Distribution: So we have configured the master branch here in the Android application on APP Center to automatically build. Now, I do want to show you something about an error that happened here in the first bill. The first automatic build Andy turn sound that I needed to enable overall in visual studio by right clicking on the android project, selecting options or property. Seeing visual studio on windows, going over to android bailed, making sure that I am a release Remember that we are building already for release over a visual studio center and enabling malted eggs. So I needed to enable it. Of course, Bush everything again, over to the remote. So we build again, and this time it wa successful. These means that notice there is now a download. Bolton. Dad helped me down. Lose the build. And if we wait for the bill to be downloaded, what made these file contained? Well, let's go ahead and show this on the finder. I'm going to extract this. Since this is a sip, open the folder. Ants notice. This is an A p K. File which we should be able to distribute now board before going ahead and distributing that I will have to make sure that these build can run on devices, which is not necessarily the case right now. So you find every gauge back to the master branch and select to configure it. Yes, it is already set to release boat. Currently, we are not able to distribute the bills. It says that on Lee, signed bales can be distributed. So greats, we have to sign the bills in here and notice that to be able to sign the bills, we need a key store file. So before being able to distribute, we need these file. Now. The best way to create a key store file is going to be from the terminal, because this way, the process is going to be identical. Whether you're on Windows or Mac or you have to do here is use the key tool. So the key Italy's a truly since told within jabber that you should have access to because you've been developing for Android on what we want to do is in the rate at key store now. To be able to do that, I will need to set the flag to generate a key, pair told said. the fly here to Gen. Ki pair with the flag in here and find that we won't a key store next. I need to specify where these finally is going to be saved, and I wanted to be saved instead of the desktop. And I can also specify how is this file going to be called? Let's go this my subscriptions, the key store very important that this has the key store extension and now we're going to have to set an alias, these alias. It is very important that you do not forget it. These alias he's going to be needed about here. Notice that we need a key alias back on APP center So but in the terminal, I am going to set the Ailey as, let's say to my subscriptions again. Then we have to also said the algorithm that is going to be used through Key Al like this. Let's make thes essay the sites of the key. Let's make these to any 48 the validity for how long eased these keys were going to be valid. Let's make this value for a long time and press enter. Now we're going to have to pass a couple of passwords. Notice again that backing up center. We need AKI store passwords and key password. So the first thing that we have dreams certain here is the key store passwords to make sure that you type it, press, enter and reenter IDs. Next, we're going to have to feel a bunch of details. You don't have to feel all of them. You can actually just press enter. But at least feel one off these fields, for example, that say that the country the to lead our country. So this is going to ask for my first name organization C T. And so long, as long as you said one of these values that is fine and down low, I have to type why and enter for yes and noticing here that we have to enter the key password. So we just entered a key store password. This is a key password older. We can press return if we wanted to be the exact same one as a guest or password, so that is an option. So if I press return, the key store east created and both passwords are going to be the same, So notice that he find. Go ahead and open my finder and navigate over to that stop. Now I have the key store right here. So excellence or we have to do is never get back to up center and or blow that kissed er again from my desktop. And to make sure in here that I said the key store password, the alias and the key password that again you may have said as the same as a G store password. Once this istan we can enable days to be these tributes is to distribute the bills, however, while one group is going to appear in here. This is not Jets configured as we want it to be, so let's not distribute that builds just yet. Bought Noticed that the option is now already enabled because we are now signing the bales every week. We can save ans build off course, continues integration. It's already going to be in place, but we're also going to be triggering a manual built. These build right here is already going to be signed, and the fight that it is already signed means that we can already used that file that a p K file to distribute to our users now before actually going ahead and distributing through a group, as which also is an option here for enabling continues delivery either next next year we have to also sign the IOS Beale's because currently jewels Now we had here on Android the build maybe create it bought It is not jets signed, which is necessary for all students tribute. So listen for it in the next lecture do the same thing that we believe in this lecture on Android but now on IOS. 39. Sign iOS Builds to Enable Distribution: the previous lecture we configured Beals over an Andrew to now be assigned. So these third bill that I have right here east now signed, which is ready to be distributed boards. We don't have that in Irish just yet. So I won't have to navigate over to the IRS version for my subscriptions application, go over to build and configure the master branch again. Now, by the way, before doing that and notice that I also had a build failed on me The 1st 1 I had to make us more changing here. So if I can figure this branch by default, you may have seen the solution selected in here. He turns out that Ryan, as we have to select the eye of espero shacked. So that is the only small change that I needed to making here. Now what I want to do now is make sure that I change this to release and sign the release build, which means that this is now going to be advice build instead off a simulator bailed. This is still going to build on every bush, But now notice that I have to sign the bills because the vines bills most being signed. And as soon as I signed the bills, I will be able to naval distribution. And again I see in groups available in here. But that is for a couple of pictures from now. For now, let's focus on signing these bills and notice that I'm going to need a couple of things in here. A provisioning profile and a certificate. To create these two files, I will have to navigate over to developer that apple dot com and navigate over to my account. I am going to sign in to the Apple Developer portal and from these patient will have to navigate over to certificates, identifiers and profiles. The very first thing that I need to do here is navigate over tried identifiers and create unidentified air for my ab. So here I will click and add. I'm going to select APP I DS click on Continue and said the description for the sap. This is going to be the my subscriptions application, and I wont have to set the bone delight the for my application, which we have used before. But if you don't remember, we can grab it by navigating over to the IRS project opening the for the police to file and finding the bundle light and the fire So I have to do is copy these model identifier and based it over here. This is unique for each application. Next I can't We can continue and simply raised her these up I d So now we have the app I t next we're going to have to create a certificate at distribution certificate because we are now going to be distributing sitting here. I am going to click on add and I am going to select Apple this tribute Shin Having selected Apple distribution, I think we can continue and oh, blowed at certificate a CSR file from my Mac. So here is another place where you will absolutely need a Mac computer. Just as we need on my computer to build and run Arriva supplication. We're going to need a Mac computer to create this file because we're going to have to have been here on my Mac, perhaps through spotlight the key chain access application. This is an application that comes with every Mac and having the sketching access application open. We'll have to never get over to the kitchen access menu, Select certificate assistant and select. Create a certificate from a certificate authority. We're going to have to set an email address and select saved to disk Quicken continue. And I'm going to save this on my desktop. Click and safe Quicken done and never gauge back to these page. Now I can sell like that file again for my desktop these CSR file. So select that one click on open and click on. Continue. These is going to create a certificate. It is very important that I download this file on the Mac computer and selected sweeties opens right here again on the teaching access. Notice it down below. You can easily notice it once you have a tone of certificates I like. I do right here through the expiration date, which is one year from today to leave. Today is February 25th. We see that these expires in February, 24th off the next year 2021. So we have the certificate already here. It is going to be very useful in just a minute. For now, we can navigate back toe all the certificates. We know that we already have. At these tributes, Shin certificate. Finally, we're going to have to navigate over to profiles and create a provisioning profile. So again I am going to click on add. And since we are already distributing or application, I'm going to go down below and select half talk because we're currently not going to be distributing to the APP store. Both threw up center. So I have to select a talk in here. Go up, click and continue and select the app i d for the my subscriptions application that we have jobs created. So by now you should have the app I d click on continue and sell like the certificate that we have just created. So in my case, I have this one right here, the one that expires in February, training to anyone. And by the way, it is very important that they have. You see other certificates in here? You still like the one that you kept yours created because these two are going to be associate ID. We will have to use the corresponding certificate. So clicking continue. You can select some device from here. This is actually going to be very interesting in the next couple of lectures for Now let's click on. Continue and name are provisioning profile. I usually like to call this with the name of the application and the type off provisioning profile that they say is for example, this is on distribution provisioning profile boat. It is also a thought, so I may have a developer frittering profile or an app store distribution brushing profile . These one is Theodore Distribution pushing profile for this application Anchalee could generate and Glicken don't lose. Now we are ready to navigate back toe up center notice that he requires first and foremost deprivation profile which already have right here so I can just track on drop in here. But it also requires the certificates as happy dwell file. And I don't know if you noticed Bolt when we don't loaded the certificate, which I have right here Distribution. It is not a pitro file. It is a c R file. So to create the certificates will have to never get back to the kitchen access. I'll find it. Remember how we did find it right here under my certificates and threw the date so I can just expand it because notice that this is the certificates blows the private key and select both of these values. Right? Click in these two items and select export. I am going to export eight over tube desktop and call this these certain Anglican safe noticed that this time he's going to be a pizza will file. I will also have to set a password for the certificate. Do not forget this password and clicking okay and allow our computer to export the key. Now backing up center, we can find that pitro file on our desktop Glicken open and notice. We're going to have to set the password that we Jewel said for that certificate. I hope you didn't forget it. And finally, we are going to be able to sign the bills just as we did for Android. I am not going to be enabling distributes bills just yet, but I am going to click on safe and build these things, Of course, going to save these changes training Future bills are already going to be signed and it's also going to trigger these additional built. This time the I p A find that is going to be generated in these build is actually going to be signed ready to be distributed. So that means now that both her IOS and Iran Drood applications are going to be built on Scient, which means that we can start distributing. So in the next lecture, we're going to start by creating a new distribution group for Android. Then we're going to create a distribution group right here for IOS. Finally, once we have those distribution groups, we will be able to navigate back to the configuration for these branches and enable distribute bills to that new group that currently of course, we do not have. So let's in Britain the next lecture and do that starting on the IOS application. 40. Continuous Delivery to Distribution Groups: So we have a reconfigure and replication here and up center to create signed bills. That means that those bills are ready to be distributed now to distribute a builds. If we go ahead and configure the bill for this master branch, we noticed that we can do it through groups or through the store. We are now going to be this treating through a group, but we don't have that room us yet. I don't have to never get over here and up center to the left, to the distribute tap Select groups ends at a new group. Let's go days, beta testers. This is usually how you want to use groups here in that center to distribute to your beta testers and eventually these tribute to the store, which is a little bit outside of the scope of this curse. But that, by the way, the configuration is pretty much identical. All you have to do is change how the build is going to be distributing your application right now, sitting these group and going to add a tester and I have anemia Padres that I want to use right now. These email address right here I am going to could create a group by now. Ofcourse we do not have any releases. We already have one tester, but no release. We have to eventually enable continues delivery so that as soon as a build is ready, a new version is distributed to these beta testers. Now, Yes, the configuration right here is pretty straightforward. But notice that if I never gate over to my inbox for these particular for that particular email I have received this invitation from the APP Center team that I have been invited to test this application for Android. Now, eventually, what is going to happen is that I'm going to receive emails similar to this one every single time that a new version is available. The new release has been made available to these groups. So I will have to keep an eye on my emails over on an android device, of course, to be able to install those new versions. But for now, I have already created these group. So that means that I can navigate back to the build, configured the master branch, navigate down to distribute Bill's turn this on and select these new beta testers group and click on safe the next time that a new build is available that is going to be distributed to our users. Now, I could trigger a new build right now, but if I do it, that new build is also going to be triggered for the iris project. And I don't have the group of various yet, so let me go ahead and do that as well. I will have to navigate over to the my subscriptions application for IOS and do the same thing. Go over to distribute go over two groups, create a new group. I am going to call this beta testers again and I can add the exact same e mailing here, which would mean that the same person is a beta tester for both my and road and my IOS application. However, in the case of IOS, it is very important that the device for these yusor ease registered. You may remember how, over on our provisioning profile, we assigned a device to be associated with that profile. That means that that profile can be installed on those devices. However, we don't know what device our users are going to be using. And even if we did. It would be a little bit of a difficult task to raise their those devices manually. So we can do is seen here instead of these groups for IOS, never get over to the configuration all the way here to the top and enable to automatically manage devices. These means that automatically, when our users try to install the application, their devices can be registered with. That provisioning profile threw up center without us needing to do anything manually. But for that we will have to select an apple developer account. So we'll have to click here on that account. Enter our apple i d the password, of course. And Glicken atthe. Now, in my case, this is already associate it with my account. As you can see right here, it don't say that it is invalid, so we'll have to reconnect. I simply have to re authenticate myself. It's like a Now select that account, Andi. Then I have to select a distribution certificate. So from here I can add a certificate which I already have. It is it is going to have to be the exact same pitro file that we have created earlier. It has to be the same one because that is the one being used by the provisioning profile. And it is Dad provisioning profile that one that we want to obtain. Of course, we have to pass the password for the certificate. Hopefully, you hadn't foregone in it. Glicken done and click on Don again Now notice that if we never get over to devices, we already see the devices that we had selective for the provisioning profile over here on the certificates, identifiers and profiles. But also now, every single time there users want to install the application. They can reuse toe their device right here. But so far then their distribution group is already configured for Iris as well. So it means that we can never get over to build. We can never get over to the configuration for the master branch down below. So leg distribute, builds and select that distribution group beta testers, for example, Anglican safe. That means that we can now trigger and you build that he's going to be off course signs and is going to be generating a new release. So let's go ahead and do that. I am going to start back in visual studio and I want to make another small change. Let's say that over on the subscription details Page, I want they order of these exactly out to be the other way around. So if you remember, I currently have the label first and then the checkbooks. Man, that works both. Perhaps he should be the other way around. I should have the cheque books first. So I'm going to have something like this that check box and they label So these teeny tiny change that means that I can save the changes, go back to a terminal execute gate, commit dash a M two af and create a message at the same time. And let's say you prove you I just like that. Execute and also execute gate Bush origin Master to push these new commit over to the remote. We know that back over on, get hub. We would have received this. Commit as we can see right here improve you I which means that backup center for both android and IOS. Either Master Branch we see and you build. So let's just wait a few minutes for these bills to complete, See their release has actually being created and here it is. After a few minutes, at least on Angelina Build has already succeeded these bill that we have just triggered. We should have greeted than a BK that he's already signed and distributed. So if we never get over to the distribute tab, we see a new version already distributed to our beta testers. And in fact, we never get over two groups, select this group and go over to releases. We see these version as well in fact, notice that if we never get over to our inbox, we, of course already received the invitation for IRAs as well, which I did add and spoiler alert. We do see the version fryers as well. But here it is that version 1.0 for my subscriptions for Android East already available. We're going to be installing this in the next lecture. For now, let's navigate over to the IOS version which we did already sees already available as well . But if we never gained here, navigate over to build over to master, we see that he succeeded. These building here has already created a nine p a file already signed. So we see the version of here in the distribute tab and over here for the group as well Overall releases hand. Of course, as we did see, we received the invitation because a new version for Iris is available less well. So now in the next couple of lectures were going to be installing these new versions so natural devices the devices there allegedly would be from these user who cast these email address. So with support from next lecture on, install these new releases on the corresponding devices. 41. Installing the Android and iOS Apps on our Users' Devices: for both our Iris and our android project Here in APP Center, we have a new release in fact, over in my inbox or the inbox for the user that we added to our distribution groups. We already see the new version and notification about there being a new version available for both the iris and android applications. However, of course, what we want to do is open these over on those devices. So I have here in my on drawer device this is a physical device and I have here the exact same inbox so I can open identification for the android application to see that there is a link of these loads. There we go. A link doing stole the my subscriptions application for Android version 1.0. Anybody and disease, we see then built number, which is number four. Remember that we have been automatically incremental ing the built number by built I d. Now, by the way, at least here on my device, I have to make sure that I long present install Bolton and click on copy link because I have to open this directly over on Google. Chrome nods on the browser. Dad my email client is opening. So let me go ahead and open the link that I Cupid, which is actually absent or us. We can see right here. And I have to make sure that I sign in with the same email accounts that received these emails. In my case, that would be Google. Let me go ahead and sign in once they have saying the and I am going to be resurrected right here to the my subscriptions application for Android over an APP center. Now, this up center is not the same account that I have back here with my computer, which is where I actually created the distribution. These is the one for my user where they have access to these new release. And what is that from here? They could see all of the releases that we have made available currently, of course, only one over to the lab. They could see all of the wraps, but right now, what we can do East click on download. This is, of course, going to go ahead and download an A p k. Of course, depending on the manufacturer, the installation of the A p. K, maybe a little bit different noticing here that I can now open the a p k file by now. By the way, these a PK fire remember, is already signed, which means that any device can install it. So if I click on install after just a few seconds, I should say it installed, although, yeah, because this is not from the play store, I may see a message like this one, I will say just to install anyway. And there we go. The APP has been installed, so if actually couldn't open now, this is the AB that we have been developing, but of course, installed on testifies. Notice that by default I have to go ahead and law again. Now, I remember one of the past words, So I'm going to go ahead and use the email and password legal. Logan, I am navigated back to the subscriptions, and I see one of the items in here. If I go ahead and select these one against the details and you can see how this is the latest version of my application because of how the checkbooks and the label are ordered, remember that previously we had the order, the the other way around for the label than the checkbooks. This is the order that we have just changed in the latest version. So indeed, this is actually working. I can click on Delete back in the subscriptions. I don't see anything again. Click. Lunev. Write something random in here. Selected. This is active, by the way. We did not change the new subscription page. Only the details page. But let's go ahead and click on safe. We never get back. We see everything working as before. So there have it. This is the application for Android already running on that device. Remember that by now anyone would be able to install this application, which is particularly useful for IOS because that means that even if you don't own a Mac, all you have to do is have to make sure that over here on the IRS application on that center, you configure the master branch ones with these files that we do have to greet from a Mac. You may borrow Mac from a friend to greet the necessary files, perhaps rent a Mac a couple of hours from making clouds, and that's it's now up center already, E is going to be using a Mac computer from the cloud, of course, to build your application and distribute it. Now, let's go ahead and see how he said that your users would be able to install it again. Are you, sir? Would have received an email jokes like the one we see here. Just like the one we saw over on Android. When I want to do now, of course, you show you these IRS device these ny pad and I can see the email right here as well. And if I click on it, I also see the install Botton and just like a naturally when I want to do in here is long press on the's Bolton, copy the Eurail and make sure that I opened this on safari. It is very important that we use safari for this process Trouble just based and go to these Eurail and again we have to look in my case again. This is going to be with Android. So let me go ahead on sign in. And once they have known that I am going to see something very similar now actually, what I have to do in here is make sure that I request the mobile website that is very important, especially here on iPod on iPhone. The mobile website is going to be requested by default here. I have to make sure that I request the mobile site which your night. But I can do by clicking on these couple of a Aikens that are to left off the address bar and clicking on Request Mobile website and we're going to be resurrected right here. This is very important because, as you may remember and let me never get back to my computer and back to up center for the distribution group for IOS, we configured the fact that the devices are going to be automatically managed like on the iPad. This is exactly where we have to manage those devices. So each of your users would see something like this. I would have to click on that device. They will click and allow, which is going to download a profile. That means that they will have to never get over to settings and identify this option right here to live that says profile downloaded. If they don't see it, they can always go to general, go over to profile and see that there is an AB centre devised registration service profile . But they have to do simply either from either off, the options is click on install, answer their past growth, and that would have installed the profile. What this means is that this device is now registered. Notice that backing up center. I now see these device as well. These is no register with their provisioning profile that we created earlier that we assigned so back to off the applications. They will now be able to find that application. In my case, this application right here. My subscriptions IOS and I do see a latest release so I can click on get this is going to prepare the version for my device and shouldn't take more than a few seconds. And there we go. Once the application has been prepared for this device, we can click owning, stole, and as any application, this is going to be installed by here on the springboard. So we see the application being installed right now, and there we go. We in click on the application and say it launched. Now, here on my iPod off course, we will have to again. Again. Let me use the same accounted angels used over an android click on Logan. And I, of course, see the exact same element that I just added from Android again selected. I can delete it. I no longer see it back here. I can click on air at a new valuing. Here I can't set is to be active, clean and safe. I see everything working as expected. So there you go. This is how both your android and IOS users would be able to install the application that you just distribute it on their devices. And this, of course, includes yourself. You could like this just rent or borrow a Mac for a few hours. Create unnecessary files that we need over here to configure the build for the master branch and starts automatically distributing new versions of your app to your device to test it out. 42. Congratulations!: congratulations. You have completed this curse. I really hope that you have learned a lot throughout each and every one of these sections from the section and get help produce of you who weren't entirely familiar with a tool to the introduction to Sam Marin to, of course, the sections on far Bays and this last one on ab center. Now, I believe you have everything that you need to go ahead and start building amazing salmon applications. You know, it's only know the basics of summer and add some very powerful summary features, but also know how to implement authentication. And at databases hand, you also know how to implement great processes from having source control locally with gates on the remote would get hub and implement some continues integration and continues delivery without center. I really did create these girls. Think about what occurs I would have loved to find when I was first starting out with some rain with ab development in general. So I sincerely hope that these girls was super useful to you. And if it waas, I really invited you to take a look at the last lecture in which I'm going to share with you. A couple of other curses that I think may be useful to us. Well, hope to see you there.