Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit aa2a2f0

Browse files
committed
Merge remote-tracking branch 'upstream/master' into fix/in_app_purchase_android/README.md
2 parents 24409e6 + e314c7a commit aa2a2f0

File tree

132 files changed

+2817
-478
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+2817
-478
lines changed

.cirrus.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ task:
7474
format_script: ./script/tool_runner.sh format --fail-on-change
7575
pubspec_script: ./script/tool_runner.sh pubspec-check
7676
license_script: dart $PLUGIN_TOOL license-check
77+
- name: federated_safety
78+
# This check is only meaningful for PRs, as it validates changes
79+
# rather than state.
80+
only_if: $CIRRUS_PR != ""
81+
script: ./script/tool_runner.sh federation-safety-check
7782
- name: dart_unit_tests
7883
env:
7984
matrix:

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ jobs:
88
release:
99
if: github.repository_owner == 'flutter'
1010
name: release
11+
permissions:
12+
# Release needs to push a tag back to the repo.
13+
contents: write
1114
runs-on: ubuntu-latest
1215
steps:
1316
- name: "Install Flutter"

packages/android_alarm_manager/android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ apply plugin: 'com.android.library'
2828

2929
android {
3030
compileSdkVersion 29
31-
compileOptions {
32-
sourceCompatibility JavaVersion.VERSION_1_8
33-
targetCompatibility JavaVersion.VERSION_1_8
34-
}
3531
defaultConfig {
3632
minSdkVersion 16
3733
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -54,6 +50,10 @@ android {
5450
}
5551
}
5652
}
53+
compileOptions {
54+
sourceCompatibility JavaVersion.VERSION_1_8
55+
targetCompatibility JavaVersion.VERSION_1_8
56+
}
5757
}
5858

5959
dependencies {

packages/android_intent/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* Remove references to the V1 Android embedding.
44
* Updated Android lint settings.
5+
* Specify Java 8 for Android build.
56

67
## 2.0.2
78

packages/android_intent/android/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ android {
3737
disable 'InvalidPackage'
3838
disable 'GradleDependency'
3939
}
40-
41-
40+
compileOptions {
41+
sourceCompatibility JavaVersion.VERSION_1_8
42+
targetCompatibility JavaVersion.VERSION_1_8
43+
}
4244
testOptions {
4345
unitTests.includeAndroidResources = true
4446
unitTests.returnDefaultValues = true

packages/camera/camera/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 0.9.4
2+
3+
* Add web support by endorsing `package:camera_web`.
4+
5+
## 0.9.3+1
6+
7+
* Remove iOS 9 availability check around ultra high capture sessions.
8+
19
## 0.9.3
210

311
* Update minimum Flutter SDK to 2.5 and iOS deployment target to 9.0.

packages/camera/camera/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![pub package](https://img.shields.io/pub/v/camera.svg)](https://pub.dev/packages/camera)
44

5-
A Flutter plugin for iOS and Android allowing access to the device cameras.
5+
A Flutter plugin for iOS, Android and Web allowing access to the device cameras.
66

77
*Note*: This plugin is still under development, and some APIs might not be available yet. We are working on a refactor which can be followed here: [issue](https://github.com/flutter/flutter/issues/31225)
88

@@ -47,6 +47,11 @@ minSdkVersion 21
4747

4848
It's important to note that the `MediaRecorder` class is not working properly on emulators, as stated in the documentation: https://developer.android.com/reference/android/media/MediaRecorder. Specifically, when recording a video with sound enabled and trying to play it back, the duration won't be correct and you will only see the first frame.
4949

50+
### Web integration
51+
52+
For web integration details, see the
53+
[`camera_web` package](https://pub.dev/packages/camera_web).
54+
5055
### Handling Lifecycle states
5156

5257
As of version [0.5.0](https://github.com/flutter/plugins/blob/master/packages/camera/CHANGELOG.md#050) of the camera plugin, lifecycle changes are no longer handled by the plugin. This means developers are now responsible to control camera resources when the lifecycle state is updated. Failure to do so might lead to unexpected behavior (for example as described in issue [#39109](https://github.com/flutter/flutter/issues/39109)). Handling lifecycle changes can be done by overriding the `didChangeAppLifecycleState` method like so:

packages/camera/camera/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ android {
3939
baseline file("lint-baseline.xml")
4040
}
4141
compileOptions {
42-
sourceCompatibility = '1.8'
43-
targetCompatibility = '1.8'
42+
sourceCompatibility JavaVersion.VERSION_1_8
43+
targetCompatibility JavaVersion.VERSION_1_8
4444
}
4545

4646

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

Lines changed: 56 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'dart:async';
88
import 'dart:io';
99

1010
import 'package:camera/camera.dart';
11+
import 'package:flutter/foundation.dart';
1112
import 'package:flutter/material.dart';
1213
import 'package:video_player/video_player.dart';
1314

@@ -231,7 +232,14 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
231232
? Container()
232233
: SizedBox(
233234
child: (localVideoController == null)
234-
? Image.file(File(imageFile!.path))
235+
? (
236+
// The captured image on the web contains a network-accessible URL
237+
// pointing to a location within the browser. It may be displayed
238+
// either with Image.network or Image.memory after loading the image
239+
// bytes to memory.
240+
kIsWeb
241+
? Image.network(imageFile!.path)
242+
: Image.file(File(imageFile!.path)))
235243
: Container(
236244
child: Center(
237245
child: AspectRatio(
@@ -267,17 +275,24 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
267275
color: Colors.blue,
268276
onPressed: controller != null ? onFlashModeButtonPressed : null,
269277
),
270-
IconButton(
271-
icon: Icon(Icons.exposure),
272-
color: Colors.blue,
273-
onPressed:
274-
controller != null ? onExposureModeButtonPressed : null,
275-
),
276-
IconButton(
277-
icon: Icon(Icons.filter_center_focus),
278-
color: Colors.blue,
279-
onPressed: controller != null ? onFocusModeButtonPressed : null,
280-
),
278+
// The exposure and focus mode are currently not supported on the web.
279+
...(!kIsWeb
280+
? [
281+
IconButton(
282+
icon: Icon(Icons.exposure),
283+
color: Colors.blue,
284+
onPressed: controller != null
285+
? onExposureModeButtonPressed
286+
: null,
287+
),
288+
IconButton(
289+
icon: Icon(Icons.filter_center_focus),
290+
color: Colors.blue,
291+
onPressed:
292+
controller != null ? onFocusModeButtonPressed : null,
293+
)
294+
]
295+
: []),
281296
IconButton(
282297
icon: Icon(enableAudio ? Icons.volume_up : Icons.volume_mute),
283298
color: Colors.blue,
@@ -616,7 +631,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
616631

617632
final CameraController cameraController = CameraController(
618633
cameraDescription,
619-
ResolutionPreset.medium,
634+
kIsWeb ? ResolutionPreset.max : ResolutionPreset.medium,
620635
enableAudio: enableAudio,
621636
imageFormatGroup: ImageFormatGroup.jpeg,
622637
);
@@ -635,12 +650,17 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
635650
try {
636651
await cameraController.initialize();
637652
await Future.wait([
638-
cameraController
639-
.getMinExposureOffset()
640-
.then((value) => _minAvailableExposureOffset = value),
641-
cameraController
642-
.getMaxExposureOffset()
643-
.then((value) => _maxAvailableExposureOffset = value),
653+
// The exposure mode is currently not supported on the web.
654+
...(!kIsWeb
655+
? [
656+
cameraController
657+
.getMinExposureOffset()
658+
.then((value) => _minAvailableExposureOffset = value),
659+
cameraController
660+
.getMaxExposureOffset()
661+
.then((value) => _maxAvailableExposureOffset = value)
662+
]
663+
: []),
644664
cameraController
645665
.getMaxZoomLevel()
646666
.then((value) => _maxAvailableZoom = value),
@@ -708,16 +728,20 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
708728
}
709729

710730
void onCaptureOrientationLockButtonPressed() async {
711-
if (controller != null) {
712-
final CameraController cameraController = controller!;
713-
if (cameraController.value.isCaptureOrientationLocked) {
714-
await cameraController.unlockCaptureOrientation();
715-
showInSnackBar('Capture orientation unlocked');
716-
} else {
717-
await cameraController.lockCaptureOrientation();
718-
showInSnackBar(
719-
'Capture orientation locked to ${cameraController.value.lockedCaptureOrientation.toString().split('.').last}');
731+
try {
732+
if (controller != null) {
733+
final CameraController cameraController = controller!;
734+
if (cameraController.value.isCaptureOrientationLocked) {
735+
await cameraController.unlockCaptureOrientation();
736+
showInSnackBar('Capture orientation unlocked');
737+
} else {
738+
await cameraController.lockCaptureOrientation();
739+
showInSnackBar(
740+
'Capture orientation locked to ${cameraController.value.lockedCaptureOrientation.toString().split('.').last}');
741+
}
720742
}
743+
} on CameraException catch (e) {
744+
_showCameraException(e);
721745
}
722746
}
723747

@@ -916,8 +940,10 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
916940
return;
917941
}
918942

919-
final VideoPlayerController vController =
920-
VideoPlayerController.file(File(videoFile!.path));
943+
final VideoPlayerController vController = kIsWeb
944+
? VideoPlayerController.network(videoFile!.path)
945+
: VideoPlayerController.file(File(videoFile!.path));
946+
921947
videoPlayerListener = () {
922948
if (videoController != null && videoController!.value.size != null) {
923949
// Refreshing the state to update video player with the correct ratio.
917 Bytes
Loading

0 commit comments

Comments
 (0)