-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new base classes on `:common:ui` module for Screen, ViewModel, Actions and NavigationActions. For now, it has been applied on About, Settings and AddTaskList features.
- Loading branch information
Showing
38 changed files
with
1,046 additions
and
174 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
.../commonMain/kotlin/dev/sergiobelda/todometer/app/feature/about/di/AboutViewModelModule.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,28 @@ | ||
/* | ||
* Copyright 2024 Sergio Belda | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.sergiobelda.todometer.app.feature.about.di | ||
|
||
import dev.sergiobelda.todometer.app.feature.about.ui.AboutViewModel | ||
import dev.sergiobelda.todometer.common.ui.di.baseViewModelOf | ||
import org.koin.core.module.dsl.named | ||
import org.koin.dsl.module | ||
|
||
val aboutViewModelModule = module { | ||
baseViewModelOf(::AboutViewModel) { | ||
named<AboutViewModel>() | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...in/kotlin/dev/sergiobelda/todometer/app/feature/about/navigation/AboutNavigationEvents.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,26 @@ | ||
/* | ||
* Copyright 2025 Sergio Belda | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.sergiobelda.todometer.app.feature.about.navigation | ||
|
||
import dev.sergiobelda.todometer.common.ui.base.BaseEvent | ||
|
||
sealed class AboutNavigationEvents : BaseEvent { | ||
data object NavigateBack : AboutNavigationEvents() | ||
data object NavigateToGitHub : AboutNavigationEvents() | ||
data object NavigateToOpenSourceLicenses : AboutNavigationEvents() | ||
data object NavigateToPrivacyPolicy : AboutNavigationEvents() | ||
} |
36 changes: 36 additions & 0 deletions
36
...in/dev/sergiobelda/todometer/app/feature/about/navigation/AboutNavigationEventsHandler.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,36 @@ | ||
/* | ||
* Copyright 2025 Sergio Belda | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.sergiobelda.todometer.app.feature.about.navigation | ||
|
||
import dev.sergiobelda.todometer.common.ui.base.navigation.NavigationEventsHandler | ||
|
||
data class AboutNavigationEventsHandler( | ||
val navigateBack: () -> Unit, | ||
val navigateToGitHub: () -> Unit, | ||
val navigateToOpenSourceLicenses: () -> Unit, | ||
val navigateToPrivacyPolicy: () -> Unit, | ||
) : NavigationEventsHandler<AboutNavigationEvents> { | ||
|
||
override fun handleNavigationEvent(event: AboutNavigationEvents) { | ||
when (event) { | ||
AboutNavigationEvents.NavigateBack -> navigateBack() | ||
AboutNavigationEvents.NavigateToGitHub -> navigateToGitHub() | ||
AboutNavigationEvents.NavigateToOpenSourceLicenses -> navigateToOpenSourceLicenses() | ||
AboutNavigationEvents.NavigateToPrivacyPolicy -> navigateToPrivacyPolicy() | ||
} | ||
} | ||
} |
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: 21 additions & 0 deletions
21
.../about/src/commonMain/kotlin/dev/sergiobelda/todometer/app/feature/about/ui/AboutState.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,21 @@ | ||
/* | ||
* Copyright 2025 Sergio Belda | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.sergiobelda.todometer.app.feature.about.ui | ||
|
||
import dev.sergiobelda.todometer.common.ui.base.BaseState | ||
|
||
data object AboutState : BaseState |
29 changes: 29 additions & 0 deletions
29
...bout/src/commonMain/kotlin/dev/sergiobelda/todometer/app/feature/about/ui/AboutUIState.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,29 @@ | ||
/* | ||
* Copyright 2025 Sergio Belda | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.sergiobelda.todometer.app.feature.about.ui | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import dev.sergiobelda.todometer.common.ui.base.BaseEvent | ||
import dev.sergiobelda.todometer.common.ui.base.BaseUIState | ||
|
||
class AboutUIState internal constructor() : BaseUIState { | ||
override fun handleEvent(event: BaseEvent) = Unit | ||
} | ||
|
||
@Composable | ||
internal fun rememberAboutUIState(): AboutUIState = remember { AboutUIState() } |
26 changes: 26 additions & 0 deletions
26
...ut/src/commonMain/kotlin/dev/sergiobelda/todometer/app/feature/about/ui/AboutViewModel.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,26 @@ | ||
/* | ||
* Copyright 2025 Sergio Belda | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.sergiobelda.todometer.app.feature.about.ui | ||
|
||
import dev.sergiobelda.todometer.common.ui.base.BaseEvent | ||
import dev.sergiobelda.todometer.common.ui.base.BaseViewModel | ||
|
||
class AboutViewModel : BaseViewModel<AboutState>( | ||
AboutState, | ||
) { | ||
override fun handleEvent(event: BaseEvent) = Unit | ||
} |
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
23 changes: 23 additions & 0 deletions
23
...v/sergiobelda/todometer/app/feature/addtasklist/navigation/AddTaskListNavigationEvents.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,23 @@ | ||
/* | ||
* Copyright 2025 Sergio Belda | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.sergiobelda.todometer.app.feature.addtasklist.navigation | ||
|
||
import dev.sergiobelda.todometer.common.ui.base.BaseEvent | ||
|
||
sealed class AddTaskListNavigationEvents : BaseEvent { | ||
data object NavigateBack : AddTaskListNavigationEvents() | ||
} |
27 changes: 27 additions & 0 deletions
27
...obelda/todometer/app/feature/addtasklist/navigation/AddTaskListNavigationEventsHandler.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,27 @@ | ||
/* | ||
* Copyright 2025 Sergio Belda | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package dev.sergiobelda.todometer.app.feature.addtasklist.navigation | ||
|
||
import dev.sergiobelda.todometer.common.ui.base.navigation.NavigationEventsHandler | ||
|
||
fun addTaskListNavigationEventsHandler( | ||
navigateBack: () -> Unit, | ||
): NavigationEventsHandler<AddTaskListNavigationEvents> = NavigationEventsHandler { | ||
when (it) { | ||
AddTaskListNavigationEvents.NavigateBack -> navigateBack() | ||
} | ||
} |
Oops, something went wrong.