Skip to content

Commit 68b4cc9

Browse files
author
Ruslan Faizullin
committed
signup screen with avatar image uploading
1 parent 43a49c3 commit 68b4cc9

Some content is hidden

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

46 files changed

+881
-31
lines changed

app/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ android {
9595

9696
apollo {
9797
generateKotlinModels.set(true)
98+
customTypeMapping = [
99+
"Upload" : "com.apollographql.apollo.api.FileUpload"
100+
]
98101
}
99102

100103
repositories {
@@ -107,10 +110,12 @@ dependencies {
107110
implementation 'com.google.code.gson:gson:2.8.6'
108111

109112
implementation androidLibs
113+
implementation retrofitLibs
110114
implementation apolloLibs
111115
implementation coroutinesLibs
112116
implementation kodeinLibs
113117
implementation roomLibs
118+
implementation glideLibs
114119
kapt compilerLibs
115120

116121
testImplementation unitTestLibs

app/proguard-rules.pro

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,7 @@
6262
-keepattributes SourceFile,LineNumberTable
6363

6464

65+
#apollo input types
66+
-keep class * implements com.apollographql.apollo.api.InputType { *; }
67+
6568

app/src/androidTest/java/com/flatstack/android/MainScreenTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void whenAppLaunch_androidBaseVisible() throws Exception {
3030

3131
@Test
3232
public void whenButtonClick_startedActivity() {
33-
onView(withId(R.id.button)).perform(click());
33+
onView(withId(R.id.selectAvatar)).perform(click());
3434
intended(hasComponent(SecondActivity.class.getName()));
3535
}
3636
}

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package="com.flatstack.android">
55

66
<uses-permission android:name="android.permission.INTERNET" />
7+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
78

89
<application
910
android:name=".App"
@@ -20,6 +21,9 @@
2021
<activity
2122
android:name=".login.LoginActivity"
2223
android:windowSoftInputMode="adjustResize" />
24+
<activity
25+
android:name=".registration.RegistrationActivity"
26+
android:windowSoftInputMode="adjustResize" />
2327
<activity
2428
android:name=".MainActivity"
2529
android:theme="@android:style/Theme.NoDisplay">
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
fragment UserGqlFragment on User {
22
firstName
33
lastName
4+
avatarUrl
45
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
mutation PresignAvatar(
2+
$input: PresignDataInput!
3+
) {
4+
presignData(input: $input) {
5+
fields {
6+
key
7+
value
8+
}
9+
url
10+
}
11+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
mutation Login($email: String!, $password: String!) {
2-
signin(email: $email, password: $password) {
1+
mutation Login($input: SignInInput!) {
2+
signin(input: $input) {
33
accessToken
44
}
55
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
mutation Register($input: SignUpInput!) {
2+
signup(input: $input) {
3+
accessToken
4+
}
5+
}

app/src/main/java/com/flatstack/android/Router.kt

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,30 @@ import android.content.Context
44
import android.content.Intent
55
import com.flatstack.android.login.LoginActivity
66
import com.flatstack.android.profile.ProfileActivity
7+
import com.flatstack.android.registration.RegistrationActivity
78

89
class Router(
910
private val appContext: Context
1011
) {
11-
fun login(context: Context = appContext, clearStack: Boolean = false) {
12+
fun login(context: Context = appContext, shouldClearStack: Boolean = false) {
1213
context.startActivity(Intent(context, LoginActivity::class.java).apply {
13-
if (clearStack) {
14+
if (shouldClearStack) {
1415
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
1516
}
1617
})
1718
}
1819

19-
fun profile(context: Context, clearStack: Boolean = false) {
20+
fun profile(context: Context, shouldClearStack: Boolean = false) {
2021
context.startActivity(Intent(context, ProfileActivity::class.java).apply {
21-
if (clearStack) {
22+
if (shouldClearStack) {
23+
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
24+
}
25+
})
26+
}
27+
28+
fun registration(context: Context, shouldClearStack: Boolean = false) {
29+
context.startActivity(Intent(context, RegistrationActivity::class.java).apply {
30+
if (shouldClearStack) {
2231
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
2332
}
2433
})

app/src/main/java/com/flatstack/android/di/kodein.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ fun initKodein(app: Application) =
1313
import(viewModelModule)
1414
import(netModule)
1515
import(repoModule)
16+
import(mapperModule)
1617
}

0 commit comments

Comments
 (0)