Skip to content

Commit

Permalink
Merge pull request #61 from eshc123/dev
Browse files Browse the repository at this point in the history
[RELEASE] test release
  • Loading branch information
eshc123 authored Apr 19, 2024
2 parents 2128018 + c734e0d commit 434e607
Show file tree
Hide file tree
Showing 58 changed files with 1,448 additions and 285 deletions.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature Template
about: Suggest an idea for this project
title: "[FEATURE]"
labels: feature
assignees: ''

---

### Feature


### ToDo
- [ ]
64 changes: 64 additions & 0 deletions .github/workflows/android_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Android CD

on:
push:
branches:
- release
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest
environment: Android CI/CD

steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Access BASE_URL
env:
GNR_BASE_URL: ${{ secrets.GNR_BASE_URL }}
run: echo GNR_BASE_URL=\"$GNR_BASE_URL\" > ./local.properties

- name: Generate Debug Keystore file from Github Secrets
run: |
mkdir ./app/keystore
echo "$KEYSTORE" > ./app/keystore/debug_keystore.b64
base64 -d -i ./app/keystore/debug_keystore.b64 > ./app/keystore/debug.keystore
env:
KEYSTORE: ${{ secrets.DEBUG_KEYSTORE_BASE64 }}

- name: Build with Gradle
run: ./gradlew assembleDebug

- name: Send APK to Slack
uses: MeilCli/slack-upload-file@v1
with:
slack_token: ${{ secrets.SLACK_BOT_TOKEN }}
file_path: ./app/build/outputs/apk/debug/app-debug.apk
channels: release-android
file_name: debug_apk.apk
file_type: apk
initial_comment: ${{ github.event.head_commit.message }}
22 changes: 22 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

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

26 changes: 26 additions & 0 deletions .idea/appInsightsSettings.xml

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

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

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

1 change: 0 additions & 1 deletion core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ dependencies {
implementation(libs.hilt.android)
kapt(libs.hilt.compiler)


implementation(project(":core:domain"))
implementation(project(":core:database"))
implementation(project(":core:network"))
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
package com.eshc.goonersapp.core.data.fake

import com.eshc.goonersapp.core.data.mapper.toDataResult
import com.eshc.goonersapp.core.data.mapper.toModel
import com.eshc.goonersapp.core.domain.model.DataResult
import com.eshc.goonersapp.core.domain.model.match.Match
import com.eshc.goonersapp.core.domain.model.match.MatchInformation
import com.eshc.goonersapp.core.domain.model.match.MatchRecently
import com.eshc.goonersapp.core.domain.model.match.MatchUpcoming
import com.eshc.goonersapp.core.domain.repository.MatchRepository
import com.eshc.goonersapp.core.network.fake.FakeMatchDataSource
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import javax.inject.Inject

class FakeMatchRepositoryImpl @Inject constructor(
private val fakeMatchDataSource: FakeMatchDataSource
) : MatchRepository {

override fun getMatch(match: Int): Flow<DataResult<Match>> = flow {
val result = fakeMatchDataSource
.getMatch(match)
.toDataResult { remote -> remote.match.toModel() }

emit(result)
}

override fun getMatchInformation(
match: Int,
season: Int,
opponent: Int,
): Flow<DataResult<MatchInformation>> = flow {
val result = fakeMatchDataSource
.getMatchInformation(
matchId = match,
seasonId = season,
opponentId = opponent
).toDataResult { remote -> remote.toModel() }

emit(result)
}

override fun getMatchesBySeason(season: String): Flow<DataResult<List<Match>>> = flow {
val result = fakeMatchDataSource
.getMatchesBySeason(seasonId = season.toInt())
.toDataResult { remote -> remote.map { response -> response.toModel() } }

emit(result)
}

override fun getUpcomingMatches(): Flow<DataResult<List<MatchUpcoming>>> = flow {
val result = fakeMatchDataSource
.getUpcomingMatches()
.toDataResult { remote -> remote.map { response -> response.toModel() } }

emit(result)
}

override fun getRecentlyMatch(): Flow<DataResult<MatchRecently>> = flow {
val result = fakeMatchDataSource
.getRecentlyMatch()
.toDataResult { remote -> remote.toModel() }

emit(result)
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
package com.eshc.goonersapp.core.data.mapper

import com.eshc.goonersapp.core.domain.model.match.LineUp
import com.eshc.goonersapp.core.domain.model.match.Match
import com.eshc.goonersapp.core.network.model.match.RemoteMatch
import com.eshc.goonersapp.core.domain.model.match.MatchDetail
import com.eshc.goonersapp.core.domain.model.match.MatchInformation
import com.eshc.goonersapp.core.domain.model.match.MatchRecently
import com.eshc.goonersapp.core.domain.model.match.MatchUpcoming
import com.eshc.goonersapp.core.domain.model.match.NotablePlayer
import com.eshc.goonersapp.core.domain.model.match.Performance
import com.eshc.goonersapp.core.network.model.match.RemoteMatchDetail
import com.eshc.goonersapp.core.network.model.match.RemoteMatchInformation
import com.eshc.goonersapp.core.network.model.match.RemoteMatchTeam
import com.eshc.goonersapp.core.network.model.match.RemoteMatchUpcoming
import com.eshc.goonersapp.core.network.model.match.RemoteRecentlyMatch

fun RemoteMatch.toModel() = Match(
id = id,
/**
* [RemoteMatchTeam] Mapper
* - Mapping [RemoteMatchTeam] to [Match]
*/
fun RemoteMatchTeam.toModel() = Match(
id = matchId,
homeTeamId = homeTeamId,
homeTeamName = homeTeamName,
homeTeamImageUrl = homeTeamImage,
Expand All @@ -18,6 +33,92 @@ fun RemoteMatch.toModel() = Match(
awayScore = awayScore,
round = round,
isFinished = isFinished == 1,
stadiumName = venueName,
leagueImageUrl = leagueImage
)

/**
* [RemoteMatchUpcoming] Mapper
* - Mapping [RemoteMatchUpcoming] to [MatchUpcoming]
*/
fun RemoteMatchUpcoming.toModel() = MatchUpcoming(
matchId = matchId,
homeTeamId = homeTeamId,
homeTeamNickname = homeTeamNickname,
homeTeamName = homeTeamName,
homeTeamImageUrl = homeTeamImage,
awayTeamId = awayTeamId,
awayTeamNickname = awayTeamNickname,
awayTeamName = awayTeamName,
awayTeamImageUrl = awayTeamImage,
matchDate = matchDate,
stadiumName = stadiumName,
leagueImageUrl = leagueImageUrl
leagueImageUrl = leagueImage
)

/**
* [RemoteMatchInformation] Mapper
* - Mapping [RemoteMatchInformation] to [MatchInformation]
*/
fun RemoteMatchInformation.toModel() = MatchInformation(
notablePlayer = notablePlayer?.let { remote ->
NotablePlayer(
playerId = remote.playerId,
playerName = remote.playerName,
playerHeight = remote.height,
playerWeight = remote.weight,
playerImageUrl = remote.playerImage,
playerPosition = remote.position,
playerPositionInitial = remote.positionInitial,
playerGoalCount = remote.goalCount
)
},
lineUp = lineUp.map { remote ->
LineUp(
lineUpId = remote.lineUpId,
matchId = remote.matchId,
playerId = remote.playerId,
teamId = remote.teamId,
playerName = remote.playerName,
playerBackNumber = remote.jerseyNumber,
formationField = remote.formationField,
formationPosition = remote.formationPosition,
positionId = remote.positionId,
positionCategory = remote.positionCategory,
positionInitial = remote.positionInitial
)
},
performance = performance.map { remote ->
Performance(
result = remote.result,
count = remote.count,
opponentImageUrl = remote.opponentImage
)
}
)

/**
* [RemoteMatchDetail] Mapper
* - Mapping [RemoteMatchDetail] to [MatchDetail]
*/
fun RemoteMatchDetail.toModel() = MatchDetail(
matchDetailId = matchDetailId,
matchId = matchId,
teamId = teamId,
playerId = playerId,
relatedPlayerId = relatedPlayerId,
minute = minute,
extraMinute = extraMinute,
type = type,
playerName = playerName,
relatedPlayerName = relatedPlayerName
)

/**
* [RemoteRecentlyMatch] Mapper
* - Mapper [RemoteRecentlyMatch] to [MatchRecently]
*/
fun RemoteRecentlyMatch.toModel() = MatchRecently(
match = match.toModel(),
matchDetail = matchDetail.map { remote -> remote.toModel() }
)
Loading

0 comments on commit 434e607

Please sign in to comment.