Skip to content

Commit

Permalink
Merge pull request #377 from thomaskioko/ios-improvements
Browse files Browse the repository at this point in the history
Refactor iOS Core navigation and Update Screens
  • Loading branch information
thomaskioko authored Dec 23, 2024
2 parents 2b4da84 + f5b47b3 commit 5693733
Show file tree
Hide file tree
Showing 272 changed files with 5,208 additions and 3,448 deletions.
98 changes: 49 additions & 49 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ jobs:
# run: bundle exec fastlane build_tvmaniac

# - name: Clear Derived Data
# run: bundle exec fastlane clear_derived_data_lane
# run: bundle exec fastlane clear_derived_data_lane

# - name: Upload test results
# uses: actions/upload-artifact@v4
Expand All @@ -327,55 +327,55 @@ jobs:
# name: test-results
# path: fastlane/test_output

ios-ui-test:
needs: [common-test]
runs-on: macos-latest
steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3.0
bundler-cache: true

- name: Cache SPM dependencies
uses: actions/cache@v4
with:
path: ${{ env.SPM_CACHE_PATH }}
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Setup Gradle Cache
uses: actions/cache@v4
with:
path: ${{ env.GRADLE_CACHE_PATH }}
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Install dependencies with Bundler
run: bundle install

- name: Run UI Tests
run: bundle exec fastlane ui_tests

- name: Upload test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: fastlane/test_output
# ios-ui-test:
# needs: [common-test]
# runs-on: macos-latest
# steps:
# - name: Checkout project
# uses: actions/checkout@v4
#
# - name: Setup Xcode
# uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: ${{ env.XCODE_VERSION }}
#
# - name: Set up Ruby
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: 3.3.0
# bundler-cache: true
#
# - name: Cache SPM dependencies
# uses: actions/cache@v4
# with:
# path: ${{ env.SPM_CACHE_PATH }}
# key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
# restore-keys: |
# ${{ runner.os }}-spm-
#
# - name: Setup Gradle Cache
# uses: actions/cache@v4
# with:
# path: ${{ env.GRADLE_CACHE_PATH }}
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
#
# - name: Install dependencies with Bundler
# run: bundle install
#
# - name: Run UI Tests
# run: bundle exec fastlane ui_tests
#
# - name: Upload test results
# uses: actions/upload-artifact@v4
# if: failure()
# with:
# name: test-results
# path: fastlane/test_output
#
create-release:
needs: [build-android, android-lint, android-screenshot-test, common-test, ios-ui-test, spotless, dependency-health, jvm-test]
needs: [build-android, android-lint, android-screenshot-test, common-test, spotless, dependency-health, jvm-test]
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-latest
steps:
Expand Down
24 changes: 0 additions & 24 deletions Package.swift

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This is my playground for learning Kotlin Multiplatform. With that said, I'm sur

| Android | iOS |
| -- | -- |
| <video src="https://github.com/thomaskioko/tv-maniac/assets/841885/a9991256-27a8-4a99-87f3-0f071c7cbc68" width=350/> | <video src="https://github.com/thomaskioko/tv-maniac/assets/841885/45fa6cd7-6bca-4baa-ad71-93339986ef12" width=350/> |
| <video src="https://github.com/thomaskioko/tv-maniac/assets/841885/a9991256-27a8-4a99-87f3-0f071c7cbc68" width=350/> | <video src="https://github.com/user-attachments/assets/d446aabc-5569-456b-9964-bbd1a9bfe371" width=350/> |


> [!IMPORTANT]
Expand Down
8 changes: 5 additions & 3 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ dependencies {
implementation(projects.data.episodes.implementation)
implementation(projects.data.featuredshows.api)
implementation(projects.data.featuredshows.implementation)
implementation(projects.data.library.api)
implementation(projects.data.library.implementation)
implementation(projects.data.genre.api)
implementation(projects.data.genre.implementation)
implementation(projects.data.watchlist.api)
implementation(projects.data.watchlist.implementation)
implementation(projects.data.popularshows.api)
implementation(projects.data.popularshows.implementation)
implementation(projects.data.recommendedshows.api)
Expand Down Expand Up @@ -63,7 +65,7 @@ dependencies {
implementation(projects.datastore.api)
implementation(projects.datastore.implementation)
implementation(projects.presenter.discover)
implementation(projects.presenter.library)
implementation(projects.presenter.watchlist)
implementation(projects.presenter.home)
implementation(projects.presenter.moreShows)
implementation(projects.presenter.search)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.arkivanov.decompose.extensions.compose.stack.Children
import com.thomaskioko.tvmaniac.home.HomeScreen
import com.thomaskioko.tvmaniac.navigation.RootPresenter
Expand All @@ -36,7 +36,7 @@ fun RootScreen(rootPresenter: RootPresenter, modifier: Modifier = Modifier) {

@Composable
private fun ChildrenContent(rootPresenter: RootPresenter, modifier: Modifier = Modifier) {
val childStack by rootPresenter.stack.collectAsState()
val childStack by rootPresenter.childStack.collectAsStateWithLifecycle()

Children(
modifier = modifier,
Expand Down Expand Up @@ -68,6 +68,9 @@ private fun ChildrenContent(rootPresenter: RootPresenter, modifier: Modifier = M
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
RootPresenter.Child.GenreShows -> {
// TODO:: Genre Shows Screen
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TvManicApplication : Application() {

override fun onCreate() {
super.onCreate()
component.initializers.init()
component.initializers.initialize()
}

fun getApplicationComponent() = component
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thomaskioko.tvmaniac.inject

import android.app.Application
import com.thomaskioko.tvmaniac.initializers.AppInitializers
import com.thomaskioko.tvmaniac.core.base.AppInitializers
import me.tatarka.inject.annotations.Provides
import software.amazon.lastmile.kotlin.inject.anvil.AppScope
import software.amazon.lastmile.kotlin.inject.anvil.MergeComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ fun PosterBackdropCard(
title: String,
imageUrl: String?,
modifier: Modifier = Modifier,
textAlign: TextAlign = TextAlign.Start,
contentScale: ContentScale = ContentScale.Crop,
imageWidth: Dp = 120.dp,
darkTheme: Boolean = true,
Expand Down Expand Up @@ -156,10 +157,11 @@ fun PosterBackdropCard(
text = title,
style = MaterialTheme.typography.labelLarge,
color = MaterialTheme.colorScheme.onSurface,
textAlign = TextAlign.Center,
textAlign = textAlign,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.align(Alignment.BottomStart),
)
Expand Down
2 changes: 1 addition & 1 deletion android/resources/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<string name="menu_item_discover">Discover</string>
<string name="menu_item_search">Search</string>
<string name="menu_item_follow">Following</string>
<string name="menu_item_library">Library</string>
<string name="menu_item_library">Watchlist</string>
<string name="menu_item_settings">Settings</string>
<string name="menu_item_profile">Profile</string>

Expand Down
2 changes: 1 addition & 1 deletion android/ui/home/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies {
implementation(projects.android.resources)

implementation(projects.android.ui.discover)
implementation(projects.android.ui.library)
implementation(projects.android.ui.watchlist)
implementation(projects.android.ui.search)
implementation(projects.android.ui.settings)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import com.thomaskioko.tvmaniac.compose.components.TvManiacBottomNavigationItem
import com.thomaskioko.tvmaniac.compose.components.TvManiacNavigationBar
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Discover
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Library
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Watchlist
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Search
import com.thomaskioko.tvmaniac.presentation.home.HomePresenter.Child.Settings
import com.thomaskioko.tvmaniac.resources.R
import com.thomaskioko.tvmaniac.ui.search.SearchScreen
import com.thomaskioko.tvmaniac.ui.discover.DiscoverScreen
import com.thomaskioko.tvmaniac.ui.library.LibraryScreen
import com.thomaskioko.tvmaniac.ui.library.WatchlistScreen
import com.thomaskioko.tvmaniac.ui.settings.SettingsScreen

@Composable
Expand All @@ -40,7 +40,7 @@ fun HomeScreen(

@Composable
private fun ChildrenContent(homePresenter: HomePresenter, modifier: Modifier = Modifier) {
val childStack by homePresenter.stack.collectAsState()
val childStack by homePresenter.homeChildStack.collectAsState()

Children(
modifier = modifier,
Expand All @@ -54,8 +54,8 @@ private fun ChildrenContent(homePresenter: HomePresenter, modifier: Modifier = M
modifier = fillMaxSizeModifier,
)
}
is Library -> {
LibraryScreen(
is Watchlist -> {
WatchlistScreen(
presenter = screen.presenter,
modifier = fillMaxSizeModifier,
)
Expand All @@ -81,7 +81,7 @@ internal fun BottomNavigationContent(
component: HomePresenter,
modifier: Modifier = Modifier,
) {
val childStack by component.stack.collectAsState()
val childStack by component.homeChildStack.collectAsState()
val activeComponent = childStack.active.instance

TvManiacNavigationBar(
Expand All @@ -104,7 +104,7 @@ internal fun BottomNavigationContent(
TvManiacBottomNavigationItem(
imageVector = Icons.Outlined.VideoLibrary,
title = stringResource(id = R.string.menu_item_library),
selected = activeComponent is Library,
selected = activeComponent is Watchlist,
onClick = { component.onLibraryClicked() },
)

Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
package com.thomaskioko.tvmaniac.ui.search

import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import com.thomaskioko.tvmaniac.presentation.search.EmptySearchState
import com.thomaskioko.tvmaniac.presentation.search.ErrorSearchState
import com.thomaskioko.tvmaniac.presentation.search.ShowItem
import com.thomaskioko.tvmaniac.presentation.search.EmptySearchResult
import com.thomaskioko.tvmaniac.presentation.search.model.ShowItem
import com.thomaskioko.tvmaniac.presentation.search.SearchResultAvailable
import com.thomaskioko.tvmaniac.presentation.search.SearchShowState
import com.thomaskioko.tvmaniac.presentation.search.ShowContentAvailable
import com.thomaskioko.tvmaniac.presentation.search.model.ShowGenre
import kotlinx.collections.immutable.toImmutableList

class SearchPreviewParameterProvider : PreviewParameterProvider<SearchShowState> {
override val values: Sequence<SearchShowState>
get() {
return sequenceOf(
EmptySearchState(),
ErrorSearchState(errorMessage = "Something went wrong"),
EmptySearchResult(),
EmptySearchResult(errorMessage = "Something went wrong"),
ShowContentAvailable(
featuredShows = createDiscoverShowList(),
trendingShows = createDiscoverShowList(),
upcomingShows = createDiscoverShowList(),
genres = createGenreShowList(),
),
SearchResultAvailable(
results = createDiscoverShowList(),
Expand All @@ -29,11 +27,16 @@ class SearchPreviewParameterProvider : PreviewParameterProvider<SearchShowState>

internal fun createDiscoverShowList(size: Int = 5) = List(size) { discoverShow }.toImmutableList()

val discoverShow = ShowItem(
internal val discoverShow = ShowItem(
tmdbId = 84958,
title = "Loki",
posterImageUrl = "/kEl2t3OhXc3Zb9FBh1AuYzRTgZp.jpg",
overview = "After stealing the Tesseract during the events of “Avengers: Endgame,” an ",
status = "Ended",
inLibrary = false,
)
internal fun createGenreShowList(size: Int = 5) = List(size) { ShowGenre(
id = 84958,
name = "Horror",
posterUrl = "/kEl2t3OhXc3Zb9FBh1AuYzRTgZp.jpg",
) }.toImmutableList()
Loading

0 comments on commit 5693733

Please sign in to comment.