Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 21 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,24 @@ ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_wrap_on_typing = false
ij_wrap_on_typing = false

[*.{kt,kts}]
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ktlint_function_naming_ignore_when_annotated_with = Composable, Test
ktlint_standard_backing-property-naming = disabled
ktlint_standard_binary-expression-wrapping = disabled
ktlint_standard_chain-method-continuation = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_condition-wrapping = disabled
ktlint_standard_function-expression-body = disabled
ktlint_standard_function-literal = disabled
ktlint_standard_function-type-modifier-spacing = disabled
ktlint_standard_multiline-loop = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_package-name = disabled
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_property-naming = disabled
ktlint_standard_max-line-length = disabled
ktlint_standard_filename = disabled
10 changes: 8 additions & 2 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3

- name: Unit Tests
- name: Check lint (spotless)
run: |
chmod +x gradlew
./gradlew test --stacktrace
./gradlew spotlessCheck

- name: Android Lint
run: ./gradlew :app:lintDebug

- name: Unit Tests
run: ./gradlew test --stacktrace
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ app/release/*
# https://github.com/JetBrains/kotlin/blob/ca34e5d2fd255ed0501bae4fae3d3691dc40d375/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerRunner.kt#L458
/.kotlin

# JVM crash logs
hs_err_pid*.log
replay_pid*.log

# Claude
# Personal Claude Code settings
.claude/settings.local.json
Expand Down
14 changes: 6 additions & 8 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ android {
debug {
extra["alwaysUpdateBuildId"] = false
isDebuggable = true
buildConfigField("String", "DOMAIN","\"api.nativeapptemplate.com\"")
buildConfigField("String", "PORT","\"\"")
buildConfigField("String", "SCHEME","\"https\"")
buildConfigField("String", "DOMAIN", "\"api.nativeapptemplate.com\"")
buildConfigField("String", "PORT", "\"\"")
buildConfigField("String", "SCHEME", "\"https\"")
// buildConfigField("String", "DOMAIN","\"192.168.1.21\"")
// buildConfigField("String", "PORT","\"3000\"")
// buildConfigField("String", "SCHEME","\"http\"")
Expand All @@ -37,9 +37,9 @@ android {
release {
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
buildConfigField("String", "DOMAIN","\"api.nativeapptemplate.com\"")
buildConfigField("String", "PORT","\"\"")
buildConfigField("String", "SCHEME","\"https\"")
buildConfigField("String", "DOMAIN", "\"api.nativeapptemplate.com\"")
buildConfigField("String", "PORT", "\"\"")
buildConfigField("String", "SCHEME", "\"https\"")
}
}

Expand Down Expand Up @@ -124,5 +124,3 @@ dependencies {
testImplementation(libs.kotlinx.coroutines.test)
testImplementation(libs.robolectric)
}


Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ class MainActivity : ComponentActivity() {
val rawMessages = if (SDK_INT >= 33) { // TIRAMISU
intent.getParcelableArrayExtra(
NfcAdapter.EXTRA_NDEF_MESSAGES,
NdefMessage::class.java
NdefMessage::class.java,
)
}else{
} else {
@Suppress("DEPRECATION")
intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)
}
Expand All @@ -140,7 +140,7 @@ class MainActivity : ComponentActivity() {

val itemTagInfoFromNdefMessage = Utility.extractItemTagInfoFrom(
context = this,
ndefMessage = ndefMessage
ndefMessage = ndefMessage,
)

updateItemTagInfoFromNdefMessage(itemTagInfoFromNdefMessage)
Expand All @@ -162,9 +162,9 @@ class MainActivity : ComponentActivity() {
val rawMessages = if (SDK_INT >= 33) { // TIRAMISU
intent.getParcelableArrayExtra(
NfcAdapter.EXTRA_NDEF_MESSAGES,
NdefMessage::class.java
NdefMessage::class.java,
)
}else{
} else {
@Suppress("DEPRECATION")
intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)
}
Expand All @@ -174,7 +174,7 @@ class MainActivity : ComponentActivity() {

val itemTagInfoFromNdefMessage = Utility.extractItemTagInfoFrom(
context = this,
ndefMessage = ndefMessage
ndefMessage = ndefMessage,
)

updateItemTagInfoFromNdefMessage(itemTagInfoFromNdefMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ object NatConstants {

return result
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class NativeAppTemplateApplication : Application() {
super.onCreate()
profileVerifierLogger()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@ interface ItemTagApi {
@GET("{account_id}/api/v1/shopkeeper/shops/{shop_id}/item_tags")
suspend fun getItemTags(
@Path("account_id") accountId: String,
@Path("shop_id") shopId: String
@Path("shop_id") shopId: String,
): ApiResponse<ItemTags>

@GET("{account_id}/api/v1/shopkeeper/item_tags/{id}")
suspend fun getItemTag(
@Path("account_id") accountId: String,
@Path("id") id: String
@Path("id") id: String,
): ApiResponse<ItemTag>

@POST("{account_id}/api/v1/shopkeeper/shops/{shop_id}/item_tags")
suspend fun createItemTag(
@Path("account_id") accountId: String,
@Path("shop_id") shopId: String,
@Body data: ItemTagBody
@Body data: ItemTagBody,
): ApiResponse<ItemTag>

@PATCH("{account_id}/api/v1/shopkeeper/item_tags/{id}")
suspend fun updateItemTag(
@Path("account_id") accountId: String,
@Path("id") id: String,
@Body data: ItemTagBody
@Body data: ItemTagBody,
): ApiResponse<ItemTag>

@DELETE("{account_id}/api/v1/shopkeeper/item_tags/{id}")
suspend fun deleteItemTag(
@Path("account_id") accountId: String,
@Path("id") id: String
@Path("id") id: String,
): ApiResponse<Status>

@PATCH("{account_id}/api/v1/shopkeeper/item_tags/{id}/complete")
Expand All @@ -52,7 +52,7 @@ interface ItemTagApi {

companion object {
fun create(retroFit: Retrofit): ItemTagApi = retroFit.create(
ItemTagApi::class.java
ItemTagApi::class.java,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface ItemTagRepository {

fun updateItemTag(
id: String,
itemTagBody: ItemTagBody
itemTagBody: ItemTagBody,
): Flow<ItemTag>

fun deleteItemTag(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ class ItemTagRepositoryImpl @Inject constructor(
try {
nativeAppTemplateApiError = response.deserializeErrorBody<ItemTags, NativeAppTemplateApiError>()
} catch (exception: Exception) {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}

if (nativeAppTemplateApiError != null) {
val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
throw Exception(message)
} else {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}
}
Expand All @@ -55,7 +55,7 @@ class ItemTagRepositoryImpl @Inject constructor(
) = flow {
val response = api.getItemTag(
mtcPreferencesDataSource.userData.first().accountId,
id
id,
)

response.suspendOnSuccess {
Expand All @@ -66,15 +66,15 @@ class ItemTagRepositoryImpl @Inject constructor(
try {
nativeAppTemplateApiError = response.deserializeErrorBody<ItemTag, NativeAppTemplateApiError>()
} catch (exception: Exception) {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}

if (nativeAppTemplateApiError != null) {
val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
throw Exception(message)
} else {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}
}
Expand All @@ -101,15 +101,15 @@ class ItemTagRepositoryImpl @Inject constructor(
try {
nativeAppTemplateApiError = response.deserializeErrorBody<ItemTag, NativeAppTemplateApiError>()
} catch (exception: Exception) {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}

if (nativeAppTemplateApiError != null) {
val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
throw Exception(message)
} else {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}
}
Expand All @@ -124,7 +124,7 @@ class ItemTagRepositoryImpl @Inject constructor(
val response = api.updateItemTag(
mtcPreferencesDataSource.userData.first().accountId,
id,
itemTagBody
itemTagBody,
)

response.suspendOnSuccess {
Expand All @@ -136,15 +136,15 @@ class ItemTagRepositoryImpl @Inject constructor(
try {
nativeAppTemplateApiError = response.deserializeErrorBody<ItemTag, NativeAppTemplateApiError>()
} catch (exception: Exception) {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}

if (nativeAppTemplateApiError != null) {
val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
throw Exception(message)
} else {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}
}
Expand All @@ -163,15 +163,15 @@ class ItemTagRepositoryImpl @Inject constructor(
try {
nativeAppTemplateApiError = response.deserializeErrorBody<Status, NativeAppTemplateApiError>()
} catch (exception: Exception) {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}

if (nativeAppTemplateApiError != null) {
val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
throw Exception(message)
} else {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}
}
Expand All @@ -190,15 +190,15 @@ class ItemTagRepositoryImpl @Inject constructor(
try {
nativeAppTemplateApiError = response.deserializeErrorBody<ItemTag, NativeAppTemplateApiError>()
} catch (exception: Exception) {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}

if (nativeAppTemplateApiError != null) {
val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
throw Exception(message)
} else {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}
}
Expand All @@ -217,15 +217,15 @@ class ItemTagRepositoryImpl @Inject constructor(
try {
nativeAppTemplateApiError = response.deserializeErrorBody<ItemTag, NativeAppTemplateApiError>()
} catch (exception: Exception) {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}

if (nativeAppTemplateApiError != null) {
val message= "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
val message = "${nativeAppTemplateApiError.message} [Status: ${nativeAppTemplateApiError.code}]"
throw Exception(message)
} else {
val message= "Not processable error(${message()})."
val message = "Not processable error(${message()})."
throw Exception(message)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ interface AccountPasswordApi {
@PATCH("{account_id}/api/v1/shopkeeper/account/password")
suspend fun updateAccountPassword(
@Path("account_id") accountId: String,
@Body data: UpdatePasswordBody
@Body data: UpdatePasswordBody,
): ApiResponse<Status>

companion object {
fun create(retroFit: Retrofit): AccountPasswordApi = retroFit.create(
AccountPasswordApi::class.java
AccountPasswordApi::class.java,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import kotlinx.coroutines.flow.Flow

interface AccountPasswordRepository {
fun updateAccountPassword(
updatePasswordBody: UpdatePasswordBody
updatePasswordBody: UpdatePasswordBody,
): Flow<Boolean>
}
Loading
Loading