@capacitor-firebase/performance 0.3.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ Add Firebase to your project if you haven't already ([Android](https://firebase.
|
|
|
13
13
|
|
|
14
14
|
### Android
|
|
15
15
|
|
|
16
|
+
**Attention**: Please make sure that you are using **Java 11**.
|
|
17
|
+
|
|
16
18
|
See [Add the Performance Monitoring plugin to your app](https://firebase.google.com/docs/perf-mon/get-started-android#add-perfmon-plugin) and follow the instructions to set up your app correctly.
|
|
17
19
|
|
|
18
20
|
#### Variables
|
|
@@ -19,74 +19,94 @@ public class FirebasePerformancePlugin extends Plugin {
|
|
|
19
19
|
|
|
20
20
|
@PluginMethod
|
|
21
21
|
public void startTrace(PluginCall call) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
try {
|
|
23
|
+
String traceName = call.getString("traceName");
|
|
24
|
+
if (traceName == null) {
|
|
25
|
+
call.reject(ERROR_TRACE_NAME_MISSING);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
Trace trace = implementation.getTraceByName(traceName);
|
|
29
|
+
if (trace != null) {
|
|
30
|
+
call.reject(ERROR_TRACE_NAME_ALREADY_ASSIGNED);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
implementation.startTrace(traceName);
|
|
34
|
+
call.resolve();
|
|
35
|
+
} catch (Exception ex) {
|
|
36
|
+
call.reject(ex.getLocalizedMessage());
|
|
26
37
|
}
|
|
27
|
-
Trace trace = implementation.getTraceByName(traceName);
|
|
28
|
-
if (trace != null) {
|
|
29
|
-
call.reject(ERROR_TRACE_NAME_ALREADY_ASSIGNED);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
implementation.startTrace(traceName);
|
|
33
|
-
call.resolve();
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
@PluginMethod
|
|
37
41
|
public void stopTrace(PluginCall call) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
try {
|
|
43
|
+
String traceName = call.getString("traceName");
|
|
44
|
+
if (traceName == null) {
|
|
45
|
+
call.reject(ERROR_TRACE_NAME_MISSING);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
Trace trace = implementation.getTraceByName(traceName);
|
|
49
|
+
if (trace == null) {
|
|
50
|
+
call.reject(ERROR_TRACE_NOT_FOUND);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
implementation.stopTrace(traceName);
|
|
54
|
+
call.resolve();
|
|
55
|
+
} catch (Exception ex) {
|
|
56
|
+
call.reject(ex.getLocalizedMessage());
|
|
47
57
|
}
|
|
48
|
-
implementation.stopTrace(traceName);
|
|
49
|
-
call.resolve();
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
@PluginMethod
|
|
53
61
|
public void incrementMetric(PluginCall call) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
try {
|
|
63
|
+
String traceName = call.getString("traceName");
|
|
64
|
+
String metricName = call.getString("metricName");
|
|
65
|
+
Integer incrementBy = call.getInt("incrementBy", 1);
|
|
66
|
+
if (traceName == null) {
|
|
67
|
+
call.reject(ERROR_TRACE_NAME_MISSING);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (metricName == null) {
|
|
71
|
+
call.reject(ERROR_METRIC_NAME_MISSING);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
Trace trace = implementation.getTraceByName(traceName);
|
|
75
|
+
if (trace == null) {
|
|
76
|
+
call.reject(ERROR_TRACE_NOT_FOUND);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
implementation.incrementMetric(traceName, metricName, incrementBy);
|
|
80
|
+
call.resolve();
|
|
81
|
+
} catch (Exception ex) {
|
|
82
|
+
call.reject(ex.getLocalizedMessage());
|
|
64
83
|
}
|
|
65
|
-
Trace trace = implementation.getTraceByName(traceName);
|
|
66
|
-
if (trace == null) {
|
|
67
|
-
call.reject(ERROR_TRACE_NOT_FOUND);
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
implementation.incrementMetric(traceName, metricName, incrementBy);
|
|
71
|
-
call.resolve();
|
|
72
84
|
}
|
|
73
85
|
|
|
74
86
|
@PluginMethod
|
|
75
87
|
public void setPerformanceCollectionEnabled(PluginCall call) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
try {
|
|
89
|
+
Boolean enabled = call.getBoolean("enabled");
|
|
90
|
+
if (enabled == null) {
|
|
91
|
+
call.reject(ERROR_ENABLED_MISSING);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
implementation.setPerformanceCollectionEnabled(enabled);
|
|
95
|
+
call.resolve();
|
|
96
|
+
} catch (Exception ex) {
|
|
97
|
+
call.reject(ex.getLocalizedMessage());
|
|
80
98
|
}
|
|
81
|
-
implementation.setPerformanceCollectionEnabled(enabled);
|
|
82
|
-
call.resolve();
|
|
83
99
|
}
|
|
84
100
|
|
|
85
101
|
@PluginMethod
|
|
86
102
|
public void isPerformanceCollectionEnabled(PluginCall call) {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
try {
|
|
104
|
+
Boolean enabled = implementation.isPerformanceCollectionEnabled();
|
|
105
|
+
JSObject result = new JSObject();
|
|
106
|
+
result.put("enabled", enabled);
|
|
107
|
+
call.resolve(result);
|
|
108
|
+
} catch (Exception ex) {
|
|
109
|
+
call.reject(ex.getLocalizedMessage());
|
|
110
|
+
}
|
|
91
111
|
}
|
|
92
112
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor-firebase/performance",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Capacitor plugin for Firebase Performance Monitoring.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -15,13 +15,24 @@
|
|
|
15
15
|
],
|
|
16
16
|
"author": "Robin Genz <mail@robingenz.dev>",
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
|
+
"homepage": "https://capawesome.io/",
|
|
18
19
|
"repository": {
|
|
19
20
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/
|
|
21
|
+
"url": "git+https://github.com/capawesome-team/capacitor-firebase.git"
|
|
21
22
|
},
|
|
22
23
|
"bugs": {
|
|
23
|
-
"url": "https://github.com/
|
|
24
|
+
"url": "https://github.com/capawesome-team/capacitor-firebase/issues"
|
|
24
25
|
},
|
|
26
|
+
"funding": [
|
|
27
|
+
{
|
|
28
|
+
"type": "github",
|
|
29
|
+
"url": "https://github.com/sponsors/capawesome-team/"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "opencollective",
|
|
33
|
+
"url": "https://opencollective.com/capawesome"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
25
36
|
"keywords": [
|
|
26
37
|
"capacitor",
|
|
27
38
|
"plugin",
|