Skip to content

Commit

Permalink
Merge commit '287af0f8f99d3afb9eaef1576ee34d683f0e2f79'
Browse files Browse the repository at this point in the history
* commit '287af0f8f99d3afb9eaef1576ee34d683f0e2f79':
  [ios_platform_images] ignore DecoderCallback deprecation (flutter#5806)
  Roll Flutter from ac29c11 to efb9368 (3 revisions) (flutter#5827)
  Fix issue where map updates don't take effect in Flutter v3.0.0 (flutter#5787)
  Roll Flutter from e4c7f6e to ac29c11 (1 revision) (flutter#5826)
  Roll Flutter from 7ca4984 to e4c7f6e (4 revisions) (flutter#5824)
  Roll Flutter from 35c0a3e to 7ca4984 (3 revisions) (flutter#5823)
  [ci] Initial migration to Cirrus Apple silicon (flutter#5794)
  Roll Flutter from 9398c14 to 35c0a3e (9 revisions) (flutter#5821)
  Roll Flutter from f852092 to 9398c14 (3 revisions) (flutter#5817)
  Roll Flutter from 7ece8f9 to f852092 (5 revisions) (flutter#5815)
  Roll Flutter from ec20ea8 to 7ece8f9 (3 revisions) (flutter#5813)
  [google_maps_flutter] Fix prefer_const_literals_to_create_immutables (flutter#5811)
  [google_maps_flutter] Updates platform interface to new analysis options (flutter#5793)
  [Camera] Return all possible cameras on iOS (flutter#5636)
  • Loading branch information
dooully committed May 25, 2022
2 parents 2f9936e + 287af0f commit d2a9cbe
Show file tree
Hide file tree
Showing 57 changed files with 882 additions and 480 deletions.
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ec20ea80ad98007bd022648168e7b3cc38b2e665
efb9368573f605fdf63b6143d7a352b400805a72
72 changes: 48 additions & 24 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,17 @@ macos_template: &MACOS_TEMPLATE
# Only one macOS task can run in parallel without credits, so use them for
# PRs on macOS.
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'

macos_intel_template: &MACOS_INTEL_TEMPLATE
<< : *MACOS_TEMPLATE
osx_instance:
image: big-sur-xcode-13

macos_arm_template: &MACOS_ARM_TEMPLATE
<< : *MACOS_TEMPLATE
macos_instance:
image: ghcr.io/cirruslabs/macos-monterey-xcode:13.4

# Light-workload Linux tasks.
# These use default machines, with fewer CPUs, to reduce pressure on the
# concurrency limits.
Expand Down Expand Up @@ -298,15 +306,11 @@ task:
drive_script:
- ./script/tool_runner.sh drive-examples --web --exclude=script/configs/exclude_integration_web.yaml

# macOS tasks.
# ARM macOS tasks.
task:
<< : *MACOS_TEMPLATE
<< : *MACOS_ARM_TEMPLATE
<< : *FLUTTER_UPGRADE_TEMPLATE
matrix:
### iOS+macOS tasks ***
- name: darwin-lint_podspecs
script:
- ./script/tool_runner.sh podspecs
### iOS tasks ###
- name: ios-build_all_plugins
env:
Expand All @@ -315,6 +319,42 @@ task:
CHANNEL: "master"
CHANNEL: "stable"
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
### macOS desktop tasks ###
- name: macos-platform_tests
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
PATH: $PATH:/usr/local/bin
build_script:
- flutter config --enable-macos-desktop
- ./script/tool_runner.sh build-examples --macos
xcode_analyze_script:
- ./script/tool_runner.sh xcode-analyze --macos
xcode_analyze_deprecation_script:
# Ensure we don't accidentally introduce deprecated code.
- ./script/tool_runner.sh xcode-analyze --macos --macos-min-version=12.3
native_test_script:
- ./script/tool_runner.sh native-test --macos
drive_script:
- ./script/tool_runner.sh drive-examples --macos --exclude=script/configs/exclude_integration_macos.yaml

# Intel macOS tasks.
task:
<< : *MACOS_INTEL_TEMPLATE
<< : *FLUTTER_UPGRADE_TEMPLATE
matrix:
### iOS+macOS tasks ***
# TODO(stuartmorgan): Move this to ARM once google_maps_flutter has ARM
# support. `pod lint` makes a synthetic target that doesn't respect the
# pod's arch exclusions, so fails to build.
- name: darwin-lint_podspecs
script:
- ./script/tool_runner.sh podspecs
### iOS tasks ###
# TODO(stuartmorgan): Swap this and ios-build_all_plugins once simulator
# tests are reliable on the ARM infrastructure. See discussion at
# https://github.com/flutter/plugins/pull/5693#issuecomment-1126011089
- name: ios-platform_tests
env:
PATH: $PATH:/usr/local/bin
Expand Down Expand Up @@ -345,6 +385,8 @@ task:
# So we run `drive-examples` after `native-test`; changing the order will result ci failure.
- ./script/tool_runner.sh drive-examples --ios --exclude=script/configs/exclude_integration_ios.yaml
### macOS desktop tasks ###
# macos-platform_tests builds all the plugins on M1, so this build is run
# on Intel to give us build coverage of both host types.
- name: macos-build_all_plugins
env:
BUILD_ALL_ARGS: "macos"
Expand All @@ -354,21 +396,3 @@ task:
setup_script:
- flutter config --enable-macos-desktop
<< : *BUILD_ALL_PLUGINS_APP_TEMPLATE
- name: macos-platform_tests
env:
matrix:
CHANNEL: "master"
CHANNEL: "stable"
PATH: $PATH:/usr/local/bin
build_script:
- flutter config --enable-macos-desktop
- ./script/tool_runner.sh build-examples --macos
xcode_analyze_script:
- ./script/tool_runner.sh xcode-analyze --macos
xcode_analyze_deprecation_script:
# Ensure we don't accidentally introduce deprecated code.
- ./script/tool_runner.sh xcode-analyze --macos --macos-min-version=12.3
native_test_script:
- ./script/tool_runner.sh native-test --macos
drive_script:
- ./script/tool_runner.sh drive-examples --macos --exclude=script/configs/exclude_integration_macos.yaml
4 changes: 0 additions & 4 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# with minimal changes for this repository. The goal is to move toward using a
# shared set of analysis options as much as possible, and eventually a shared
# file.
#
# Plugins that have not yet switched from the previous set of options have a
# local analysis_options.yaml that points to analysis_options_legacy.yaml
# instead.

# Specify analysis options.
#
Expand Down
14 changes: 0 additions & 14 deletions analysis_options_legacy.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.9.7

* Returns all the available cameras on iOS.

## 0.9.6

* Adds audio access permission handling logic on iOS to fix an issue with `prepareForVideoRecording` not awaiting for the audio permission request result.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
25C3919135C3D981E6F800D0 /* libPods-RunnerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1944D8072499F3B5E7653D44 /* libPods-RunnerTests.a */; };
334733EA2668111C00DCC49E /* CameraOrientationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 03BB767226653ABE00CE5A93 /* CameraOrientationTests.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
43ED1537282570DE00EB00DE /* AvailableCamerasTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 43ED1536282570DE00EB00DE /* AvailableCamerasTest.m */; };
788A065A27B0E02900533D74 /* StreamingTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 788A065927B0E02900533D74 /* StreamingTest.m */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
Expand Down Expand Up @@ -71,6 +72,7 @@
14AE82C910C2A12F2ECB2094 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
1944D8072499F3B5E7653D44 /* libPods-RunnerTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RunnerTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
43ED1536282570DE00EB00DE /* AvailableCamerasTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AvailableCamerasTest.m; sourceTree = "<group>"; };
59848A7CA98C1FADF8840207 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
788A065927B0E02900533D74 /* StreamingTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StreamingTest.m; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -148,6 +150,7 @@
E032F24F279F5E94009E9028 /* CameraCaptureSessionQueueRaceConditionTests.m */,
E0F95E3C27A32AB900699390 /* CameraPropertiesTests.m */,
788A065927B0E02900533D74 /* StreamingTest.m */,
43ED1536282570DE00EB00DE /* AvailableCamerasTest.m */,
);
path = RunnerTests;
sourceTree = "<group>";
Expand Down Expand Up @@ -418,6 +421,7 @@
E487C86026D686A10034AC92 /* CameraPreviewPauseTests.m in Sources */,
E071CF7427B31DE4006EF3BA /* FLTCamSampleBufferTests.m in Sources */,
E04F108627A87CA600573D0C /* FLTSavePhotoDelegateTests.m in Sources */,
43ED1537282570DE00EB00DE /* AvailableCamerasTest.m in Sources */,
F6EE622F2710A6FC00905E4A /* MockFLTThreadSafeFlutterResult.m in Sources */,
E0CDBAC227CD9729002561D9 /* CameraTestUtils.m in Sources */,
334733EA2668111C00DCC49E /* CameraOrientationTests.m in Sources */,
Expand Down
121 changes: 121 additions & 0 deletions packages/camera/camera/example/ios/RunnerTests/AvailableCamerasTest.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// 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.

@import camera;
@import camera.Test;
@import XCTest;
@import AVFoundation;
#import <OCMock/OCMock.h>
#import "MockFLTThreadSafeFlutterResult.h"

@interface AvailableCamerasTest : XCTestCase
@end

@implementation AvailableCamerasTest

- (void)testAvailableCamerasShouldReturnAllCamerasOnMultiCameraIPhone {
CameraPlugin *camera = [[CameraPlugin alloc] initWithRegistry:nil messenger:nil];
XCTestExpectation *expectation =
[[XCTestExpectation alloc] initWithDescription:@"Result finished"];

// iPhone 13 Cameras:
AVCaptureDevice *wideAngleCamera = OCMClassMock([AVCaptureDevice class]);
OCMStub([wideAngleCamera uniqueID]).andReturn(@"0");
OCMStub([wideAngleCamera position]).andReturn(AVCaptureDevicePositionBack);

AVCaptureDevice *frontFacingCamera = OCMClassMock([AVCaptureDevice class]);
OCMStub([frontFacingCamera uniqueID]).andReturn(@"1");
OCMStub([frontFacingCamera position]).andReturn(AVCaptureDevicePositionFront);

AVCaptureDevice *ultraWideCamera = OCMClassMock([AVCaptureDevice class]);
OCMStub([ultraWideCamera uniqueID]).andReturn(@"2");
OCMStub([ultraWideCamera position]).andReturn(AVCaptureDevicePositionBack);

AVCaptureDevice *telephotoCamera = OCMClassMock([AVCaptureDevice class]);
OCMStub([telephotoCamera uniqueID]).andReturn(@"3");
OCMStub([telephotoCamera position]).andReturn(AVCaptureDevicePositionBack);

NSMutableArray *requiredTypes =
[@[ AVCaptureDeviceTypeBuiltInWideAngleCamera, AVCaptureDeviceTypeBuiltInTelephotoCamera ]
mutableCopy];
if (@available(iOS 13.0, *)) {
[requiredTypes addObject:AVCaptureDeviceTypeBuiltInUltraWideCamera];
}

id discoverySessionMock = OCMClassMock([AVCaptureDeviceDiscoverySession class]);
OCMStub([discoverySessionMock discoverySessionWithDeviceTypes:requiredTypes
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionUnspecified])
.andReturn(discoverySessionMock);

NSMutableArray *cameras = [NSMutableArray array];
[cameras addObjectsFromArray:@[ wideAngleCamera, frontFacingCamera, telephotoCamera ]];
if (@available(iOS 13.0, *)) {
[cameras addObject:ultraWideCamera];
}
OCMStub([discoverySessionMock devices]).andReturn([NSArray arrayWithArray:cameras]);

MockFLTThreadSafeFlutterResult *resultObject =
[[MockFLTThreadSafeFlutterResult alloc] initWithExpectation:expectation];

// Set up method call
FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName:@"availableCameras"
arguments:nil];

[camera handleMethodCallAsync:call result:resultObject];

// Verify the result
NSDictionary *dictionaryResult = (NSDictionary *)resultObject.receivedResult;
if (@available(iOS 13.0, *)) {
XCTAssertTrue([dictionaryResult count] == 4);
} else {
XCTAssertTrue([dictionaryResult count] == 3);
}
}
- (void)testAvailableCamerasShouldReturnOneCameraOnSingleCameraIPhone {
CameraPlugin *camera = [[CameraPlugin alloc] initWithRegistry:nil messenger:nil];
XCTestExpectation *expectation =
[[XCTestExpectation alloc] initWithDescription:@"Result finished"];

// iPhone 8 Cameras:
AVCaptureDevice *wideAngleCamera = OCMClassMock([AVCaptureDevice class]);
OCMStub([wideAngleCamera uniqueID]).andReturn(@"0");
OCMStub([wideAngleCamera position]).andReturn(AVCaptureDevicePositionBack);

AVCaptureDevice *frontFacingCamera = OCMClassMock([AVCaptureDevice class]);
OCMStub([frontFacingCamera uniqueID]).andReturn(@"1");
OCMStub([frontFacingCamera position]).andReturn(AVCaptureDevicePositionFront);

NSMutableArray *requiredTypes =
[@[ AVCaptureDeviceTypeBuiltInWideAngleCamera, AVCaptureDeviceTypeBuiltInTelephotoCamera ]
mutableCopy];
if (@available(iOS 13.0, *)) {
[requiredTypes addObject:AVCaptureDeviceTypeBuiltInUltraWideCamera];
}

id discoverySessionMock = OCMClassMock([AVCaptureDeviceDiscoverySession class]);
OCMStub([discoverySessionMock discoverySessionWithDeviceTypes:requiredTypes
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionUnspecified])
.andReturn(discoverySessionMock);

NSMutableArray *cameras = [NSMutableArray array];
[cameras addObjectsFromArray:@[ wideAngleCamera, frontFacingCamera ]];
OCMStub([discoverySessionMock devices]).andReturn([NSArray arrayWithArray:cameras]);

MockFLTThreadSafeFlutterResult *resultObject =
[[MockFLTThreadSafeFlutterResult alloc] initWithExpectation:expectation];

// Set up method call
FlutterMethodCall *call = [FlutterMethodCall methodCallWithMethodName:@"availableCameras"
arguments:nil];

[camera handleMethodCallAsync:call result:resultObject];

// Verify the result
NSDictionary *dictionaryResult = (NSDictionary *)resultObject.receivedResult;
XCTAssertTrue([dictionaryResult count] == 2);
}

@end
8 changes: 7 additions & 1 deletion packages/camera/camera/ios/Classes/CameraPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,14 @@ - (void)handleMethodCallAsync:(FlutterMethodCall *)call
result:(FLTThreadSafeFlutterResult *)result {
if ([@"availableCameras" isEqualToString:call.method]) {
if (@available(iOS 10.0, *)) {
NSMutableArray *discoveryDevices =
[@[ AVCaptureDeviceTypeBuiltInWideAngleCamera, AVCaptureDeviceTypeBuiltInTelephotoCamera ]
mutableCopy];
if (@available(iOS 13.0, *)) {
[discoveryDevices addObject:AVCaptureDeviceTypeBuiltInUltraWideCamera];
}
AVCaptureDeviceDiscoverySession *discoverySession = [AVCaptureDeviceDiscoverySession
discoverySessionWithDeviceTypes:@[ AVCaptureDeviceTypeBuiltInWideAngleCamera ]
discoverySessionWithDeviceTypes:discoveryDevices
mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionUnspecified];
NSArray<AVCaptureDevice *> *devices = discoverySession.devices;
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
Dart.
repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.9.6
version: 0.9.7

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## NEXT
## 2.1.6

* Fixes issue in Flutter v3.0.0 where some updates to the map don't take effect on Android.
* Fixes iOS native unit tests on M1 devices.
* Minor fixes for new analysis options.

Expand Down
Loading

0 comments on commit d2a9cbe

Please sign in to comment.