MakerLab logo MakerLab

Authentication

Since the authentication process is centralized in MakerLab’s api endpoint, the app will make this process through a Web View that, allied to the redirects made by OAuth protocol used by the university, will take the user through the steps needed to the authentication process. The app will only interfere in last step - establishing the session with the wiki - where it will get the session-id through the request headers and save it in the app preferences (Shared Preferences), as it will be necessary to perform all the requests to MakerLab’s api endpoints. This Shared Preferences are saved in a secure way (Secure Preferences) on the equipment (smartphone or tablet) memory. After this proccess, the webview cache need to be cleared, so that the user can logout and re-login with another accounts, since UA’s idp saves session and allways maintains an logged account.

After the login’s process, the app will request for user’s infos by making a request to /api/profile endpoint and save the user name, email and wiki user id. At this point the app also saves the current login time, since wiki’s session is maintained only for 15 days, so it needs to force logout so that the session-id is allways valid.

An auto-login feature is also present, by handling the user infos on app preferences. When the user forces logout, these infos are cleared, so the app will ask the user to make authentication by following all workflow shown above.

DMLCalls

The DMLCalls is the model class responsible for populate and mantaining the information needed on others views, namely the complete list of users, and the list of projects and requisitions of the user that is authenticated. A complete workflow (getting list of users > list of user’s projects > list of user’s requisitions) is done on the app startup, so that the views can be populated in the initial state.

These information obtained from the MakerLab’s api endpoints is stored follwoing the OOP methodology, as follows.

These objects are stored in lists, accessible at any time, through DMCalls instance. It is also possible to force a refresh of the user’s projects and requisitions by calling the respective method (forceUserProjectsLoad, forceUserRequisitions). The user’s projects refresh will notify Main Activity (with a broadcast signal) and redirect the user to projects list in order to refresh the list view with the last projects, and the user’s requisitions refresh will notify the reader fragment in order to re-activate the camera function.

Api call’s

All requests to MakerLab’s api endpoints are done based on Volley lib. However, since wiki host has a self-signed certificate to work on http secure mode (https), some changes have to be done on top of Volley lib. These changes are present on network package , namely:

The server certificate that is used on MakerLab’s api endpoints interactions is generated in MakerLab’s server (.crt extension) and placed on assets folder (on project path). Also, the cookie that is attached to the requests / responses is obtained on Authentication phase, as described in above section.

Views structure

The app views are all based on Fragments interface, selected by a side menu which is available at any time with the exception of Project Page fragment, User list fragment and Create Project fragment, since they make part of a separate workflow. In that case, it is necessary to handle go back feature (top left icon is replaced for a go back arrow) and it’s logic in MainActivity.

Item scanner

Since the app needs to scan QR codes and work on theirs information, the application uses MobileVisionBarcodeScanner lib, which in itself is based on a solution created by Google. It detects a QR code and returns it’s value so that we can work above it.

Augmented Reality

The augmented reality feature was a addition made on MobileVisionBarcodeScanner source code. When a code is readed, a Barcode wrapper is created, which make possible to find the code bounding box. Based on that, the app builds and draw four paintings on returned canvas, as following:

This feature can be enabled or disabled on settings menu, which controlls a flag saved on app preferences.

Requisitions / Deliveries logics

After the QR code is readed and returned, it is necessary to find the equipment infos, by making a request to api/equipments/QRCODE_SCANNED and analyse the name, quantity and active requisitions number. After that a dialog is created to handle user input, namely:

The inexistence of projects prevents the dialog from being displayed, since there are no projects in which the user can associate the requisition, as well as the inexistence of available equipment’s units will block the requisition feature and the inexistence of active requisitions of the equipment will block delivery feature.

When “Concluir” button is pressed, the request need to be done, by making a PUT request to api/projects/CHOSEN_PROJECT_ID/requisitions/QRCODE_SCANNED in order to make a requisition or a DELETE request to same endpoint to make a delivery. Since the server does not support multiple requisitions / deliveries at once, it is necessary to make multiple requests to the specific endpoint, which value is determined by the number chosen in the NumberPicker. After all requests are computed by the server, a message with operation status will show and the requisition list needs to be refresh by making a reload of the requisitions list on DMLCalls, which, when the reload is finished, will broadcast a signal in order to allow the user to make new requisitions or deliveries based on updated values.

Projects

Create Project

Based on two fields on a form where the user fills the project name and description a PUT request is made to api/projects/new?title=PROJECT_NAME&content=PROJECT_DESCRIPTION. After that the user is redirected to project list view.

Listing Projects

The user’s projects list (DMLCalls projects list) is showing based on a listview with a custom adapter which shows the project name, creation date and a rectangle image which represents the project.

Project Page

When a project is clicked on above section, a page with more details appears. The main feature of this page is to see and manage the project members, by showing a list with them.

Adding members to projects

When the user clicks on “Adicionar Membros”, a new page with all MakerLab’s users is shown, so that the user can select and add multiple members to it’s projects. This checkable list is handle by consulting isSelected flag present on User object, so it needs to be unchecked on page startup. A listview item click listener is also setted in order to improve user experience and allow them to pick a user by simply touch on the item or in the checkbox. When “Adicionar Membros” button is clicked, a PUT request to api/projects/PROJECT_ID/members/USER_ID has to be done , user by user, since the server does not support multiple addings’.

Requisitions Lists

Based on requisitions and deliveries done on Item Scanner section, a page will be show all user active requisitions (DMLCalls requisition list). Each item of this list will have the equipment name, the project which requisition is associated and number of units requested.

Development Environment

The app was created on Android Studio IDE and the dependencies are maintained using Gradle (used by default with Android Studio IDE).

Dependencies

In order to create and build the app so that the requeriments and user experience gets fulfilled, some external libs have been used, namely: