Skip to content

Commit 8e80913

Browse files
authored
[camera] Federate mobile implementations (flutter#5937)
1 parent abdfe61 commit 8e80913

File tree

211 files changed

+5688
-294
lines changed

Some content is hidden

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

211 files changed

+5688
-294
lines changed

packages/camera/camera/CHANGELOG.md

+1

packages/camera/camera/android/settings.gradle

-1
This file was deleted.

packages/camera/camera/example/ios/Podfile

-7
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ flutter_ios_podfile_setup
2929

3030
target 'Runner' do
3131
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32-
33-
target 'RunnerTests' do
34-
platform :ios, '9.0'
35-
inherit! :search_paths
36-
# Pods for testing
37-
pod 'OCMock', '~> 3.8.1'
38-
end
3932
end
4033

4134
post_install do |installer|

packages/camera/camera/example/ios/Runner.xcodeproj/project.pbxproj

-240
Large diffs are not rendered by default.

packages/camera/camera/pubspec.yaml

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ description: A Flutter plugin for controlling the camera. Supports previewing
55
repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
77
version: 0.9.7+1
8+
# Temporarily disable publishing to allow moving Android and iOS
9+
# implementations.
10+
publish_to: none
811

912
environment:
1013
sdk: ">=2.14.0 <3.0.0"
@@ -14,14 +17,18 @@ flutter:
1417
plugin:
1518
platforms:
1619
android:
17-
package: io.flutter.plugins.camera
18-
pluginClass: CameraPlugin
20+
default_package: camera_android
1921
ios:
20-
pluginClass: CameraPlugin
22+
default_package: camera_avfoundation
2123
web:
2224
default_package: camera_web
2325

2426
dependencies:
27+
# Temporary path dependencies to allow moving Android and iOS implementations.
28+
camera_android:
29+
path: ../camera_android
30+
camera_avfoundation:
31+
path: ../camera_avfoundation
2532
camera_platform_interface: ^2.2.0
2633
camera_web: ^0.2.1
2734
flutter:
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Below is a list of people and organizations that have contributed
2+
# to the Flutter project. Names should be added to the list like so:
3+
#
4+
# Name/Organization <email address>
5+
6+
Google Inc.
7+
The Chromium Authors
8+
German Saprykin <[email protected]>
9+
Benjamin Sauer <[email protected]>
10+
11+
Ali Bitek <[email protected]>
12+
Pol Batlló <[email protected]>
13+
Anatoly Pulyaevskiy
14+
Hayden Flinner <[email protected]>
15+
Stefano Rodriguez <[email protected]>
16+
Salvatore Giordano <[email protected]>
17+
Brian Armstrong <[email protected]>
18+
Paul DeMarco <[email protected]>
19+
Fabricio Nogueira <[email protected]>
20+
Simon Lightfoot <[email protected]>
21+
Ashton Thomas <[email protected]>
22+
Thomas Danner <[email protected]>
23+
Diego Velásquez <[email protected]>
24+
Hajime Nakamura <[email protected]>
25+
Tuyển Vũ Xuân <[email protected]>
26+
Miguel Ruivo <[email protected]>
27+
Sarthak Verma <[email protected]>
28+
Mike Diarmid <[email protected]>
29+
Invertase <[email protected]>
30+
Elliot Hesp <[email protected]>
31+
Vince Varga <[email protected]>
32+
Aawaz Gyawali <[email protected]>
33+
EUI Limited <[email protected]>
34+
Katarina Sheremet <[email protected]>
35+
Thomas Stockx <[email protected]>
36+
Sarbagya Dhaubanjar <[email protected]>
37+
Ozkan Eksi <[email protected]>
38+
Rishab Nayak <[email protected]>
39+
40+
Jonathan Younger <[email protected]>
41+
Jose Sanchez <[email protected]>
42+
Debkanchan Samadder <[email protected]>
43+
Audrius Karosevicius <[email protected]>
44+
Lukasz Piliszczuk <[email protected]>
45+
SoundReply Solutions GmbH <[email protected]>
46+
Rafal Wachol <[email protected]>
47+
Pau Picas <[email protected]>
48+
Christian Weder <[email protected]>
49+
Alexandru Tuca <[email protected]>
50+
Christian Weder <[email protected]>
51+
Rhodes Davis Jr. <[email protected]>
52+
Luigi Agosti <[email protected]>
53+
Quentin Le Guennec <[email protected]>
54+
Koushik Ravikumar <[email protected]>
55+
Nissim Dsilva <[email protected]>
56+
Giancarlo Rocha <[email protected]>
57+
Ryo Miyake <[email protected]>
58+
Théo Champion <[email protected]>
59+
Kazuki Yamaguchi <[email protected]>
60+
Eitan Schwartz <[email protected]>
61+
Chris Rutkowski <[email protected]>
62+
Juan Alvarez <[email protected]>
63+
Aleksandr Yurkovskiy <[email protected]>
64+
Anton Borries <[email protected]>
65+
66+
Rahul Raj <[email protected]>
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Copyright 2013 The Flutter Authors. All rights reserved.
2+
3+
Redistribution and use in source and binary forms, with or without modification,
4+
are permitted provided that the following conditions are met:
5+
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above
9+
copyright notice, this list of conditions and the following
10+
disclaimer in the documentation and/or other materials provided
11+
with the distribution.
12+
* Neither the name of Google Inc. nor the names of its
13+
contributors may be used to endorse or promote products derived
14+
from this software without specific prior written permission.
15+
16+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
20+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rootProject.name = 'camera_android'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
def localProperties = new Properties()
2+
def localPropertiesFile = rootProject.file('local.properties')
3+
if (localPropertiesFile.exists()) {
4+
localPropertiesFile.withReader('UTF-8') { reader ->
5+
localProperties.load(reader)
6+
}
7+
}
8+
9+
def flutterRoot = localProperties.getProperty('flutter.sdk')
10+
if (flutterRoot == null) {
11+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12+
}
13+
14+
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15+
if (flutterVersionCode == null) {
16+
flutterVersionCode = '1'
17+
}
18+
19+
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20+
if (flutterVersionName == null) {
21+
flutterVersionName = '1.0'
22+
}
23+
24+
apply plugin: 'com.android.application'
25+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26+
27+
android {
28+
compileSdkVersion 31
29+
30+
lintOptions {
31+
disable 'InvalidPackage'
32+
}
33+
34+
defaultConfig {
35+
applicationId "io.flutter.plugins.cameraexample"
36+
minSdkVersion 21
37+
targetSdkVersion 28
38+
versionCode flutterVersionCode.toInteger()
39+
versionName flutterVersionName
40+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
41+
}
42+
43+
buildTypes {
44+
release {
45+
// TODO: Add your own signing config for the release build.
46+
// Signing with the debug keys for now, so `flutter run --release` works.
47+
signingConfig signingConfigs.debug
48+
}
49+
profile {
50+
matchingFallbacks = ['debug', 'release']
51+
}
52+
}
53+
}
54+
55+
flutter {
56+
source '../..'
57+
}
58+
59+
dependencies {
60+
testImplementation 'junit:junit:4.12'
61+
androidTestImplementation 'androidx.test:runner:1.2.0'
62+
androidTestImplementation 'androidx.test:rules:1.2.0'
63+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
package io.flutter.plugins;
6+
7+
import java.lang.annotation.ElementType;
8+
import java.lang.annotation.Retention;
9+
import java.lang.annotation.RetentionPolicy;
10+
import java.lang.annotation.Target;
11+
12+
@Retention(RetentionPolicy.RUNTIME)
13+
@Target(ElementType.TYPE)
14+
public @interface DartIntegrationTest {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
package io.flutter.plugins.cameraexample;
6+
7+
import androidx.test.rule.ActivityTestRule;
8+
import dev.flutter.plugins.integration_test.FlutterTestRunner;
9+
import io.flutter.embedding.android.FlutterActivity;
10+
import io.flutter.plugins.DartIntegrationTest;
11+
import org.junit.Rule;
12+
import org.junit.runner.RunWith;
13+
14+
@DartIntegrationTest
15+
@RunWith(FlutterTestRunner.class)
16+
public class FlutterActivityTest {
17+
@Rule
18+
public ActivityTestRule<FlutterActivity> rule = new ActivityTestRule<>(FlutterActivity.class);
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="io.flutter.plugins.cameraexample">
3+
4+
<application
5+
android:icon="@mipmap/ic_launcher"
6+
android:label="camera_example">
7+
<activity
8+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection"
9+
android:hardwareAccelerated="true"
10+
android:launchMode="singleTop"
11+
android:name="io.flutter.embedding.android.FlutterActivity"
12+
android:theme="@style/LaunchTheme"
13+
android:windowSoftInputMode="adjustResize">
14+
<intent-filter>
15+
<action android:name="android.intent.action.MAIN"/>
16+
<category android:name="android.intent.category.LAUNCHER"/>
17+
</intent-filter>
18+
</activity>
19+
<meta-data android:name="flutterEmbedding" android:value="2"/>
20+
</application>
21+
22+
<uses-feature
23+
android:name="android.hardware.camera"
24+
android:required="true"/>
25+
26+
<uses-permission android:name="android.permission.INTERNET"/>
27+
<uses-permission android:name="android.permission.FLASHLIGHT"/>
28+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="@android:color/white" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
4+
<!-- Show a splash screen on the activity. Automatically removed when
5+
Flutter draws its first frame -->
6+
<item name="android:windowBackground">@drawable/launch_background</item>
7+
</style>
8+
</resources>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
buildscript {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
}
6+
7+
dependencies {
8+
classpath 'com.android.tools.build:gradle:3.5.0'
9+
}
10+
}
11+
12+
allprojects {
13+
repositories {
14+
google()
15+
mavenCentral()
16+
}
17+
}
18+
19+
rootProject.buildDir = '../build'
20+
subprojects {
21+
project.buildDir = "${rootProject.buildDir}/${project.name}"
22+
}
23+
subprojects {
24+
project.evaluationDependsOn(':app')
25+
}
26+
27+
task clean(type: Delete) {
28+
delete rootProject.buildDir
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
org.gradle.jvmargs=-Xmx1536M
2+
android.useAndroidX=true
3+
android.enableJetifier=false
4+
android.enableR8=true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
zipStoreBase=GRADLE_USER_HOME
4+
zipStorePath=wrapper/dists
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
include ':app'
2+
3+
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4+
5+
def plugins = new Properties()
6+
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7+
if (pluginsFile.exists()) {
8+
pluginsFile.withInputStream { stream -> plugins.load(stream) }
9+
}
10+
11+
plugins.each { name, path ->
12+
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13+
include ":$name"
14+
project(":$name").projectDir = pluginDirectory
15+
}

0 commit comments

Comments
 (0)