Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Initial commit
  • Loading branch information
ajou4095 committed Jan 16, 2024
1 parent bff7461 commit d74b255
Show file tree
Hide file tree
Showing 84 changed files with 267 additions and 353 deletions.
44 changes: 0 additions & 44 deletions .github/workflows/readme.yml

This file was deleted.

9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Android-Template
# 장부 관리 앱

[![Android CI](https://github.com/ajou4095/template-android/actions/workflows/android.yml/badge.svg?branch=main)](https://github.com/ajou4095/template-android/actions/workflows/android.yml)

## Description

Android 개발 시 사용하는 template repository 입니다.
복사 후 template 단어를 전체 검색해, 프로젝트 명으로 변경해주세요. (대소문자 주의해서 폴더까지 변경 부탁드립니다.)
[![Android CI](https://github.com/dnd-side-project/dnd-10th-8-android/actions/workflows/android.yml/badge.svg?branch=main)](https://github.com/dnd-side-project/dnd-10th-8-android/actions/workflows/android.yml)

### Build

Expand Down
37 changes: 0 additions & 37 deletions README_TEMPLATE.md

This file was deleted.

8 changes: 4 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ plugins {
}

android {
namespace = "com.ray.template"
namespace = "ac.dnd.bookkeeping.android"
compileSdk = libs.versions.sdk.compile.get().toInt()

defaultConfig {
applicationId = "com.ray.template"
applicationId = "ac.dnd.bookkeeping.android"
minSdk = libs.versions.sdk.min.get().toInt()
targetSdk = libs.versions.sdk.target.get().toInt()
versionCode = libs.versions.app.versioncode.get().toInt()
Expand Down Expand Up @@ -62,10 +62,10 @@ sentry {
debug = false

// The slug of the Sentry organization to use for uploading proguard mappings/source contexts.
org = "ray-sample"
org = "dnd108-72"

// The slug of the Sentry project to use for uploading proguard mappings/source contexts.
projectName = "ray-sample-android"
projectName = "android"

// The authentication token to use for uploading proguard mappings/source contexts.
// WARNING: Do not expose this token in your build.gradle files, but rather set an environment
Expand Down
4 changes: 2 additions & 2 deletions app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xmlns:tools="http://schemas.android.com/tools">

<application
android:name=".TemplateDebugApplication"
android:name=".BookkeepingDebugApplication"
android:icon="@drawable/ic_launcher"
tools:node="merge"
tools:replace="android:name" />

</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.ray.template
package ac.dnd.bookkeeping.android

import timber.log.Timber

class TemplateDebugApplication : TemplateApplication() {
class BookkeepingDebugApplication : BookkeepingApplication() {
override fun onCreate() {
super.onCreate()
Timber.plant(Timber.DebugTree())
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".TemplateApplication"
android:name=".BookkeepingApplication"
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/Template">
android:theme="@style/Bookkeeping">

<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="${sentryDsnToken}" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ray.template
package ac.dnd.bookkeeping.android

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
open class TemplateApplication : Application()
open class BookkeepingApplication : Application()
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">template</string>
</resources>
<string name="app_name">장부 관리 앱</string>
</resources>
2 changes: 1 addition & 1 deletion common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

android {
namespace = "com.ray.template.common"
namespace = "ac.dnd.bookkeeping.android.common"
compileSdk = libs.versions.sdk.compile.get().toInt()

defaultConfig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.ray.template.common
package ac.dnd.bookkeeping.android.common

fun Boolean?.orFalse(): Boolean {
return this ?: false
}

fun Boolean?.orTrue(): Boolean {
return this ?: true
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ray.template.common
package ac.dnd.bookkeeping.android.common

import android.os.Bundle
import androidx.lifecycle.SavedStateHandle
Expand Down Expand Up @@ -70,4 +70,4 @@ fun Bundle?.getStringOrDefault(
defaultValue: String? = null
): String {
return (this?.getString(key) ?: defaultValue).orEmpty()
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ray.template.common
package ac.dnd.bookkeeping.android.common

fun Double?.orZero(): Double {
return this ?: 0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.ray.template.common
package ac.dnd.bookkeeping.android.common

fun Char?.orEmpty(): Char {
return this ?: Char.MIN_VALUE
}
}
2 changes: 1 addition & 1 deletion data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
}

android {
namespace = "com.ray.template.data"
namespace = "ac.dnd.bookkeeping.android.data"
compileSdk = libs.versions.sdk.compile.get().toInt()

defaultConfig {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ray.template.data.remote.network.di
package ac.dnd.bookkeeping.android.data.remote.network.di

import dagger.Module
import dagger.Provides
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package ac.dnd.bookkeeping.android.data.di

import ac.dnd.bookkeeping.android.data.repository.bookkeeping.MockBookkeepingRepository
import ac.dnd.bookkeeping.android.data.repository.authentication.MockAuthenticationRepository
import ac.dnd.bookkeeping.android.domain.repository.AuthenticationRepository
import ac.dnd.bookkeeping.android.domain.repository.BookkeepingRepository
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
internal abstract class RepositoryModule {
@Binds
@Singleton
abstract fun bindsBookkeepingRepository(
mockBookkeepingRepository: MockBookkeepingRepository
): BookkeepingRepository

@Binds
@Singleton
abstract fun bindsAuthenticationRepository(
authenticationRepository: MockAuthenticationRepository
): AuthenticationRepository
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ray.template.data.remote.local
package ac.dnd.bookkeeping.android.data.remote.local

import android.content.Context
import androidx.core.content.edit
Expand Down Expand Up @@ -96,6 +96,6 @@ class SharedPreferencesManager(context: Context) {
}

companion object {
const val SHARED_PREFERENCE_FILE_NAME = "com.ray.template.prefs"
const val SHARED_PREFERENCE_FILE_NAME = "ac.dnd.bookkeeping.android.prefs"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.ray.template.data.remote.local.di
package ac.dnd.bookkeeping.android.data.remote.local.di

import android.content.Context
import com.ray.template.data.remote.local.SharedPreferencesManager
import ac.dnd.bookkeeping.android.data.remote.local.SharedPreferencesManager
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ac.dnd.bookkeeping.android.data.remote.mapper

interface DataMapper<D> {
fun toDomain(): D
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.ray.template.data.remote.network.api
package ac.dnd.bookkeeping.android.data.remote.network.api

import com.ray.template.data.remote.network.di.NoAuthHttpClient
import com.ray.template.data.remote.network.environment.BaseUrlProvider
import com.ray.template.data.remote.network.environment.ErrorMessageMapper
import com.ray.template.data.remote.network.model.authentication.GetAccessTokenReq
import com.ray.template.data.remote.network.model.authentication.GetAccessTokenRes
import com.ray.template.data.remote.network.util.convert
import ac.dnd.bookkeeping.android.data.remote.network.di.NoAuthHttpClient
import ac.dnd.bookkeeping.android.data.remote.network.environment.BaseUrlProvider
import ac.dnd.bookkeeping.android.data.remote.network.environment.ErrorMessageMapper
import ac.dnd.bookkeeping.android.data.remote.network.model.authentication.GetAccessTokenReq
import ac.dnd.bookkeeping.android.data.remote.network.model.authentication.GetAccessTokenRes
import ac.dnd.bookkeeping.android.data.remote.network.util.convert
import io.ktor.client.HttpClient
import io.ktor.client.request.post
import io.ktor.client.request.setBody
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.ray.template.data.remote.network.api
package ac.dnd.bookkeeping.android.data.remote.network.api

import com.ray.template.data.remote.network.di.AuthHttpClient
import com.ray.template.data.remote.network.environment.BaseUrlProvider
import com.ray.template.data.remote.network.environment.ErrorMessageMapper
import com.ray.template.data.remote.network.model.sample.SampleInformationRes
import com.ray.template.data.remote.network.util.convert
import ac.dnd.bookkeeping.android.data.remote.network.di.AuthHttpClient
import ac.dnd.bookkeeping.android.data.remote.network.environment.BaseUrlProvider
import ac.dnd.bookkeeping.android.data.remote.network.environment.ErrorMessageMapper
import ac.dnd.bookkeeping.android.data.remote.network.model.bookkeeping.BookkeepingInformationRes
import ac.dnd.bookkeeping.android.data.remote.network.util.convert
import io.ktor.client.HttpClient
import io.ktor.client.request.get
import io.ktor.client.request.parameter

class SampleApi(
class BookkeepingApi(
@AuthHttpClient private val client: HttpClient,
private val baseUrlProvider: BaseUrlProvider,
private val errorMessageMapper: ErrorMessageMapper
Expand All @@ -21,7 +21,7 @@ class SampleApi(
apiKey: String,
title: String,
artist: String
): Result<SampleInformationRes> {
): Result<BookkeepingInformationRes> {
return client.get("$baseUrl/ws/1.1") {
parameter("api_key", apiKey)
parameter("q_track", title)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.ray.template.data.remote.network.di
package ac.dnd.bookkeeping.android.data.remote.network.di

import com.ray.template.data.remote.network.environment.ErrorMessageMapper
import com.ray.template.data.remote.network.api.SampleApi
import com.ray.template.data.remote.network.environment.BaseUrlProvider
import ac.dnd.bookkeeping.android.data.remote.network.environment.ErrorMessageMapper
import ac.dnd.bookkeeping.android.data.remote.network.api.BookkeepingApi
import ac.dnd.bookkeeping.android.data.remote.network.environment.BaseUrlProvider
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand All @@ -16,12 +16,12 @@ internal object ApiModule {

@Provides
@Singleton
fun provideSampleApi(
fun provideBookkeepingApi(
client: HttpClient,
baseUrlProvider: BaseUrlProvider,
errorMessageMapper: ErrorMessageMapper
): SampleApi {
return SampleApi(
): BookkeepingApi {
return BookkeepingApi(
client,
baseUrlProvider,
errorMessageMapper
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.ray.template.data.remote.network.di
package ac.dnd.bookkeeping.android.data.remote.network.di

import dagger.BindsOptionalOf
import dagger.Module
Expand Down
Loading

0 comments on commit d74b255

Please sign in to comment.