param( [string]$platform = "" ) # TODO: remove # https://github.com/flutter/flutter/issues/182281 $NewOverScrollIndicator = "362b1de29974ffc1ed6faa826e1df870d7bec75f"; # set `gestureSettings` $BottomSheetAndroidPatch = "lib/scripts/bottom_sheet_android.patch" # https://github.com/bggRGjQaUbCoE/PiliPlus/issues/1906 $BottomSheetIOSFlutterPatch = "lib/scripts/bottom_sheet_ios_flutter.patch" $BottomSheetIOSPiliPlusPatch = "lib/scripts/bottom_sheet_ios_piliplus.patch" # TODO: remove # https://github.com/flutter/flutter/issues/185052 $TextSelectionMenuFix = "beb2ad17004a1b118ff2bd09f55cee23198f6652"; # https://github.com/bggRGjQaUbCoE/PiliPlus/issues/1662 # handle bottom scroll event $ScrollViewPatch = "lib/scripts/scroll_view.patch" # https://github.com/bggRGjQaUbCoE/PiliPlus/issues/2106 # use `TouchGestureRecognizer` on all platforms $TextSelectionPatch = "lib/scripts/text_selection.patch" # https://github.com/bggRGjQaUbCoE/PiliPlus/issues/1947 $NavigatorPatch = "lib/scripts/navigator.patch" # https://github.com/bggRGjQaUbCoE/PiliPlus/issues/2107 $ImageAnimPatch = "lib/scripts/image_anim.patch" # remove `_scheduleRebuild` $LayoutBuilderPatch = "lib/scripts/layout_builder.patch" # https://github.com/bggRGjQaUbCoE/PiliPlus/issues/2308 $NavigationDrawerPatch = "lib/scripts/navigation_drawer.patch" # apply text color to icon color $PopupMenuPatch = "lib/scripts/popup_menu.patch" # remove `Hero` effect $FABPatch = "lib/scripts/fab.patch" # https://github.com/flutter/flutter/issues/139890 # https://github.com/flutter/flutter/issues/174689 # separator support # clamp handle offset # widgetspan selection support # clear selection when tapping outside # free selection if there is only one text # clamp dragging selection behavior on Android # show selection menu if secondary tap position is in text region on desktop $SelectableRegionPatch = "lib/scripts/selectable_region.patch" # https://github.com/flutter/flutter/issues/132047 # https://github.com/flutter/flutter/issues/174689 $EditableTextPatch = "lib/scripts/editable_text.patch" # set `selectAllOnFocus` to `false` by default $TextFieldPatch = "lib/scripts/text_field.patch" # notify `userScrollDirection` only if position is actually changing $ScrollPositionPatch = "lib/scripts/scroll_position.patch" # expose `_shouldIgnorePointer` $ScrollablePatch = "lib/scripts/scrollable.patch" $ScrollableGesturePatch = "lib/scripts/scrollable_gesture.patch" $DraggableScrollableSheetPatch = "lib/scripts/draggable_scrollable_sheet.patch" # TODO: remove # https://github.com/flutter/flutter/issues/124078 # https://github.com/flutter/flutter/pull/183261 $NullSafetySelectableRegionPatch = "lib/scripts/null_safety_for_selectable_region.patch" # TODO: remove # https://github.com/flutter/flutter/issues/90223 $ModalBarrierPatch = "lib/scripts/modal_barrier.patch" # TODO: remove # https://github.com/flutter/flutter/issues/182466 $MouseCursorPatch = "lib/scripts/mouse_cursor.patch" $GeetestIOSPatch = "lib/scripts/geetest_ios.patch" if ($platform.ToLower() -eq "ios") { git apply $BottomSheetIOSPiliPlusPatch if ($LASTEXITCODE -eq 0) { Write-Host "$BottomSheetIOSPiliPlusPatch applied" } git apply $GeetestIOSPatch if ($LASTEXITCODE -eq 0) { Write-Host "$GeetestIOSPatch applied" } } Set-Location $env:FLUTTER_ROOT $picks = @($TextSelectionMenuFix) $reverts = @() $patches = @($ModalBarrierPatch, $TextSelectionPatch, $MouseCursorPatch, $ImageAnimPatch, $LayoutBuilderPatch, $NavigationDrawerPatch, $PopupMenuPatch, $FABPatch, $NullSafetySelectableRegionPatch, $SelectableRegionPatch, $EditableTextPatch, $TextFieldPatch, $ScrollPositionPatch, $ScrollablePatch, $ScrollableGesturePatch, $DraggableScrollableSheetPatch) switch ($platform.ToLower()) { "android" { $patches += $BottomSheetAndroidPatch $patches += $ScrollViewPatch $patches += $NavigatorPatch } "ios" { $patches += $ScrollViewPatch $patches += $BottomSheetIOSFlutterPatch $patches += $NavigatorPatch } "linux" { } "macos" { } "windows" { } default {} } git config --global user.name "ci" git config --global user.email "example@example.com" git reset --hard HEAD foreach ($pick in $picks) { git stash git cherry-pick $pick --no-edit if ($LASTEXITCODE -eq 0) { git reset --soft HEAD~1 Write-Host "$pick picked" } git stash pop } foreach ($revert in $reverts) { git stash git revert $revert --no-edit if ($LASTEXITCODE -eq 0) { git reset --soft HEAD~1 Write-Host "$revert reverted" } git stash pop } foreach ($patch in $patches) { git apply "$env:GITHUB_WORKSPACE/$patch" if ($LASTEXITCODE -eq 0) { Write-Host "$patch applied" } }