From 5037248d3b06f70cc44f4d120bd1a523dfdaec41 Mon Sep 17 00:00:00 2001 From: Elliot Hesp Date: Wed, 18 Jul 2018 12:49:12 +0100 Subject: [PATCH] [perm][android] Cleanup/return boolean values --- .../firebase/perf/RNFirebasePerformance.java | 43 ++----------------- lib/modules/perf/HttpMetric.js | 1 - lib/modules/perf/Trace.js | 1 - 3 files changed, 4 insertions(+), 41 deletions(-) diff --git a/android/src/main/java/io/invertase/firebase/perf/RNFirebasePerformance.java b/android/src/main/java/io/invertase/firebase/perf/RNFirebasePerformance.java index 1499899c..f73dbdfd 100644 --- a/android/src/main/java/io/invertase/firebase/perf/RNFirebasePerformance.java +++ b/android/src/main/java/io/invertase/firebase/perf/RNFirebasePerformance.java @@ -48,7 +48,6 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule { @ReactMethod public void getTraceAttribute(String identifier, String attribute, Promise promise) { promise.resolve(getOrCreateTrace(identifier).getAttribute(attribute)); -<<<<<<< Updated upstream } @ReactMethod @@ -76,38 +75,10 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule { } @ReactMethod -======= - } - - @ReactMethod - public void getTraceAttributes(String identifier, Promise promise) { - Map attributes = getOrCreateTrace(identifier).getAttributes(); - WritableMap map = Arguments.createMap(); - - for (Map.Entry entry : attributes.entrySet()) { - map.putString(entry.getKey(), entry.getValue()); - } - - promise.resolve(map); - } - - @ReactMethod - public void getTraceLongMetric(String identifier, String metricName, Promise promise) { - Integer value = Long.valueOf(getOrCreateTrace(identifier).getLongMetric(metricName)).intValue(); - promise.resolve(value); - } - - @ReactMethod - public void incrementTraceMetric(String identifier, String metricName, Integer incrementBy, Promise promise) { - getOrCreateTrace(identifier).incrementMetric(metricName, incrementBy.longValue()); - promise.resolve(null); - } - - @ReactMethod ->>>>>>> Stashed changes public void putTraceAttribute(String identifier, String attribute, String value, Promise promise) { getOrCreateTrace(identifier).putAttribute(attribute, value); - promise.resolve(null); + // TODO putAttribute returns void? Docs state it returns true/false. + promise.resolve(true); } @ReactMethod @@ -164,7 +135,8 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule { @ReactMethod public void putHttpMetricAttribute(String url, String httpMethod, String attribute, String value, Promise promise) { getOrCreateHttpMetric(url, httpMethod).putAttribute(attribute, value); - promise.resolve(null); + // TODO putAttribute returns void? Docs state it returns true/false. + promise.resolve(true); } @ReactMethod @@ -227,12 +199,6 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule { if (httpMetrics.containsKey(identifier)) { return httpMetrics.get(identifier); } -<<<<<<< Updated upstream - HttpMetric httpMetric = FirebasePerformance.getInstance().newHttpMetric(url, httpMethod); - httpMetrics.put(identifier, httpMetric); - return httpMetric; - } -======= HttpMetric httpMetric = FirebasePerformance.getInstance().newHttpMetric(url, this.mapStringToMethod(httpMethod)); httpMetrics.put(identifier, httpMetric); return httpMetric; @@ -262,5 +228,4 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule { return ""; } ->>>>>>> Stashed changes } diff --git a/lib/modules/perf/HttpMetric.js b/lib/modules/perf/HttpMetric.js index eb85df2d..bccd8df2 100644 --- a/lib/modules/perf/HttpMetric.js +++ b/lib/modules/perf/HttpMetric.js @@ -31,7 +31,6 @@ export default class HttpMetric { ); } - // TODO return true or false putAttribute(attribute: string, value: string): Promise { return getNativeModule(this._perf).putHttpMetricAttribute( this.url, diff --git a/lib/modules/perf/Trace.js b/lib/modules/perf/Trace.js index 174f1bef..a2babf77 100644 --- a/lib/modules/perf/Trace.js +++ b/lib/modules/perf/Trace.js @@ -40,7 +40,6 @@ export default class Trace { ); } - // TODO return true or false putAttribute(attribute: string, value: string): Promise { return getNativeModule(this._perf).putTraceAttribute( this.identifier,