Skip to content

Commit 7e911b9

Browse files
Merge branch 'main' into update-min-os-versions
2 parents 1802029 + b314944 commit 7e911b9

File tree

13 files changed

+1113
-69
lines changed

13 files changed

+1113
-69
lines changed

.ci/flutter_master.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
cb7b7dfe86c77265e7ab50cbb0dba95d5d0d42a9
1+
de4be4f3892d78b768128e0f46e7a79b65dbfb8c
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Creates Batch Release for A Package"
2+
3+
on:
4+
repository_dispatch:
5+
types: [batch_release_pr]
6+
7+
jobs:
8+
create_release_pr:
9+
runs-on: ubuntu-latest
10+
env:
11+
BRANCH_NAME: ${{ github.event.client_payload.package }}-${{ github.run_id }}-${{ github.run_attempt }}
12+
steps:
13+
- name: checkout repository
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
15+
- name: Set up tools
16+
run: dart pub get
17+
working-directory: ${{ github.workspace }}/script/tool
18+
# This step is to create a branch for batch release
19+
# A branch may not be created if there is nothing to release.
20+
# In that case, the workflow will exit and complete successfully.
21+
- name: create batch release PR
22+
run: |
23+
git config --global user.name ${{ secrets.USER_NAME }}
24+
git config --global user.email ${{ secrets.USER_EMAIL }}
25+
dart ./script/tool/lib/src/main.dart branch-for-batch-release --packages=${{ github.event.client_payload.package }} --branch=${{ env.BRANCH_NAME }} --remote=origin
26+
- name: Check if branch was created
27+
id: check-branch-exists
28+
uses: GuillaumeFalourd/[email protected]
29+
with:
30+
branch: ${{ env.BRANCH_NAME }}
31+
32+
- name: Create Pull Request
33+
if: steps.check-branch-exists.outputs.exists == 'true'
34+
uses: peter-evans/create-pull-request@v7
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
commit-message: "[${{ github.event.client_payload.package }}] Batch release"
38+
title: "[${{ github.event.client_payload.package }}] Batch release"
39+
body: "This PR was created automatically to batch release the `${{ github.event.client_payload.package }}`."
40+
branch: ${{ env.BRANCH_NAME }}
41+
base: release
42+
43+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Creates Batch Release for go_router"
2+
3+
on:
4+
schedule:
5+
# Run every Monday at 8:00 AM
6+
- cron: "0 8 * * 1"
7+
8+
jobs:
9+
dispatch_release_pr:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Repository Dispatch
13+
uses: peter-evans/repository-dispatch@v4
14+
with:
15+
token: "${{ secrets.GITHUB_TOKEN }}"
16+
event-type: batch_release_pr
17+
client-payload: '{"package": "go_router"}'

packages/camera/camera_windows/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.2.6+4
2+
3+
* Removes usage of the deprecated and ignored `maxVideoDuration` in the example.
4+
15
## 0.2.6+3
26

37
* Updates to Pigeon 26.

packages/camera/camera_windows/example/lib/main.dart

Lines changed: 12 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class _MyAppState extends State<MyApp> {
2828
int _cameraId = -1;
2929
bool _initialized = false;
3030
bool _recording = false;
31-
bool _recordingTimed = false;
3231
bool _previewPaused = false;
3332
Size? _previewSize;
3433
MediaSettings _mediaSettings = const MediaSettings(
@@ -147,7 +146,6 @@ class _MyAppState extends State<MyApp> {
147146
_cameraIndex = 0;
148147
_previewSize = null;
149148
_recording = false;
150-
_recordingTimed = false;
151149
_cameraInfo =
152150
'Failed to initialize camera: ${e.code}: ${e.description}';
153151
});
@@ -166,7 +164,6 @@ class _MyAppState extends State<MyApp> {
166164
_cameraId = -1;
167165
_previewSize = null;
168166
_recording = false;
169-
_recordingTimed = false;
170167
_previewPaused = false;
171168
_cameraInfo = 'Camera disposed';
172169
});
@@ -191,56 +188,22 @@ class _MyAppState extends State<MyApp> {
191188
_showInSnackBar('Picture captured to: ${file.path}');
192189
}
193190

194-
Future<void> _recordTimed(int seconds) async {
195-
if (_initialized && _cameraId > 0 && !_recordingTimed) {
196-
unawaited(
197-
CameraPlatform.instance.onVideoRecordedEvent(_cameraId).first.then((
198-
VideoRecordedEvent event,
199-
) async {
200-
if (mounted) {
201-
setState(() {
202-
_recordingTimed = false;
203-
});
204-
205-
_showInSnackBar('Video captured to: ${event.file.path}');
206-
}
207-
}),
208-
);
209-
210-
await CameraPlatform.instance.startVideoRecording(
211-
_cameraId,
212-
maxVideoDuration: Duration(seconds: seconds),
213-
);
214-
215-
if (mounted) {
216-
setState(() {
217-
_recordingTimed = true;
218-
});
219-
}
220-
}
221-
}
222-
223191
Future<void> _toggleRecord() async {
224192
if (_initialized && _cameraId > 0) {
225-
if (_recordingTimed) {
226-
/// Request to stop timed recording short.
227-
await CameraPlatform.instance.stopVideoRecording(_cameraId);
193+
if (!_recording) {
194+
await CameraPlatform.instance.startVideoRecording(_cameraId);
228195
} else {
229-
if (!_recording) {
230-
await CameraPlatform.instance.startVideoRecording(_cameraId);
231-
} else {
232-
final XFile file = await CameraPlatform.instance.stopVideoRecording(
233-
_cameraId,
234-
);
196+
final XFile file = await CameraPlatform.instance.stopVideoRecording(
197+
_cameraId,
198+
);
235199

236-
_showInSnackBar('Video captured to: ${file.path}');
237-
}
200+
_showInSnackBar('Video captured to: ${file.path}');
201+
}
238202

239-
if (mounted) {
240-
setState(() {
241-
_recording = !_recording;
242-
});
243-
}
203+
if (mounted) {
204+
setState(() {
205+
_recording = !_recording;
206+
});
244207
}
245208
}
246209
}
@@ -407,18 +370,7 @@ class _MyAppState extends State<MyApp> {
407370
const SizedBox(width: 5),
408371
ElevatedButton(
409372
onPressed: _initialized ? _toggleRecord : null,
410-
child: Text(
411-
(_recording || _recordingTimed)
412-
? 'Stop recording'
413-
: 'Record Video',
414-
),
415-
),
416-
const SizedBox(width: 5),
417-
ElevatedButton(
418-
onPressed: (_initialized && !_recording && !_recordingTimed)
419-
? () => _recordTimed(5)
420-
: null,
421-
child: const Text('Record 5 seconds'),
373+
child: Text(_recording ? 'Stop recording' : 'Record Video'),
422374
),
423375
if (_cameras.length > 1) ...<Widget>[
424376
const SizedBox(width: 5),

packages/camera/camera_windows/lib/camera_windows.dart

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,11 @@ class CameraWindows extends CameraPlatform {
5050
@override
5151
Future<List<CameraDescription>> availableCameras() async {
5252
try {
53-
final List<String?> cameras = await _hostApi.getAvailableCameras();
53+
final List<String> cameras = await _hostApi.getAvailableCameras();
5454

55-
return cameras.map((String? cameraName) {
55+
return cameras.map((String cameraName) {
5656
return CameraDescription(
57-
// This type is only nullable due to Pigeon limitations, see
58-
// https://github.com/flutter/flutter/issues/97848. The native code
59-
// will never return null.
60-
name: cameraName!,
57+
name: cameraName,
6158
// TODO(stuartmorgan): Implement these; see
6259
// https://github.com/flutter/flutter/issues/97540.
6360
lensDirection: CameraLensDirection.front,

packages/camera/camera_windows/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera_windows
22
description: A Flutter plugin for getting information about and controlling the camera on Windows.
33
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_windows
44
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
5-
version: 0.2.6+3
5+
version: 0.2.6+4
66

77
environment:
88
sdk: ^3.8.0
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Use this file as template to draft a unreleased changelog file.
2+
# Make a copy of this file in the same directory, rename it, and fill in the details.
3+
changelog: |
4+
- Can include a list of changes.
5+
- with markdown supported.
6+
version: <major|minor|patch|skip>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file is for test purposes only.
2+
# TODO(chuntai): remove this file before publishing.
3+
changelog: |
4+
- Adds 'batch' option to CI config for go_router package.
5+
- Updates GitHub Actions workflow for batch releases of go_router.
6+
version: major
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file is for test purposes only.
2+
# TODO(chuntai): remove this file before publishing.
3+
changelog: |
4+
- Adds some other features
5+
version: minor

0 commit comments

Comments
 (0)