Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/170 сonfigured app distribution #174

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5761895
71-Password-Recovery
MajoritySky2496 Mar 24, 2024
194065a
71-Password-Recovery
MajoritySky2496 Apr 2, 2024
50ff55d
71-Password-Recovery
MajoritySky2496 Apr 7, 2024
c90b930
Merge branch 'dev' of https://github.com/CashAdv/CashADV into 71-Pass…
MajoritySky2496 Apr 7, 2024
e76c00c
Merge branch 'feature/51-code-confirmation-view' of https://github.co…
MajoritySky2496 Apr 9, 2024
4cac51f
71-Password-Recovery
MajoritySky2496 Apr 13, 2024
8ddb053
71-Password-Recovery
MajoritySky2496 Apr 29, 2024
4d45e88
71-Password-Recovery
MajoritySky2496 Apr 30, 2024
f15ead7
71-Password-Recovery
MajoritySky2496 May 5, 2024
ad48ba0
71-Password-Recovery
MajoritySky2496 May 5, 2024
cdc6801
Merge branch 'dev' of https://github.com/CashAdv/CashADV into 71-Pass…
MajoritySky2496 May 5, 2024
51dba94
71-Password-Recovery
MajoritySky2496 May 5, 2024
50e3eda
71-Password-Recovery
MajoritySky2496 May 7, 2024
50b2e4b
71-Password-Recovery
MajoritySky2496 May 8, 2024
30684c4
71-Password-Recovery
MajoritySky2496 May 10, 2024
31a49cf
71-Password-Recovery
MajoritySky2496 May 15, 2024
40c2d33
Merge branch 'dev' into 71-Password-Recovery
MajoritySky2496 May 20, 2024
1ed7137
71-Password-Recovery
MajoritySky2496 May 20, 2024
db0c6c1
71-Password-Recovery
MajoritySky2496 May 21, 2024
6c16850
71-Password-Recovery
MajoritySky2496 May 29, 2024
1d49e48
71-Password-Recovery
MajoritySky2496 Jun 5, 2024
0cdcb8e
170-Configured-AppDistribution
MajoritySky2496 Jun 6, 2024
c596267
170-Configured-AppDistribution
MajoritySky2496 Jun 9, 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
6 changes: 3 additions & 3 deletions .github/workflows/sendAppToQaAfterMergeStageQa.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Build and sent to QA stageQa

on:
# Triggers the workflow when pull request closed events but only for the "dev" branch
# Triggers the workflow when pull request closed
pull_request:
types:
- closed
branches: [ "dev" ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а почему убрать проверку на dev-бранч?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я так понял уведомления будут отправляется если только сделать мердж ветки dev в main, но нам же для всех веток надо? Поэтому решил убрать dev.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это условие будет срабатывать при закрытии PR в ветку dev
то есть когда мы мерджим PR в dev, тут всё правильно


workflow_dispatch:

Expand All @@ -29,7 +29,7 @@ jobs:
run: |
echo "$CREDENTIAL_FILE_CONTENT" > ./app/serviceCredentialsFile.json
echo "App type: stageQa" >> ./app/src/releaseNotes.txt
echo "buildNumber=${GITHUB_RUN_NUMBER}" >> ./app/src/releaseNotes.txt
echo "buildNumber==${GITHUB_SHA::7}">> ./app/src/releaseNotes.txt
./gradlew appDistributionToQaStageQa

- name: Check status
Expand Down
7 changes: 6 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

initVKID()

}


signingConfigs {
create("release") {

Expand Down Expand Up @@ -130,6 +132,7 @@ task("appDistributionToQaProdQa") {
dependsOn("appDistributionUploadProdQa")
}


dependencies {

// Core
Expand Down Expand Up @@ -183,6 +186,7 @@ dependencies {
implementation(libs.firebase.crashlytics)
implementation(libs.firebase.analytics)
implementation(platform(libs.firebase.bom))
implementation("com.google.firebase:firebase-appdistribution-api:16.0.0-beta13")

// Auth vk
implementation(libs.vk.auth)
Expand Down Expand Up @@ -218,4 +222,5 @@ fun ApplicationDefaultConfig.initVKID() {
"VKIDClientSecret" to clientSecret
)
)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package app.cashadvisor.authorization.data

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это из другого пулл-реквеста, надо убрать

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

удалить эти файлы и сделать новый push ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лучше сделать чистую ветку от dev и там модифицировать только то, что нужно для задачи

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

сделай чистый PR и тогда можно будет нормально смотреть что ты сделал


import app.cashadvisor.authorization.data.models.response.customError.ErrorWrongConfirmationCodeResponse
import app.cashadvisor.common.data.models.ErrorResponse
import app.cashadvisor.common.utill.exceptions.LoginException
import app.cashadvisor.common.utill.exceptions.NetworkException
import app.cashadvisor.common.utill.exceptions.ResetPasswordException
import javax.inject.Inject
import kotlinx.serialization.json.Json

class NetworkToResetPasswordExceptionMapper @Inject constructor(
private val json: Json
) {
fun handleConfirmResetPasswordWithCode(exception: NetworkException): ResetPasswordException {
return when (exception) {
is NetworkException.BadRequest -> {
val errorResponse = handleErrorResponse<ErrorResponse>(exception.errorBody)
ResetPasswordException.ConfirmResetPasswordWithCode.BadRequestInvalidCodeOrMissingContentTypeHeader(
message = errorResponse.message,
statusCode = errorResponse.statusCode
)
}

is NetworkException.Unauthorized -> {
val errorResponse =
handleErrorResponse<ErrorWrongConfirmationCodeResponse>(exception.errorBody)
ResetPasswordException.ConfirmResetPasswordWithCode.UnauthorizedWrongConfirmationCode(
remainingAttempts = errorResponse.remainingAttempts,
lockDuration = errorResponse.lockDurationNanoseconds,
message = errorResponse.error,
statusCode = errorResponse.statusCode
)
}

is NetworkException.InternalServerError -> {
val errorResponse = handleErrorResponse<ErrorResponse>(exception.errorBody)
ResetPasswordException.ConfirmResetPasswordWithCode
.InternalServerErrorFailedToConfirmResetPassword(
message = errorResponse.message,
statusCode = errorResponse.statusCode
)
}

else -> handleCommonException(exception)
}

}

fun handleConfirmEmailToResetPassword(exception: NetworkException): ResetPasswordException {
return when (exception) {
is NetworkException.BadRequest -> {
val errorResponse = handleErrorResponse<ErrorResponse>(exception.errorBody)
ResetPasswordException.ConfirmEmailToResetPassword.BadRequestInvalidInputOrContentType(
message = errorResponse.message,
statusCode = errorResponse.statusCode
)
}

is NetworkException.InternalServerError -> {
val errorResponse = handleErrorResponse<ErrorResponse>(exception.errorBody)
ResetPasswordException.ConfirmEmailToResetPassword.InternalServerErrorFailedToGenerateTokenOrSendEmail(
message = errorResponse.message,
statusCode = errorResponse.statusCode
)
}

else -> handleCommonException(exception)
}

}

fun handleSaveNewPassword(exception: NetworkException): ResetPasswordException {
return when (exception) {
is NetworkException.BadRequest -> {
val errorResponse = handleErrorResponse<ErrorResponse>(exception.errorBody)
ResetPasswordException.SaveNewPassword
.BadRequestInvalidPasswordOrMissingContentTypeHeader(
message = errorResponse.message,
statusCode = errorResponse.statusCode
)
}

is NetworkException.Unauthorized -> {
val errorResponse =
handleErrorResponse<ErrorWrongConfirmationCodeResponse>(exception.errorBody)
ResetPasswordException.SaveNewPassword.UnauthorizedInvalidTokenOrMissingContentTypeHeader(
message = errorResponse.error,
statusCode = errorResponse.statusCode
)
}

is NetworkException.InternalServerError -> {
val errorResponse = handleErrorResponse<ErrorResponse>(exception.errorBody)
ResetPasswordException.SaveNewPassword.InternalServerErrorFailedToResetPassword(
message = errorResponse.message,
statusCode = errorResponse.statusCode
)
}

else -> handleCommonException(exception)
}
}

private fun handleCommonException(exception: NetworkException): ResetPasswordException {
return when (exception) {
is NetworkException.NoInternetConnection -> {
ResetPasswordException.NoConnection(exception.errorBody)
}

is NetworkException.Undefined -> {
ResetPasswordException.Undefined()
}

else -> {
ResetPasswordException.Undefined()
}
}
}

private inline fun <reified T> handleErrorResponse(errorMessage: String): T {
try {
return json.decodeFromString<T>(errorMessage)

} catch (e: Exception) {
throw LoginException.Undefined()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package app.cashadvisor.authorization.data

import app.cashadvisor.authorization.data.models.ConfirmResetPasswordWithCodeInputDto
import app.cashadvisor.authorization.data.models.ResetPasswordInputDto
import app.cashadvisor.authorization.data.models.ConfirmResetPasswordWithCodeOutputDto
import app.cashadvisor.authorization.data.models.ResetPasswordOutputDto
import app.cashadvisor.authorization.data.models.SaveNewPasswordInputDto
import app.cashadvisor.authorization.data.models.SaveNewPasswordOutputDto
import app.cashadvisor.authorization.data.models.request.ResetPasswordRequest
import app.cashadvisor.authorization.data.models.request.ResetPasswordWithCodeRequest
import app.cashadvisor.authorization.data.models.request.SaveNewPasswordRequest
import app.cashadvisor.authorization.data.models.response.ConfirmResetPasswordResponse
import app.cashadvisor.authorization.data.models.response.ResetPasswordResponse
import app.cashadvisor.authorization.data.models.response.SaveNewPasswordResponse
import javax.inject.Inject

class ResetDataMapper @Inject constructor() {

fun toResetPasswordRequest(inputDto: ResetPasswordInputDto): ResetPasswordRequest {
return ResetPasswordRequest(
email = inputDto.email

)
}

fun toConfirmResetPasswordWithCodeOutputDto(response: ConfirmResetPasswordResponse):
ConfirmResetPasswordWithCodeOutputDto {
return ConfirmResetPasswordWithCodeOutputDto(
message = response.message,
statusCode = response.statusCode
)
}

fun toResetPasswordWithCodeRequest(inputDto: ConfirmResetPasswordWithCodeInputDto):
ResetPasswordWithCodeRequest {
return ResetPasswordWithCodeRequest(
code = inputDto.code,
token = inputDto.token
)
}

fun toResetPasswordOutputDto(response: ResetPasswordResponse): ResetPasswordOutputDto {
return ResetPasswordOutputDto(
message = response.message,
token = response.token,
statusCode = response.statusCode
)
}

fun toSaveNewPasswordRequest(inputDto: SaveNewPasswordInputDto): SaveNewPasswordRequest {
return SaveNewPasswordRequest(
email = inputDto.email,
password = inputDto.password,
resetToken = inputDto.resetToken
)
}

fun toSaveNewPasswordOutputDto(response: SaveNewPasswordResponse): SaveNewPasswordOutputDto {
return SaveNewPasswordOutputDto(
message = response.message,
statusCode = response.statusCode
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package app.cashadvisor.authorization.data

import app.cashadvisor.authorization.data.models.ConfirmResetPasswordWithCodeInputDto
import app.cashadvisor.authorization.data.models.ResetPasswordInputDto
import app.cashadvisor.authorization.data.models.ConfirmResetPasswordWithCodeOutputDto
import app.cashadvisor.authorization.data.models.ResetPasswordOutputDto
import app.cashadvisor.authorization.data.models.SaveNewPasswordInputDto
import app.cashadvisor.authorization.data.models.SaveNewPasswordOutputDto
import app.cashadvisor.authorization.domain.models.ConfirmCode
import app.cashadvisor.authorization.domain.models.ConfirmResetPasswordWithCode
import app.cashadvisor.authorization.domain.models.Email
import app.cashadvisor.authorization.domain.models.Password
import app.cashadvisor.authorization.domain.models.ResetPasswordData
import app.cashadvisor.authorization.domain.models.SaveNewPasswordData
import javax.inject.Inject

class ResetDomainMapper @Inject constructor() {

fun toResetPasswordInputDto(email: Email): ResetPasswordInputDto {
return ResetPasswordInputDto(
email = email.value
)
}

fun toConfirmResetPasswordByEmailWithCodeInputDto(
code: ConfirmCode,
token: String
): ConfirmResetPasswordWithCodeInputDto {
return ConfirmResetPasswordWithCodeInputDto(
code = code.value,
token = token
)
}

fun toSaveNewPasswordInputDto(
email: Email,
password: Password,
resetToken: String
): SaveNewPasswordInputDto {
return SaveNewPasswordInputDto(
email = email.value,
password = password.value,
resetToken = resetToken
)
}

fun toConfirmResetPasswordWithCode(data: ConfirmResetPasswordWithCodeOutputDto): ConfirmResetPasswordWithCode {
return ConfirmResetPasswordWithCode(
message = data.message,
)
}

fun toResetPasswordData(data: ResetPasswordOutputDto): ResetPasswordData {
return ResetPasswordData(
message = data.message,
statusCode = data.statusCode
)
}

fun toSaveNewPasswordData(data: SaveNewPasswordOutputDto): SaveNewPasswordData {
return SaveNewPasswordData(
message = data.message,
statusCode = data.statusCode
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package app.cashadvisor.authorization.data.api

import app.cashadvisor.authorization.data.models.request.ResetPasswordWithCodeRequest
import app.cashadvisor.authorization.data.models.request.ResetPasswordRequest
import app.cashadvisor.authorization.data.models.request.SaveNewPasswordRequest
import app.cashadvisor.authorization.data.models.response.ConfirmResetPasswordResponse
import app.cashadvisor.authorization.data.models.response.ResetPasswordResponse
import app.cashadvisor.authorization.data.models.response.SaveNewPasswordResponse
import retrofit2.http.Body
import retrofit2.http.Headers
import retrofit2.http.POST

interface ResetPasswordApiService {

@Headers("Content-Type: application/json")
@POST("auth/login/reset/password")
suspend fun resetPassword(@Body passwordResetRequest: ResetPasswordRequest ):ResetPasswordResponse

@Headers("Content-Type: application/json")
@POST("auth/login/reset/password/confirm")
suspend fun resetPasswordConfirm(@Body resetPasswordRequest: ResetPasswordWithCodeRequest):ConfirmResetPasswordResponse

@Headers("Content-Type: application/json")
@POST("auth/login/reset/password")
suspend fun saveNewPassword(@Body saveNewPasswordRequest: SaveNewPasswordRequest):SaveNewPasswordResponse

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package app.cashadvisor.authorization.data.api

import app.cashadvisor.authorization.data.models.ConfirmResetPasswordWithCodeInputDto
import app.cashadvisor.authorization.data.models.ConfirmResetPasswordWithCodeOutputDto
import app.cashadvisor.authorization.data.models.ResetPasswordInputDto
import app.cashadvisor.authorization.data.models.ResetPasswordOutputDto
import app.cashadvisor.authorization.data.models.SaveNewPasswordInputDto
import app.cashadvisor.authorization.data.models.SaveNewPasswordOutputDto

interface ResetPasswordRemoteDataSource {
suspend fun confirmEmail(inputDto: ResetPasswordInputDto):ResetPasswordOutputDto
suspend fun confirmResetPasswordByEmailWithCode(inputDto: ConfirmResetPasswordWithCodeInputDto):ConfirmResetPasswordWithCodeOutputDto
suspend fun saveNewPassword(inputDto:SaveNewPasswordInputDto):SaveNewPasswordOutputDto
}
Loading
Loading