-
Notifications
You must be signed in to change notification settings - Fork 238
/
Messages.java
85 lines (79 loc) · 3.37 KB
/
Messages.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
// Autogenerated from Pigeon (v4.2.14), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package com.amazonaws.amplify.amplify_analytics_pinpoint.amplify_analytics_pinpoint;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.plugin.common.BasicMessageChannel;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MessageCodec;
import io.flutter.plugin.common.StandardMessageCodec;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
/** Generated class from Pigeon. */
@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
public class Messages {
public interface Result<T> {
void success(T result);
void error(Throwable error);
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface PigeonLegacyDataProvider {
void getEndpointId(@NonNull String pinpointAppId, Result<String> result);
/** The codec used by PigeonLegacyDataProvider. */
static MessageCodec<Object> getCodec() {
return new StandardMessageCodec(); }
/**Sets up an instance of `PigeonLegacyDataProvider` to handle messages through the `binaryMessenger`. */
static void setup(BinaryMessenger binaryMessenger, PigeonLegacyDataProvider api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.PigeonLegacyDataProvider.getEndpointId", getCodec());
if (api != null) {
channel.setMessageHandler((message, reply) -> {
ArrayList wrapped = new ArrayList<>();
try {
ArrayList<Object> args = (ArrayList<Object>)message;
assert args != null;
String pinpointAppIdArg = (String)args.get(0);
if (pinpointAppIdArg == null) {
throw new NullPointerException("pinpointAppIdArg unexpectedly null.");
}
Result<String> resultCallback = new Result<String>() {
public void success(String result) {
wrapped.add(0, result);
reply.reply(wrapped);
}
public void error(Throwable error) {
ArrayList<Object> wrappedError = wrapError(error);
reply.reply(wrappedError);
}
};
api.getEndpointId(pinpointAppIdArg, resultCallback);
}
catch (Error | RuntimeException exception) {
ArrayList<Object> wrappedError = wrapError(exception);
reply.reply(wrappedError);
}
});
} else {
channel.setMessageHandler(null);
}
}
}
}
@NonNull private static ArrayList<Object> wrapError(@NonNull Throwable exception) {
ArrayList<Object> errorList = new ArrayList<>(3);
errorList.add(exception.toString());
errorList.add(exception.getClass().getSimpleName());
errorList.add("Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
return errorList;
}
}