Skip to content

Commit

Permalink
Merge pull request #682 from team-aliens/release/v1.3.0
Browse files Browse the repository at this point in the history
Release/v1.3.0
  • Loading branch information
JunJaBoy authored Jun 4, 2024
2 parents 052a417 + 0ee56d1 commit 42ef6b5
Show file tree
Hide file tree
Showing 55 changed files with 959 additions and 439 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()

versionCode = 11
versionName = "v1.3.2"
versionCode = 13
versionName = "1.3.4"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
8 changes: 6 additions & 2 deletions app/src/main/java/team/aliens/dms/android/app/DmsApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import team.aliens.dms.android.feature.editpassword.EditPasswordViewModel
import team.aliens.dms.android.feature.editpassword.navigation.EditPasswordNavGraph
import team.aliens.dms.android.feature.outing.OutingViewModel
import team.aliens.dms.android.feature.outing.navigation.OutingNavGraph
import team.aliens.dms.android.feature.resetpassword.ResetPasswordViewModel
import team.aliens.dms.android.feature.resetpassword.navigation.ResetPasswordNavGraph
import team.aliens.dms.android.feature.signup.SignUpViewModel
import team.aliens.dms.android.feature.signup.TermsUrl
import team.aliens.dms.android.feature.signup.navigation.SignUpNavGraph
Expand Down Expand Up @@ -65,10 +67,12 @@ fun DmsApp(
}
hiltViewModel<OutingViewModel>(parentEntry)
}
dependency(OutingNavGraph) {

dependency(ResetPasswordNavGraph) {
val parentEntry = remember(navBackStackEntry) {
navController.getBackStackEntry(OutingNavGraph.route)
navController.getBackStackEntry(ResetPasswordNavGraph.route)
}
hiltViewModel<ResetPasswordViewModel>(parentEntry)
}
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ object NetworkConfigModule {
method = HttpMethod.GET,
path = "/schools/code",
),

// File
HttpRequest(
method = HttpMethod.GET,
path = "/files/url",
)
)
}

Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/ProjectPaths.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ object ProjectPaths {
const val PROJECT = ":core:project"
const val SCHOOL = ":core:school"
const val UI = ":core:ui"
const val FILE = ":core:file"
}

object Shared {
Expand All @@ -22,5 +23,6 @@ object ProjectPaths {
const val MODEL = ":shared:model"
const val VALIDATOR = ":shared:validator"
const val TIMER = ":shared:timer"
const val FILE = ":shared:file"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import androidx.compose.ui.Modifier
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DmsTopAppBar(
title: @Composable () -> Unit,
modifier: Modifier = Modifier,
title: @Composable () -> Unit = {},
navigationIcon: @Composable () -> Unit = {},
actions: @Composable RowScope.() -> Unit = {},
windowInsets: WindowInsets = TopAppBarDefaults.windowInsets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ object DmsIcon {
val LogoDark = R.drawable.ic_logo_dark
val LogoLight = R.drawable.ic_logo_light
val Lunch = R.drawable.ic_lunch
val MyPage = R.drawable.ic_my_page
val MyPage = R.drawable.ic_person
val Notice = R.drawable.ic_notice
val Palette = R.drawable.ic_palette
val PasswordInvisible = R.drawable.ic_password_invisible
Expand All @@ -34,4 +34,6 @@ object DmsIcon {
val Visible = R.drawable.ic_visible
val Warning = R.drawable.ic_warning
val BlueNotice = R.drawable.ic_blue_notice
val Edit = R.drawable.ic_edit
val ProfileDefault = R.drawable.ic_profile_default
}
13 changes: 13 additions & 0 deletions core/design-system/src/main/res/drawable/ic_edit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="14dp"
android:height="14dp"
android:viewportWidth="14"
android:viewportHeight="14">
<group>
<clip-path
android:pathData="M0,0h14v14h-14z"/>
<path
android:pathData="M9.175,5.65L8.35,4.825L2.917,10.259V11.083H3.741L9.175,5.65ZM10,4.825L10.824,4.001L10,3.176L9.175,4.001L10,4.825ZM4.225,12.25H1.75V9.775L9.587,1.938C9.696,1.829 9.845,1.767 10,1.767C10.154,1.767 10.302,1.829 10.412,1.938L12.062,3.588C12.172,3.698 12.233,3.846 12.233,4.001C12.233,4.155 12.172,4.304 12.062,4.413L4.225,12.25H4.225Z"
android:fillColor="#999999"/>
</group>
</vector>
9 changes: 0 additions & 9 deletions core/design-system/src/main/res/drawable/ic_my_page.xml

This file was deleted.

5 changes: 5 additions & 0 deletions core/design-system/src/main/res/drawable/ic_person.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:tint="#FFFFFF" android:viewportHeight="24" android:viewportWidth="24" android:width="24dp">

<path android:fillColor="@android:color/white" android:pathData="M12,12c2.21,0 4,-1.79 4,-4s-1.79,-4 -4,-4 -4,1.79 -4,4 1.79,4 4,4zM12,14c-2.67,0 -8,1.34 -8,4v1c0,0.55 0.45,1 1,1h14c0.55,0 1,-0.45 1,-1v-1c0,-2.66 -5.33,-4 -8,-4z"/>

</vector>
12 changes: 6 additions & 6 deletions core/design-system/src/main/res/drawable/ic_plus.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
android:width="30dp"
android:height="30dp"
android:viewportWidth="30"
android:viewportHeight="30">
<path
android:pathData="M6.545,12.563H11.141V17.158C11.141,17.625 11.525,18.017 12,18.017C12.474,18.017 12.858,17.625 12.858,17.158V12.563H17.454C17.921,12.563 18.313,12.178 18.313,11.704C18.313,11.229 17.921,10.845 17.454,10.845H12.858V6.249C12.858,5.782 12.474,5.391 12,5.391C11.525,5.391 11.141,5.782 11.141,6.249V10.845H6.545C6.078,10.845 5.687,11.229 5.687,11.704C5.687,12.178 6.078,12.563 6.545,12.563Z"
android:fillColor="#1C1C1E"/>
android:pathData="M8.183,15.703H13.927V21.447C13.927,22.031 14.407,22.521 15.001,22.521C15.594,22.521 16.074,22.031 16.074,21.447V15.703H21.819C22.402,15.703 22.892,15.223 22.892,14.63C22.892,14.036 22.402,13.556 21.819,13.556H16.074V7.812C16.074,7.228 15.594,6.738 15.001,6.738C14.407,6.738 13.927,7.228 13.927,7.812V13.556H8.183C7.599,13.556 7.109,14.036 7.109,14.63C7.109,15.223 7.599,15.703 8.183,15.703Z"
android:fillColor="#ffffff"/>
</vector>
16 changes: 16 additions & 0 deletions core/design-system/src/main/res/drawable/ic_profile_default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="150dp"
android:height="153dp"
android:viewportWidth="150"
android:viewportHeight="153">
<path
android:pathData="M75,75m-75,0a75,75 0,1 1,150 0a75,75 0,1 1,-150 0"
android:fillColor="#DDDDDD"/>
<group>
<clip-path
android:pathData="M74.91,93.42C88.8,93.42 100.59,81.06 100.59,65.06C100.59,49.45 88.74,37.47 74.91,37.47C61.02,37.47 49.1,49.64 49.16,65.19C49.16,81.06 60.95,93.42 74.91,93.42ZM35.15,152.68H114.54C125.06,152.68 128.69,149.49 128.69,143.63C128.69,127.26 107.92,104.7 74.84,104.7C41.84,104.7 21,127.26 21,143.63C21,149.49 24.63,152.68 35.15,152.68Z"/>
<path
android:pathData="M75,75m-75,0a75,75 0,1 1,150 0a75,75 0,1 1,-150 0"
android:fillColor="#ffffff"/>
</group>
</vector>
File renamed without changes.
43 changes: 43 additions & 0 deletions core/file/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
}

android {
namespace = "team.aliens.dms.android.core.file"
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = Versions.java
targetCompatibility = Versions.java
}
kotlinOptions {
jvmTarget = Versions.java.toString()
}
}

dependencies {

implementation(libs.androidx.core)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso)
}
Empty file added core/file/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions core/file/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 team.aliens.dms.android.core.file

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("team.aliens.dms.android.core.file.test", appContext.packageName)
}
}
4 changes: 4 additions & 0 deletions core/file/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>
78 changes: 78 additions & 0 deletions core/file/src/main/java/team/aliens/dms/android/core/file/File.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package team.aliens.dms.android.core.file

import android.content.Context
import android.net.Uri
import android.os.Environment
import android.provider.OpenableColumns
import java.io.File
import java.io.FileOutputStream

object File {
fun toFile(
context: Context,
uri: Uri,
): File {
val fileName = getFileName(
context = context,
uri = uri,
)
val file = createTempFile(
context = context,
fileName = fileName,
)

copyToFile(
context = context,
uri = uri,
file = file,
)

return File(file.absolutePath)
}

private fun copyToFile(
context: Context,
uri: Uri,
file: File,
) {
val inputStream = context.contentResolver.openInputStream(uri)
val outputStream = FileOutputStream(file)

val buffer = ByteArray(4 * 1024)
while (true) {
val byteCount = inputStream!!.read(buffer)
if (byteCount < 0) break
outputStream.write(buffer, 0, byteCount)
}

inputStream.close()
}

private fun getFileName(
uri: Uri,
context: Context,
): String {
val cursor = context.contentResolver.query(uri, null, null, null, null)
var fileName = ""

cursor?.run {
cursor.moveToFirst()
val index = getColumnIndex(OpenableColumns.DISPLAY_NAME)
if (index != -1) {
fileName = cursor.getString(index)
}
}
cursor?.close()

return fileName
}

private fun createTempFile(
context: Context,
fileName: String,
): File {
val storageDir = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)

return File(storageDir, fileName)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package team.aliens.dms.android.core.file

import org.junit.Test

import org.junit.Assert.*

/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import okhttp3.Response
import team.aliens.dms.android.core.jwt.JwtProvider
import team.aliens.dms.android.core.jwt.network.IgnoreRequests
import team.aliens.dms.android.core.network.toHttpMethod
import team.aliens.dms.android.core.network.util.ResourceKeys
import javax.inject.Inject

class JwtInterceptor @Inject constructor(
Expand Down Expand Up @@ -34,6 +35,10 @@ class JwtInterceptor @Inject constructor(
val path = this@shouldBeIgnored.url.encodedPath
val method = this@shouldBeIgnored.method.toHttpMethod()

path.contains(ignoreRequest.path) && method == ignoreRequest.method
path.contains(ignoreRequest.path) && method == ignoreRequest.method ||checkS3Request(url = this@shouldBeIgnored.url.toString())
}

private fun checkS3Request(url: String): Boolean {
return url.contains(ResourceKeys.IMAGE_URL)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package team.aliens.dms.android.core.network.util

object RequestType {
const val Binary = "application/octet-stream"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package team.aliens.dms.android.core.network.util

object ResourceKeys {
const val IMAGE_URL = "https://image-dms.s3.ap-northeast-2.amazonaws.com/"
}
Loading

0 comments on commit 42ef6b5

Please sign in to comment.