Agora Vote iOS

Intern Name: Aleksandra Komagorkina (@akomagorkina)

Organization: AOSSIE

Agora iOS

Source Code

Mentor: Abhishek Agarwal

Overview of the Application

Agora vote iOS allows users to create elections, invite voters, view results etc. This application uses Agora Web API as a backend application. It allows for elections to be held by using multiple algorithms such as Oklahoma, RangeVoting. The iOS project has started in 2020 and some intial UI was implemented back then, but there was no functional API support or any business logic integration up until now.

Goals

My mentor and I changed the project scope and goals at the first weeks of coding period. Together we decided to focus my project on exploring and implementing The Composable Architecture (TCA) as well as continuing the implementation of SwiftUI while following the User Interface Guidelines and iOS best practices.

The introduction of TCA was justified by the need to better bind together views in SwiftUI and potential business logic represented as state machines for additional robustness, so the Composable Architecture fit in it nicely.

My goal was to build an authentication and authorisation layers, as well as to connect together Create Election flows and remote API, as well as to update and clean up the UI.

Here are the steps which were taken to reach those goals:

First part of the coding period was focused on the Authorization flow:

Second part of the coding period was focused on the Create election flow and polishing the code:

I dedicated some time in the Final Evaluation week to add missing documentation and address mentor's feedback as well as to complete final work submission.

Enhancement features:

Summary of whole GSoC journey

​ I didn't have any prior experience of contributing to AOSSIE or any other open source project so it was a completely new experience for me.

I have never worked with TCA before and was really happy to dedicate some time to dive in into learning and exploring the topic. Introducing a clear definition of State, Store, Action, Environment, and Reducers to the app was a wonderful idea since it allows to support better State management in SwiftUI.

I have started the first part of the coding period by updating project settings and frameworks. The next step was the initial introduction of the TCA to the app: together with the mentor we've decided to start implementing TCA in the authorization flow first.

The app was missing the networking layer as well as a few screens. The introduction of the TCA also required updating the navigation layer of the app, so I have not only added the missing UI and aligned it with the API but also added a separate Navigation and Networking layers, as well as created a Test store for the authentication flow. My mentor suggested to focus on the implementing the architecture and leave the testing for the future projects, so it gave me more time to work on the other features.

While I was working on the Network layer of the app I was many times blocked by the unresponsive server, so I've decided to create a Mock server for the future testing. It took me some time to build it but saved me much more since I was not dependant on backend any more.

During the second coding period I have worked on the Create Election flow. At that point I felt more confident working on the TCA implementation, however I had more issues with the UI and Network support. I have started by aligning the create election model with the API, then introduced the TCA and plugged in the UI into it. At the end I've connected it to the network layer.

Since the topic was new to me I think the hardest part was to plan my work around it. As TCA requires a completely different structure of the app, and involves changing the networking and the navigation layer of the app, as well as a separate test store.

I've realised the importance of prior planning when it comes to building an app's architecture as at times I felt the need to redo certain things and it'd take way more effort with multiple Pull Requests happening in parallel as ideally those features would have been split into multiple ones.

Merge Requests

  1. Merge Request !1 - Update project settings and frameworks (Merged)
  1. Merge Request !2 - Introduce The Composable Architecture (Merged)
  1. Merge Request !3 - Implement Sign-up flow using TCA (Merged)
  1. Merge Request !4 - Implement Sign-in flow using TCA (Merged)

Add support for the Sign-in to get access to refresh and authentication tokens:

  1. Merge Request !5 - Add support for a Mocked Server (Finished, pending review from mentor)
  1. Merge Request !6 - UI and business logic for authorization flows (Merged)
  1. Merge Requet !7 - Align election model with API (Finished, pending review from mentor)
  1. Merge Request !8 - Bind Create Election controls to TCA (Finished, pending review from mentor)
  1. Merge Request !9 - Connect Create Election flow to the server (Finished, pending review from mentor)
  1. Merge Request !10 - Add final project submission (Finished, pending review from mentor)

Future Scope