-
Notifications
You must be signed in to change notification settings - Fork 1
New code save #95
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
New code save #95
Conversation
This patch introduces a feature to save and restore the history of code written in the editor. Key features: - Code history is automatically saved when you stop typing for 2 seconds. - A new screen is added to view the list of saved histories, sorted by timestamp. - You can select a history entry to view the full code and restore it to the editor. - The history is stored locally on your device, with each problem having its own history. Note on tests: The existing test suite has some failing tests (`widget_test.dart` and `update_service_test.dart`). These failures appear to be caused by pre-existing issues in the test setup, specifically related to network requests in the test environment. I have made an effort to fix the `widget_test.dart` by providing the necessary providers, but the underlying issue with async operations during app startup in tests remains. These failing tests are unrelated to the new code history feature.
…en.dart and widget_test.dart; adopt dev styles and test setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📋レビュー概要
このプルリクエストは新しいコード履歴機能を導入し、ユーザーが問題ごとにコードを自動的に保存・復元できるようにします。実装には、新しいデータモデル、ファイルベースの履歴保存のためのサービス、履歴を表示するための新しい画面が含まれます。エディタ画面も大幅にリファクタリングされ、新しいUIレイアウトと自動保存機能が追加された。
全体として、これはユーザー体験を大幅に改善する素晴らしい機能追加である。コードは全般的によく構造化されている。私のレビューは、堅牢性、保守性、テストの改善に重点を置いています。
ᔍ 一般的なフィードバック
- エラー処理**: 新しいファイルベースサービスには、I/O例外によるクラッシュを防ぐためのエラーハンドリングを含めるべきです。
- CI/CD**: GitHub Actions ワークフローには、正しく実行するために対処すべき設定上の問題があります。
- テスト: 新機能は、その正しさを保証し、将来のリグレッションを防ぐために、専用のウィジェットテストが役立つでしょう。
- コードのクリーン化**: 削除されるべきデバッグログが残っています。
エディター画面のUI改善は素晴らしく、インターフェイスをより直感的にしています。よくやった!
*** Translated with www.DeepL.com/Translator (free version) ***
- '.github/workflows/build.yml' | ||
# このファイル名に合わせてパスを更新 | ||
- '.github/workflows/flutter-ci.yml' | ||
- 'android/**' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🔴 critical: The trigger path for this workflow file is incorrect. The file is named
build.yaml
, but the path in the trigger is set to.github/workflows/flutter-ci.yml
. This will prevent the workflow from running when this file itself is changed.
- 'android/**' | |
- '.github/workflows/build.yaml' |
steps: | ||
# Step 1: リポジトリのコードをチェックアウト | ||
- name: Checkout code | ||
uses: actions/checkout@v4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🟡 medium: The
contains
function is not necessary here and makes the condition harder to read. A direct string comparison is simpler and achieves the same result. This comment applies to the otherif
conditions in this job as well.
uses: actions/checkout@v4 | |
if: (github.event.inputs.build_type || 'split') == 'split' |
# <--- 変更点: 以下の2つのステップでアップロードするファイルを分岐 --- > | ||
|
||
# 分割APKをアップロード | ||
- name: Upload Split APKs Artifact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🟡 medium: The
contains
function is not necessary here. A direct string comparison is simpler and more readable. This comment also applies to theRelease with Single APK
step.
- name: Upload Split APKs Artifact | |
if: needs.build_android.outputs.build_type == 'split' |
// CodeController の言語も更新 | ||
_codeController.language = _getHighlightLanguage(_selectedLanguage); | ||
developer.log('Language changed to: $_selectedLanguage, loading code...', name: 'EditorScreen'); | ||
developer.log( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🟢 low: This file contains a large number of
developer.log
andprint
statements. While useful for debugging, they should be removed or replaced with a more structured logging solution before this feature is released to production to avoid cluttering the console logs.
developer.log( | |
// developer.log('Language changed to: $_selectedLanguage, loading code...', name: 'EditorScreen'); |
import '../services/code_history_service.dart'; | ||
import 'code_history_screen.dart'; | ||
|
||
// 3点メニュー用のアクション列挙体(トップレベルに定義) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🟢 low: For better encapsulation, you could define this enum inside the
_EditorScreenState
class, as it's only used there. However, since it's a private enum (_ToolbarAction
), its scope is already limited to this file, so this is a minor stylistic suggestion.
// 3点メニュー用のアクション列挙体(トップレベルに定義) | |
enum _ToolbarAction { save, history, restore, reset, share } | |
class _EditorScreenState extends State<EditorScreen> { |
No description provided.