From ac6ed614cbe1732b7a302859f8bb612be9724027 Mon Sep 17 00:00:00 2001 From: done <23427957+sensuikan1973@users.noreply.github.com> Date: Sat, 20 Mar 2021 13:19:53 +0900 Subject: [PATCH] fix windows compress script, file info, and so on. (#83) * fix windows compress script See: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.archive/compress-archive?view=powershell-7.1#example-4--compress-a-directory-that-excludes-the-root-directory * 0.1.0-alpha.1 * change windows file info * fix home indicator * fix noisy snackbar * title centering * fix msvc path --- .github/scripts/prepare_to_pack_for_windows.sh | 12 ++++++++---- .github/workflows/flutter_build.yaml | 9 +++++---- .github/workflows/publish.yaml | 2 +- lib/home/home.dart | 17 +++++++++-------- lib/models/board_notifier.dart | 8 ++++---- lib/models/board_state.dart | 2 +- pubspec.yaml | 2 +- windows/runner/Runner.rc | 6 +++--- 8 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/scripts/prepare_to_pack_for_windows.sh b/.github/scripts/prepare_to_pack_for_windows.sh index 3ddeb294c..ad34669e3 100755 --- a/.github/scripts/prepare_to_pack_for_windows.sh +++ b/.github/scripts/prepare_to_pack_for_windows.sh @@ -2,7 +2,11 @@ # See: https://flutter.dev/desktop#windows # See: https://github.com/sensuikan1973/pedax/pull/71#issuecomment-798849250 -target_dll_path="/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.28.29325/x64/Microsoft.VC142.CRT" -cp "$target_dll_path/vcruntime140.dll" build/windows/runner/Release/ -cp "$target_dll_path/vcruntime140_1.dll" build/windows/runner/Release/ -cp "$target_dll_path/msvcp140.dll" build/windows/runner/Release/ +# See: https://github.com/sensuikan1973/pedax/pull/83#issuecomment-803240876 +msvc_path="/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC" +ls "$msvc_path" + +target_vc_path="$msvc_path/14.28.29910/x64/Microsoft.VC142.CRT" +cp "$target_vc_path/vcruntime140.dll" build/windows/runner/Release/ +cp "$target_vc_path/vcruntime140_1.dll" build/windows/runner/Release/ +cp "$target_vc_path/msvcp140.dll" build/windows/runner/Release/ diff --git a/.github/workflows/flutter_build.yaml b/.github/workflows/flutter_build.yaml index b9c2d93d3..998cf49a1 100644 --- a/.github/workflows/flutter_build.yaml +++ b/.github/workflows/flutter_build.yaml @@ -13,7 +13,7 @@ on: jobs: build: runs-on: ${{ matrix.os }} - timeout-minutes: 15 + timeout-minutes: 20 strategy: fail-fast: false # I want results from all OSes even if one fails. matrix: @@ -51,6 +51,10 @@ jobs: run: flutter doctor -v - name: build run: flutter build ${{ matrix.subcommand }} --${{ matrix.mode }} + + # - name: debug + # uses: mxschmitt/action-tmate@v3 + - name: prepare to pack shell: bash run: ${{ matrix.prepare_to_pack_script }} @@ -65,9 +69,6 @@ jobs: shell: bash run: .github/scripts/output_build_info.sh ${{ matrix.distribution_path }} - # - name: debug - # uses: mxschmitt/action-tmate@v3 - - uses: actions/upload-artifact@v2 with: name: pedax-${{ runner.os }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index d59239844..d1f678f55 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -62,7 +62,7 @@ jobs: run: |- mkdir -p ${{ env.PUBLISH_DIR }} cd ${{ matrix.distribution_path }} - powershell Compress-Archive -Path *.* -DestinationPath $Env:GITHUB_WORKSPACE/${{ env.PUBLISH_DIR }}/pedax-${{ runner.os }}.zip + powershell Compress-Archive -Path ./* -DestinationPath $Env:GITHUB_WORKSPACE/${{ env.PUBLISH_DIR }}/pedax-${{ runner.os }}.zip - name: compress files (macOS, Linux) if: runner.os == 'macOS' || runner.os == 'Linux' run: |- diff --git a/lib/home/home.dart b/lib/home/home.dart index 63836a25e..8e03cbc38 100644 --- a/lib/home/home.dart +++ b/lib/home/home.dart @@ -59,18 +59,19 @@ class _HomeState extends State { @override Widget build(BuildContext context) { - final edaxInitOnce = context.select((notifier) => notifier.value.edaxInitOnce); - if (!edaxInitOnce) return const Center(child: CupertinoActivityIndicator()); - final bookLoadStatus = context.select((notifier) => notifier.value.bookLoadStatus); - if (bookLoadStatus == BookLoadStatus.loaded) _showSnackBarOfBookLoaded(); + final edaxServerSpawned = context.select((notifier) => notifier.value.edaxServerSpawned); + if (!edaxServerSpawned) return const Center(child: CupertinoActivityIndicator()); + final bookLoadStatus = context.select((notifier) => notifier.value.bookLoadStatus); if (bookLoadStatus == BookLoadStatus.loading) _showSnackBarOfBookLoading(); + if (bookLoadStatus == BookLoadStatus.loaded) _showSnackBarOfBookLoaded(); return Scaffold( appBar: AppBar( leading: _menu(), - title: Text(AppLocalizations.of(context)!.analysisMode, textAlign: TextAlign.center), + title: Text(AppLocalizations.of(context)!.analysisMode), + centerTitle: true, ), - body: context.select((notifier) => notifier.value.edaxServerSpawned) + body: context.select((notifier) => notifier.value.edaxInitOnce) ? Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -159,7 +160,7 @@ class _HomeState extends State { void _showSnackBarOfBookLoaded() { context.read().value.bookLoadStatus = BookLoadStatus.notifiedToUser; WidgetsBinding.instance?.addPostFrameCallback((_) { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); + ScaffoldMessenger.of(context).removeCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text(AppLocalizations.of(context)!.finishedLoadingBookFile, textAlign: TextAlign.center), @@ -171,7 +172,7 @@ class _HomeState extends State { void _showSnackBarOfBookLoading() { context.read().value.bookLoadStatus = BookLoadStatus.notifiedToUser; WidgetsBinding.instance?.addPostFrameCallback((_) { - ScaffoldMessenger.of(context).hideCurrentSnackBar(); + ScaffoldMessenger.of(context).removeCurrentSnackBar(); ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text(AppLocalizations.of(context)!.loadingBookFile, textAlign: TextAlign.center), diff --git a/lib/models/board_notifier.dart b/lib/models/board_notifier.dart index 679eb2dfe..ce0379010 100644 --- a/lib/models/board_notifier.dart +++ b/lib/models/board_notifier.dart @@ -56,13 +56,13 @@ class BoardNotifier extends ValueNotifier { notifyListeners(); }); - _edaxServerPort.send(const InitRequest()); - value ..edaxServerSpawned = true ..level = level ..hintStepByStep = hintStepByStep; notifyListeners(); + + _edaxServerPort.send(const InitRequest()); } void requestInit() => _edaxServerPort.send(const InitRequest()); @@ -127,8 +127,6 @@ class BoardNotifier extends ValueNotifier { ..lastMove = message.lastMove ..currentMoves = message.moves; } else if (message is InitResponse) { - if (!value.edaxInitOnce) value.edaxInitOnce = true; - _requestLatestHintList(message.moves); value ..board = message.board ..squaresOfPlayer = UnmodifiableListView(value.board.squaresOfPlayer) @@ -136,6 +134,8 @@ class BoardNotifier extends ValueNotifier { ..currentColor = message.currentColor ..lastMove = message.lastMove ..currentMoves = message.moves; + if (!value.edaxInitOnce) value.edaxInitOnce = true; + _requestLatestHintList(message.moves); } else if (message is RotateResponse) { _requestLatestHintList(message.moves); value diff --git a/lib/models/board_state.dart b/lib/models/board_state.dart index 82a4f115a..b1730a696 100644 --- a/lib/models/board_state.dart +++ b/lib/models/board_state.dart @@ -16,7 +16,7 @@ class BoardState { UnmodifiableListView hints = UnmodifiableListView([]); bool edaxInitOnce = false; String currentMoves = ''; - BookLoadStatus bookLoadStatus = BookLoadStatus.loading; + BookLoadStatus? bookLoadStatus; bool hintIsVisible = true; bool edaxServerSpawned = false; int bestScore = 0; diff --git a/pubspec.yaml b/pubspec.yaml index e201ce661..9c2c5c434 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ issue_tracker: https://github.com/sensuikan1973/pedax/issues # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.1.0-alpha.0+1 +version: 0.1.0-alpha.1+1 environment: # See: https://dart.dev/tools/pub/pubspec#sdk-constraints sdk: '>=2.12.0 <3.0.0' diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 8773b503b..1eff719b9 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -89,11 +89,11 @@ BEGIN BEGIN BLOCK "040904e4" BEGIN - VALUE "CompanyName", "com.example" "\0" - VALUE "FileDescription", "A new Flutter project." "\0" + VALUE "CompanyName", "com.done.sensuikan1973" "\0" + VALUE "FileDescription", "othello Board GUI with edax." "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "InternalName", "pedax" "\0" - VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0" + VALUE "LegalCopyright", "Copyright (C) 2021 com.done.sensuikan1973. All rights reserved." "\0" VALUE "OriginalFilename", "pedax.exe" "\0" VALUE "ProductName", "pedax" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0"