Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
241eadc
initial commit
bparrishMines Apr 25, 2023
8619800
attempt to get plugin ready for CI
bparrishMines Apr 25, 2023
7ebaa32
formatting
bparrishMines Apr 25, 2023
a7f88ad
analyzer errors
bparrishMines Apr 25, 2023
7ad4d46
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines Apr 25, 2023
40a6178
dep order
bparrishMines Apr 25, 2023
25f36b1
example dep order
bparrishMines Apr 25, 2023
87179de
fix readme
bparrishMines Apr 25, 2023
ba934f9
add dependabot
bparrishMines Apr 25, 2023
0dbdc12
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines Apr 25, 2023
13f55ee
namespace
bparrishMines Apr 25, 2023
1f28c7d
cameraMerge branch 'main' of github.com:flutter/packages into file_se…
bparrishMines May 8, 2023
017ed72
implement pigeon files
bparrishMines May 8, 2023
fe605c0
change namespace
bparrishMines May 8, 2023
0fec82b
dart side of impl
bparrishMines May 9, 2023
f179ab0
java side impl of pigeon api
bparrishMines May 9, 2023
1002bc3
implement something
bparrishMines May 9, 2023
32c440b
running example
bparrishMines May 9, 2023
f45cc08
dart side of new impl
bparrishMines May 11, 2023
2adae90
capture current state
bparrishMines May 11, 2023
b49eab6
formatting
bparrishMines May 16, 2023
a513192
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines May 16, 2023
9cd2774
working code i guess
bparrishMines May 16, 2023
b8aae60
handle opening multiple files
bparrishMines May 16, 2023
6c92c72
finish handling opening images
bparrishMines May 16, 2023
82a6c79
java side of handling get dirs
bparrishMines May 16, 2023
7725cc5
remove get dirs
bparrishMines May 16, 2023
a6a4066
remove test context
bparrishMines May 16, 2023
6d7a340
some improvements to readablity
bparrishMines May 17, 2023
750e588
finish dart side tests
bparrishMines May 17, 2023
0e5e416
open file test
bparrishMines May 18, 2023
1b08e94
formatting
bparrishMines May 18, 2023
56dcdd8
update helper method
bparrishMines May 18, 2023
be9dcc8
open files test
bparrishMines May 18, 2023
4e6c548
use a set instead
bparrishMines May 18, 2023
407a118
formatting
bparrishMines May 18, 2023
fb8485b
add placeholder integration test
bparrishMines May 18, 2023
b165ed4
update pubspec
bparrishMines May 18, 2023
2673f12
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines May 18, 2023
c5643ae
conditionalize namespace
bparrishMines May 18, 2023
d25a689
lint fixes
bparrishMines May 18, 2023
6ae37e6
fix integration test import
bparrishMines May 18, 2023
20c55f8
formatting
bparrishMines May 18, 2023
12070b6
handle null toFileResponse
bparrishMines May 18, 2023
9498a56
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines May 24, 2023
a99550a
dart side of pigeon updates
bparrishMines May 25, 2023
0942fb8
fix dart todo
bparrishMines May 25, 2023
f3b07c8
update java side
bparrishMines May 25, 2023
33c3801
formatting and java side
bparrishMines May 25, 2023
21419de
method for typegroups
bparrishMines May 26, 2023
8dfc2b1
comment
bparrishMines May 31, 2023
882acb7
using the binding instead
bparrishMines May 31, 2023
e351b7a
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines May 31, 2023
dc85a97
bump mockito and clarify launch test
bparrishMines Jun 7, 2023
b809399
running integration test
bparrishMines Jun 13, 2023
f83d6f3
formatting and the other files
bparrishMines Jun 13, 2023
e84c565
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines Jun 13, 2023
6074461
working integration test
bparrishMines Jun 13, 2023
d667d8a
integration test files
bparrishMines Jun 13, 2023
2b72838
running tests
bparrishMines Jun 13, 2023
9827799
license
bparrishMines Jun 13, 2023
fff7692
authors
bparrishMines Jun 13, 2023
245336d
some small fixes
bparrishMines Jun 13, 2023
0ceef57
use manifest instead maybe
bparrishMines Jun 13, 2023
563e570
add entry point
bparrishMines Jun 14, 2023
66b32aa
add integrationTestMain to integration test
bparrishMines Jun 14, 2023
791c67e
fix activity test rule
bparrishMines Jun 14, 2023
7d50a42
formatting
bparrishMines Jun 14, 2023
443e4c8
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines Jun 14, 2023
776a771
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines Jun 15, 2023
b85e1a7
Merge branch 'main' of github.com:flutter/packages into file_selector…
bparrishMines Jun 26, 2023
018aa30
small review fixes
bparrishMines Jun 26, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,34 @@ updates:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/file_selector/file_selector_android/android"
commit-message:
prefix: "[file_selector]"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
ignore:
- dependency-name: "com.android.tools.build:gradle"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: "junit:junit"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: "org.mockito:*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]
- dependency-name: "androidx.test:*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/file_selector/file_selector_android/example/android/app"
commit-message:
prefix: "[file_selector]"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-minor", "version-update:semver-patch"]

- package-ecosystem: "gradle"
directory: "/packages/flutter_adaptive_scaffold/example/android/app"
commit-message:
Expand Down
3 changes: 3 additions & 0 deletions packages/file_selector/file_selector_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1
Comment thread
bparrishMines marked this conversation as resolved.
Outdated

* Implements file_selector_platform_interface for Android.
25 changes: 25 additions & 0 deletions packages/file_selector/file_selector_android/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright 2013 The Flutter Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15 changes: 15 additions & 0 deletions packages/file_selector/file_selector_android/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# file\_selector\_android

The Android implementation of [`file_selector`][1].

## Usage

This package is [endorsed][2], which means you can simply use `file_selector`
normally. This package will be automatically included in your app when you do,
so you do not need to add it to your `pubspec.yaml`.

However, if you `import` this package to use any of its APIs directly, you
should add it to your `pubspec.yaml` as usual.

[1]: https://pub.dev/packages/file_selector
[2]: https://flutter.dev/docs/development/packages-and-plugins/developing-packages#endorsed-federated-plugin
61 changes: 61 additions & 0 deletions packages/file_selector/file_selector_android/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
group 'io.flutter.plugins.file_selector_android'
version '1.0'

buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
}
}

rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}

apply plugin: 'com.android.library'

android {
namespace 'io.flutter.plugins.file_selector_android'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stuartmorgan Is there a preference for the org of new Android implementations? This is the standard, but I think new ones should be dev.flutter.packages.<pluginname>.

@stuartmorgan-g stuartmorgan-g Apr 26, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should definitely use dev.flutter going forward. A while ago I fixed all the legacy references to io.flutter in the plugins repo, except for Android because changing namespaces is non-trivial so I punted on that part.

compileSdkVersion 33

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion 16
}

dependencies {
implementation 'androidx.annotation:annotation:1.5.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-inline:5.1.0'
testImplementation 'androidx.test:core:1.3.0'
}

lintOptions {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
}

testOptions {
unitTests.includeAndroidResources = true
unitTests.returnDefaultValues = true
unitTests.all {
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'file_selector_android'
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.flutter.plugins.file_selector_android">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// 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.

package io.flutter.plugins.file_selector_android;

import androidx.annotation.NonNull;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;

/** FileSelectorAndroidPlugin */
public class FileSelectorAndroidPlugin implements FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android
///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity
private MethodChannel channel;

@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "file_selector_android");
channel.setMethodCallHandler(this);
}

@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
if (call.method.equals("getPlatformVersion")) {
result.success("Android " + android.os.Build.VERSION.RELEASE);
} else {
result.notImplemented();
}
}

@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
channel.setMethodCallHandler(null);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// 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.

package io.flutter.plugins.file_selector_android;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import org.junit.Test;

/**
* This demonstrates a simple unit test of the Java portion of this plugin's implementation.
*
* <p>Once you have built the plugin's example app, you can run these tests from the command line by
* running `./gradlew testDebugUnitTest` in the `example/android/` directory, or you can run them
* directly from IDEs that support JUnit such as Android Studio.
*/
public class FileSelectorAndroidPluginTest {
@Test
public void onMethodCall_getPlatformVersion_returnsExpectedValue() {
FileSelectorAndroidPlugin plugin = new FileSelectorAndroidPlugin();

final MethodCall call = new MethodCall("getPlatformVersion", null);
MethodChannel.Result mockResult = mock(MethodChannel.Result.class);
plugin.onMethodCall(call, mockResult);

verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Platform Implementation Test App

This is a test app for manual testing and automated integration testing
of this platform implementation. It is not intended to demonstrate actual use of
this package, since the intent is that plugin clients use the app-facing
package.

Unless you are making changes to this implementation package, this example is
very unlikely to be relevant.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "io.flutter.plugins.file_selector_android_example"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "io.flutter.plugins.file_selector_android_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}

flutter {
source '../..'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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.

package io.flutter.plugins;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/*
* Annotation to aid repository tooling in determining if a test is
* a native java unit test or a java class with a dart integration.
*
* See: https://github.com/flutter/flutter/wiki/Plugin-Tests#enabling-android-ui-tests
* for more infomation.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface DartIntegrationTest {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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.

package io.flutter.plugins.file_selector_android_example;

import androidx.test.rule.ActivityTestRule;
import dev.flutter.plugins.integration_test.FlutterTestRunner;
import io.flutter.plugins.DartIntegrationTest;
import org.junit.Rule;
import org.junit.runner.RunWith;

@DartIntegrationTest
@RunWith(FlutterTestRunner.class)
public class MainActivityTest {
@Rule public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="file_selector_android_example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// 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.

package io.flutter.plugins.file_selector_android_example;

import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends FlutterActivity {}
Loading