Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ スケジュール詳細画面のリファクタリング #173

Merged
merged 1 commit into from
Jan 3, 2024

Conversation

tatsutakein
Copy link
Member

@tatsutakein tatsutakein commented Jan 3, 2024

Issue

  • close #ISSUE_NUMBER 🦕

概要

スケジュール詳細画面のリファクタリングを実施します.

レビュー観点

特になし

レビューレベル

  • Lv0: まったく見ないで Approve する
  • Lv1: ぱっとみて違和感がないかチェックして Approve する
  • Lv2: 仕様レベルまで理解して、仕様通りに動くかある程度検証して Approve する
  • Lv3: 実際に環境で動作確認したうえで Approve する

レビュー優先度

  • すぐに見てもらいたい ( hotfix など ) 🚀
  • 今日中に見てもらいたい 🚗
  • 今日〜明日中で見てもらいたい 🚶
  • 数日以内で見てもらいたい 🐢

参考リンク

スクリーンショット

Before After

Summary by CodeRabbit

  • 新機能

    • スケジュール詳細画面に、スケジュールのストリーミング取得、参加者情報のストリーミング取得、および自分の参加状況のストリーミング取得機能を追加しました。
  • 機能改善

    • 参加状況の取り扱いに関連するロジックを改善し、より直感的なユーザー体験を提供します。
    • スケジュール詳細画面のUIを更新し、スケジュールデータに基づいてレイアウトとパディングを調整しました。
  • バグ修正

    • 参加者ステータスチップのクリック動作を修正し、データクラスからオブジェクトへの変換を行いました。
  • ドキュメント

    • 新しい関数とユースケースに関するドキュメンテーションを追加しました。
  • リファクタリング

    • 参加データの挿入と更新のロジックを改善しました。
    • スケジュール詳細ステートマシンのロジックとコントロールフローを再構築しました。
  • スタイル

    • スケジュール詳細画面のスタイルを更新し、よりクリーンなデザインを実現しました。

@tatsutakein tatsutakein requested a review from a team as a code owner January 3, 2024 09:28
Copy link

coderabbitai bot commented Jan 3, 2024

Walkthrough

参加者のステータス処理に関連する論理変更が行われました。具体的には、参加者のステータスを取得し、ストリームする新しいユースケースが導入され、既存の関数が更新または名前が変更されました。スケジュールの詳細画面も、新しい依存関係に基づいて更新されています。

Changes

ファイルパス 変更概要
.../ios/combined/EntryPointTest.kt FetchMyParticipantStatusUseCaseMyParticipantStatusStreamUseCaseに変更。
.../Modules/Sources/Schedule/ComposeScheduleDetailScreen.swift ScheduleDetailStateMachineの初期化パラメータを変更。
.../core/data/.../DefaultParticipantRepository.kt
.../core/data/.../ParticipantRepository.kt
DefaultParticipantRepositoryの関数を更新し、ParticipantRepositoryparticipantStatusStreamを追加。
.../core/domain/.../MyParticipantStatusStreamUseCase.kt
.../core/domain/.../ParticipateUseCase.kt
.../core/domain/.../ScheduleParticipantsStreamUseCase.kt
.../core/domain/.../ScheduleStreamUseCase.kt
新しいユースケースのインターフェースと実装を追加。
.../core/domain/.../di/UseCaseModule.kt 新しいユースケースクラスを追加し、既存のユースケースを置き換え。
.../core/network/.../FakeParticipantRemoteDataSource.kt
.../core/network/.../ParticipantRemoteDataSource.kt
.../core/network/.../SupabaseParticipantRemoteDataSource.kt
insertParticipateupsertParticipateにリネームし、パラメータを更新。
.../core/network/.../model/NetworkParticipant.kt toNetworkModel関数を追加。
.../feature/schedule/.../ScheduleDetailIntent.kt ClickParticipantStatusChipからscheduleプロパティを削除し、サブクラスをオブジェクトに変更。
.../feature/schedule/.../ScheduleDetailScreen.kt インポートモジュールの変更、レイアウトとパディングの調整。
.../feature/schedule/.../ScheduleDetailScreenUiState.kt scheduleプロパティの名前を変更し、新しいプロパティを追加。
.../feature/schedule/.../ScheduleDetailStateMachine.kt ユースケース、ステートフローの導入とuiStateプロパティの再構築。
.../feature/schedule/.../di/ScheduleFeatureModule.kt ScheduleDetailStateMachineの初期化に新しい依存関係を導入。

🐇💻
更新の風が吹き、コードが変わる
ストリームが流れ、状態が踊る
ラビットが見守る新しい夜明けを

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between dd67966 and 7537bb7.
Files selected for processing (18)
  • app/ios-combined/src/iosTest/kotlin/club/nito/ios/combined/EntryPointTest.kt (2 hunks)
  • app/ios/Modules/Sources/Schedule/ComposeScheduleDetailScreen.swift (1 hunks)
  • core/data/src/commonMain/kotlin/club/nito/core/data/DefaultParticipantRepository.kt (1 hunks)
  • core/data/src/commonMain/kotlin/club/nito/core/data/ParticipantRepository.kt (1 hunks)
  • core/domain/src/commonMain/kotlin/club/nito/core/domain/MyParticipantStatusStreamUseCase.kt (1 hunks)
  • core/domain/src/commonMain/kotlin/club/nito/core/domain/ParticipateUseCase.kt (1 hunks)
  • core/domain/src/commonMain/kotlin/club/nito/core/domain/ScheduleParticipantsStreamUseCase.kt (1 hunks)
  • core/domain/src/commonMain/kotlin/club/nito/core/domain/ScheduleStreamUseCase.kt (1 hunks)
  • core/domain/src/commonMain/kotlin/club/nito/core/domain/di/UseCaseModule.kt (3 hunks)
  • core/network/src/commonMain/kotlin/club/nito/core/network/participation/FakeParticipantRemoteDataSource.kt (1 hunks)
  • core/network/src/commonMain/kotlin/club/nito/core/network/participation/ParticipantRemoteDataSource.kt (1 hunks)
  • core/network/src/commonMain/kotlin/club/nito/core/network/participation/SupabaseParticipantRemoteDataSource.kt (1 hunks)
  • core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipant.kt (1 hunks)
  • feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailIntent.kt (1 hunks)
  • feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailScreen.kt (8 hunks)
  • feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailScreenUiState.kt (1 hunks)
  • feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailStateMachine.kt (3 hunks)
  • feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/di/ScheduleFeatureModule.kt (1 hunks)
Additional comments: 28
feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailScreenUiState.kt (1)
  • 13-16: participantSchedule の名前変更と新しいプロパティ scheduleWithPlaceusers の追加は適切です。ただし、myParticipantStatus の型が FetchSingleContentResult<ParticipantStatus> から ParticipantStatus に変更されているため、この変更が新しいデータ処理戦略と一致していることを確認してください。
feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/di/ScheduleFeatureModule.kt (1)
  • 17-25: scheduleFeatureModule 内の factory 宣言で、パラメータ名 idscheduleId に変更され、新しい依存関係 scheduleStream, scheduleParticipantsStream, myParticipantStatusStream が追加されています。これらの依存関係がモジュールで適切に提供されていることを確認してください。
feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailIntent.kt (1)
  • 12-22: ClickParticipantStatusChip クラスから schedule プロパティが削除され、そのサブクラス Participate, Absent, Hold がデータクラスからオブジェクトに変換されています。これらの変更が意図した使用法と一致していることを確認してください。
core/domain/src/commonMain/kotlin/club/nito/core/domain/MyParticipantStatusStreamUseCase.kt (1)
  • 13-29: 新しいインターフェース MyParticipantStatusStreamUseCase とその実装 FetchMyParticipantStatusExecutor が追加されました。この実装がリアクティブストリームのベストプラクティスに従っていることを確認してください。
core/network/src/commonMain/kotlin/club/nito/core/network/participation/model/NetworkParticipant.kt (1)
  • 28-32: NetworkParticipant クラスに新しい関数 toNetworkModel が追加され、ParticipantNetworkParticipant に変換します。この関数が正しく実装されていることを確認してください。
app/ios/Modules/Sources/Schedule/ComposeScheduleDetailScreen.swift (1)
  • 17-23: ComposeScheduleDetailScreen 構造体内の ScheduleDetailStateMachine 初期化で、依存関係 fetchParticipantScheduleByIdfetchMyParticipantStatusscheduleStream, scheduleParticipantsStream, myParticipantStatusStream に置き換えられています。新しい依存関係が正しく注入されていることを確認してください。
core/domain/src/commonMain/kotlin/club/nito/core/domain/ScheduleStreamUseCase.kt (1)
  • 16-37: 新しいインターフェース ScheduleStreamUseCase とその実装 ScheduleStreamExecutor が追加されました。この実装がエラーハンドリングとリアクティブストリームのベストプラクティスに従っていることを確認してください。
core/network/src/commonMain/kotlin/club/nito/core/network/participation/ParticipantRemoteDataSource.kt (1)
  • 46-48: 関数 insertParticipateupsertParticipate に名前変更され、パラメータ declarationparticipant に変更されています。これにより明確さと一貫性が向上していることを確認してください。
core/domain/src/commonMain/kotlin/club/nito/core/domain/ScheduleParticipantsStreamUseCase.kt (1)
  • 16-40: 新しいインターフェース ScheduleParticipantsStreamUseCase とその実装 ScheduleParticipantsStreamExecutor が追加されました。この実装がエラーハンドリングとリアクティブストリームのベストプラクティスに従っていることを確認してください。
core/network/src/commonMain/kotlin/club/nito/core/network/participation/FakeParticipantRemoteDataSource.kt (1)
  • 39-45: FakeParticipantRemoteDataSource クラスで、関数 insertParticipateupsertParticipate に名前変更され、パラメータ declarationparticipant に変更されています。関数本体が participant のプロパティを正しく使用していることを確認してください。
core/data/src/commonMain/kotlin/club/nito/core/data/ParticipantRepository.kt (1)
  • 52-73: ParticipantRepository インターフェースに新しい関数 participantStatusStream が追加され、関数 upsertLocalParticipateupsertParticipate に名前変更されています。これらの変更が一貫性を持っていることを確認してください。
app/ios-combined/src/iosTest/kotlin/club/nito/ios/combined/EntryPointTest.kt (1)
  • 48-48: インポート文とドメインユースケースの使用法が EntryPointTest.kt で変更されています。FetchMyParticipantStatusUseCase の使用が MyParticipantStatusStreamUseCase に置き換えられているため、新しいユースケースが正しくインスタンス化されていることを確認してください。
core/domain/src/commonMain/kotlin/club/nito/core/domain/di/UseCaseModule.kt (1)
  • 36-41: UseCaseModule に新しいクラスが追加され、MyParticipantStatusStreamUseCase, ScheduleParticipantsStreamUseCase, ScheduleStreamUseCase がそれぞれのエグゼキュータにバインドされています。これらの追加とバインディングが適切であることを確認してください。
core/domain/src/commonMain/kotlin/club/nito/core/domain/ParticipateUseCase.kt (4)
  • 14-19: 新しいパラメータoldStatusnewStatusParticipateUseCaseインターフェースに追加されました。これにより、参加者の状態変更が明確になり、リファクタリングの目的に合致しています。

  • 33-37: cachedParticipant変数を使用して、例外が発生した場合に元の参加者ステータスを復元するロジックが追加されました。この変更は状態の一貫性を保つために良い実践です。ただし、例外処理のロジック全体を検証することをお勧めします。

  • 40-47: invokeメソッド内でupsertLocalParticipateupsertParticipateが使用されており、参加者データの扱いが改善されていることが示唆されます。これらのメソッドの実装詳細を検証することをお勧めします。

  • 49-66: 例外処理ロジックがCancellationExceptionとその他の例外を区別しており、これはKotlinコルーチンでの良い実践です。ドメインエラーの正しい使用を検証することをお勧めします。

core/data/src/commonMain/kotlin/club/nito/core/data/DefaultParticipantRepository.kt (3)
  • 41-41: upsertLocalParticipateメソッドが追加され、ローカルデータの扱いが改善されていると考えられます。

  • 43-47: upsertParticipateメソッドが追加され、リモートデータソースを更新した後にローカルデータベースを更新するようになりました。データの一貫性を保つために、このデータフローを検証することをお勧めします。

  • 49-60: updateParticipateメソッドがローカルデータベースを先に更新するように変更されました。リモート更新が失敗した場合の一貫性の問題を含め、操作の順序と潜在的な一貫性の問題の処理を検証することをお勧めします。

core/network/src/commonMain/kotlin/club/nito/core/network/participation/SupabaseParticipantRemoteDataSource.kt (1)
  • 78-83: insertParticipateupsertParticipateに名前が変更され、パラメータがdeclarationからparticipantに変更されました。これはメソッドの新しい機能に合わせており、挿入と更新の両方の操作を処理するようになっています。
feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailStateMachine.kt (3)
  • 29-37: コンストラクタのパラメータが新しいストリームユースケースを受け入れるように変更されました。これはよりリアクティブなアーキテクチャへの移行を示している可能性があります。

  • 63-76: uiStateプロパティが新しいステートフローを組み込むように再構築されました。これはコンストラクタの変更と一致し、リアクティブなアプローチに沿っています。

  • 93-111: ユーザーインテントの処理が新しいparticipate関数を使用するようにリファクタリングされました。新しいパラメータoldStatusnewStatusを考慮すると、この変更は論理的です。

feature/schedule/src/commonMain/kotlin/club/nito/feature/schedule/detail/ScheduleDetailScreen.kt (4)
  • 51-59: インポートされたモジュールとschedule変数の型に関連する変更があります。これらの変更はリファクタリングと一致しています。

  • 110-110: schedule変数の型がScheduleWithPlaceに変更され、UIコンポーネントがそれに応じて更新されました。データモデルの強化を示唆しており、UIコンポーネントがこの変更を反映するように更新されています。

  • 132-147: UIのレイアウトとパディングが調整され、scheduleデータに基づいて新しいUIコンポーネントが追加されました。これらはユーザーエクスペリエンスを向上させるための小さな改善のようです。

  • 459-502: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [423-500]

BottomParticipateBarコンポーザブル関数が新しいstatusを処理し、参加ステータスのためのクリッカブルなチップを提供するように更新されました。これは新しい参加者ステータスの処理に一致し、UIの対話性を向上させます。

@tatsutakein tatsutakein merged commit d301543 into main Jan 3, 2024
6 checks passed
@tatsutakein tatsutakein deleted the rt/refactor-schedule-detail branch January 3, 2024 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant