Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions packages/path_provider/path_provider_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.25

* Fixes Java warnings.

## 2.0.24

* Clarifies explanation of endorsement in README.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ android {
checkAllWarnings true
warningsAsErrors true
disable 'AndroidGradlePluginVersion', 'InvalidPackage', 'GradleDependency'
baseline file("lint-baseline.xml")
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down

This file was deleted.

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 (v3.2.0), do not edit directly.
// Autogenerated from Pigeon (v9.2.4), do not edit directly.
// See also: https://pub.dev/packages/pigeon

package io.flutter.plugins.pathprovider;
Expand All @@ -14,42 +14,67 @@
import io.flutter.plugin.common.MessageCodec;
import io.flutter.plugin.common.StandardMessageCodec;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/** Generated class from Pigeon. */
@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"})
public class Messages {

public enum StorageDirectory {
root(0),
music(1),
podcasts(2),
ringtones(3),
alarms(4),
notifications(5),
pictures(6),
movies(7),
downloads(8),
dcim(9),
documents(10);

private int index;
/** Error class for passing custom error details to Flutter via a thrown PlatformException. */
public static class FlutterError extends RuntimeException {

private StorageDirectory(final int index) {
this.index = index;
/** The error code. */
public final String code;

/** The error details. Must be a datatype supported by the api codec. */
public final Object details;

public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) {
super(message);
this.code = code;
this.details = details;
}
}

private static class PathProviderApiCodec extends StandardMessageCodec {
public static final PathProviderApiCodec INSTANCE = new PathProviderApiCodec();

private PathProviderApiCodec() {}
@NonNull
protected static ArrayList<Object> wrapError(@NonNull Throwable exception) {
ArrayList<Object> errorList = new ArrayList<Object>(3);
if (exception instanceof FlutterError) {
FlutterError error = (FlutterError) exception;
errorList.add(error.code);
errorList.add(error.getMessage());
errorList.add(error.details);
} else {
errorList.add(exception.toString());
errorList.add(exception.getClass().getSimpleName());
errorList.add(
"Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
}
return errorList;
}

public enum StorageDirectory {
ROOT(0),
MUSIC(1),
PODCASTS(2),
RINGTONES(3),
ALARMS(4),
NOTIFICATIONS(5),
PICTURES(6),
MOVIES(7),
DOWNLOADS(8),
DCIM(9),
DOCUMENTS(10);

final int index;

private StorageDirectory(final int index) {
this.index = index;
}
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface PathProviderApi {

@Nullable
String getTemporaryPath();

Expand All @@ -69,14 +94,13 @@ public interface PathProviderApi {
List<String> getExternalStoragePaths(@NonNull StorageDirectory directory);

/** The codec used by PathProviderApi. */
static MessageCodec<Object> getCodec() {
return PathProviderApiCodec.INSTANCE;
static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}

/**
* Sets up an instance of `PathProviderApi` to handle messages through the `binaryMessenger`.
*/
static void setup(BinaryMessenger binaryMessenger, PathProviderApi api) {
static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PathProviderApi api) {
{
BinaryMessenger.TaskQueue taskQueue = binaryMessenger.makeBackgroundTaskQueue();
BasicMessageChannel<Object> channel =
Expand All @@ -88,12 +112,13 @@ static void setup(BinaryMessenger binaryMessenger, PathProviderApi api) {
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
ArrayList<Object> wrapped = new ArrayList<Object>();
try {
String output = api.getTemporaryPath();
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
wrapped.add(0, output);
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
reply.reply(wrapped);
});
Expand All @@ -112,12 +137,13 @@ static void setup(BinaryMessenger binaryMessenger, PathProviderApi api) {
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
ArrayList<Object> wrapped = new ArrayList<Object>();
try {
String output = api.getApplicationSupportPath();
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
wrapped.add(0, output);
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
reply.reply(wrapped);
});
Expand All @@ -136,12 +162,13 @@ static void setup(BinaryMessenger binaryMessenger, PathProviderApi api) {
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
ArrayList<Object> wrapped = new ArrayList<Object>();
try {
String output = api.getApplicationDocumentsPath();
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
wrapped.add(0, output);
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
reply.reply(wrapped);
});
Expand All @@ -160,12 +187,13 @@ static void setup(BinaryMessenger binaryMessenger, PathProviderApi api) {
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
ArrayList<Object> wrapped = new ArrayList<Object>();
try {
String output = api.getExternalStoragePath();
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
wrapped.add(0, output);
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
reply.reply(wrapped);
});
Expand All @@ -184,12 +212,13 @@ static void setup(BinaryMessenger binaryMessenger, PathProviderApi api) {
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
ArrayList<Object> wrapped = new ArrayList<Object>();
try {
List<String> output = api.getExternalCachePaths();
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
wrapped.add(0, output);
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
reply.reply(wrapped);
});
Expand All @@ -208,18 +237,16 @@ static void setup(BinaryMessenger binaryMessenger, PathProviderApi api) {
if (api != null) {
channel.setMessageHandler(
(message, reply) -> {
Map<String, Object> wrapped = new HashMap<>();
ArrayList<Object> wrapped = new ArrayList<Object>();
ArrayList<Object> args = (ArrayList<Object>) message;
StorageDirectory directoryArg =
args.get(0) == null ? null : StorageDirectory.values()[(int) args.get(0)];
try {
ArrayList<Object> args = (ArrayList<Object>) message;
StorageDirectory directoryArg =
args.get(0) == null ? null : StorageDirectory.values()[(int) args.get(0)];
if (directoryArg == null) {
throw new NullPointerException("directoryArg unexpectedly null.");
}
List<String> output = api.getExternalStoragePaths(directoryArg);
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
wrapped.add(0, output);
} catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
reply.reply(wrapped);
});
Expand All @@ -229,14 +256,4 @@ static void setup(BinaryMessenger binaryMessenger, PathProviderApi api) {
}
}
}

private static Map<String, Object> wrapError(Throwable exception) {
Map<String, Object> errorMap = new HashMap<>();
errorMap.put("message", exception.toString());
errorMap.put("code", exception.getClass().getSimpleName());
errorMap.put(
"details",
"Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
return errorMap;
}
}
Loading