Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Commit 7eb654a

Browse files
author
MishkaV
committed
Merge branch 'develop' into prod
2 parents 7067a55 + 6baf22f commit 7eb654a

File tree

116 files changed

+2234
-423
lines changed

Some content is hidden

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

116 files changed

+2234
-423
lines changed

.ci/.gitlab-ci.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ build-app:
103103
unit-testing:
104104
stage: unitTest
105105
image: openjdk:11-jdk
106-
extends: .before_script_template
107106
rules:
108-
- when: always
107+
- when: never
109108
tags:
110109
- docker_miem
111110
script:

buildSrc/src/main/kotlin/consts/Dependencies.kt

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,29 @@ object Dependencies {
4141
const val UI_UTILS = "androidx.compose.ui:ui-util:$COMPOSE_VERSION"
4242

4343
const val MATERIAL = "androidx.compose.material3:material3:$MATERIAL3_VERSION"
44-
const val MATERIAL_ICONS = "androidx.compose.material:material-icons-extended:$COMPOSE_VERSION"
44+
const val MATERIAL_ICONS =
45+
"androidx.compose.material:material-icons-extended:$COMPOSE_VERSION"
4546

4647
const val UI_TOOLING_PREVIEW = "androidx.compose.ui:ui-tooling-preview:$COMPOSE_VERSION"
47-
const val UI_TOOLING = "androidx.compose.ui:ui-tooling:$COMPOSE_VERSION" // debugImplementation
48+
const val UI_TOOLING =
49+
"androidx.compose.ui:ui-tooling:$COMPOSE_VERSION" // debugImplementation
4850

49-
const val ACTIVITY_COMPOSE = "androidx.activity:activity-compose:$ACTIVITY_COMPOSE_VERSION"
51+
const val ACTIVITY_COMPOSE =
52+
"androidx.activity:activity-compose:$ACTIVITY_COMPOSE_VERSION"
5053

51-
const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout-compose:$CONSTRAINT_VERSION"
54+
const val CONSTRAINT_LAYOUT =
55+
"androidx.constraintlayout:constraintlayout-compose:$CONSTRAINT_VERSION"
5256

5357
val ALL_CORE_DEPS =
54-
listOf(UI, UI_UTILS, MATERIAL, MATERIAL_ICONS, UI_TOOLING_PREVIEW, ACTIVITY_COMPOSE, CONSTRAINT_LAYOUT)
58+
listOf(
59+
UI,
60+
UI_UTILS,
61+
MATERIAL,
62+
MATERIAL_ICONS,
63+
UI_TOOLING_PREVIEW,
64+
ACTIVITY_COMPOSE,
65+
CONSTRAINT_LAYOUT
66+
)
5567
val ALL_CORE_DEBUG_DEPS = listOf(UI_TOOLING)
5668
}
5769

@@ -67,15 +79,17 @@ object Dependencies {
6779
private const val LIFECYCLE_VERSION = "2.5.1"
6880

6981
const val RUNTIME = "androidx.lifecycle:lifecycle-runtime-ktx:$LIFECYCLE_VERSION"
70-
const val VIEW_MODEL = "androidx.lifecycle:lifecycle-viewmodel-compose:$LIFECYCLE_VERSION"
82+
const val VIEW_MODEL =
83+
"androidx.lifecycle:lifecycle-viewmodel-compose:$LIFECYCLE_VERSION"
7184

7285
val ALL_LIFECYCLE_DEPS = listOf(RUNTIME, VIEW_MODEL)
7386
}
7487

7588
object Foundation {
7689

7790
const val COMPOSE_FOUNDATION = "androidx.compose.foundation:foundation:$COMPOSE_VERSION"
78-
const val COMPOSE_FOUNDATION_LAYOUT = "androidx.compose.foundation:foundation-layout:$COMPOSE_VERSION"
91+
const val COMPOSE_FOUNDATION_LAYOUT =
92+
"androidx.compose.foundation:foundation-layout:$COMPOSE_VERSION"
7993

8094
val ALL_FOUNDATION_DEPS = listOf(COMPOSE_FOUNDATION, COMPOSE_FOUNDATION_LAYOUT)
8195
}
@@ -99,7 +113,8 @@ object Dependencies {
99113
private const val VERSION = "0.28.0"
100114

101115
const val ACCOMPANIST_CORE = "com.google.accompanist:accompanist-pager:$VERSION"
102-
const val ACCOMPANIST_INDICATORS = "com.google.accompanist:accompanist-pager-indicators:$VERSION"
116+
const val ACCOMPANIST_INDICATORS =
117+
"com.google.accompanist:accompanist-pager-indicators:$VERSION"
103118

104119
val ALL_ACCOMPANIST_DEPS = listOf(ACCOMPANIST_CORE, ACCOMPANIST_INDICATORS)
105120
}
@@ -143,14 +158,19 @@ object Dependencies {
143158
const val TIMBER = "com.jakewharton.timber:timber:$TIMBER_VERSION"
144159
}
145160

146-
object Retrofit {
147-
private const val RETROFIT_VERSION = "2.9.0"
161+
object Network {
162+
private const val MOSHI_KOTLIN_VERSION = "1.14.0"
163+
private const val OKHTTP_VERSION = "4.10.0"
148164

149-
const val CONVERTER_GSON = "com.squareup.retrofit2:converter-gson:$RETROFIT_VERSION"
150-
const val RETROFIT_DEPENDENCY = "com.squareup.retrofit2:retrofit:$RETROFIT_VERSION"
151-
const val RX_ADAPTER = "com.squareup.retrofit2:adapter-rxjava3:$RETROFIT_VERSION"
165+
const val MOSHI_KOTLIN = "com.squareup.moshi:moshi-kotlin:$MOSHI_KOTLIN_VERSION"
166+
const val OKHTTP = "com.squareup.okhttp3:okhttp:$OKHTTP_VERSION"
167+
const val LOGGING_INTERCEPTOR = "com.squareup.okhttp3:logging-interceptor:$OKHTTP_VERSION"
152168

153-
val ALL_DEPS = listOf(CONVERTER_GSON, RETROFIT_DEPENDENCY, RX_ADAPTER)
169+
val ALL_DEPS = listOf(
170+
MOSHI_KOTLIN,
171+
OKHTTP,
172+
LOGGING_INTERCEPTOR
173+
)
154174
}
155175

156176
object RxJava {
@@ -176,7 +196,8 @@ object Dependencies {
176196
private const val CONSTRAINT_LAYOUT_VERSION = "2.1.4"
177197
private const val MATERIAL_VERSION = "1.7.0"
178198

179-
const val CONSTRAINT_LAYOUT = "androidx.constraintlayout:constraintlayout:$CONSTRAINT_LAYOUT_VERSION"
199+
const val CONSTRAINT_LAYOUT =
200+
"androidx.constraintlayout:constraintlayout:$CONSTRAINT_LAYOUT_VERSION"
180201
const val CORE = "com.google.android.material:material:$MATERIAL_VERSION"
181202

182203
val ALL_DEPS = listOf(CONSTRAINT_LAYOUT, CORE)
@@ -187,22 +208,25 @@ object Dependencies {
187208
private const val BOM_VERSION = "31.1.0"
188209
private const val CRASHLYTICS_GRADLE_VERSION = "2.9.2"
189210

190-
const val GOOGLE_SERVICES_GRADLE_PLUGIN = "com.google.gms:google-services:$GOOGLE_SERVICES_VERSION"
211+
const val GOOGLE_SERVICES_GRADLE_PLUGIN =
212+
"com.google.gms:google-services:$GOOGLE_SERVICES_VERSION"
191213
const val FIREBASE_CRASHLYTICS_GRADLE_PLUGIN =
192214
"com.google.firebase:firebase-crashlytics-gradle:$CRASHLYTICS_GRADLE_VERSION"
193215

194216
const val FIREBASE_BOM = "com.google.firebase:firebase-bom:$BOM_VERSION"
195217
const val FIREBASE_ANALYTICS = "com.google.firebase:firebase-analytics-ktx"
196218
const val FIREBASE_CRASHLYTICS = "com.google.firebase:firebase-crashlytics-ktx"
197219

198-
val ALL_GRADLE_PLUGINS = listOf(GOOGLE_SERVICES_GRADLE_PLUGIN, FIREBASE_CRASHLYTICS_GRADLE_PLUGIN)
220+
val ALL_GRADLE_PLUGINS =
221+
listOf(GOOGLE_SERVICES_GRADLE_PLUGIN, FIREBASE_CRASHLYTICS_GRADLE_PLUGIN)
199222

200223
val ALL_DEPS = listOf(FIREBASE_ANALYTICS, FIREBASE_CRASHLYTICS)
201224
}
202225

203226
object Plugins {
204227
const val DETEKT_VERSION = "1.22.0"
205228

206-
const val DETEKT_FORMATTING = "io.gitlab.arturbosch.detekt:detekt-formatting:$DETEKT_VERSION"
229+
const val DETEKT_FORMATTING =
230+
"io.gitlab.arturbosch.detekt:detekt-formatting:$DETEKT_VERSION"
207231
}
208232
}

buildSrc/src/main/kotlin/conventions/module_advanced/impl/conventions.module-common-network-impl.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ dependencies {
1919

2020
// Core
2121
// Retrofit Api Fabric
22-
implementation(project(":core:retrofitApiFabric:impl"))
22+
implementation(project(":core:jsonRpcApiFabric:impl"))
2323
}

common/network/authorization/api/src/main/kotlin/odoo/miem/android/common/network/authorization/api/IAuthorizationInteractor.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package odoo.miem.android.common.network.authorization.api
22

3-
import odoo.miem.android.core.utils.state.ResultObservable
3+
import odoo.miem.android.core.utils.state.ResultSingle
44

55
/**
66
* [IAuthorizationInteractor] - interface for wrapping authorization
@@ -19,5 +19,5 @@ interface IAuthorizationInteractor {
1919
*
2020
* @return Observable<Result> which we can observer and get Success or Error result
2121
*/
22-
fun generalAuthorization(baseUrl: String, login: String, password: String): ResultObservable<Int>
22+
fun generalAuthorization(baseUrl: String, login: String, password: String): ResultSingle<Unit>
2323
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package odoo.miem.android.common.network.authorization.impl
22

3-
import io.reactivex.rxjava3.schedulers.Schedulers
43
import odoo.miem.android.common.network.authorization.api.IAuthorizationInteractor
54
import odoo.miem.android.common.network.authorization.api.di.IAuthorizationRepositoryApi
65
import odoo.miem.android.core.dataStore.api.di.IDataStoreApi
76
import odoo.miem.android.core.di.impl.api
7+
import odoo.miem.android.core.utils.builder.urlProcessing
8+
import odoo.miem.android.core.utils.regex.getSessionIdFromCookie
89
import odoo.miem.android.core.utils.state.ErrorResult
910
import odoo.miem.android.core.utils.state.Result
10-
import odoo.miem.android.core.utils.state.ResultObservable
11+
import odoo.miem.android.core.utils.state.ResultSingle
1112
import odoo.miem.android.core.utils.state.SuccessResult
1213
import timber.log.Timber
1314
import javax.inject.Inject
@@ -22,24 +23,40 @@ class AuthorizationInteractor @Inject constructor() : IAuthorizationInteractor {
2223
private val authorizationRepository by api(IAuthorizationRepositoryApi::authorizationRepository)
2324
private val dataStore by api(IDataStoreApi::dataStore)
2425

25-
override fun generalAuthorization(baseUrl: String, login: String, password: String): ResultObservable<Int> {
26+
override fun generalAuthorization(
27+
baseUrl: String,
28+
login: String,
29+
password: String
30+
): ResultSingle<Unit> {
2631
Timber.d("generalAuthorization(): baseUrl = $baseUrl, login = $login, password = $password")
2732

28-
dataStore.setUrl(baseUrl)
33+
dataStore.setUrl(proceedUrl(baseUrl))
2934

3035
return authorizationRepository.generalAuthorization(
3136
login = login,
3237
password = password
3338
)
34-
.subscribeOn(Schedulers.io())
35-
.map<Result<Int>> {
36-
Timber.d("generalAuthorization(): uid = $it")
37-
dataStore.setUID(it)
38-
SuccessResult(data = it)
39+
.map<Result<Unit>> { cookie ->
40+
Timber.d("generalAuthorization(): sessionId = $cookie")
41+
dataStore.setAuthorized(true)
42+
dataStore.setSessionId(
43+
cookie.split(COOKIE_SPLIT_SIGN)
44+
.find { it.contains(FIELD_SESSION_ID) }
45+
.orEmpty()
46+
.getSessionIdFromCookie()
47+
)
48+
SuccessResult()
3949
}
4050
.onErrorReturn {
4151
Timber.e("generalAuthorization(): error message = ${it.message}")
4252
ErrorResult(R.string.general_authorization_error)
4353
}
4454
}
55+
56+
private fun proceedUrl(inputUrl: String): String = "${urlProcessing(inputUrl)}web/"
57+
58+
private companion object {
59+
const val COOKIE_SPLIT_SIGN = ";"
60+
const val FIELD_SESSION_ID = "session_id"
61+
}
4562
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package odoo.miem.android.common.uiKitComponents.text
2+
3+
import androidx.annotation.StringRes
4+
import androidx.compose.material3.MaterialTheme
5+
import androidx.compose.material3.Text
6+
import androidx.compose.runtime.Composable
7+
import androidx.compose.ui.Modifier
8+
import androidx.compose.ui.graphics.Color
9+
import androidx.compose.ui.res.stringResource
10+
import androidx.compose.ui.text.style.TextAlign
11+
12+
/**
13+
* [HeadlineText] is best-suited for short, high-emphasis text
14+
*
15+
* @param textRes - resource on text, which will be displayed
16+
* @param isLarge - true or false, depends on size of headline
17+
*
18+
* @author Egor Danilov
19+
*/
20+
@Composable
21+
fun HeadlineText(
22+
@StringRes textRes: Int,
23+
modifier: Modifier = Modifier,
24+
color: Color = MaterialTheme.colorScheme.onPrimaryContainer,
25+
textAlign: TextAlign = TextAlign.Start,
26+
isLarge: Boolean = true
27+
) = BaseHeadlineText(
28+
text = stringResource(textRes),
29+
modifier = modifier,
30+
color = color,
31+
textAlign = textAlign,
32+
isLarge = isLarge
33+
)
34+
35+
/**
36+
* [HeadlineText] is best-suited for short, high-emphasis text
37+
*
38+
* @param text - text, which will be displayed
39+
* @param isLarge - true or false, depends on size of headline
40+
*
41+
* @author Egor Danilov
42+
*/
43+
@Composable
44+
fun HeadlineText(
45+
text: String,
46+
modifier: Modifier = Modifier,
47+
color: Color = MaterialTheme.colorScheme.onPrimaryContainer,
48+
textAlign: TextAlign = TextAlign.Start,
49+
isLarge: Boolean = true
50+
) = BaseHeadlineText(
51+
text = text,
52+
modifier = modifier,
53+
color = color,
54+
textAlign = textAlign,
55+
isLarge = isLarge
56+
)
57+
58+
/**
59+
* [HeadlineText] base realization of [HeadlineText]
60+
*
61+
* @param text - string with text, which will be displayed
62+
* @param isLarge - true or false, depends on size of headline
63+
*
64+
* @author Egor Danilov
65+
*/
66+
@Composable
67+
private fun BaseHeadlineText(
68+
text: String,
69+
modifier: Modifier = Modifier,
70+
color: Color = MaterialTheme.colorScheme.onPrimaryContainer,
71+
textAlign: TextAlign = TextAlign.Start,
72+
isLarge: Boolean = true
73+
) = Text(
74+
text = text,
75+
style = if (isLarge) {
76+
MaterialTheme.typography.headlineMedium
77+
} else {
78+
MaterialTheme.typography.headlineSmall
79+
},
80+
modifier = modifier,
81+
textAlign = textAlign,
82+
color = color
83+
)

common/uiKitComponents/src/main/kotlin/odoo/miem/android/common/uiKitComponents/textfields/BaseTextField.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ fun BaseTextField(
3535
keyboardType: KeyboardType = KeyboardType.Text,
3636
@StringRes labelResource: Int,
3737
leadingIcon: @Composable (() -> Unit)? = null,
38+
placeholder: @Composable (() -> Unit)? = null,
3839
modifier: Modifier = Modifier,
3940
enabled: Boolean = true,
4041
onValueChange: (TextFieldValue) -> Unit = {},
@@ -52,6 +53,7 @@ fun BaseTextField(
5253
enabled = enabled,
5354
singleLine = true,
5455
label = { Text(text = stringResource(labelResource), style = MaterialTheme.typography.bodyMedium) },
56+
placeholder = placeholder,
5557
visualTransformation = visualTransformation,
5658
keyboardOptions = KeyboardOptions(keyboardType = keyboardType, imeAction = imeAction),
5759
keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),

common/uiKitComponents/src/main/kotlin/odoo/miem/android/common/uiKitComponents/textfields/LoginTextField.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ fun LoginTextField(
4141
visualTransformation: VisualTransformation = VisualTransformation.None,
4242
imeAction: ImeAction = ImeAction.Done,
4343
isError: Boolean = false,
44+
placeholder: @Composable (() -> Unit)? = null,
4445
modifier: Modifier = Modifier
4546
) {
4647
var isPasswordVisible by remember { mutableStateOf(false) }
@@ -84,6 +85,7 @@ fun LoginTextField(
8485
trailingIcon = trailingIcon,
8586
imeAction = imeAction,
8687
isError = isError,
88+
placeholder = placeholder,
8789
modifier = modifier
8890
)
8991
}

common/uiKitComponents/src/main/res/values-ru/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111

1212
<!-- Search Text field -->
1313
<string name="search_text_field_label">Введите название модуля</string>
14-
<string name="outlined_module_card_header">Добавить любимый модуль</string>
14+
<string name="outlined_module_card_header">Добавить\nлюбимый модуль</string>
1515
</resources>

core/dataStore/api/src/main/kotlin/odoo/miem/android/core/dataStore/api/IDataStore.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ interface IDataStore {
1919
*/
2020
val currentUID: Int
2121
fun setUID(uid: Int)
22+
23+
val isAuthorized: Boolean
24+
fun setAuthorized(authorized: Boolean)
25+
26+
val sessionId: String
27+
fun setSessionId(newSessionId: String)
2228
}

0 commit comments

Comments
 (0)