generated from AdamMc331/AndroidAppTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
91 additions
and
208 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...ndroidMain/kotlin/com/adammcneilly/pocketleague/shared/screens/DKMPViewModelForAndroid.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package com.adammcneilly.pocketleague.shared.screens | ||
|
||
import com.adammcneilly.pocketleague.shared.data.AppDependencies | ||
import com.adammcneilly.pocketleague.shared.data.Repository | ||
|
||
/** | ||
* Creates an instance of a [DKMPViewModel] to be used within an Android application. | ||
*/ | ||
fun DKMPViewModel.Factory.getAndroidInstance(): DKMPViewModel { | ||
return DKMPViewModel( | ||
dependencies = AppDependencies(), | ||
dependencies = Repository(), | ||
) | ||
} |
48 changes: 0 additions & 48 deletions
48
shared/src/commonMain/kotlin/com/adammcneilly/pocketleague/shared/data/AppDependencies.kt
This file was deleted.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
shared/src/commonMain/kotlin/com/adammcneilly/pocketleague/shared/data/Repository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.adammcneilly.pocketleague.shared.data | ||
|
||
import com.adammcneilly.pocketleague.shared.data.remote.octanegg.services.OctaneGGEventService | ||
import com.adammcneilly.pocketleague.shared.data.remote.octanegg.services.OctaneGGGameService | ||
import com.adammcneilly.pocketleague.shared.data.remote.octanegg.services.OctaneGGMatchService | ||
import com.adammcneilly.pocketleague.shared.data.repositories.EventRepository | ||
import com.adammcneilly.pocketleague.shared.data.repositories.GameRepository | ||
import com.adammcneilly.pocketleague.shared.data.repositories.MatchRepository | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.withContext | ||
|
||
/** | ||
* The main entry point to various data layers inside the application. | ||
* | ||
* @property[useDefaultDispatcher] Most often true, meaning repo calls should be run on the | ||
* Dispatchers.Default dispatcher. We can toggle this false for tests, though. | ||
*/ | ||
class Repository( | ||
private val useDefaultDispatcher: Boolean = true, | ||
) { | ||
internal val eventRepository: EventRepository by lazy { | ||
OctaneGGEventService() | ||
} | ||
|
||
internal val matchRepository: MatchRepository by lazy { | ||
OctaneGGMatchService() | ||
} | ||
|
||
internal val gameRepository: GameRepository by lazy { | ||
OctaneGGGameService() | ||
} | ||
|
||
/** | ||
* Runs the supplied [block] inside the scope for this repo, dependent | ||
* oon the [useDefaultDispatcher] flag. | ||
*/ | ||
suspend fun <T> withRepoContext(block: suspend () -> T): T { | ||
return if (useDefaultDispatcher) { | ||
withContext(Dispatchers.Default) { | ||
block() | ||
} | ||
} else { | ||
block() | ||
} | ||
} | ||
} |
16 changes: 0 additions & 16 deletions
16
...monMain/kotlin/com/adammcneilly/pocketleague/shared/eventlist/GetUpcomingEventsUseCase.kt
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
...ain/kotlin/com/adammcneilly/pocketleague/shared/eventlist/GetUpcomingEventsUseCaseImpl.kt
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...ommonMain/kotlin/com/adammcneilly/pocketleague/shared/matchdetail/GetMatchGamesUseCase.kt
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
...nMain/kotlin/com/adammcneilly/pocketleague/shared/matchdetail/GetMatchGamesUseCaseImpl.kt
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
...mmonMain/kotlin/com/adammcneilly/pocketleague/shared/matchlist/GetRecentMatchesUseCase.kt
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
...Main/kotlin/com/adammcneilly/pocketleague/shared/matchlist/GetRecentMatchesUseCaseImpl.kt
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
shared/src/commonMain/kotlin/com/adammcneilly/pocketleague/shared/screens/DKMPViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.