Skip to content

Commit 08c7243

Browse files
authored
Client – Upload & Manage Signature (openMF#2498)
1 parent f6932ab commit 08c7243

48 files changed

Lines changed: 1420 additions & 605 deletions

File tree

Some content is hidden

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

cmp-android/dependencies/demoDebugRuntimeClasspath.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ com.arkivanov.essenty:back-handler-android:2.1.0
160160
com.arkivanov.essenty:back-handler:2.1.0
161161
com.arkivanov.essenty:utils-internal-android:2.1.0
162162
com.arkivanov.essenty:utils-internal:2.1.0
163+
com.attafitamim.krop:core-android:0.2.0
164+
com.attafitamim.krop:core:0.2.0
165+
com.attafitamim.krop:ui-android:0.2.0
166+
com.attafitamim.krop:ui:0.2.0
163167
com.caverock:androidsvg-aar:1.4
164168
com.google.accompanist:accompanist-drawablepainter:0.37.3
165169
com.google.accompanist:accompanist-permissions:0.36.0

cmp-android/dependencies/demoReleaseRuntimeClasspath.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ com.arkivanov.essenty:back-handler-android:2.1.0
160160
com.arkivanov.essenty:back-handler:2.1.0
161161
com.arkivanov.essenty:utils-internal-android:2.1.0
162162
com.arkivanov.essenty:utils-internal:2.1.0
163+
com.attafitamim.krop:core-android:0.2.0
164+
com.attafitamim.krop:core:0.2.0
165+
com.attafitamim.krop:ui-android:0.2.0
166+
com.attafitamim.krop:ui:0.2.0
163167
com.caverock:androidsvg-aar:1.4
164168
com.google.accompanist:accompanist-drawablepainter:0.37.3
165169
com.google.accompanist:accompanist-permissions:0.36.0

cmp-android/dependencies/prodDebugRuntimeClasspath.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ com.arkivanov.essenty:back-handler-android:2.1.0
160160
com.arkivanov.essenty:back-handler:2.1.0
161161
com.arkivanov.essenty:utils-internal-android:2.1.0
162162
com.arkivanov.essenty:utils-internal:2.1.0
163+
com.attafitamim.krop:core-android:0.2.0
164+
com.attafitamim.krop:core:0.2.0
165+
com.attafitamim.krop:ui-android:0.2.0
166+
com.attafitamim.krop:ui:0.2.0
163167
com.caverock:androidsvg-aar:1.4
164168
com.google.accompanist:accompanist-drawablepainter:0.37.3
165169
com.google.accompanist:accompanist-permissions:0.36.0

cmp-android/dependencies/prodReleaseRuntimeClasspath.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ com.arkivanov.essenty:back-handler-android:2.1.0
160160
com.arkivanov.essenty:back-handler:2.1.0
161161
com.arkivanov.essenty:utils-internal-android:2.1.0
162162
com.arkivanov.essenty:utils-internal:2.1.0
163+
com.attafitamim.krop:core-android:0.2.0
164+
com.attafitamim.krop:core:0.2.0
165+
com.attafitamim.krop:ui-android:0.2.0
166+
com.attafitamim.krop:ui:0.2.0
163167
com.caverock:androidsvg-aar:1.4
164168
com.google.accompanist:accompanist-drawablepainter:0.37.3
165169
com.google.accompanist:accompanist-permissions:0.36.0

core/data/src/commonMain/kotlin/com/mifos/core/data/di/RepositoryModule.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ val RepositoryModule = module {
221221
singleOf(::SignatureRepositoryImp) bind SignatureRepository::class
222222
singleOf(::SurveyListRepositoryImp) bind SurveyListRepository::class
223223
singleOf(::SurveySubmitRepositoryImp) bind SurveySubmitRepository::class
224+
singleOf(::SignatureRepositoryImp) bind SignatureRepository::class
224225

225226
includes(platformModule)
226227
single<PlatformDependentDataModule> { getPlatformDataModule }

core/data/src/commonMain/kotlin/com/mifos/core/data/repository/DocumentDialogRepository.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
package com.mifos.core.data.repository
1111

1212
import com.mifos.core.common.utils.DataState
13+
import com.mifos.core.network.GenericResponse
1314
import io.ktor.client.request.forms.MultiPartFormDataContent
15+
import kotlinx.coroutines.flow.Flow
1416

1517
/**
1618
* Created by Aditya Gupta on 16/08/23.
@@ -21,12 +23,12 @@ interface DocumentDialogRepository {
2123
entityType: String,
2224
entityId: Int,
2325
file: MultiPartFormDataContent,
24-
): DataState<Unit>
26+
): Flow<DataState<GenericResponse>>
2527

2628
suspend fun updateDocument(
2729
entityType: String,
2830
entityId: Int,
2931
documentId: Int,
3032
file: MultiPartFormDataContent,
31-
): DataState<Unit>
33+
): Flow<DataState<GenericResponse>>
3234
}

core/data/src/commonMain/kotlin/com/mifos/core/data/repository/DocumentListRepository.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ package com.mifos.core.data.repository
1111

1212
import com.mifos.core.common.utils.DataState
1313
import com.mifos.core.model.objects.noncoreobjects.Document
14+
import com.mifos.core.network.GenericResponse
1415
import io.ktor.client.statement.HttpResponse
1516
import kotlinx.coroutines.flow.Flow
1617

@@ -21,15 +22,15 @@ interface DocumentListRepository {
2122

2223
fun getDocumentsList(entityType: String, entityId: Int): Flow<DataState<List<Document>>>
2324

24-
suspend fun downloadDocument(
25+
fun downloadDocument(
2526
entityType: String,
2627
entityId: Int,
2728
documentId: Int,
28-
): HttpResponse
29+
): Flow<DataState<HttpResponse>>
2930

3031
suspend fun removeDocument(
3132
entityType: String,
3233
entityId: Int,
3334
documentId: Int,
34-
): Unit
35+
): GenericResponse
3536
}

core/data/src/commonMain/kotlin/com/mifos/core/data/repository/SignatureRepository.kt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,24 @@
99
*/
1010
package com.mifos.core.data.repository
1111

12-
import com.mifos.core.common.utils.DataState
12+
import com.mifos.core.network.GenericResponse
1313
import io.ktor.client.request.forms.MultiPartFormDataContent
1414

1515
/**
16-
* Created by Aditya Gupta on 08/08/23.
16+
* Created by Arin Yadav on 03/09/25
1717
*/
1818
interface SignatureRepository {
1919

20-
suspend fun createDocument(
20+
suspend fun createSignature(
2121
entityType: String,
2222
entityId: Int,
2323
file: MultiPartFormDataContent,
24-
): DataState<Unit>
24+
): GenericResponse
25+
26+
suspend fun updateSignature(
27+
entityType: String,
28+
entityId: Int,
29+
documentId: Int,
30+
file: MultiPartFormDataContent,
31+
): GenericResponse
2532
}

core/data/src/commonMain/kotlin/com/mifos/core/data/repositoryImp/DocumentDialogRepositoryImp.kt

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@
1010
package com.mifos.core.data.repositoryImp
1111

1212
import com.mifos.core.common.utils.DataState
13+
import com.mifos.core.common.utils.asDataStateFlow
1314
import com.mifos.core.data.repository.DocumentDialogRepository
15+
import com.mifos.core.network.GenericResponse
1416
import com.mifos.core.network.datamanager.DataManagerDocument
1517
import io.ktor.client.request.forms.MultiPartFormDataContent
18+
import kotlinx.coroutines.flow.Flow
19+
import kotlinx.coroutines.flow.flow
1620

1721
/**
1822
* Created by Aditya Gupta on 16/08/23.
@@ -25,21 +29,25 @@ class DocumentDialogRepositoryImp(
2529
entityType: String,
2630
entityId: Int,
2731
file: MultiPartFormDataContent,
28-
): DataState<Unit> {
29-
return dataManagerDocument.createDocument(entityType, entityId, file)
30-
}
32+
): Flow<DataState<GenericResponse>> = flow {
33+
emit(
34+
dataManagerDocument.createDocument(entityType, entityId, file),
35+
)
36+
}.asDataStateFlow()
3137

3238
override suspend fun updateDocument(
3339
entityType: String,
3440
entityId: Int,
3541
documentId: Int,
3642
file: MultiPartFormDataContent,
37-
): DataState<Unit> {
38-
return dataManagerDocument.updateDocument(
39-
entityType,
40-
entityId,
41-
documentId,
42-
file,
43+
): Flow<DataState<GenericResponse>> = flow {
44+
emit(
45+
dataManagerDocument.updateDocument(
46+
entityType,
47+
entityId,
48+
documentId,
49+
file,
50+
),
4351
)
44-
}
52+
}.asDataStateFlow()
4553
}

core/data/src/commonMain/kotlin/com/mifos/core/data/repositoryImp/DocumentListRepositoryImp.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import com.mifos.core.common.utils.DataState
1313
import com.mifos.core.common.utils.asDataStateFlow
1414
import com.mifos.core.data.repository.DocumentListRepository
1515
import com.mifos.core.model.objects.noncoreobjects.Document
16+
import com.mifos.core.network.GenericResponse
1617
import com.mifos.core.network.datamanager.DataManagerDocument
1718
import io.ktor.client.statement.HttpResponse
1819
import kotlinx.coroutines.flow.Flow
@@ -29,19 +30,19 @@ class DocumentListRepositoryImp(
2930
.asDataStateFlow()
3031
}
3132

32-
override suspend fun downloadDocument(
33+
override fun downloadDocument(
3334
entityType: String,
3435
entityId: Int,
3536
documentId: Int,
36-
): HttpResponse {
37-
return dataManagerDocument.downloadDocument(entityType, entityId, documentId)
37+
): Flow<DataState<HttpResponse>> {
38+
return dataManagerDocument.downloadDocument(entityType, entityId, documentId).asDataStateFlow()
3839
}
3940

4041
override suspend fun removeDocument(
4142
entityType: String,
4243
entityId: Int,
4344
documentId: Int,
44-
) {
45+
): GenericResponse {
4546
return dataManagerDocument.removeDocument(entityType, entityId, documentId)
4647
}
4748
}

0 commit comments

Comments
 (0)