Skip to content

Commit

Permalink
[various] Update Windows packages to Pigeon 21 (flutter#7180)
Browse files Browse the repository at this point in the history
Updates all Windows platform implementation packages to use the latest version of Pigeon. The main motivation was picking up the enum naming fix, but I figured I'd do all of them at once, even if they didn't use enums.
  • Loading branch information
stuartmorgan authored Jul 22, 2024
1 parent c21b01d commit e978e06
Show file tree
Hide file tree
Showing 27 changed files with 499 additions and 293 deletions.
4 changes: 4 additions & 0 deletions packages/camera/camera_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.2.4+1

* Updates to pigeon 21.

## 0.2.4

* Removes `maxVideoDuration`/`maxDuration`, as the feature was never exposed at
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_windows/lib/src/messages.g.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v20.0.2), do not edit directly.
// Autogenerated from Pigeon (v21.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers

Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera_windows/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_windows
description: A Flutter plugin for getting information about and controlling the camera on Windows.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_windows
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.2.4
version: 0.2.4+1

environment:
sdk: ^3.2.0
Expand All @@ -29,7 +29,7 @@ dev_dependencies:
flutter_test:
sdk: flutter
mockito: 5.4.4
pigeon: ^20.0.0
pigeon: ^21.0.0

topics:
- camera
14 changes: 7 additions & 7 deletions packages/camera/camera_windows/windows/capture_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CaptureControllerImpl::CaptureControllerImpl(
CaptureControllerListener* listener)
: capture_controller_listener_(listener),
media_settings_(
PlatformMediaSettings(PlatformResolutionPreset::max, true)),
PlatformMediaSettings(PlatformResolutionPreset::kMax, true)),
CaptureController(){};

CaptureControllerImpl::~CaptureControllerImpl() {
Expand Down Expand Up @@ -381,17 +381,17 @@ void CaptureControllerImpl::TakePicture(const std::string& file_path) {

uint32_t CaptureControllerImpl::GetMaxPreviewHeight() const {
switch (media_settings_.resolution_preset()) {
case PlatformResolutionPreset::low:
case PlatformResolutionPreset::kLow:
return 240;
case PlatformResolutionPreset::medium:
case PlatformResolutionPreset::kMedium:
return 480;
case PlatformResolutionPreset::high:
case PlatformResolutionPreset::kHigh:
return 720;
case PlatformResolutionPreset::veryHigh:
case PlatformResolutionPreset::kVeryHigh:
return 1080;
case PlatformResolutionPreset::ultraHigh:
case PlatformResolutionPreset::kUltraHigh:
return 2160;
case PlatformResolutionPreset::max:
case PlatformResolutionPreset::kMax:
default:
// no limit.
return 0xffffffff;
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_windows/windows/messages.g.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v20.0.2), do not edit directly.
// Autogenerated from Pigeon (v21.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#undef _HAS_EXCEPTIONS
Expand Down
14 changes: 7 additions & 7 deletions packages/camera/camera_windows/windows/messages.g.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Autogenerated from Pigeon (v20.0.2), do not edit directly.
// Autogenerated from Pigeon (v21.0.0), do not edit directly.
// See also: https://pub.dev/packages/pigeon

#ifndef PIGEON_MESSAGES_G_H_
Expand Down Expand Up @@ -60,12 +60,12 @@ class ErrorOr {

// Pigeon version of platform interface's ResolutionPreset.
enum class PlatformResolutionPreset {
low = 0,
medium = 1,
high = 2,
veryHigh = 3,
ultraHigh = 4,
max = 5
kLow = 0,
kMedium = 1,
kHigh = 2,
kVeryHigh = 3,
kUltraHigh = 4,
kMax = 5
};

// Pigeon version of MediaSettings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ TEST(CameraPlugin, CreateHandlerCallsInitCamera) {
};

plugin.Create(MOCK_CAMERA_NAME,
PlatformMediaSettings(PlatformResolutionPreset::max, true),
PlatformMediaSettings(PlatformResolutionPreset::kMax, true),
std::move(create_result));

EXPECT_TRUE(result_called);
Expand All @@ -168,7 +168,7 @@ TEST(CameraPlugin, CreateHandlerErrorOnInvalidDeviceId) {
};

plugin.Create(MOCK_INVALID_CAMERA_NAME,
PlatformMediaSettings(PlatformResolutionPreset::max, true),
PlatformMediaSettings(PlatformResolutionPreset::kMax, true),
std::move(create_result));

EXPECT_TRUE(result_called);
Expand Down Expand Up @@ -204,7 +204,7 @@ TEST(CameraPlugin, CreateHandlerErrorOnExistingDeviceId) {
EXPECT_EQ(reply.value(), 1);
};

PlatformMediaSettings media_settings(PlatformResolutionPreset::max, true);
PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, true);
plugin.Create(MOCK_CAMERA_NAME, media_settings,
std::move(first_create_result));

Expand Down Expand Up @@ -263,7 +263,7 @@ TEST(CameraPlugin, CreateHandlerAllowsRetry) {
EXPECT_TRUE(reply.has_error());
};

PlatformMediaSettings media_settings(PlatformResolutionPreset::max, true);
PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, true);
plugin.Create(MOCK_CAMERA_NAME, media_settings,
std::move(first_create_result));

Expand Down
4 changes: 2 additions & 2 deletions packages/camera/camera_windows/windows/test/camera_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TEST(Camera, InitCameraCreatesCaptureController) {

EXPECT_TRUE(camera->GetCaptureController() == nullptr);

PlatformMediaSettings media_settings(PlatformResolutionPreset::max, false);
PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, false);

// Init camera with mock capture controller factory
bool result = camera->InitCamera(
Expand Down Expand Up @@ -81,7 +81,7 @@ TEST(Camera, InitCameraReportsFailure) {

EXPECT_TRUE(camera->GetCaptureController() == nullptr);

PlatformMediaSettings media_settings(PlatformResolutionPreset::max, false);
PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, false);

// Init camera with mock capture controller factory
bool result = camera->InitCamera(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void MockInitCaptureController(
MockTextureRegistrar* texture_registrar, MockCaptureEngine* engine,
MockCamera* camera, int64_t mock_texture_id,
const PlatformMediaSettings media_settings =
PlatformMediaSettings(PlatformResolutionPreset::max, true)) {
PlatformMediaSettings(PlatformResolutionPreset::kMax, true)) {
ComPtr<MockMediaSource> video_source = new MockMediaSource();
ComPtr<MockMediaSource> audio_source = new MockMediaSource();

Expand Down Expand Up @@ -261,7 +261,7 @@ TEST(CaptureController, InitCaptureEngineCanOnlyBeCalledOnce) {

bool result = capture_controller->InitCaptureDevice(
texture_registrar.get(), MOCK_DEVICE_ID,
PlatformMediaSettings(PlatformResolutionPreset::max, true));
PlatformMediaSettings(PlatformResolutionPreset::kMax, true));

EXPECT_FALSE(result);

Expand Down Expand Up @@ -303,7 +303,7 @@ TEST(CaptureController, InitCaptureEngineReportsFailure) {

bool result = capture_controller->InitCaptureDevice(
texture_registrar.get(), MOCK_DEVICE_ID,
PlatformMediaSettings(PlatformResolutionPreset::max, true));
PlatformMediaSettings(PlatformResolutionPreset::kMax, true));

EXPECT_FALSE(result);
EXPECT_FALSE(engine->initialized_);
Expand Down Expand Up @@ -348,7 +348,7 @@ TEST(CaptureController, InitCaptureEngineReportsAccessDenied) {

bool result = capture_controller->InitCaptureDevice(
texture_registrar.get(), MOCK_DEVICE_ID,
PlatformMediaSettings(PlatformResolutionPreset::max, true));
PlatformMediaSettings(PlatformResolutionPreset::kMax, true));

EXPECT_FALSE(result);
EXPECT_FALSE(engine->initialized_);
Expand Down Expand Up @@ -734,7 +734,7 @@ TEST(CaptureController, StartRecordWithSettingsSuccess) {
const auto kVideoBitrate = 200000;
const auto kAudioBitrate = 32000;

PlatformMediaSettings media_settings(PlatformResolutionPreset::max, true);
PlatformMediaSettings media_settings(PlatformResolutionPreset::kMax, true);
media_settings.set_frames_per_second(kFps);
media_settings.set_video_bitrate(kVideoBitrate);
media_settings.set_audio_bitrate(kAudioBitrate);
Expand Down
3 changes: 2 additions & 1 deletion packages/file_selector/file_selector_windows/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 0.9.3+2

* Updates to pigeon 21.
* Updates minimum supported SDK version to Flutter 3.16/Dart 3.2.

## 0.9.3+1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class FileSelectorWindows extends FileSelectorPlatform {
}) async {
final FileDialogResult result = await _hostApi.showOpenDialog(
SelectionOptions(
allowMultiple: false,
selectFolders: false,
allowedTypes: _typeGroupsFromXTypeGroups(acceptedTypeGroups),
),
initialDirectory,
Expand All @@ -41,7 +39,6 @@ class FileSelectorWindows extends FileSelectorPlatform {
final FileDialogResult result = await _hostApi.showOpenDialog(
SelectionOptions(
allowMultiple: true,
selectFolders: false,
allowedTypes: _typeGroupsFromXTypeGroups(acceptedTypeGroups),
),
initialDirectory,
Expand Down Expand Up @@ -73,8 +70,6 @@ class FileSelectorWindows extends FileSelectorPlatform {
}) async {
final FileDialogResult result = await _hostApi.showSaveDialog(
SelectionOptions(
allowMultiple: false,
selectFolders: false,
allowedTypes: _typeGroupsFromXTypeGroups(acceptedTypeGroups),
),
options.initialDirectory,
Expand All @@ -95,7 +90,6 @@ class FileSelectorWindows extends FileSelectorPlatform {
}) async {
final FileDialogResult result = await _hostApi.showOpenDialog(
SelectionOptions(
allowMultiple: false,
selectFolders: true,
allowedTypes: <TypeGroup>[],
),
Expand Down
Loading

0 comments on commit e978e06

Please sign in to comment.