diff --git a/.github/workflows/Android_Develop_PR_CD.yml b/.github/workflows/Android_Develop_CD.yml similarity index 55% rename from .github/workflows/Android_Develop_PR_CD.yml rename to .github/workflows/Android_Develop_CD.yml index 1980dba1..48dedaeb 100644 --- a/.github/workflows/Android_Develop_PR_CD.yml +++ b/.github/workflows/Android_Develop_CD.yml @@ -11,73 +11,14 @@ defaults: working-directory: ./android jobs: - ktlintCheck: - name: ktLint Check - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Run ktLint Check - uses: ./.github/actions/ktlint_check - with: - POKE_BASE_URL: ${{ secrets.POKE_BASE_URL }} - - testAlphaUnitTest: - name: Test Alpha Unit Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Gradle cache - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: set up JDK 17 - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: 17 - - - name: Create Google-Services.json - env: - GOOGLE_SERVICES_ALPHA: ${{ secrets.GOOGLE_SERVICES_ALPHA }} - GOOGLE_SERVICES_BETA: ${{ secrets.GOOGLE_SERVICES_BETA }} - GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} - run: | - touch ./app/src/debug/google-services.json - touch ./app/src/alpha/google-services.json - touch ./app/src/beta/google-services.json - mkdir ./app/src/release - touch ./app/src/release/google-services.json - echo $GOOGLE_SERVICES_ALPHA >> ./app/src/debug/google-services.json - echo $GOOGLE_SERVICES_ALPHA >> ./app/src/alpha/google-services.json - echo $GOOGLE_SERVICES_BETA >> ./app/src/beta/google-services.json - echo $GOOGLE_SERVICES >> ./app/src/release/google-services.json - - - name: Create Local Properties - run: touch local.properties - - - name: Access Local Properties - env: - POKE_BASE_URL: ${{ secrets.POKE_BASE_URL }} - run: | - echo POKE_BASE_URL=\"${{ secrets.POKE_BASE_URL }}\" >> local.properties - - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - - name: run alpha unit test - run: ./gradlew testAlphaUnitTest + CI_Android_Develop: + uses: ./.github/workflows/Android_Develop_CI.yml + secrets: inherit - Distribution: + Distribution_To_Discord: name: Alpha APK to Discord runs-on: ubuntu-latest - needs: [ ktlintCheck, testAlphaUnitTest ] + needs: [ CI_Android_Develop ] steps: - uses: actions/checkout@v4 - name: Gradle cache @@ -121,23 +62,8 @@ jobs: - name: Access Local Properties env: POKE_BASE_URL: ${{ secrets.POKE_BASE_URL }} - # POKE_RELEASE_URL: ${{ secrets.HOST_RELEASE_URI }} - # KEYSTORE_PATH: ${{ secrets.KEYSTORE_PATH }} - # STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} - # KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} - # KEY_ALIAS: ${{ secrets.KEY_ALIAS }} - # STORE_FILE: ${{ secrets.STORE_FILE }} run: | echo POKE_BASE_URL=\"${{ secrets.POKE_BASE_URL }}\" >> local.properties - # echo STORE_PASSWORD= $STORE_PASSWORD >> local.properties - # echo KEY_PASSWORD= $KEY_PASSWORD >> local.properties - # echo KEY_ALIAS= $KEY_ALIAS >> local.properties - # echo STORE_FILE= $STORE_FILE >> local.properties - # - name: Create Key Store - # env: - # KEY_STORE_BASE_64: ${{secrets.KEY_STORE_BASE_64}} - # run: | - # echo "$KEY_STORE_BASE_64" | base64 -d > ./funch_key_store.jks - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -169,8 +95,8 @@ jobs: PR_TITLE: ${{ github.event.pull_request.title }} PR_URL: ${{ github.event.pull_request.html_url }} run: | - CONTENT="최신 개발 버전 APK 가 나왔어요!🎉 - [배포 버전] : $VERSION! + CONTENT="최신 개발 버전 APK 가 나왔어요!🎉 + [배포 버전] : $VERSION! [해당 PR 제목] : $PR_TITLE" EMBED=$(jq -n \ --arg title "PR Merged: $PR_TITLE" \ diff --git a/.github/workflows/Android_Develop_PR_CI.yml b/.github/workflows/Android_Develop_CI.yml similarity index 99% rename from .github/workflows/Android_Develop_PR_CI.yml rename to .github/workflows/Android_Develop_CI.yml index d1b9cbaf..63da1e1c 100644 --- a/.github/workflows/Android_Develop_PR_CI.yml +++ b/.github/workflows/Android_Develop_CI.yml @@ -3,6 +3,7 @@ name: Android PR Builder on: pull_request: branches: [ an/develop ] + workflow_call: defaults: run: diff --git a/.github/workflows/Android_Release_CD.yml b/.github/workflows/Android_Release_CD.yml new file mode 100644 index 00000000..3032843d --- /dev/null +++ b/.github/workflows/Android_Release_CD.yml @@ -0,0 +1,115 @@ +name: Android Release New Version 🎉 + +on: + push: + tags: + - "v*.*.*" + +jobs: + CI_Android_Release: + uses: ./.github/workflows/Android_Release_CI.yml + secrets: inherit + + Distribution_To_PlayStore: + name: CD Release Builder + runs-on: ubuntu-latest + needs: [ CI_Android_Release ] + + steps: + - uses: actions/checkout@v4 + + - name: show github pull request + run: echo ${{ github.event.pull_request.title }} + + - name: Gradle cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + + - name: Create Google-Services.json + env: + GOOGLE_SERVICES_ALPHA: ${{ secrets.GOOGLE_SERVICES_ALPHA }} + GOOGLE_SERVICES_BETA: ${{ secrets.GOOGLE_SERVICES_BETA }} + GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} + run: | + touch ./app/src/debug/google-services.json + touch ./app/src/alpha/google-services.json + touch ./app/src/beta/google-services.json + mkdir ./app/src/release + touch ./app/src/release/google-services.json + echo $GOOGLE_SERVICES_ALPHA >> ./app/src/debug/google-services.json + echo $GOOGLE_SERVICES_ALPHA >> ./app/src/alpha/google-services.json + echo $GOOGLE_SERVICES_BETA >> ./app/src/beta/google-services.json + echo $GOOGLE_SERVICES >> ./app/src/release/google-services.json + cat ./app/src/debug/google-services.json + working-directory: android + + - name: Create Local Properties + run: touch local.properties + working-directory: android + + - name: Access Local Properties + env: + POKE_BASE_URL: ${{ secrets.POKE_BASE_URL }} + # POKE_DEV_BASE_URL: ${{ secrets.HOST_RELEASE_URI }} + STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + run: | + echo POKE_BASE_URL=\"${{ secrets.POKE_BASE_URL }}\" >> local.properties + echo STORE_PASSWORD= $STORE_PASSWORD >> local.properties + echo KEY_PASSWORD= $KEY_PASSWORD >> local.properties + echo KEY_ALIAS= $KEY_ALIAS >> local.properties + working-directory: android + + - name: Create RELEASE Key Store + env: + KEY_STORE: ${{secrets.RELEASE_KEY_STORE}} + run: | + touch ./keystore/poke_key.keystore + echo "$KEY_STORE" | base64 -d > ./keystore/poke_key.keystore + working-directory: android + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + working-directory: android + + - name: Build Release APK + run: ./gradlew assembleRelease + working-directory: android + + - name: Upload Release Build to Artifacts + uses: actions/upload-artifact@v3 + with: + name: release-artifacts + path: android/app/build/outputs/apk/release/ + if-no-files-found: error + + - name: Create Github Release + uses: softprops/action-gh-release@v1 + with: + generate_release_notes: true + files: | + android/app/build/outputs/apk/release/app-release.apk + + - name: Build release aab + run: ./gradlew bundleRelease + working-directory: android + + - name: Upload artifact to Google Play Store + uses: r0adkll/upload-google-play@v1 + with: + serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} + releaseFiles: android/app/build/outputs/bundle/release/app-release.aab + packageName: poke.rogue.helper diff --git a/.github/workflows/Android_Release_CI.yml b/.github/workflows/Android_Release_CI.yml new file mode 100644 index 00000000..0ec5f44d --- /dev/null +++ b/.github/workflows/Android_Release_CI.yml @@ -0,0 +1,93 @@ +name: Android PR Builder + +on: + push: + branches: [ "an/release*" ] + workflow_call: + +jobs: + ktlintCheck: + name: ktLint Check + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Run ktLint Check + uses: ./.github/actions/ktlint_check + with: + POKE_BASE_URL: ${{ secrets.POKE_BASE_URL }} + + testReleaseUnitTest: + name: CI Release Builder + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Gradle cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-gradle- + + - name: set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + + - name: Create Google-Services.json + env: + GOOGLE_SERVICES_ALPHA: ${{ secrets.GOOGLE_SERVICES_ALPHA }} + GOOGLE_SERVICES_BETA: ${{ secrets.GOOGLE_SERVICES_BETA }} + GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }} + run: | + touch ./app/src/debug/google-services.json + touch ./app/src/alpha/google-services.json + touch ./app/src/beta/google-services.json + mkdir ./app/src/release + touch ./app/src/release/google-services.json + echo $GOOGLE_SERVICES_ALPHA >> ./app/src/debug/google-services.json + echo $GOOGLE_SERVICES_ALPHA >> ./app/src/alpha/google-services.json + echo $GOOGLE_SERVICES_BETA >> ./app/src/beta/google-services.json + echo $GOOGLE_SERVICES >> ./app/src/release/google-services.json + cat ./app/src/debug/google-services.json + working-directory: android + + - name: Create Local Properties + run: touch local.properties + working-directory: android + + - name: Access Local Properties + env: + POKE_BASE_URL: ${{ secrets.POKE_BASE_URL }} + # POKE_DEV_BASE_URL: ${{ secrets.HOST_RELEASE_URI }} + STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }} + KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} + KEY_ALIAS: ${{ secrets.KEY_ALIAS }} + run: | + echo POKE_BASE_URL=\"${{ secrets.POKE_BASE_URL }}\" >> local.properties + echo STORE_PASSWORD= $STORE_PASSWORD >> local.properties + echo KEY_PASSWORD= $KEY_PASSWORD >> local.properties + echo KEY_ALIAS= $KEY_ALIAS >> local.properties + working-directory: android + + - name: Create RELEASE Key Store + env: + KEY_STORE: ${{secrets.RELEASE_KEY_STORE}} + run: | + touch ./keystore/poke_key.jks + echo "$KEY_STORE" | base64 -d > ./keystore/poke_key.jks + working-directory: android + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + working-directory: android + + - name: Unit Test Release + run: ./gradlew testReleaseUnitTest + working-directory: android diff --git a/.github/workflows/PR_Comment_Notification.yml b/.github/workflows/PR_Comment_Notification.yml new file mode 100644 index 00000000..d0608dba --- /dev/null +++ b/.github/workflows/PR_Comment_Notification.yml @@ -0,0 +1,72 @@ +name: Discord Notification on PR Comment + +on: + issue_comment: + types: [created, edited] + +jobs: + notify-discord: + if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/noti') }} + runs-on: ubuntu-latest + + steps: + - name: Set Environment Variables + env: + TITLE: ${{ github.event.issue.title }} + run: | + if [[ "${{ env.TITLE }}" == *"BE"* ]]; then + echo "AVATAR_URL=${{ secrets.BE_DISCORD_AVATAR_URL }}" >> $GITHUB_ENV + echo "COMMENT_BODY= 🤚백엔드 친구들 모여라~ 🔊" >> $GITHUB_ENV + echo "USERNAME=망나뇽" >> $GITHUB_ENV + echo "WEB_HOOK=${{ secrets.BE_DISCORD_WEB_HOOK }}" >> $GITHUB_ENV + elif [[ "${{ env.TITLE }}" == *"AN"* ]]; then + echo "AVATAR_URL=${{ secrets.AN_DISCORD_AVATAR_URL }}" >> $GITHUB_ENV + echo "COMMENT_BODY= 🤖안드 친구들 모여라~ 🔊" >> $GITHUB_ENV + echo "USERNAME=이상해씨" >> $GITHUB_ENV + echo "WEB_HOOK=${{ secrets.AN_DISCORD_WEB_HOOK }}" >> $GITHUB_ENV + fi + + - name: Notify Discord + env: + COMMENT_BODY: ${{ env.COMMENT_BODY }} + COMMENT_AUTHOR: ${{ github.event.comment.user.login }} + PR_URL: ${{ github.event.issue.pull_request.html_url }} + AUTHOR_URL: ${{ github.event.comment.user.avatar_url }} + AVATAR_URL: ${{ env.AVATAR_URL }} + CONTENT: ${{ github.event.comment.body }} + USERNAME: ${{ env.USERNAME }} + WEB_HOOK: ${{ env.WEB_HOOK }} + run: | + if [ -n "$WEB_HOOK" ]; then + JSON_PAYLOAD=$(jq -n \ + --arg content "$CONTENT" \ + --arg description "$COMMENT_BODY" \ + --arg username "$USERNAME" \ + --arg avatar_url "$AVATAR_URL" \ + --arg title "Pull Request Command" \ + --arg url "$PR_URL" \ + --arg author_url "$AUTHOR_URL" \ + --arg author_name "$COMMENT_AUTHOR" \ + --arg color "5814783" \ + --arg timestamp "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \ + '{ + content: $content, + username: $username, + avatar_url: $avatar_url, + embeds: [{ + title: $title, + url: $url, + author: { + name: $author_name, + icon_url: $author_url + }, + description: $description, + color: ($color | tonumber), + timestamp: $timestamp + }] + }') + + curl -X POST -H "Content-Type: application/json" -d "$JSON_PAYLOAD" "$WEB_HOOK" + else + echo "No matching title found. Skipping notification." + fi diff --git a/README.md b/README.md new file mode 100644 index 00000000..e1cd6b1c --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Introduction + +🍄 `PokéRogue` 게임 유저가 `PokéRogue Helper` 서비스를 통해 포켓몬 배틀을 온전히 즐길수 있도록 도와주는 `Application` +
+
+ + + +
+
+ +😨 1302마리의 포켓몬을 마주하기가 막막하지 않나요? + +😨 설마 아직도 낡은 상성표를 찾아 보고 계신가요? + +😨 무슨 기술을 써야 이길 수 있을까? 타입 상성이 뭔데? + +
+ + +✨ 배틀 도우미: 내 포켓몬의 기술이 상대 포켓몬에 얼마나 타격을 주는지 수치로 알 수 있습니다. + +✨ 타입 매칭: 내 포켓몬과 상대 포켓몬의 상성을 쉽고 빠르게 알 수 있습니다. + +✨ 포켓몬 도감: 특성, 종족값, 진화 정보, 출현 바이옴 같이 배틀에 유용한 정보를 자세하게 알 수 있습니다. + +✨ 바이옴 도감: 포켓몬의 출현 정보와 다음 바이옴을 알 수 있습니다. + +✨ 특성 도감: 특성 정보와 특성에 해당하는 모든 포켓몬을 알려줍니다. + +이제 포켓로그 배틀의 고수가 되어보세요! ⚡️ diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 6f23e23b..d869327b 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -29,7 +29,7 @@ android { create("release") { keyAlias = properties.getProperty("KEY_ALIAS") keyPassword = properties.getProperty("KEY_PASSWORD") - storeFile = file("${project.rootDir.absolutePath}/keystore/poke_key.jks") + storeFile = file("${project.rootDir.absolutePath}/keystore/poke_key.keystore") storePassword = properties.getProperty("STORE_PASSWORD") } } diff --git a/android/app/src/main/java/poke/rogue/helper/presentation/splash/PokemonIntroActivity.kt b/android/app/src/main/java/poke/rogue/helper/presentation/splash/PokemonIntroActivity.kt index 40f4db57..b36674c0 100644 --- a/android/app/src/main/java/poke/rogue/helper/presentation/splash/PokemonIntroActivity.kt +++ b/android/app/src/main/java/poke/rogue/helper/presentation/splash/PokemonIntroActivity.kt @@ -12,11 +12,12 @@ import poke.rogue.helper.presentation.home.HomeActivity import poke.rogue.helper.presentation.util.context.startActivity import poke.rogue.helper.presentation.util.repeatOnStarted -class PokemonIntroActivity() : +class PokemonIntroActivity : ErrorHandleActivity(R.layout.activity_pokemon_intro) { private val viewModel by viewModel() override val errorViewModel: ErrorHandleViewModel get() = viewModel + override val toolbar: Toolbar? = null override fun onCreate(savedInstanceState: Bundle?) { @@ -24,7 +25,7 @@ class PokemonIntroActivity() : super.onCreate(savedInstanceState) repeatOnStarted { viewModel.navigationToHomeEvent.collect { - finish() + finishAffinity() startActivity() } } diff --git a/android/app/src/main/java/poke/rogue/helper/presentation/splash/PokemonIntroViewModel.kt b/android/app/src/main/java/poke/rogue/helper/presentation/splash/PokemonIntroViewModel.kt index 5e4ae172..250400d9 100644 --- a/android/app/src/main/java/poke/rogue/helper/presentation/splash/PokemonIntroViewModel.kt +++ b/android/app/src/main/java/poke/rogue/helper/presentation/splash/PokemonIntroViewModel.kt @@ -15,7 +15,6 @@ import poke.rogue.helper.presentation.base.BaseViewModelFactory import poke.rogue.helper.presentation.base.error.ErrorHandleViewModel import poke.rogue.helper.presentation.util.event.MutableEventFlow import poke.rogue.helper.presentation.util.event.asEventFlow -import timber.log.Timber class PokemonIntroViewModel( private val pokemonRepository: DexRepository, @@ -36,7 +35,7 @@ class PokemonIntroViewModel( launch { getKoin().get().warmUp() } } } catch (e: Exception) { - Timber.e(e) + handlePokemonError(e) } finally { _navigationToHomeEvent.emit(Unit) } diff --git a/android/gradle/libs.versions.toml b/android/gradle/libs.versions.toml index a41f68c0..d3a39820 100644 --- a/android/gradle/libs.versions.toml +++ b/android/gradle/libs.versions.toml @@ -5,8 +5,8 @@ koin = "4.0.0" minSdk = "26" robolectric = "4.13" targetSdk = "34" -appVersion = "1.0.1" -versionCode = "10001" +appVersion = "1.1.0" +versionCode = "101000" agp = "8.3.2" # kotlin diff --git a/android/local/src/main/java/poke/rogue/helper/local/db/PokeRogueDatabase.kt b/android/local/src/main/java/poke/rogue/helper/local/db/PokeRogueDatabase.kt index a995a9f6..dcf95955 100644 --- a/android/local/src/main/java/poke/rogue/helper/local/db/PokeRogueDatabase.kt +++ b/android/local/src/main/java/poke/rogue/helper/local/db/PokeRogueDatabase.kt @@ -33,5 +33,13 @@ abstract class PokeRogueDatabase : RoomDatabase() { .build().also { instance = it } } } + + fun dropDatabase(context: Context) { + synchronized(this) { + instance?.close() + instance = null + context.deleteDatabase(DATABASE_NAME) + } + } } }