[perm][android] Cleanup/return boolean values
This commit is contained in:
parent
4c383d278b
commit
5037248d3b
|
@ -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<String, String> attributes = getOrCreateTrace(identifier).getAttributes();
|
||||
WritableMap map = Arguments.createMap();
|
||||
|
||||
for (Map.Entry<String, String> 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
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ export default class HttpMetric {
|
|||
);
|
||||
}
|
||||
|
||||
// TODO return true or false
|
||||
putAttribute(attribute: string, value: string): Promise<true | false> {
|
||||
return getNativeModule(this._perf).putHttpMetricAttribute(
|
||||
this.url,
|
||||
|
|
|
@ -40,7 +40,6 @@ export default class Trace {
|
|||
);
|
||||
}
|
||||
|
||||
// TODO return true or false
|
||||
putAttribute(attribute: string, value: string): Promise<true | false> {
|
||||
return getNativeModule(this._perf).putTraceAttribute(
|
||||
this.identifier,
|
||||
|
|
Loading…
Reference in New Issue