Skip to content

Commit c22e5e8

Browse files
Initial commit
1 parent f44c453 commit c22e5e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+501
-1017
lines changed

README.md

Lines changed: 33 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,46 @@
1-
# The Brief:
1+
#Moneybox Technical Task
22

3-
Create a mini version of the Moneybox app that will allow existing users to login, check their account and add money to their moneybox.
3+
##The Brief…
4+
Create a screen that allows a user to login to their moneybox account and display their total plan value.
45

5-
## Part A - Fix current bugs
6+
Duration: 2 hours
67

7-
In this repository you will find LoginActivity that allows users to enter their username, password and optionally their name. We have implemented a basic screen for you that validates username, password and name against simple regular expressions but makes no calls to the API.
8+
##What we are looking for…
9+
A fully working Android application
10+
Clean coding style
11+
Demonstration of architecture choices
12+
UI considerations including validation
13+
Unit Tests
814

9-
Unfortunately this screen has 3 bugs raised by our testers that they want you to fix and are listed below. If you are struggling to fix any of these bugs, please give it your best attempt and then move onto the next bug or task.
15+
##The Project…
16+
The project includes the networking code and models to complete the task, you will just need to integrate them and implement the logic.
1017

11-
### Bug 1 - Layout does not look as expected
18+
The `Networking` class contains the `OkHttp` and `Retrofit` instances with the required headers for an unauthenticated request.
19+
The `models` package contains the request and response models with all the fields required for the rest of the task.
1220

13-
Please re-arrange the views in the LoginActivity to match the expected layout.
21+
##Part 1 - Login Screen…
22+
We would like to allow the user to enter their email address and password and login to our app. Please design your screen according to the wireframes below:
1423

15-
![](/images/correct_layout.png)
16-
17-
### Bug 2 - Validation is incorrect
18-
If the input entered by the user is correct then they should see a toast saying “Input is valid!”. However if it is not correct we should show an error on the field that is incorrect. Below is the following validation logic:
19-
20-
- Email is not optional and should match EMAIL_REGEX
21-
- Password is not optional and should match PASSWORD_REGEX
22-
- Name is optional, but if it contains any value it should match NAME_REGEX
23-
24-
There is some validation logic in LoginActivity, but it is currently incorrect. Please implement this feature to match this logic.
25-
26-
### Bug 3 - Animation is looping incorrectly
27-
28-
Above the login button is an animation of an owl and a pig. We would like this animation to play every time the user starts the activity and then loop indefinitely. The logic for this animation should be as follows:
29-
30-
- The animation should start from frame **0** to **109** when the user first starts the activity. See below for animation.
31-
![](/images/firstpig.gif)
32-
- When the first stage of the animation has finished it should then loop from frame **131** to **158** continuously. See below for animation.<br/>
33-
![](/images/secondpig.gif)
34-
35-
To create animation in our app we use a helpful library called Lottie. This has been added to the project for you, but currently it just plays the animation once and then stops. Please implement the logic as described above.
36-
37-
There is lots of helpful documentation on Lottie [here](http://airbnb.io/lottie/#/android). Please take a look at this page for information on how to loop the animation, play from a min and max frame and detect when an animation ends.
38-
39-
## Part B - Add 2 new screens
40-
41-
We now want to give some useful functionality to our users. To allow them to log into the app, view and edit their account using our sandbox API.
42-
43-
### Screen 2 - User accounts screen
44-
This screen should be shown after the user has successfully logged in and should show have the following functionality:
45-
- Display "Hello {name} **only** if they provided it on previous screen"
46-
- Show the **'TotalPlanValue'** of a user.
47-
- Show the accounts the user holds, e.g. ISA, GIA, LISA, Pension.
48-
- Show all of those account's **'PlanValue'**.
49-
- Shhow all of those account's **'Moneybox'** total.
50-
51-
### Screen 3 - Individual account screen
52-
If a user selects one of those accounts, they should then be taken to this screen. This screen should have the following functionality:
53-
- Show the **'Name'** of the account.
54-
- Show the account's **'PlanValue'**.
55-
- Show the accounts **'Moneybox'** total.
56-
- Allow a user to add to a fixed value (e.g. £10) to their moneybox total.
57-
58-
A prototype wireframe of all 3 screens is provided as a guideline. You are free to change any elements of the screen and provide additional information if you wish.
59-
60-
![](/images/wireframe.png)
61-
62-
## What we are looking for:
63-
- An android application written in either Java or Kotlin.
64-
- Demonstration of coding style and design patterns.
65-
- Knowledge of common android libraries and any others that you find useful.
66-
- Storage of data between screens.
67-
- Consistency of data between screens.
68-
- Error handling.
69-
- Any form of unit or integration testing you see fit.
70-
- The application must run on Android 5.0 and above.
71-
- The application must compile and run in Android Studio.
72-
73-
Please feel free to refactor the LoginActivity and use any libraries/helper methods to make your life easier.
74-
75-
## How to Submit your solution:
76-
- Zip up your solution, excluding any build artifacts to reduce the size, and email it back to our recruitment team.
77-
- Provide a readme in markdown which details how you solved the bugs in part A, and explains the structure of your solution in Part B and any libraries that you may have used.
78-
79-
## API Usage
80-
This a brief summary of the api endpoints in the moneybox sandbox environment. There a lot of other additional properties from the json responses that are not relevant, but you must use these endpoints to retrieve the information needed for this application.
81-
82-
#### Base URL & Test User
83-
The base URL for the moneybox sandbox environment is `https://api-test01.moneyboxapp.com/`.
84-
You can log into test your app using the following user:
85-
86-
| Username | Password |
87-
| ------------- | ------------- |
88-
| androidtest@moneyboxapp.com | P455word12 |
89-
90-
#### Headers
91-
92-
In order to make requests https must be used and the following headers must be included in each request.
93-
94-
| Key | Value |
95-
| ------------- | ------------- |
96-
| AppId | 3a97b932a9d449c981b595 |
97-
| Content-Type | application/json |
98-
| appVersion | 5.10.0 |
99-
| apiVersion | 3.0.0 |
100-
101-
#### Authentication
102-
To login with this user to retrieve a bearer token you need to call `POST /users/login`.
24+
To login please use the endpoint and credentials below:
10325
```
104-
POST /users/login
105-
{
106-
"Email": "androidtest@moneyboxapp.com",
107-
"Password": "P455word12",
108-
"Idfa": "ANYTHING"
109-
}
26+
Endpoint: @POST("users/login")
27+
Email: jaeren+androidtest@moneyboxapp.com
28+
Password: P455word12
11029
```
111-
Sample json response
112-
```
113-
"Session": {
114-
"BearerToken": "TsMWRkbrcu3NGrpf84gi2+pg0iOMVymyKklmkY0oI84=",
115-
"ExternalSessionId": "4ff0eab7-7d3f-40c5-b87b-68d4a4961983", -- not used
116-
"SessionExternalId": "4ff0eab7-7d3f-40c5-b87b-68d4a4961983", -- not used
117-
"ExpiryInSeconds": 0 -- not used
118-
}
119-
```
120-
After obtaining a bearer token an Authorization header must be provided for all other endpoints along with the headers listed above (Note: The BearerToken has a sliding expiration of 5 mins).
30+
You can use `LoginRequest` to make your request and `LoginResponse to parse your response.
12131

122-
| Key | Value |
123-
| ------------- | ------------- |
124-
| Authorization | Bearer TsMWRkbrcu3NGrpf84gi2+pg0iOMVymyKklmkY0oI84= |
32+
##Part 2 - Display Plan Value
33+
Once you have logged in, please create a simple screen that displays the user's `TotalPlanValue`. Please design your screen according to the wireframe below:
34+
35+
To retrieve this data please use the endpoint with an additional authorization header, replacing BEARER_TOKEN_HERE with the bearer token you get in `SessionDataResponse`:
12536

126-
#### Investor Products
127-
Provides product and account information for a user that will be needed for the two additional screens.
128-
```
129-
GET /investorproducts
130-
```
131-
### One off payments
132-
Adds a one off amount to the users moneybox.
13337
```
134-
POST /oneoffpayments
135-
{
136-
"Amount": 20,
137-
"InvestorProductId": 3230 ------> The InvestorProductId from /investorproducts endpoint
138-
}
38+
Endpoint: @GET("investorproducts")
39+
Header name: Authorization
40+
Header value: Bearer {BEARER_TOKEN_HERE}
41+
13942
```
140-
Good luck!
43+
You can use the `AllProductsResponse` to parse this response and retrieve the plan value.
44+
45+
##How to submit your test…
46+
Please push your project to Github and invite android@moneyboxapp.com to view your project.

app/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/build
1+
/build

app/build.gradle

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1-
apply plugin: 'com.android.application'
2-
3-
apply plugin: 'kotlin-android'
4-
5-
apply plugin: 'kotlin-android-extensions'
6-
7-
repositories {
8-
google()
1+
plugins {
2+
id 'com.android.application'
3+
id 'org.jetbrains.kotlin.android'
94
}
105

116
android {
12-
compileSdkVersion 28
7+
compileSdk 31
8+
139
defaultConfig {
14-
applicationId "com.example.minimoneybox"
15-
minSdkVersion 21
16-
targetSdkVersion 28
10+
applicationId "com.moneybox.minimb"
11+
minSdk 21
12+
targetSdk 31
1713
versionCode 1
18-
versionName "1.0"
19-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14+
versionName "8.35.0"
15+
16+
buildConfigField "String", "BASE_URL", baseUrl
17+
buildConfigField "String", "API_VERSION", apiVersion
18+
buildConfigField "String", "APP_ID", appId
2019
}
20+
2121
buildTypes {
2222
release {
2323
minifyEnabled false
2424
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2525
}
2626
}
27+
compileOptions {
28+
sourceCompatibility JavaVersion.VERSION_1_8
29+
targetCompatibility JavaVersion.VERSION_1_8
30+
}
31+
kotlinOptions {
32+
jvmTarget = '1.8'
33+
}
2734
}
2835

2936
dependencies {
30-
implementation fileTree(dir: 'libs', include: ['*.jar'])
31-
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
32-
implementation 'com.android.support:appcompat-v7:28.0.0'
33-
implementation 'com.android.support:design:28.0.0'
34-
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
35-
testImplementation 'junit:junit:4.12'
36-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
37-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
38-
implementation 'com.airbnb.android:lottie:2.7.0'
39-
}
37+
implementation 'androidx.core:core-ktx:1.7.0'
38+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
39+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
40+
implementation 'com.google.code.gson:gson:2.9.0'
41+
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
42+
implementation 'androidx.appcompat:appcompat:1.4.1'
43+
}

app/proguard-rules.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818

1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
21+
#-renamesourcefileattribute SourceFile

app/src/androidTest/java/com/example/minimoneybox/ExampleInstrumentedTest.kt

Lines changed: 0 additions & 24 deletions
This file was deleted.

app/src/main/AndroidManifest.xml

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.example.minimoneybox">
3+
package="com.moneybox.minimb">
44

5-
<application
6-
android:allowBackup="true"
7-
android:icon="@mipmap/ic_launcher"
8-
android:label="@string/app_name"
9-
android:roundIcon="@mipmap/ic_launcher_round"
10-
android:supportsRtl="true"
11-
android:theme="@style/AppTheme">
12-
<activity
13-
android:name=".LoginActivity"
14-
android:label="@string/app_name">
15-
<intent-filter>
16-
<action android:name="android.intent.action.MAIN"/>
17-
18-
<category android:name="android.intent.category.LAUNCHER"/>
19-
<action android:name="android.intent.action.VIEW" />
20-
</intent-filter>
5+
<uses-permission android:name="android.permission.INTERNET" />
216

22-
</activity>
7+
<application
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.AppCompat">
2314
</application>
2415

2516
</manifest>

app/src/main/assets/pig.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)