Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
๐Ÿš€ Feature Updates

- ๊ทธ๋ž˜ํ”„ ๋ฐ์ดํ„ฐ ๋ณ€ํ™˜ ๋ฒ„๊ทธ ์ˆ˜์ •
- ๋‹ค์ด๋‚˜๋ฏน ํ…Œ๋งˆ ์ง€์›
- ์ƒํ’ˆ ์ •๋ณด๋กœ๊นŒ์ง€ ๋”ฅ๋งํฌ ์ง€์›
- ์ ‘๊ทผ์„ฑ ๊ฐœ์„  (Talkback ์ „๋ถ€ ์ง€์›)
- ํ‘ธ์‹œ ์•Œ๋ฆผ ์ง€์›

๐ŸšงNotice

ํ˜„์žฌ ์•Œ๋ฆผ ์„ค์ • ํ† ๊ธ€์— ๋ฒ„๊ทธ๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ๋น ๋ฅธ ์‹œ์ผ ๋‚ด์— ์ˆ˜์ •ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

Co-Authored-By: EunhoKang <[email protected]>
Co-Authored-By: ootr47 <[email protected]>
Co-Authored-By: ์†๋ฌธ๊ธฐ <[email protected]>
Co-Authored-By: ByeongIk Choi <[email protected]>
  • Loading branch information
5 people committed Dec 8, 2023
1 parent fda3a6d commit fd7b149
Show file tree
Hide file tree
Showing 172 changed files with 5,097 additions and 1,605 deletions.
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

1 change: 1 addition & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea/deploymentTargetDropDown.xml
.DS_Store
/build
/captures
Expand Down
6 changes: 2 additions & 4 deletions android/.idea/gradle.xml

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

10 changes: 10 additions & 0 deletions android/.idea/migrations.xml

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

14 changes: 9 additions & 5 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ android {
applicationId = "app.priceguard"
minSdk = 29
targetSdk = 34
versionCode = 2
versionName = "0.1.1"
versionCode = 3
versionName = "0.2.0"
versionCode = 4
versionName = "0.3.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -64,6 +62,7 @@ dependencies {
implementation("com.google.firebase:firebase-analytics")
implementation("com.google.firebase:firebase-crashlytics")
implementation("com.google.firebase:firebase-perf")
implementation("com.google.firebase:firebase-messaging")

// Android
implementation("androidx.core:core-ktx:1.12.0")
Expand Down Expand Up @@ -106,8 +105,13 @@ dependencies {
// Pull to Refresh
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")

// Worker
implementation("androidx.work:work-runtime-ktx:2.9.0")
implementation("androidx.hilt:hilt-work:1.1.0")
kapt("androidx.hilt:hilt-compiler:1.1.0")

// Material chart
implementation(project(":materialchart"))
implementation("app.priceguard:materialchart:0.1.2")
}

kapt {
Expand Down
49 changes: 47 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
android:supportsRtl="true"
android:theme="@style/Theme.PriceGuard"
tools:targetApi="34">

<meta-data
android:name="com.google.firebase.messaging.price_notification"
android:value="@string/price_notification" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_priceguard_notification" />

<activity
android:name=".ui.additem.link.LinkHelperWebViewActivity"
android:exported="false" />
<activity
android:name=".ui.splash.SplashScreenActivity"
android:exported="true">
Expand All @@ -37,16 +48,50 @@
android:exported="false" />
<activity
android:name=".ui.additem.AddItemActivity"
android:exported="false" />
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.SEND" />

<category android:name="android.intent.category.DEFAULT" />

<data android:mimeType="text/plain" />
</intent-filter>
</activity>
<activity
android:name=".ui.detail.DetailActivity"
android:exported="false" />
android:exported="true"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:host="product"
android:scheme="priceguard" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.PriceGuard.WithActionBar" />
<activity
android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.PriceGuard.WithActionBar" />

<service
android:name=".service.PriceGuardFirebaseMessagingService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove" />

</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package app.priceguard.data

import app.priceguard.data.dto.PriceDataDTO
import app.priceguard.data.graph.ProductChartData
import app.priceguard.materialchart.data.GraphMode

class GraphDataConverter {

fun toDataset(priceData: List<PriceDataDTO>?): List<ProductChartData> {
priceData ?: return listOf()
if (priceData.isEmpty()) {
return listOf()
}

val dataList = mutableListOf<ProductChartData>()
priceData.forEach { dto ->
dto.time ?: return@forEach
dto.price ?: return@forEach
dto.isSoldOut ?: return@forEach
dataList.add(
ProductChartData(
x = dto.time / 1000,
y = dto.price.toFloat(),
valid = dto.isSoldOut.not()
)
)
}

return dataList.toList()
}

fun packWithEdgeData(
list: List<ProductChartData>,
period: GraphMode = GraphMode.DAY
): List<ProductChartData> {
val currentTime = getCurrentTime()
val startTime = getStartTime(period, currentTime)
val sortedList = list.sortedBy { it.x }
val filteredList = sortedList.filter { it.x in startTime..currentTime }
val sievedList = sortedList.filter { it.x !in startTime..currentTime }
val startData = if (sievedList.none()) {
list.first()
} else {
sievedList.last()
}

return if (filteredList.isEmpty()) {
listOf(
ProductChartData(startTime, startData.y, startData.valid),
ProductChartData(currentTime, list.last().y, list.last().valid)
)
} else {
listOf(
ProductChartData(
startTime,
startData.y,
startData.valid
)
) + filteredList + ProductChartData(
currentTime,
filteredList.last().y,
filteredList.last().valid
)
}
}

private fun getStartTime(period: GraphMode, currentTime: Float = getCurrentTime()): Float {
return when (period) {
GraphMode.DAY -> {
currentTime - DAY
}

GraphMode.WEEK -> {
currentTime - WEEK
}

GraphMode.MONTH -> {
currentTime - MONTH
}

GraphMode.QUARTER -> {
currentTime - QUARTER
}
}
}

private fun getCurrentTime(): Float {
return (System.currentTimeMillis() / 1000).toFloat()
}

companion object {
const val DAY = 86400
const val WEEK = DAY * 7
const val MONTH = DAY * 31
const val QUARTER = MONTH * 3
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.priceguard.data.datastore

interface ConfigDataSource {
suspend fun saveDynamicMode(mode: Int)
suspend fun saveDarkMode(mode: Int)
suspend fun getDynamicMode(): Int?
suspend fun getDarkMode(): Int?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package app.priceguard.data.datastore

import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.intPreferencesKey
import app.priceguard.di.ConfigQualifier
import javax.inject.Inject
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map

class ConfigDataSourceImpl @Inject constructor(
@ConfigQualifier private val dataStore: DataStore<Preferences>
) : ConfigDataSource {

private val dynamicMode = intPreferencesKey("dynamic_mode")
private val darkMode = intPreferencesKey("dark_mode")

override suspend fun saveDynamicMode(mode: Int) {
dataStore.edit { preferences ->
preferences[dynamicMode] = mode
}
}

override suspend fun saveDarkMode(mode: Int) {
dataStore.edit { preferences ->
preferences[darkMode] = mode
}
}

override suspend fun getDynamicMode(): Int? {
return dataStore.data.map { preferences ->
preferences[dynamicMode]
}.first()
}

override suspend fun getDarkMode(): Int? {
return dataStore.data.map { preferences ->
preferences[darkMode]
}.first()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.core.edit
import androidx.datastore.preferences.core.stringPreferencesKey
import app.priceguard.di.TokensQualifier
import javax.inject.Inject
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map

class TokenDataSourceImpl @Inject constructor(private val dataStore: DataStore<Preferences>) : TokenDataSource {
class TokenDataSourceImpl @Inject constructor(
@TokensQualifier private val dataStore: DataStore<Preferences>
) : TokenDataSource {

private val accessTokenKey = stringPreferencesKey("access_token")
private val refreshTokenKey = stringPreferencesKey("refresh_token")
Expand Down
23 changes: 0 additions & 23 deletions android/app/src/main/java/app/priceguard/data/dto/LoginResponse.kt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package app.priceguard.data.dto
package app.priceguard.data.dto.add

import kotlinx.serialization.Serializable

Expand Down
Loading

0 comments on commit fd7b149

Please sign in to comment.