From Fedora Project Wiki

< User:Amitosh

Revision as of 15:09, 26 March 2018 by Amitosh (talk | contribs) (Created page with "{{DISPLAYTITLE: Improve Fedora Android App - Backend}} == Project Information == '''Organization:''' Fedora Project '''Student:''' Amitosh Swain Mahapatra '''Possible mentor...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Project Information

Organization: Fedora Project

Student: Amitosh Swain Mahapatra

Possible mentors:

Contact Information

Email: amitosh@fedoraproject.org

PGP Key: 89A3A2B0

Time zone: UTC +5:30

Freenode IRC nick: amitosh

Github: https://github.com/agathver

Blog: https://amitosh.in

Social media accounts:

Proposal

Abstract

Fedora has an android app which lets a user browse Fedora Magazine, Fedora Ask, Fedocal etc within it. This app is build using the Ionic Framework, Angular and Cordova. Essentially it is a cross-platform hybrid app.

In the current form, most of the functions rely on an in-app browser to render content. This project aims to improve the existing Fedora App for Android for speed, utility and responsiveness, introduce a deeper native integration and make the app more personal for the user.

Project Goals

  1. Personalization of app features.
  2. Offline first experience – caching data from Fedora Magazine and Social and optionally, making some of the content accessible offline.
  3. Provides native experience where possible.
  4. Improves integration with Fedora Infra apps.
  5. Notifies the user for new posts, calendar events, etc on an opt-in basis.
  6. Provides deeper integration of apps like FedoCal and system calendar.
  7. Coordinate with the UI/UX intern to implement screens with appropriate design principles.

Optional Goals (if other constraints permits):

  1. Integration with Fedora FedMSG Notifications

Deliverables

  1. Refactored, and restructured code for the android app, providing native experience to the fullest and offline support.
  2. Deeper integration with system as well as various Fedora Infra apps.
  3. An Ionic hybrid app that is publishable to app stores like Google Play Store and F-Droid

Implementation

Offline first experience

The current app is modeled as a shell over web-services. This is far from optimal. Data such as posts in Fedora Magazine and Fedora Social can be safely cached and refreshed when the user visits the page or periodically as a background service.

This feature can be implemented with an “update check” facility. In a table, we store the last updated timestamp for every source. While refreshing, we request the upstream API to provide new posts since the last update time.

  • Facebook supports time queries through additional FQL query conditions.
  • Twitter provides support for time queries through max_id, since_id, and count.
  • Wordpress supports time queries with before and after query parameters.

Ionic Native Storage provides a high-performance SQLite based storage that can effectively serve as the backing store for this feature.

FedoCal and System calendar sync

Currently, the user has to explicitly add each item to the device calendar. We can improve this feature by allowing the user to opt-in to a specific calendar on FedoCal such that all new events posted on the calendar will automatically be synced to the device calendar.

Using Ionic Native - Calendar, we can directly create events in users device, once the user grants us the permission to write to the system calendar. We can add new entries to the device calendar automatically when they are published to the calendars chosen by the user.

Package Search

We can provide an interactive search for packages available in Fedora rpm repositories using the API at Fedora Package Search Meta App. The package search will allow the user to search the Fedora repositories for packages that are installable using DNF.

Fedora Package Search is a front-end to Xapian, which accepts queries in a JSON format as a GET request and returns a JSON response. The implementation will consist of a new PkgSearch Provider which will perform this request and update the client.

The search client will be a separate page in the Fedora app. It will be available under the “Extras”, or the hamburger menu, depending on the UI/UX pattern that evolves in the course of the UI/UX Improvement project.

Overview section

The current layout is based on boxes. It has been requested to morph this view into an Overview page. This page will contain highlights from all sections of the app. It will also serve as the main entry point.

Tracking article reads in Fedora Magazine

Fedora magazine currently lacks any means of tracking new or unread posts. With the implementation of offline storage, it’s trivial to track the read/unread state of an article. Unread articles can be shown in a different UI than the read articles.

Improving the loading and filtering articles and posts

We can easily implement infinite scrolling with scroll down to load pattern. Ionic framework provides ready-made support for this interaction. Additionally, Facebook, Twitter, and WordPress APIs also support this pattern of interaction.

In order to categorize the articles, we can allow filtering of WordPress articles via tags and date published. Similarly, for Fedora Social, we can filter the data sources. Fedora Magazine and the community blog run on WordPress which expose tags on the articles. The filter will utilize this data to provide an interface for filtering the

Bookmarks and offline reading

Implementing a light-weight reader will improve the loading times of the articles, as well as allow to cache the contents to provide offline reading capabilities. Articles will be cached for a relatively short TTL (a week maybe?). Additionally, a user will be able to bookmark an article (or any item) and access it from a Bookmarks screen.

User page

We will have a user page (optional) which will show user info for signed-in users, their batches, and activity from FEDMsg.

Batch information is available at Tahrir API at Fedora Badges. FEDMsg data is available from DataGrepper. The DataGrepper view will be implemented as an infinite scrolling view with a search option.

Accessing user info in this manner will need FAS Login.

Fedora Account System Login

Fedora Account System is an OpenID connect instance providing SSO across all fedora apps. It is required to access a few protected apps such as FMN Notifications. FAS uses OpenID Connect to provide authentication tokens. Implementation of OpenID connect can be carried out by securely by following guidelines in RFC 8252. The implementation will redirect the user to IdP login at https://id.fedoraproject.org with appropriate client id and client secret. The IdP on successful login will redirect back to an app-specific URI (like fedora://login) with access codes. These access codes will be validated with id.fedoraproject.org endpoints to generate the access tokens, which can be used to query protected APIs.

Support for FMN Notifications

FMN is a notification service which sends a notification to users for events in FEDMsg. FMN already sends notifications as emails. Notifications are dependent on FAS Login.

Push notifications to the mobile app can be implemented by creating a FMN-FCM bridge. The FMN has an Server-Sent-Events endpoint which can be subscribed by a client, and the client in-turn published them to FCM. A prototype based on the older GCM API exists which can serve as a starting point.

Timeline

Phase I - Learning, ideation and preparation:

Till May 14:
  • Discuss with the community to decide on the exact particulars of the implementation, library pattern, code styles, possible pitfalls etc.
  • Try lifting FMN-FCM bridge to a fair quality. The success of this will decide the fate of integration of FMN notifications.
  • Interact with the UI/UX intern to develop a joint plan of action.

Phase II - Coding

Week 1: May 14 - May 20
  • Refactoring existing code to iron out compatibility issues due to the recent upgrade to Ionic v3.
  • Improve type-safety of code by introducing additional TypeScript type assertions.
Week 2: May 21 - May 27 and Week 3: May 28 - June 3
  • Implementation of offline storage for Fedora Magazine and Fedora Social.
  • Implementing sync for Fedora Magazine and Fedora Social.
  • Unit tests.
Week 4: June 3 - June 12
  • Unit tests. (contd.)
  • Prepare for first term evaluation.
Week 5: June 13 - June 17
  • First term evaluations
  • June 14 - June 17: Away from the keyboard for Raja celebrations
Week 6: June 18 - June 24 and Week 7: June 24 - July 1
  • FedoCal and system calendar sync
  • Read tracking for Fedora Magazine
  • Unit tests
Week 8: July 2 - July 8
  • July 2 - 4: Away from the keyboard for semester registrations
  • Package search
  • Preparing for second term evaluation.
Week 9: July 9 - July 15
  • Bookmarks and offline reading
  • Category filtering for Fedora Magazine and Fedora Social
  • Second term evaluations
Week 10: July 16 - July 23
  • FAS Login
  • Implementation of user info section
Week 11: July 23 - July 30
  • FMN notifications
Week 12: July 31 - August 5
  • Buffer time for unexpected situations
  • My classes will start somewhere in August, so I intend to complete most of the work before that.
Week 13: August 6 - August 13
  • Final submission

About Me

Educational background

I am currently a third-year B.Tech student in computer science and engineering at College of Engineering and Technology, Bhubaneswar, India. How computers and software worked have fascinated me since my middle school days. My first exposure to programming was with C in 6th grade. Since then, I have been constantly exploring new areas of programming. I chose to study computer science, in order to satisfy my curiosity for learning new things in the field of computer science and IT, and also due to fact that I perform academically well in computer science courses, due to my interest in the subject.

Why did I choose Fedora?

My first exposure to Linux world was thorough Fedora. It was back in my 9th grade when I first installed Fedora 16 (Verne). So I have always been interested to contribute back to The Fedora Project whenever I got the chance. I have been involved with the Fedora project for the past two years. I’m a member of the DotNet Team where we try to improve the ecosystem of .NET in Fedora. And I wish to contribute to other areas of my interest and talents.

Why did I choose this project?

The idea of integrating a bucket of fedora services was very appealing to me. I have been doing extensive JavaScript and Hybrid mobile app development since quite some time. I'm a long time Fedora user, and this would be my chance to give something back to the community.

Contributions to this project

  • Updated project to use TypeScript, Angular and Ionic v3 - PR #6

The project was lagging behind in technology and it was impossible to support newer versions of Android (and iOS) with the original versions of Ionic. I successfully ported the codebase based on Ionic v2 to Ionic v3.

  • Updated project docs to include detailed build instructions - PR #3, PR #36

I added Ionic build instructions describing the prerequisites and steps to create an APK or iPK from the sources. This has helped new contributors to quickly jump-start their local development environment.

Experience

I set my feet on Android development when I started my undergraduation in 2015. I have worked on more than a dozen projects based on Ionic and Cordova. I also have a good share of web development and JavaScript frameworks. I’m well versed in Angular, ReactJS and React Native. I have some familiarity with WordPress and Fedora DataGrepper APIs. I have also worked on Single Sign-on systems involving SAML and OAuth.

Contributions to open source

  • An active contributor to a project called bcrypt. It is a very widely used NodeJS module that provides bcrypt hashing capabilities, which is commonly used to store passwords in hashed form.
  • Member of the technical society of our college where we promote the use of FOSS technology among the students. I also help out students who decide to start using Fedora, Ubuntu or any other Linux system.
  • Answering questions on StackOverflow, CodeProject, and AskFedora about FOSS technologies as well as general programming and help questions.

Previous Google Summer of Code Experience

This is my second time attempting Google Summer of Code. I successfully completed my GSoC project - Code Quality Metrics for Projects listed on LibreCores.org with FOSSi Foundation in 2017.

Commitments and engagements during GSoC

If selected, I’ll give my full dedication to the project. I have no other full-time commitments during the month of May to August and will be able to provide 35-40 hours a week to the project.

Periods of unavailability or other constraints:

  • June 14 to June 17: We have the celebrations for our traditional Odia festival - Raja. I don’t expect myself to be able to give much time during this period.
  • July 1st week: I have my university semester registrations and registrations for placement, I would be away from the keyboard for 3 - 4 days.
  • August 10 to end of GSoC period: My classes are expected to begin from August 10. During that period, I would be able to give around 20-25 hours per week.