[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
|
@ReactMethod
|
||||||
public void getTraceAttribute(String identifier, String attribute, Promise promise) {
|
public void getTraceAttribute(String identifier, String attribute, Promise promise) {
|
||||||
promise.resolve(getOrCreateTrace(identifier).getAttribute(attribute));
|
promise.resolve(getOrCreateTrace(identifier).getAttribute(attribute));
|
||||||
<<<<<<< Updated upstream
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
|
@ -76,38 +75,10 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@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) {
|
public void putTraceAttribute(String identifier, String attribute, String value, Promise promise) {
|
||||||
getOrCreateTrace(identifier).putAttribute(attribute, value);
|
getOrCreateTrace(identifier).putAttribute(attribute, value);
|
||||||
promise.resolve(null);
|
// TODO putAttribute returns void? Docs state it returns true/false.
|
||||||
|
promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
|
@ -164,7 +135,8 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule {
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
public void putHttpMetricAttribute(String url, String httpMethod, String attribute, String value, Promise promise) {
|
public void putHttpMetricAttribute(String url, String httpMethod, String attribute, String value, Promise promise) {
|
||||||
getOrCreateHttpMetric(url, httpMethod).putAttribute(attribute, value);
|
getOrCreateHttpMetric(url, httpMethod).putAttribute(attribute, value);
|
||||||
promise.resolve(null);
|
// TODO putAttribute returns void? Docs state it returns true/false.
|
||||||
|
promise.resolve(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ReactMethod
|
@ReactMethod
|
||||||
|
@ -227,12 +199,6 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule {
|
||||||
if (httpMetrics.containsKey(identifier)) {
|
if (httpMetrics.containsKey(identifier)) {
|
||||||
return httpMetrics.get(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));
|
HttpMetric httpMetric = FirebasePerformance.getInstance().newHttpMetric(url, this.mapStringToMethod(httpMethod));
|
||||||
httpMetrics.put(identifier, httpMetric);
|
httpMetrics.put(identifier, httpMetric);
|
||||||
return httpMetric;
|
return httpMetric;
|
||||||
|
@ -262,5 +228,4 @@ public class RNFirebasePerformance extends ReactContextBaseJavaModule {
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
>>>>>>> Stashed changes
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ export default class HttpMetric {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO return true or false
|
|
||||||
putAttribute(attribute: string, value: string): Promise<true | false> {
|
putAttribute(attribute: string, value: string): Promise<true | false> {
|
||||||
return getNativeModule(this._perf).putHttpMetricAttribute(
|
return getNativeModule(this._perf).putHttpMetricAttribute(
|
||||||
this.url,
|
this.url,
|
||||||
|
|
|
@ -40,7 +40,6 @@ export default class Trace {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO return true or false
|
|
||||||
putAttribute(attribute: string, value: string): Promise<true | false> {
|
putAttribute(attribute: string, value: string): Promise<true | false> {
|
||||||
return getNativeModule(this._perf).putTraceAttribute(
|
return getNativeModule(this._perf).putTraceAttribute(
|
||||||
this.identifier,
|
this.identifier,
|
||||||
|
|
Loading…
Reference in New Issue