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

๐Ÿ”€ :: (#13) - add qrcode function #51

Merged
merged 21 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5320bf3
:fire: :: Del gauth dependencies
minStone-dev Feb 6, 2024
dde3add
:recycle: :: Rollback dependency
minStone-dev Feb 6, 2024
9276a7d
:memo: :: Add qrcode module and set dependency
minStone-dev Feb 6, 2024
44b7094
:memo: :: Add QrcodeScanPreview.kt
minStone-dev Feb 6, 2024
9d1ba91
:memo: :: Add QrcodeScanGuide.kt
minStone-dev Feb 7, 2024
b29441d
:memo: :: Add QrcodeScanGuide.kt
minStone-dev Feb 7, 2024
a641d6b
:memo: :: Add QrcodeScanTopBar.kt
minStone-dev Feb 7, 2024
f7de637
Merge branch 'develop' into feature/13-publishing-qr-code-scan
minStone-dev Feb 14, 2024
628575a
:memo: :: Add nav QrcodeScanScreen.kt
minStone-dev Feb 14, 2024
689fa8d
:memo: :: Add get permission camera
minStone-dev Feb 14, 2024
3f51b44
:sparkles: :: Add QrcodeScanner.kt
minStone-dev Feb 14, 2024
13002dc
:sparkles: :: Add qrcode scan function implementation
minStone-dev Feb 14, 2024
57f0f58
:memo: :: Add OutingAPI outing function
minStone-dev Feb 15, 2024
125eb4b
:memo: :: Add OutingAPI outing function data source
minStone-dev Feb 15, 2024
b39533b
:memo: :: Add OutingAPI outing function repository
minStone-dev Feb 15, 2024
f9910a9
:memo: :: Add OutingUseCase.kt
minStone-dev Feb 15, 2024
9303f45
:sparkles: :: Add qrcode scan function
minStone-dev Feb 15, 2024
e92f07c
Merge branch 'develop' into feature/13-publishing-qr-code-scan
minStone-dev Feb 15, 2024
b17718c
:memo: :: Modify QrcodeScanScreen.kt
minStone-dev Feb 15, 2024
345e82f
:memo: :: Del log
minStone-dev Feb 15, 2024
4fec43b
:memo: :: Change flow -> run catching
minStone-dev Feb 15, 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
4 changes: 4 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies {
implementation(project(":feature:login"))
implementation(project(":feature:sign-up"))
implementation(project(":feature:main"))
implementation(project(":feature:qrcode-scan"))

implementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext)
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<uses-feature android:name="android.hardware.camera" />

<application
android:name=".di.GomsApplication"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import com.goms.main.navigation.navigateToOutingStatus
import com.goms.main.navigation.navigateToStudentManagement
import com.goms.main.navigation.outingStatusScreen
import com.goms.main.navigation.studentManagementScreen
import com.goms.qrcode_scan.navigation.navigateToQrScan
import com.goms.qrcode_scan.navigation.qrcodeScanScreen
import com.goms.sign_up.navigation.navigateToNumber
import com.goms.sign_up.navigation.navigateToPassword
import com.goms.sign_up.navigation.navigateToSignUp
Expand Down Expand Up @@ -66,7 +68,11 @@ fun GomsNavHost(
viewModelStoreOwner = mainViewModelStoreOwner,
onOutingStatusClick = navController::navigateToOutingStatus,
onLateListClick = navController::navigateToLateList,
onStudentManagementClick = navController::navigateToStudentManagement
onStudentManagementClick = navController::navigateToStudentManagement,
onQrcodeClick = navController::navigateToQrScan
Copy link
Contributor

Choose a reason for hiding this comment

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

์ด๊ฑฐ ์ด๋ฆ„์„ onQrcodeClick๋ง๊ณ  onQrcodeScanClick์œผ๋กœ ๋ฐ”๊พธ๋Š”๊ฒŒ ์ข‹์ง€ ์•Š์„๊นŒ์š” ์–ด๋“œ๋ฏผ qr ์ƒ์„ฑ๋„ ํ•ด์•ผํ•˜๋Š”๋ฐ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

๋‚˜์ค‘์— ๋”ฐ๋กœ ๋กœ์ง ์ถ”๊ฐ€ํ•ด์„œ ์ฒ˜๋ฆฌํ•˜๋Š”๊ฒŒ ๋” ๋‚˜์„๊ฑฐ ๊ฐ™์•„์„œ ์ €๋ ‡๊ฒŒ ํ–ˆ์–ด์š”

)
qrcodeScanScreen(
onPermissionBlock = navController::popBackStack
)
outingStatusScreen(
viewModelStoreOwner = mainViewModelStoreOwner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ package com.goms.data.repository.outing
import com.goms.model.response.outing.CountResponse
import com.goms.model.response.outing.OutingResponse
import kotlinx.coroutines.flow.Flow
import java.util.UUID

interface OutingRepository {
suspend fun outing(outingUUID: UUID): Flow<Unit>

suspend fun getOutingList(): Flow<List<OutingResponse>>

suspend fun getOutingCount(): Flow<CountResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ import com.goms.model.response.outing.CountResponse
import com.goms.model.response.outing.OutingResponse
import com.goms.network.datasource.outing.OutingDataSource
import kotlinx.coroutines.flow.Flow
import java.util.UUID
import javax.inject.Inject

class OutingRepositoryImpl @Inject constructor(
private val remoteOutingDataSource: OutingDataSource
) : OutingRepository {
override suspend fun outing(outingUUID: UUID): Flow<Unit> {
return remoteOutingDataSource.outing(outingUUID)
}

override suspend fun getOutingList(): Flow<List<OutingResponse>> {
return remoteOutingDataSource.getOutingList()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ fun QrScanIcon(
)
}

@Composable
fun QrScanGuideIcon(
modifier: Modifier = Modifier
) {
Image(
painter = painterResource(id = R.drawable.ic_qr_scan_guide),
contentDescription = "Qr Scan Guide Icon",
modifier = modifier
)
}

@Composable
fun QrCreateIcon(
modifier: Modifier = Modifier
Expand Down
18 changes: 18 additions & 0 deletions core/design-system/src/main/res/drawable/ic_qr_scan_guide.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="129dp"
android:height="128dp"
android:viewportWidth="129"
android:viewportHeight="128">
<path
android:pathData="M8.5,49V8H48.5V4H7.5C5.84,4 4.5,5.34 4.5,7V49H8.5ZM48.5,120H8.5V49L8.5,79H4.5V121C4.5,122.66 5.84,124 7.5,124H48.5V120ZM80.5,120V124H121.5C123.16,124 124.5,122.66 124.5,121V79H120.5V120H80.5ZM120.5,49H124.5V7C124.5,5.34 123.16,4 121.5,4H80.5V8H120.5V49Z"
android:fillColor="#ffffff"
android:fillType="evenOdd"/>
<group>
<clip-path
android:pathData="M8.5,49V8H48.5V4H7.5C5.84,4 4.5,5.34 4.5,7V49H8.5ZM48.5,120H8.5V49L8.5,79H4.5V121C4.5,122.66 5.84,124 7.5,124H48.5V120ZM80.5,120V124H121.5C123.16,124 124.5,122.66 124.5,121V79H120.5V120H80.5ZM120.5,49H124.5V7C124.5,5.34 123.16,4 121.5,4H80.5V8H120.5V49Z"
android:fillType="evenOdd"/>
<path
android:pathData="M8.5,8V7.9H8.4V8H8.5ZM48.5,8V8.1H48.6V8H48.5ZM48.5,4H48.6V3.9H48.5V4ZM4.5,49H4.4V49.1H4.5V49ZM8.5,120H8.4V120.1H8.5V120ZM48.5,120H48.6V119.9H48.5V120ZM8.5,79V79.1H8.6V79H8.5ZM4.5,79V78.9H4.4V79H4.5ZM48.5,124V124.1H48.6V124H48.5ZM80.5,124H80.4V124.1H80.5V124ZM80.5,120V119.9H80.4V120H80.5ZM124.5,79H124.6V78.9H124.5V79ZM120.5,79V78.9H120.4V79H120.5ZM120.5,120V120.1H120.6V120H120.5ZM124.5,49V49.1H124.6V49H124.5ZM120.5,49H120.4V49.1H120.5V49ZM80.5,4V3.9H80.4V4H80.5ZM80.5,8H80.4V8.1H80.5V8ZM120.5,8H120.6V7.9H120.5V8ZM8.4,8V49H8.6V8H8.4ZM48.5,7.9H8.5V8.1H48.5V7.9ZM48.4,4V8H48.6V4H48.4ZM48.5,3.9H7.5V4.1H48.5V3.9ZM7.5,3.9C5.79,3.9 4.4,5.29 4.4,7H4.6C4.6,5.4 5.9,4.1 7.5,4.1V3.9ZM4.4,7V49H4.6V7H4.4ZM4.5,49.1H8.5V48.9H4.5V49.1ZM8.5,120.1H48.5V119.9H8.5V120.1ZM8.4,49V120H8.6V49H8.4ZM8.4,49L8.4,79H8.6L8.6,49H8.4ZM8.5,78.9H4.5V79.1H8.5V78.9ZM4.4,79V121H4.6V79H4.4ZM4.4,121C4.4,122.71 5.79,124.1 7.5,124.1V123.9C5.9,123.9 4.6,122.6 4.6,121H4.4ZM7.5,124.1H48.5V123.9H7.5V124.1ZM48.4,120V124H48.6V120H48.4ZM80.6,124V120H80.4V124H80.6ZM80.5,124.1H121.5V123.9H80.5V124.1ZM121.5,124.1C123.21,124.1 124.6,122.71 124.6,121H124.4C124.4,122.6 123.1,123.9 121.5,123.9V124.1ZM124.6,121V79H124.4V121H124.6ZM120.5,79.1H124.5V78.9H120.5V79.1ZM120.6,120V79H120.4V120H120.6ZM80.5,120.1H120.5V119.9H80.5V120.1ZM124.5,48.9H120.5V49.1H124.5V48.9ZM124.6,49V7H124.4V49H124.6ZM124.6,7C124.6,5.29 123.21,3.9 121.5,3.9V4.1C123.1,4.1 124.4,5.4 124.4,7H124.6ZM121.5,3.9H80.5V4.1H121.5V3.9ZM80.6,8V4H80.4V8H80.6ZM120.5,7.9H80.5V8.1H120.5V7.9ZM120.6,49V8H120.4V49H120.6Z"
android:fillColor="#4D4D4D"/>
</group>
</vector>
13 changes: 13 additions & 0 deletions core/domain/src/main/java/com/goms/domain/outing/OutingUseCase.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.goms.domain.outing

import com.goms.data.repository.outing.OutingRepository
import kotlinx.coroutines.flow.Flow
import java.util.UUID
import javax.inject.Inject

class OutingUseCase @Inject constructor(
private val outingRepository: OutingRepository
) {
suspend operator fun invoke(outingUUID: UUID): Flow<Unit> =
outingRepository.outing(outingUUID)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

๋ฐ˜ํ™˜ํ•˜๋Š” ๊ฐ’์ด ์—†์œผ๋ฉด runCatching์„ ์‚ฌ์šฉํ•˜๋Š”๊ฒŒ ๋” ์ข‹์„๊ฑฐ ๊ฐ™์•„์š”

9 changes: 9 additions & 0 deletions core/network/src/main/java/com/goms/network/api/OutingAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@ package com.goms.network.api

import com.goms.model.response.outing.CountResponse
import com.goms.model.response.outing.OutingResponse
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
import java.util.UUID

interface OutingAPI {
@POST("/api/v2/outing/{outingUUID}")
suspend fun outing(
@Path("outingUUID") outingUUID: UUID
): Response<Unit>

@GET("/api/v2/outing/")
suspend fun getOutingList(): List<OutingResponse>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ package com.goms.network.datasource.outing
import com.goms.model.response.outing.CountResponse
import com.goms.model.response.outing.OutingResponse
import kotlinx.coroutines.flow.Flow
import java.util.UUID

interface OutingDataSource {
suspend fun outing(outingUUID: UUID): Flow<Unit>

suspend fun getOutingList(): Flow<List<OutingResponse>>

suspend fun getOutingCount(): Flow<CountResponse>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import java.util.UUID
import javax.inject.Inject

class OutingDataSourceImpl @Inject constructor(
private val outingAPI: OutingAPI
) : OutingDataSource {
override suspend fun outing(outingUUID: UUID): Flow<Unit> = flow {
emit(
GomsApiHandler<Unit>()
.httpRequest { outingAPI.outing(outingUUID) }
.sendRequest()
)
}.flowOn(Dispatchers.IO)

override suspend fun getOutingList(): Flow<List<OutingResponse>> = flow {
emit(
GomsApiHandler<List<OutingResponse>>()
Expand Down
10 changes: 8 additions & 2 deletions feature/main/src/main/java/com/goms/main/MainScreen.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.goms.main

import android.util.Log
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand Down Expand Up @@ -37,7 +38,8 @@ fun MainRoute(
viewModelStoreOwner: ViewModelStoreOwner,
onOutingStatusClick: () -> Unit,
onLateListClick: () -> Unit,
onStudentManagementClick: () -> Unit
onStudentManagementClick: () -> Unit,
onQrcodeClick: () -> Unit
) {
MainViewModelProvider(viewModelStoreOwner = viewModelStoreOwner) { viewModel ->
val role by viewModel.role.collectAsStateWithLifecycle(initialValue = "")
Expand All @@ -55,6 +57,7 @@ fun MainRoute(
onOutingStatusClick = onOutingStatusClick,
onLateListClick = onLateListClick,
onStudentManagementClick = onStudentManagementClick,
onQrcodeClick = onQrcodeClick,
mainCallBack = {
viewModel.getProfile()
viewModel.getLateRankList()
Expand All @@ -74,6 +77,7 @@ fun MainScreen(
onOutingStatusClick: () -> Unit,
onLateListClick: () -> Unit,
onStudentManagementClick: () -> Unit,
onQrcodeClick: () -> Unit,
mainCallBack: () -> Unit
) {
LaunchedEffect(true) {
Expand Down Expand Up @@ -125,7 +129,9 @@ fun MainScreen(
.align(Alignment.BottomEnd)
.padding(end = 16.dp, bottom = 16.dp),
role = role
) {}
) {
onQrcodeClick()
}
Comment on lines +132 to +134
Copy link
Contributor

Choose a reason for hiding this comment

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

์—ฌ๊ธฐ์„œ ํด๋ฆญํ–ˆ์„๋•Œ์— qr scan์œผ๋กœ ์ด๋™ํ•˜๋Š”๋ฐ ์ œ๊ฐ€ component์—์„œ ๋”ฐ๋กœ ๋ถ„๋ฆฌ๋ฅผ ์•ˆํ•ด๋†”์„œ ์–ด๋“œ๋ฏผํ• ๋•Œ ์ˆ˜์ • ํ•„์š”ํ• ๊ฑฐ ๊ฐ™์•„์š” ์ง€๊ธˆ์€ ๊ดœ์ฐฎ์€๋ฐ

Copy link
Contributor

Choose a reason for hiding this comment

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

์ด๊ฑด ๋‚˜์ค‘์— ์ปดํฌ๋„ŒํŠธ์—์„œ ์œ ์ €์ด๋™๊ณผ ์–ด๋“œ๋ฏผ ์ด๋™์„ ๋‚˜๋ˆ„๋Š”๊ฒŒ ์ข‹์•„๋ณด์—ฌ์š”

Copy link
Contributor Author

Choose a reason for hiding this comment

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

์ด๊ฒƒ๋„ ๊ฐ™์€ ์ด์œ  ์ž…๋‹ˆ๋‹ค

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@ fun NavGraphBuilder.mainScreen(
viewModelStoreOwner: ViewModelStoreOwner,
onOutingStatusClick: () -> Unit,
onLateListClick: () -> Unit,
onStudentManagementClick: () -> Unit
onStudentManagementClick: () -> Unit,
onQrcodeClick: () -> Unit
) {
composable(route = mainRoute) {
MainRoute(
viewModelStoreOwner = viewModelStoreOwner,
onOutingStatusClick = onOutingStatusClick,
onLateListClick = onLateListClick,
onStudentManagementClick = onStudentManagementClick
onStudentManagementClick = onStudentManagementClick,
onQrcodeClick = onQrcodeClick
)
}
}
Expand Down
1 change: 1 addition & 0 deletions feature/qrcode-scan/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
22 changes: 22 additions & 0 deletions feature/qrcode-scan/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import com.goms.goms_android_v2.libs

plugins {
id("goms.android.feature")
id("goms.android.hilt")
}

android {
namespace = "com.goms.qrcode_scan"
}

dependencies {
add("implementation", libs.findLibrary("camera.core").get())
add("implementation", libs.findLibrary("camera.view").get())
add("implementation", libs.findLibrary("camera.camera2").get())
add("implementation", libs.findLibrary("camera.lifecycle").get())
add("implementation", libs.findLibrary("camera.extensions").get())

add("implementation", libs.findLibrary("mlkit").get())

add("implementation", libs.findLibrary("accompanist.permission").get())
}
Empty file.
21 changes: 21 additions & 0 deletions feature/qrcode-scan/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.goms.qrcode_scan

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.goms.qrcode_scan.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions feature/qrcode-scan/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Loading
Loading