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
20 changes: 19 additions & 1 deletion NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ https://creativecommons.org/licenses/by/4.0/
================================================================================
3. Android Open Source Project (AndroidX, Jetpack Compose, Material Components)
================================================================================
androidx.core, androidx.lifecycle, androidx.activity,
androidx.core, androidx.lifecycle, androidx.activity, androidx.fragment,
androidx.compose.* , androidx.compose.material3

Copyright (C) The Android Open Source Project
Expand Down Expand Up @@ -173,5 +173,23 @@ SOFTWARE.

================================================================================

9. Google Play 인앱 업데이트 라이브러리 (#500)
--------------------------------------------
com.google.android.play:app-update, com.google.android.play:core-common
Play 스토어에서 설치한 앱이 도움말의 '업데이트 확인'에서 휴대폰의 Play 스토어 앱에
새 버전이 있는지 물을 때 씁니다. 이 라이브러리는 권한(인터넷 권한 포함)을 더하지 않습니다.

Copyright (C) Google LLC
Play Core Software Development Kit Terms of Service
https://developer.android.com/guide/playcore/license

com.google.android.gms:play-services-tasks, com.google.android.gms:play-services-basement
(위 라이브러리가 함께 가져옵니다)
Copyright (C) Google LLC
Android Software Development Kit License
https://developer.android.com/studio/terms.html

================================================================================

테스트에만 쓰이는 의존성(JUnit, Espresso, org.json 등)은 APK 에 포함되지 않으므로
위 목록에서 제외했습니다.
7 changes: 7 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
}.getOrElse("true"))

if (buildingBundle) {
ndk { abiFilters += shippedAbis }

Check warning on line 37 in app/build.gradle.kts

View workflow job for this annotation

GitHub Actions / 빌드 · 유닛 테스트 · APK

Lint ChromeOsAbiSupport

Missing x86_64 ABI support for ChromeOS
}

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -137,7 +137,7 @@
// App Bundle 은 스토어가 기기에 맞는 ABI 만 골라 보내므로 분할이 필요 없다(맨 위 buildingBundle).
isEnable = !buildingBundle
reset()
include(*shippedAbis.toTypedArray())

Check warning on line 140 in app/build.gradle.kts

View workflow job for this annotation

GitHub Actions / 빌드 · 유닛 테스트 · APK

Lint ChromeOsAbiSupport

Missing x86_64 ABI support for ChromeOS
isUniversalApk = false
}
}
Expand Down Expand Up @@ -198,10 +198,10 @@
}

dependencies {
implementation("androidx.core:core-ktx:1.19.0")

Check warning on line 201 in app/build.gradle.kts

View workflow job for this annotation

GitHub Actions / 빌드 · 유닛 테스트 · APK

Lint GradleDependency

A newer version of androidx.core:core-ktx than 1.19.0 is available: 1.19.1
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.11.0")

Check warning on line 202 in app/build.gradle.kts

View workflow job for this annotation

GitHub Actions / 빌드 · 유닛 테스트 · APK

Lint GradleDependency

A newer version of androidx.lifecycle:lifecycle-runtime-ktx than 2.11.0 is available: 2.11.1
implementation("androidx.activity:activity-compose:1.13.0")
implementation(platform("androidx.compose:compose-bom:2026.09.00"))

Check warning on line 204 in app/build.gradle.kts

View workflow job for this annotation

GitHub Actions / 빌드 · 유닛 테스트 · APK

Lint GradleDependency

A newer version of androidx.compose:compose-bom than 2026.09.00 is available: 2026.11.01
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
Expand All @@ -215,12 +215,19 @@
//noinspection NewerVersionAvailable
implementation("com.microsoft.onnxruntime:onnxruntime-android:1.22.0")

// 도움말의 '업데이트 확인'(#500). Play 스토어에서 설치한 앱이 휴대폰의 Play 스토어 앱에 새 버전이 있는지 묻는다.
// 앱이 인터넷에 접속하지 않고 Play 스토어 앱과 기기 안에서 주고받으며, 권한을 더하지 않는다(InternetPermissionTest).
implementation("com.google.android.play:app-update:2.1.0")
// app-update 가 끌고 오는 play-services-basement 는 androidx.fragment 1.0.0 을 가져온다. fragment 가 1.3.0 보다 낮으면
// registerForActivityResult 가 틀리게 동작할 수 있어 릴리스 lint 가 막는다(InvalidFragmentVersionForActivityResult). 새 판으로 올려 둔다.
implementation("androidx.fragment:fragment:1.9.1")

testImplementation("junit:junit:4.13.2")
// Real org.json for JVM unit tests (the Android stub is not mocked by default)
testImplementation("org.json:json:20260814")
androidTestImplementation("androidx.test.ext:junit:1.3.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.7.0")
androidTestImplementation(platform("androidx.compose:compose-bom:2026.09.00"))

Check warning on line 230 in app/build.gradle.kts

View workflow job for this annotation

GitHub Actions / 빌드 · 유닛 테스트 · APK

Lint GradleDependency

A newer version of androidx.compose:compose-bom than 2026.09.00 is available: 2026.11.01
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
androidTestImplementation("androidx.test:runner:1.7.0")
androidTestImplementation("androidx.test:rules:1.7.0")
Expand Down
20 changes: 19 additions & 1 deletion app/src/main/assets/licenses/NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ https://creativecommons.org/licenses/by/4.0/
================================================================================
3. Android Open Source Project (AndroidX, Jetpack Compose, Material Components)
================================================================================
androidx.core, androidx.lifecycle, androidx.activity,
androidx.core, androidx.lifecycle, androidx.activity, androidx.fragment,
androidx.compose.* , androidx.compose.material3

Copyright (C) The Android Open Source Project
Expand Down Expand Up @@ -173,5 +173,23 @@ SOFTWARE.

================================================================================

9. Google Play 인앱 업데이트 라이브러리 (#500)
--------------------------------------------
com.google.android.play:app-update, com.google.android.play:core-common
Play 스토어에서 설치한 앱이 도움말의 '업데이트 확인'에서 휴대폰의 Play 스토어 앱에
새 버전이 있는지 물을 때 씁니다. 이 라이브러리는 권한(인터넷 권한 포함)을 더하지 않습니다.

Copyright (C) Google LLC
Play Core Software Development Kit Terms of Service
https://developer.android.com/guide/playcore/license

com.google.android.gms:play-services-tasks, com.google.android.gms:play-services-basement
(위 라이브러리가 함께 가져옵니다)
Copyright (C) Google LLC
Android Software Development Kit License
https://developer.android.com/studio/terms.html

================================================================================

테스트에만 쓰이는 의존성(JUnit, Espresso, org.json 등)은 APK 에 포함되지 않으므로
위 목록에서 제외했습니다.
74 changes: 73 additions & 1 deletion app/src/main/java/com/example/soundvisualizer/help/HelpTab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.LiveRegionMode
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.liveRegion
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
Expand All @@ -59,6 +62,7 @@ import com.example.soundvisualizer.SecondaryTextColor
import com.example.soundvisualizer.SettingsExpander
import com.example.soundvisualizer.SettingsManager
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

private val BodySize = 15.sp
Expand Down Expand Up @@ -187,11 +191,12 @@ fun HelpTab() {
Text(stringResource(R.string.help_about_team), fontSize = BodySize, color = PrimaryTextColor)
Text(stringResource(R.string.help_about_license), fontSize = 14.sp, lineHeight = 21.sp, color = SecondaryTextColor)
}
UpdateButton()
OutlinedButton(
onClick = { showLicenses = true },
border = BorderStroke(1.dp, AccentColor),
shape = RoundedCornerShape(14.dp),
modifier = Modifier.fillMaxWidth().padding(top = 16.dp).heightIn(min = 48.dp)
modifier = Modifier.fillMaxWidth().padding(top = 10.dp).heightIn(min = 48.dp)
) {
Text(stringResource(R.string.help_licenses_button), fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center, color = AccentColor)
}
Expand All @@ -208,6 +213,73 @@ fun HelpTab() {
}
}

/**
* 업데이트 확인(#500). 앱에는 인터넷 권한이 없어 직접 묻지 않는다. Play 스토어에서 설치했으면 휴대폰의 Play 스토어 앱에
* 새 버전이 있는지 묻고, 최신이면 그렇다고 알린다. 새 버전이 있거나 묻지 못하면, 그리고 다른 곳에서 설치했으면 그 스토어의
* 앱 페이지를 연다([UpdateStore]). 스토어 페이지에서 업데이트 버튼을 누르는 것은 사용자다.
*/
@Composable
private fun UpdateButton() {
val context = LocalContext.current
val scope = rememberCoroutineScope()
val store = remember(context) { UpdateStore.of(UpdateCheck.installer(context)) }
var checking by remember { mutableStateOf(false) }
var latest by rememberSaveable { mutableStateOf(false) }
val noStore = stringResource(R.string.help_update_no_store)

OutlinedButton(
onClick = {
latest = false
val links = UpdateLinks.forStore(store, context.packageName)
if (store != UpdateStore.Play) {
openStore(context, links, noStore)
return@OutlinedButton
}
checking = true
scope.launch {
val hasUpdate = UpdateCheck.playHasUpdate(context)
checking = false
if (hasUpdate == false) latest = true else openStore(context, links, noStore)
}
},
enabled = !checking,
border = BorderStroke(1.dp, AccentColor),
shape = RoundedCornerShape(14.dp),
modifier = Modifier.fillMaxWidth().padding(top = 16.dp).heightIn(min = 48.dp)
) {
Text(
stringResource(if (checking) R.string.help_update_checking else R.string.help_update_button),
fontSize = 15.sp, fontWeight = FontWeight.Bold, textAlign = TextAlign.Center, color = AccentColor
)
}
if (latest) {
// 누른 결과라 화면 읽어주기가 읽고 지나가게 한다.
Text(
stringResource(R.string.help_update_latest),
fontSize = 14.sp, lineHeight = 21.sp, color = SecondaryTextColor,
modifier = Modifier.padding(top = 8.dp).semantics { liveRegion = LiveRegionMode.Polite }
)
}
}

/** 스토어 페이지를 연다. Play 주소는 Play 스토어 앱으로 열고, 그 앱이 없으면 브라우저로 연다. 둘 다 안 되면 알린다. */
private fun openStore(context: Context, links: UpdateLinks, noStore: String) {
fun open(url: String): Boolean {
val intent = Intent(Intent.ACTION_VIEW, url.toUri()).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
// market:// 은 다른 마켓 앱도 받을 수 있어 고르는 창이 뜬다. Play 스토어 앱으로 바로 연다.
if (url.startsWith("market://")) intent.setPackage(UpdateStore.PLAY_STORE_PACKAGE)
return try {
context.startActivity(intent)
true
} catch (e: ActivityNotFoundException) {
false
}
}
if (open(links.primary)) return
if (links.fallback != null && open(links.fallback)) return
Toast.makeText(context, noStore, Toast.LENGTH_LONG).show()
}

/**
* 개인정보처리방침을 브라우저로 여는 버튼(#468). 앱 언어가 한국어면 한국어, 그 밖에는 영어 페이지를 연다.
* 브라우저가 없는 기기에서는 주소를 알려 준다.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.example.soundvisualizer.help

import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.util.Log
import com.google.android.play.core.appupdate.AppUpdateManagerFactory
import com.google.android.play.core.install.model.UpdateAvailability
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlin.coroutines.resume

/**
* 도움말의 '업데이트 확인'(#500)이 기기에 묻는 것. 어느 스토어로 보낼지는 [UpdateStore] 가 정한다.
*/
internal object UpdateCheck {

private const val TAG = "UpdateCheck"

/** 이 앱을 설치한 앱의 패키지 이름. 스토어 밖에서 설치했거나 알 수 없으면 null. */
fun installer(context: Context): String? = try {
val pm = context.packageManager
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
pm.getInstallSourceInfo(context.packageName).installingPackageName
} else {
@Suppress("DEPRECATION")
pm.getInstallerPackageName(context.packageName)
}
} catch (e: PackageManager.NameNotFoundException) {
null
} catch (e: IllegalArgumentException) {
null
}

/**
* Play 스토어 앱에 새 버전이 있는지 묻는다. 있으면 true, 최신이면 false, 묻지 못하면 null(그때는 Play 스토어 페이지를 연다).
*
* Play 인앱 업데이트 라이브러리는 앱이 인터넷에 접속하지 않고 기기 안의 Play 스토어 앱과 주고받는다. Play 스토어에서 설치한
* 앱만 답을 받는다(그래서 [UpdateStore.Play] 일 때만 부른다).
*/
suspend fun playHasUpdate(context: Context): Boolean? = suspendCancellableCoroutine { continuation ->
try {
AppUpdateManagerFactory.create(context.applicationContext).appUpdateInfo
.addOnSuccessListener { info ->
val availability = info.updateAvailability()
if (continuation.isActive) {
continuation.resume(
availability == UpdateAvailability.UPDATE_AVAILABLE ||
availability == UpdateAvailability.DEVELOPER_TRIGGERED_UPDATE_IN_PROGRESS
)
}
}
.addOnFailureListener { e ->
Log.w(TAG, "Play 스토어에 업데이트를 묻지 못했습니다", e)
if (continuation.isActive) continuation.resume(null)
}
} catch (e: RuntimeException) {
// Play 스토어 앱이 없거나 꺼져 있는 기기.
Log.w(TAG, "Play 인앱 업데이트를 쓸 수 없습니다", e)
if (continuation.isActive) continuation.resume(null)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.example.soundvisualizer.help

/**
* 도움말의 '업데이트 확인'(#500)이 어느 스토어로 보낼지.
*
* 앱에는 인터넷 권한이 없다. 새 버전이 있는지는 Play 스토어에서 설치한 경우에만 휴대폰의 Play 스토어 앱에 물을 수 있고,
* 그 밖에는 스토어 페이지를 열어 거기서 업데이트하게 한다. 원스토어에서 받은 사람은 원스토어로 보낸다(원스토어가 업데이트를
* 관리한다). GitHub 의 APK 처럼 스토어 밖에서 설치했으면 Play 스토어로 보낸다. 같은 팀 키로 서명해 Play 스토어 판이 그 위에 설치된다.
*
* 화면이나 Android API 없이 문자열만 다루므로 단위 테스트로 고정한다.
*/
enum class UpdateStore {
/** Play 스토어에서 설치했다. Play 스토어 앱에 새 버전이 있는지 물을 수 있다. */
Play,

/** 원스토어에서 설치했다. 원스토어의 앱 페이지를 연다. */
OneStore,

/** 그 밖(GitHub APK, 다른 마켓, 알 수 없음). Play 스토어의 앱 페이지를 연다. */
Other;

companion object {
const val PLAY_STORE_PACKAGE = "com.android.vending"

/** 원스토어 앱과 원스토어 서비스, 예전 통신사 마켓(원스토어로 합쳐짐)의 패키지 이름. */
val ONE_STORE_PACKAGES = setOf(
"com.skt.skaf.A000Z00040",
"com.skt.skaf.OA00018282",
"com.kt.olleh.storefront",
"com.kt.olleh.istore",
"com.lguplus.appstore",
"android.lgt.appstore",
)

/** 원스토어의 SoundVisualizer 페이지(상품 번호 0001013096). 원스토어 앱이 있으면 그 앱이 연다. */
const val ONE_STORE_URL = "https://m.onestore.co.kr/v2/ko-kr/app/0001013096"

/** 설치한 앱의 패키지 이름(Android 의 installingPackageName)으로 정한다. */
fun of(installer: String?): UpdateStore = when {
installer == PLAY_STORE_PACKAGE -> Play
installer in ONE_STORE_PACKAGES -> OneStore
else -> Other
}

/** Play 스토어 앱으로 여는 주소. */
fun playMarketUri(packageName: String): String = "market://details?id=$packageName"

/** Play 스토어 앱이 없을 때 브라우저로 여는 주소. */
fun playWebUrl(packageName: String): String = "https://play.google.com/store/apps/details?id=$packageName"
}
}

/** 업데이트 확인을 눌렀을 때 할 일. 앞의 것이 열리지 않으면 뒤의 것을 연다. */
data class UpdateLinks(val primary: String, val fallback: String?) {
companion object {
fun forStore(store: UpdateStore, packageName: String): UpdateLinks = when (store) {
UpdateStore.OneStore -> UpdateLinks(UpdateStore.ONE_STORE_URL, null)
UpdateStore.Play, UpdateStore.Other ->
UpdateLinks(UpdateStore.playMarketUri(packageName), UpdateStore.playWebUrl(packageName))
}
}
}
4 changes: 4 additions & 0 deletions app/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@
<string name="help_about_team">من تطوير فريق SOVIS</string>
<string name="help_about_license">يتم توزيع هذا التطبيق بموجب Apache License 2.0. أسماء الأصوات ومجموعاتها في علامة تبويب «الأصوات» مبنية على أنطولوجيا AudioSet ومرخّصة بموجب CC BY-SA 4.0 (راجع «تراخيص البرامج المفتوحة المصدر» أدناه).</string>
<string name="help_licenses_button">تراخيص البرامج المفتوحة المصدر</string>
<string name="help_update_button">التحقق من التحديثات</string>
<string name="help_update_checking">جارٍ التحقق من التحديثات…</string>
<string name="help_update_latest">أنت تستخدم أحدث إصدار.</string>
<string name="help_update_no_store">تعذّر فتح متجر تطبيقات أو متصفح.</string>
<string name="help_licenses_title">تراخيص البرامج المفتوحة المصدر</string>
<string name="help_privacy_button">سياسة الخصوصية</string>
<string name="help_privacy_no_browser">لا يوجد متصفح لفتح الرابط. سياسة الخصوصية متاحة على %1$s.</string>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@
<string name="help_about_team">Entwickelt vom Team SOVIS</string>
<string name="help_about_license">Diese App wird unter der Apache License 2.0 bereitgestellt. Die Namen und Gruppen der Geräusche im Tab „Geräusche“ beruhen auf der AudioSet-Ontologie und stehen unter der Lizenz CC BY-SA 4.0 (siehe „Open-Source-Lizenzen“ unten).</string>
<string name="help_licenses_button">Open-Source-Lizenzen</string>
<string name="help_update_button">Nach Updates suchen</string>
<string name="help_update_checking">Suche nach Updates …</string>
<string name="help_update_latest">Sie verwenden die neueste Version.</string>
<string name="help_update_no_store">Es konnte weder eine Store-App noch ein Browser geöffnet werden.</string>
<string name="help_licenses_title">Open-Source-Lizenzen</string>
<string name="help_privacy_button">Datenschutzerklärung</string>
<string name="help_privacy_no_browser">Kein Browser zum Öffnen des Links. Die Datenschutzerklärung finden Sie unter %1$s.</string>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,10 @@
<string name="help_about_team">Creado por el equipo SOVIS</string>
<string name="help_about_license">Esta app se distribuye bajo la Apache License 2.0. Los nombres y los grupos de sonidos de la pestaña Sonidos se basan en la ontología de AudioSet y se distribuyen bajo la licencia CC BY-SA 4.0 (consulta “Licencias de código abierto” más abajo).</string>
<string name="help_licenses_button">Licencias de código abierto</string>
<string name="help_update_button">Buscar actualizaciones</string>
<string name="help_update_checking">Buscando actualizaciones…</string>
<string name="help_update_latest">Estás usando la versión más reciente.</string>
<string name="help_update_no_store">No se pudo abrir una tienda de aplicaciones ni un navegador.</string>
<string name="help_licenses_title">Licencias de código abierto</string>
<string name="help_privacy_button">Política de privacidad</string>
<string name="help_privacy_no_browser">No hay ningún navegador para abrir el enlace. La política de privacidad está en %1$s.</string>
Expand Down
Loading
Loading