Create an account page
On Monday, I started working on the create an account page. On Friday I had initially created the page but there was no content. I followed the screen designs and included all the form fields an inputs. Creating the page was helped by the tutorials I found in the first week. However, one problem I found was that there was no check box native to Xamarin, to overcome this problem I would need to use a nuget package that would allow the use of checkboxes. This Github repo showed me how to use the checkboxes from the nuget package.
I also used the query I created the previous week to create a drop down consisting of all the libraries. When populating the library table, I used libraries from Powys, as this would provide me with realistic data.
Additionally, when creating this page, one problem I found was that I would need to enable scrolling. For this, I looked at the Microsoft documentation and added the <scrollview> attribute to my content page. I would also write a UI test to give me confidence that it worked.
Forgotten password page.
I also created the forgotten password page, this would be very similar to the login page, so I used the styling from that page to create this page. This is a very simple page with only one input field and a button. After I created this page I also ensured that the back button was added by looking at this forum and specifying that the Splash Screen was a navigation page. This meant that every page after the splash screen resulted in a back button that would take you to that page.
On Tuesday, I started looking at authentication, whilst there were a number of different tutorials, a lot of them focused on OAuth. Out of the remaining tutorials I looked at implementing authentication and a login system using Firebase. This is a link to one of the tutorials I followed, however, many of the tutorials seemed out dated or Android specific. Whilst, my app would be primarily tested in Android I wanted to make use of the shared project in Xamarin forms.
Towards the end of the day I started looking more into using OAuth, in particular Google. This would also eliminate the problem of storing passwords locally, making my application more secure.
After this I started looking at validation. The ‘create account’ page required validation on several of the input fields especially on the email and password fields. I watched this video and followed this tutorial to configure the validation on a sample project. While, these posts acted as a good starting point, I would need to provide validation specific to my application. I then decided to leave this until I had configured either an authentication system or OAuth into my project, in case the pages the validation was on needed to be changed.
OAuth with Google.
On Wendesday, I started looking into OAuth with Google. I created an account with the Google developer console and added my app. Upon creation of the project, in the credentials tab you would need to add an OAuth client ID. From this menu you would need to enter the application type, the name, package name, and signing-certificate fingerprint which I found using this video tutorial. However, whilst I was looking at tutorials such as this one. It was unclear whether I needed to create a web application, Android. Another problem I had was that many of the tutorials are platform specific. I then decided to develop an OAuth system with Twitter, as the main goal was to get one developed fairly quickly. Although, I would like to develop a Google OAuth system in the future.
OAuth with Twitter.
I then developed OAuth with Twitter. I looked at some Git hub repos such as this one, and I followed this tutorial. I also read this part of the Xamarin docs that talked about authentication with OAuth in Xamarin forms. In order to use OAuth using Twitter I had to create an app on the Twitter developer console.
After this I started writing the code in my project, unlike the Google Authentication, Twitter used OAuth1 which required differed parameters, such as the consumer key, consumer secret, request token url, authorize url, access token url and callback url. These could all be accessed via the Twitter developer console. Due to most of the tutorials being platform specific I first implemented it in the MainActivity.cs (which was in the Android project). Once this was finished, I added a task to the sprint board to move this to the shared project.
OAuth with Twitter.
On Thursday I continued developing OAuth with Twitter. On Wednesday, I had successfully implemented authentication on MainActivity.cs. However, upon successful authentication it redirected to the Twitter home page. I mainly focused on moving the code from MainActivity.cs to the Splash screen page. In the Splash screen there would be a button saying ‘Log in with Twitter’ and this would fire the authentication method. A possible desirable would be to have authentication with Google or Facebook, however these would be implemented differently as they use OAuth2 as opposed to Twitter which only supports OAuth1.
Looking into the GoodBooks dataset.
On Friday, I started looking into the GoodBooks dataset. This datset consists of six million ratings for ten thousand popular books. The dataset also contains metaadata about the books, and tags/ shelves/ genres. Whilst I wouldn’t be using the ratings.csv, I would need to use the books.csv, book_tags.csv and tags.csv, which I could use to get the genres.
I then inserted this tables into my database, I could do this by going into DB browser then file -> import -> table from csv file. This would generate a new table based on the CSV file. By using this dataset it would give me some realistic data to work with. However, I would later have to add a OriginLibraryId and a CurrentLibraryId to all the books for the purposes of my project. When importing the csv files I modified the contents to include foreign keys, for instance the BookTags table contains a TagId that references the TagId in the Tags table.
After finishing importing the new tables, I started looking into search. The first thing I had to do was to edit the existing book model to map to the new columns that were added as part of the CSV import. I then created a search page, and added a search term entry box and a button.
I then created a new query, that would get all the books in the database. To begin with, I wasn’t going to bother with filters, however this would be added later on. This search would be performed on page load. Once this was working I started modifying the query to take into account search terms that the user might enter. I tested my queries in DB browser first and then moved the code into the BookManager class.