Skip to content

Commit

Permalink
Remove unnecessary print statements, and use Log.w where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-xD committed Nov 16, 2021
1 parent acf168e commit 1a74a64
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
Expand Up @@ -3,6 +3,7 @@
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;

import java.util.Map;

Expand All @@ -26,6 +27,7 @@
*/
public class AblyEventStreamHandler implements EventChannel.StreamHandler {

private static final String TAG = AblyEventStreamHandler.class.getName();
/**
* Creating an ablyLibrary instance.
* As ablyLibrary is a singleton,
Expand Down Expand Up @@ -197,7 +199,7 @@ public void onListen(Object object, EventChannel.EventSink uiThreadEventSink) {
@Override
public void onCancel(Object object) {
if (object == null) {
System.out.println("Cannot process null input on cancel");
Log.w(TAG, "Cannot process null input on cancel");
return;
}
final AblyFlutterMessage<AblyEventMessage<Object>> ablyMessage = getMessage(object);
Expand Down
Expand Up @@ -76,9 +76,7 @@ private void setupChannels(BinaryMessenger messenger, Context applicationContext
}

@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
System.out.println("Ably Plugin onDetachedFromEngine");
}
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {}

private static MethodCodec createCodec(CipherParamsStorage cipherParamsStorage) {
return new StandardMethodCodec(new AblyMessageCodec(cipherParamsStorage));
Expand Down
@@ -1,5 +1,7 @@
package io.ably.flutter.plugin;

import android.util.Log;

import androidx.annotation.Nullable;

import com.google.firebase.messaging.RemoteMessage;
Expand Down Expand Up @@ -58,7 +60,7 @@ interface CodecDecoder<T> {
}

private static class CodecPair<T> {

private static final String TAG = CodecPair.class.getName();
final CodecEncoder<T> encoder;
final CodecDecoder<T> decoder;

Expand All @@ -69,15 +71,15 @@ private static class CodecPair<T> {

Map<String, Object> encode(final Object value) {
if (this.encoder == null) {
System.out.println("Codec encoder not defined");
Log.w(TAG, "Encoder is null");
return null;
}
return this.encoder.encode((T) value);
}

T decode(Map<String, Object> jsonMap) {
if (this.decoder == null) {
System.out.println("Codec decoder not defined");
Log.w(TAG, "Decoder is null");
return null;
}
return this.decoder.decode(jsonMap);
Expand Down
Expand Up @@ -151,7 +151,6 @@ private void handleAblyException(@NonNull MethodChannel.Result result, @NonNull
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull MethodChannel.Result rawResult) {
final MethodChannel.Result result = new MethodResultWrapper(rawResult);
System.out.println("Ably Plugin handle: " + call.method);
final BiConsumer<MethodCall, MethodChannel.Result> handler = _map.get(call.method);
if (null == handler) {
// We don't have a handler for a method with this name so tell the caller.
Expand All @@ -177,7 +176,6 @@ public void onError(ErrorInfo reason) {
}

private void register(@NonNull MethodCall call, @NonNull MethodChannel.Result result) {
System.out.println("Registering library instance to clean up any existing instances");
hotRestartCallback.on();
_ably.dispose();
result.success(null);
Expand Down Expand Up @@ -205,10 +203,7 @@ public void success(@Nullable Object result) {

@Override
public void error(String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) {
System.out.println(errorDetails);
if (errorMessage != null) {
result.error("40000", String.format("Error from authCallback: %s", errorMessage), errorDetails);
}
result.error("40000", String.format("Error from authCallback: %s", errorMessage), errorDetails);
latch.countDown();
}

Expand Down

0 comments on commit 1a74a64

Please sign in to comment.