Skip to content
This repository has been archived by the owner on Jan 7, 2025. It is now read-only.

Login and Registration #10

Merged
merged 40 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
204f313
Add GET and PUT requests to the API service implementation for authen…
hrystynaa Oct 3, 2023
408c6d4
Improve naming
hrystynaa Oct 3, 2023
124e7e8
add Internet permission in Manifest
vita133 Oct 7, 2023
42c423a
add BaseResponse class for handling response states
vita133 Oct 7, 2023
bfffe1f
implement AuthViewModel and AuthViewModelFactory
vita133 Oct 7, 2023
a56ff88
add LoginRequest, baseUrl and methods AuthViewModel
vita133 Oct 13, 2023
c7074b0
Some refactoring in AuthViewModelFactory and AuthViewModel. Solved bu…
michigang1 Oct 15, 2023
7be8439
add base navigation graph with fragments and base ui implementations
vita133 Oct 31, 2023
9e2b0fe
add simple login test
NikitaSutulov Nov 1, 2023
0188f28
Merge branch 'authentication_api' into navigation
NikitaSutulov Nov 6, 2023
fca77e5
Merge pull request #4 from fictadvisor/navigation
NikitaSutulov Nov 6, 2023
696308e
improve code format
NikitaSutulov Nov 7, 2023
239c654
added return type for some methods
NikitaSutulov Nov 8, 2023
4b48b56
add methods handling to authentication api
vita133 Nov 8, 2023
8234e36
Implement user registration logic in ContinueRegistrationFragment
vita133 Nov 10, 2023
1804db9
fix verifyIsRegistered Error: "Email is empty"
vita133 Nov 13, 2023
e3ea63a
add input user data validation
vita133 Jan 15, 2024
9a24b58
refactor ContinueRegistrationFragment
vita133 Jan 15, 2024
8ad76aa
add TelegramService prototype
vita133 Jan 25, 2024
86bd2fb
added structures needed for further group loading
NikitaSutulov Jan 25, 2024
5929edd
changed RegistrationFragment to get groups from the server.
NikitaSutulov Jan 25, 2024
12e1d02
switch to RegistrationDTO in register request
vita133 Jan 26, 2024
0dc8981
get group id from server
vita133 Jan 26, 2024
62bea6c
Merge pull request #6 from fictadvisor/feature-load-groups-during-reg…
vita133 Jan 26, 2024
a413761
fixed WelcomeFragment layout
NikitaSutulov Jan 26, 2024
2b768b5
fixed RegistrationFragment layout
NikitaSutulov Jan 26, 2024
44c21bc
fixed ContinueRegistrationFragment layout
NikitaSutulov Jan 26, 2024
882f344
Merge pull request #7 from fictadvisor/fix-welcome-fragment-layout
vita133 Jan 30, 2024
28af27a
added email verification link processing
NikitaSutulov Jan 30, 2024
ca2228a
fix type of register response
vita133 Feb 2, 2024
4454ee8
Implement StorageUtil class
hrystynaa Feb 2, 2024
0221d0e
Merge remote-tracking branch 'origin/registration' into registration
hrystynaa Feb 2, 2024
19e70d6
Merge pull request #8 from fictadvisor/feature-token-from-deeplinks
vita133 Feb 2, 2024
7f87d90
refactoring: validation of textView is replaced in special classes
michigang1 Feb 5, 2024
4cbcc94
feature: login process in an implemented, process of password resetin…
michigang1 Feb 5, 2024
5de0fb7
refactoring: all UI classes are replaced in UI package
michigang1 Feb 5, 2024
7f74ddf
Added email validation in ForgotPasswordFragment
michigang1 Feb 5, 2024
75decde
add review changes
vita133 Feb 6, 2024
5da268c
Merge pull request #9 from fictadvisor/login
vita133 Feb 6, 2024
24ee33e
fixed login input validation
NikitaSutulov Feb 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 30 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs'
id 'kotlin-kapt'
id 'kotlin-platform-android'
id 'kotlin-android'
Expand All @@ -9,20 +10,20 @@ plugins {

android {
namespace 'com.fictadvisor.android'
compileSdk 33
compileSdk 34

defaultConfig {
applicationId "com.fictadvisor.android"
minSdk 26
targetSdk 33
targetSdk 34
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildFeatures {
viewBinding = true
viewBinding {
enabled = true
}

buildTypes {
Expand Down Expand Up @@ -51,14 +52,32 @@ android {

dependencies {

implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.9.0'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
implementation 'com.google.code.gson:gson:2.9.0'

testImplementation 'org.junit.jupiter:junit-jupiter:5.10.0'

androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'

def nav_version = "2.7.4"

// Kotlin
implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
implementation("androidx.navigation:navigation-ui-ktx:$nav_version")

// Feature module Support
implementation("androidx.navigation:navigation-dynamic-features-fragment:$nav_version")

// Testing Navigation
androidTestImplementation("androidx.navigation:navigation-testing:$nav_version")

// Jetpack Compose Integration
implementation("androidx.navigation:navigation-compose:$nav_version")

// - - Coroutines
def coroutines_version = "1.7.3"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
Expand All @@ -76,4 +95,8 @@ dependencies {
implementation "com.squareup.retrofit2:converter-gson:$retrofit_version"
implementation "com.squareup.okhttp3:okhttp:$logging_version"
implementation "com.squareup.okhttp3:logging-interceptor:$logging_version"

// - - MockWebServer
def mock_web_server_version = "4.3.1"
testImplementation "com.squareup.okhttp3:mockwebserver:$mock_web_server_version"
}
5 changes: 4 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
Expand All @@ -13,13 +14,15 @@
android:theme="@style/Theme.Fictadvisorandroid"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:name=".ui.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<nav-graph android:value="@navigation/my_nav" />
</activity>
</application>

Expand Down
11 changes: 0 additions & 11 deletions app/src/main/java/com/fictadvisor/android/MainActivity.kt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.fictadvisor.android.data.dto

import okhttp3.ResponseBody

sealed class BaseResponse<out T> {
data class Success<out T>(val data: T? = null) : BaseResponse<T>()
data class Loading(val nothing: Nothing? = null) : BaseResponse<Nothing>()
data class Error(val error: ErrorResponse? = null) : BaseResponse<Nothing>()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.fictadvisor.android.data.dto

data class CheckRegisterTelegramResponse(
val isRegistered: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.fictadvisor.android.data.dto

data class CheckResetTokenResponse(
val isAvailable: Boolean
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.fictadvisor.android.data.dto

import java.sql.Timestamp

data class ErrorResponse(
val status: Long,
val timestamp: String,
val error: String,
val message: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.fictadvisor.android.data.dto

data class ExtendedGroupResponse(
val id: String,
val code: String,
val state: String,
val role: String,
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.fictadvisor.android.data.dto

data class ForgotPasswordRequest(
data class ForgotPasswordDTO(
val email: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.fictadvisor.android.data.dto

data class GetAllGroupsResponse(val groups: List<GroupDTO>)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.fictadvisor.android.data.dto

data class GroupDTO(val id: String, val code: String)
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.fictadvisor.android.data.dto

data class User(
data class LoginRequest (
val username: String,
val email: String,
val password: String
val password: String,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.fictadvisor.android.data.dto

data class OrdinaryStudentResponse(
val firstName: String,
val middleName: String,
val lastName: String,
val id: String,
val username: String,
val email: String,
val avatar: String,
val telegramId: Long,
val group: ExtendedGroupResponse,
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.fictadvisor.android.data.dto

data class RegistrationTelegramRequest(
data class RegisterTelegramDTO(
val token: String,
val telegramId: Long
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.fictadvisor.android.data.dto

data class RegistrationDTO(
val student: StudentDTO,
val user: UserDTO,
val telegram: TelegramDTO? = null // not required
)

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.fictadvisor.android.data.dto

data class ResetPasswordDTO(
val password: String
)
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.fictadvisor.android.data.dto

data class Student(
data class StudentDTO(
val groupId: String,
val firstName: String,
val middleName: String,
val lastName: String,
val isCaptain: Boolean,
)
){
fun isEmpty(): Boolean {
return groupId.isEmpty() || firstName.isEmpty() || middleName.isEmpty() || lastName.isEmpty()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.fictadvisor.android.data.dto

import com.google.gson.annotations.SerializedName

data class Telegram(
data class TelegramDTO(
@SerializedName("auth_date")
val authDate: Long,
@SerializedName("first_name")
Expand All @@ -13,6 +13,6 @@ data class Telegram(
val photoUrl: String,
val hash: String,
val id: Long,
val username: String
// val username: String //deleted

)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.fictadvisor.android.data.dto

data class TokensDTO (
val accessToken: String,
val refreshToken: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.fictadvisor.android.data.dto

data class UpdatePasswordDTO (
val oldPassword: String,
val newPassword: String
)
11 changes: 11 additions & 0 deletions app/src/main/java/com/fictadvisor/android/data/dto/UserDTO.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.fictadvisor.android.data.dto

data class UserDTO(
val username: String,
val email: String,
val password: String
) {
fun isEmpty(): Boolean {
return username.isEmpty() || email.isEmpty() || password.isEmpty()
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.fictadvisor.android.data.dto

data class VerifyEmailRequest(
data class VerificationEmailDTO(
val email: String
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.fictadvisor.android.data.remote

import com.fictadvisor.android.data.remote.api.AuthApi
import com.fictadvisor.android.data.remote.api.GroupApi
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
Expand All @@ -16,7 +17,7 @@ private const val timeoutConnect = 30 // In seconds

object RetrofitClient {

private const val baseUrl = ""
private const val baseUrl = "https://apidev.fictadvisor.com/v2/"

val retrofitClient: Retrofit.Builder by lazy {

Expand Down Expand Up @@ -58,4 +59,11 @@ object RetrofitClient {
.build()
.create(AuthApi::class.java)
}

val groupApi: GroupApi by lazy {
retrofitClient
.build()
.create(GroupApi::class.java)
}

}
Loading
Loading