-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from stslex/dev
Refactor navigation
- Loading branch information
Showing
47 changed files
with
279 additions
and
359 deletions.
There are no files selected for viewing
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
8 changes: 4 additions & 4 deletions
8
app/src/main/java/st/slex/csplashscreen/ui/InitialAppViewModel.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,15 +1,15 @@ | ||
package st.slex.csplashscreen.ui | ||
|
||
import androidx.lifecycle.ViewModel | ||
import st.slex.csplashscreen.core.navigation.NavigationScreen | ||
import st.slex.csplashscreen.core.ui.di.Navigator | ||
import st.slex.csplashscreen.core.navigation.navigator.NavigationTarget | ||
import st.slex.csplashscreen.core.navigation.navigator.Navigator | ||
import javax.inject.Inject | ||
|
||
class InitialAppViewModel @Inject constructor( | ||
private val navigator: Navigator | ||
) : ViewModel() { | ||
|
||
fun navigate(screen: NavigationScreen) { | ||
navigator(screen) | ||
fun navigate(screen: NavigationTarget.Screen) { | ||
navigator.navigate(screen) | ||
} | ||
} |
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
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,4 +1,4 @@ | ||
object AppVersions { | ||
const val VERSION_NAME = "1.69" | ||
const val VERSION_CODE = 15 | ||
const val VERSION_NAME = "1.70" | ||
const val VERSION_CODE = 16 | ||
} |
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
43 changes: 14 additions & 29 deletions
43
core/navigation/src/main/java/st/slex/csplashscreen/core/navigation/AppArguments.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,49 +1,34 @@ | ||
package st.slex.csplashscreen.core.navigation | ||
|
||
sealed class AppArguments { | ||
sealed class AppArguments( | ||
vararg val arguments: String | ||
) { | ||
|
||
abstract val arguments: List<String> | ||
val argumentsForRoute: String | ||
get() = when (arguments.isEmpty()) { | ||
true -> String() | ||
false -> arguments.joinToString(separator = "/", prefix = "/") | ||
} | ||
|
||
open val argumentsForRoute: String | ||
get() = arguments.joinToString(separator = "/", prefix = "/") | ||
|
||
object Empty : AppArguments() { | ||
override val arguments: List<String> | ||
get() = emptyList() | ||
override val argumentsForRoute: String | ||
get() = String() | ||
} | ||
data object Empty : AppArguments() | ||
|
||
data class ImageDetailScreen( | ||
val imageId: String | ||
) : AppArguments() { | ||
override val arguments: List<String> | ||
get() = listOf(imageId) | ||
} | ||
) : AppArguments(imageId) | ||
|
||
data class CollectionScreen( | ||
val collectionId: String | ||
) : AppArguments() { | ||
|
||
override val arguments: List<String> | ||
get() = listOf(collectionId) | ||
} | ||
) : AppArguments(collectionId) | ||
|
||
data class SearchPhotosScreen( | ||
private val query: String | ||
) : AppArguments() { | ||
|
||
override val arguments: List<String> | ||
get() = listOf(query) | ||
) : AppArguments(query) { | ||
|
||
val checkedQuery: String | ||
get() = arguments.firstOrNull().orEmpty().trimEnd() | ||
} | ||
|
||
data class UserScreen( | ||
val username: String | ||
) : AppArguments() { | ||
override val arguments: List<String> | ||
get() = listOf(username) | ||
} | ||
} | ||
) : AppArguments(username) | ||
} |
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
21 changes: 0 additions & 21 deletions
21
core/navigation/src/main/java/st/slex/csplashscreen/core/navigation/NavExt.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.