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

Commit

Permalink
Merge pull request #10 from fictadvisor/registration
Browse files Browse the repository at this point in the history
Login and Registration
  • Loading branch information
vita133 authored Feb 22, 2024
2 parents 7a3b788 + 24ee33e commit db1a2be
Show file tree
Hide file tree
Showing 62 changed files with 2,829 additions and 83 deletions.
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

0 comments on commit db1a2be

Please sign in to comment.