@capacitor-firebase/performance 0.5.1-dev.01021f0.1659726888 → 1.0.0
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/CapacitorFirebasePerformance.podspec +19 -19
- package/LICENSE +201 -201
- package/README.md +76 -76
- package/android/build.gradle +59 -59
- package/android/src/main/AndroidManifest.xml +3 -3
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/performance/FirebasePerformance.java +45 -45
- package/android/src/main/java/io/capawesome/capacitorjs/plugins/firebase/performance/FirebasePerformancePlugin.java +112 -112
- package/dist/docs.json +2 -2
- package/dist/esm/definitions.d.ts +102 -102
- package/dist/esm/definitions.js +1 -1
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +6 -6
- package/dist/esm/web.d.ts +10 -10
- package/dist/esm/web.js +40 -40
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +39 -39
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +39 -39
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/FirebasePerformance.swift +46 -46
- package/ios/Plugin/FirebasePerformancePlugin.h +10 -10
- package/ios/Plugin/FirebasePerformancePlugin.m +12 -12
- package/ios/Plugin/FirebasePerformancePlugin.swift +83 -83
- package/ios/Plugin/Info.plist +24 -24
- package/package.json +95 -95
package/android/build.gradle
CHANGED
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
ext {
|
|
2
|
-
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
-
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
|
4
|
-
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
5
|
-
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
6
|
-
firebasePerfVersion = project.hasProperty('firebasePerfVersion') ? rootProject.ext.firebasePerfVersion : '20.0.6'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
buildscript {
|
|
10
|
-
repositories {
|
|
11
|
-
google()
|
|
12
|
-
mavenCentral()
|
|
13
|
-
}
|
|
14
|
-
dependencies {
|
|
15
|
-
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
apply plugin: 'com.android.library'
|
|
20
|
-
|
|
21
|
-
android {
|
|
22
|
-
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
|
|
23
|
-
defaultConfig {
|
|
24
|
-
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
-
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
|
|
26
|
-
versionCode 1
|
|
27
|
-
versionName "1.0"
|
|
28
|
-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
-
}
|
|
30
|
-
buildTypes {
|
|
31
|
-
release {
|
|
32
|
-
minifyEnabled false
|
|
33
|
-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
lintOptions {
|
|
37
|
-
abortOnError false
|
|
38
|
-
}
|
|
39
|
-
compileOptions {
|
|
40
|
-
sourceCompatibility JavaVersion.VERSION_11
|
|
41
|
-
targetCompatibility JavaVersion.VERSION_11
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
repositories {
|
|
46
|
-
google()
|
|
47
|
-
mavenCentral()
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
dependencies {
|
|
52
|
-
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
|
-
implementation project(':capacitor-android')
|
|
54
|
-
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
-
implementation "com.google.firebase:firebase-perf:$firebasePerfVersion"
|
|
56
|
-
testImplementation "junit:junit:$junitVersion"
|
|
57
|
-
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
58
|
-
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
59
|
-
}
|
|
1
|
+
ext {
|
|
2
|
+
junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.2'
|
|
3
|
+
androidxAppCompatVersion = project.hasProperty('androidxAppCompatVersion') ? rootProject.ext.androidxAppCompatVersion : '1.4.2'
|
|
4
|
+
androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.3'
|
|
5
|
+
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.4.0'
|
|
6
|
+
firebasePerfVersion = project.hasProperty('firebasePerfVersion') ? rootProject.ext.firebasePerfVersion : '20.0.6'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
buildscript {
|
|
10
|
+
repositories {
|
|
11
|
+
google()
|
|
12
|
+
mavenCentral()
|
|
13
|
+
}
|
|
14
|
+
dependencies {
|
|
15
|
+
classpath 'com.android.tools.build:gradle:7.2.1'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
apply plugin: 'com.android.library'
|
|
20
|
+
|
|
21
|
+
android {
|
|
22
|
+
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
|
|
25
|
+
targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 32
|
|
26
|
+
versionCode 1
|
|
27
|
+
versionName "1.0"
|
|
28
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
29
|
+
}
|
|
30
|
+
buildTypes {
|
|
31
|
+
release {
|
|
32
|
+
minifyEnabled false
|
|
33
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError false
|
|
38
|
+
}
|
|
39
|
+
compileOptions {
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
repositories {
|
|
46
|
+
google()
|
|
47
|
+
mavenCentral()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
dependencies {
|
|
52
|
+
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
53
|
+
implementation project(':capacitor-android')
|
|
54
|
+
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
|
55
|
+
implementation "com.google.firebase:firebase-perf:$firebasePerfVersion"
|
|
56
|
+
testImplementation "junit:junit:$junitVersion"
|
|
57
|
+
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
|
58
|
+
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
|
59
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
-
package="io.capawesome.capacitorjs.plugins.firebase.performance">
|
|
3
|
-
</manifest>
|
|
1
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
package="io.capawesome.capacitorjs.plugins.firebase.performance">
|
|
3
|
+
</manifest>
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
package io.capawesome.capacitorjs.plugins.firebase.performance;
|
|
2
|
-
|
|
3
|
-
import com.google.firebase.perf.metrics.Trace;
|
|
4
|
-
import java.util.HashMap;
|
|
5
|
-
|
|
6
|
-
public class FirebasePerformance {
|
|
7
|
-
|
|
8
|
-
private HashMap<String, Trace> traces = new HashMap<String, Trace>();
|
|
9
|
-
|
|
10
|
-
public void startTrace(String traceName) {
|
|
11
|
-
Trace trace = this.getFirebasePerformanceInstance().newTrace(traceName);
|
|
12
|
-
trace.start();
|
|
13
|
-
this.traces.put(traceName, trace);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public void stopTrace(String traceName) {
|
|
17
|
-
Trace trace = this.traces.get(traceName);
|
|
18
|
-
trace.stop();
|
|
19
|
-
this.traces.remove(traceName);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public void incrementMetric(String traceName, String metricName, Integer incrementBy) {
|
|
23
|
-
Trace trace = this.traces.get(traceName);
|
|
24
|
-
trace.incrementMetric(metricName, incrementBy);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
public Trace getTraceByName(String traceName) {
|
|
28
|
-
if (this.traces.containsKey(traceName)) {
|
|
29
|
-
return this.traces.get(traceName);
|
|
30
|
-
}
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public void setEnabled(Boolean enabled) {
|
|
35
|
-
this.getFirebasePerformanceInstance().setPerformanceCollectionEnabled(enabled);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public Boolean isEnabled() {
|
|
39
|
-
return this.getFirebasePerformanceInstance().isPerformanceCollectionEnabled();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
private com.google.firebase.perf.FirebasePerformance getFirebasePerformanceInstance() {
|
|
43
|
-
return com.google.firebase.perf.FirebasePerformance.getInstance();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
1
|
+
package io.capawesome.capacitorjs.plugins.firebase.performance;
|
|
2
|
+
|
|
3
|
+
import com.google.firebase.perf.metrics.Trace;
|
|
4
|
+
import java.util.HashMap;
|
|
5
|
+
|
|
6
|
+
public class FirebasePerformance {
|
|
7
|
+
|
|
8
|
+
private HashMap<String, Trace> traces = new HashMap<String, Trace>();
|
|
9
|
+
|
|
10
|
+
public void startTrace(String traceName) {
|
|
11
|
+
Trace trace = this.getFirebasePerformanceInstance().newTrace(traceName);
|
|
12
|
+
trace.start();
|
|
13
|
+
this.traces.put(traceName, trace);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public void stopTrace(String traceName) {
|
|
17
|
+
Trace trace = this.traces.get(traceName);
|
|
18
|
+
trace.stop();
|
|
19
|
+
this.traces.remove(traceName);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public void incrementMetric(String traceName, String metricName, Integer incrementBy) {
|
|
23
|
+
Trace trace = this.traces.get(traceName);
|
|
24
|
+
trace.incrementMetric(metricName, incrementBy);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public Trace getTraceByName(String traceName) {
|
|
28
|
+
if (this.traces.containsKey(traceName)) {
|
|
29
|
+
return this.traces.get(traceName);
|
|
30
|
+
}
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public void setEnabled(Boolean enabled) {
|
|
35
|
+
this.getFirebasePerformanceInstance().setPerformanceCollectionEnabled(enabled);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public Boolean isEnabled() {
|
|
39
|
+
return this.getFirebasePerformanceInstance().isPerformanceCollectionEnabled();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private com.google.firebase.perf.FirebasePerformance getFirebasePerformanceInstance() {
|
|
43
|
+
return com.google.firebase.perf.FirebasePerformance.getInstance();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
package io.capawesome.capacitorjs.plugins.firebase.performance;
|
|
2
|
-
|
|
3
|
-
import com.getcapacitor.JSObject;
|
|
4
|
-
import com.getcapacitor.Plugin;
|
|
5
|
-
import com.getcapacitor.PluginCall;
|
|
6
|
-
import com.getcapacitor.PluginMethod;
|
|
7
|
-
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
8
|
-
import com.google.firebase.perf.metrics.Trace;
|
|
9
|
-
|
|
10
|
-
@CapacitorPlugin(name = "FirebasePerformance")
|
|
11
|
-
public class FirebasePerformancePlugin extends Plugin {
|
|
12
|
-
|
|
13
|
-
public static final String ERROR_TRACE_NAME_MISSING = "traceName must be provided.";
|
|
14
|
-
public static final String ERROR_METRIC_NAME_MISSING = "metricName must be provided.";
|
|
15
|
-
public static final String ERROR_TRACE_NAME_ALREADY_ASSIGNED = "traceName already assigned.";
|
|
16
|
-
public static final String ERROR_ENABLED_MISSING = "enabled must be provided.";
|
|
17
|
-
public static final String ERROR_TRACE_NOT_FOUND = "No trace was found with the provided traceName.";
|
|
18
|
-
private FirebasePerformance implementation = new FirebasePerformance();
|
|
19
|
-
|
|
20
|
-
@PluginMethod
|
|
21
|
-
public void startTrace(PluginCall call) {
|
|
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());
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@PluginMethod
|
|
41
|
-
public void stopTrace(PluginCall call) {
|
|
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());
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
@PluginMethod
|
|
61
|
-
public void incrementMetric(PluginCall call) {
|
|
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());
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
@PluginMethod
|
|
87
|
-
public void setEnabled(PluginCall call) {
|
|
88
|
-
try {
|
|
89
|
-
Boolean enabled = call.getBoolean("enabled");
|
|
90
|
-
if (enabled == null) {
|
|
91
|
-
call.reject(ERROR_ENABLED_MISSING);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
implementation.setEnabled(enabled);
|
|
95
|
-
call.resolve();
|
|
96
|
-
} catch (Exception ex) {
|
|
97
|
-
call.reject(ex.getLocalizedMessage());
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@PluginMethod
|
|
102
|
-
public void isEnabled(PluginCall call) {
|
|
103
|
-
try {
|
|
104
|
-
Boolean enabled = implementation.isEnabled();
|
|
105
|
-
JSObject result = new JSObject();
|
|
106
|
-
result.put("enabled", enabled);
|
|
107
|
-
call.resolve(result);
|
|
108
|
-
} catch (Exception ex) {
|
|
109
|
-
call.reject(ex.getLocalizedMessage());
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
1
|
+
package io.capawesome.capacitorjs.plugins.firebase.performance;
|
|
2
|
+
|
|
3
|
+
import com.getcapacitor.JSObject;
|
|
4
|
+
import com.getcapacitor.Plugin;
|
|
5
|
+
import com.getcapacitor.PluginCall;
|
|
6
|
+
import com.getcapacitor.PluginMethod;
|
|
7
|
+
import com.getcapacitor.annotation.CapacitorPlugin;
|
|
8
|
+
import com.google.firebase.perf.metrics.Trace;
|
|
9
|
+
|
|
10
|
+
@CapacitorPlugin(name = "FirebasePerformance")
|
|
11
|
+
public class FirebasePerformancePlugin extends Plugin {
|
|
12
|
+
|
|
13
|
+
public static final String ERROR_TRACE_NAME_MISSING = "traceName must be provided.";
|
|
14
|
+
public static final String ERROR_METRIC_NAME_MISSING = "metricName must be provided.";
|
|
15
|
+
public static final String ERROR_TRACE_NAME_ALREADY_ASSIGNED = "traceName already assigned.";
|
|
16
|
+
public static final String ERROR_ENABLED_MISSING = "enabled must be provided.";
|
|
17
|
+
public static final String ERROR_TRACE_NOT_FOUND = "No trace was found with the provided traceName.";
|
|
18
|
+
private FirebasePerformance implementation = new FirebasePerformance();
|
|
19
|
+
|
|
20
|
+
@PluginMethod
|
|
21
|
+
public void startTrace(PluginCall call) {
|
|
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());
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@PluginMethod
|
|
41
|
+
public void stopTrace(PluginCall call) {
|
|
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());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@PluginMethod
|
|
61
|
+
public void incrementMetric(PluginCall call) {
|
|
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());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@PluginMethod
|
|
87
|
+
public void setEnabled(PluginCall call) {
|
|
88
|
+
try {
|
|
89
|
+
Boolean enabled = call.getBoolean("enabled");
|
|
90
|
+
if (enabled == null) {
|
|
91
|
+
call.reject(ERROR_ENABLED_MISSING);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
implementation.setEnabled(enabled);
|
|
95
|
+
call.resolve();
|
|
96
|
+
} catch (Exception ex) {
|
|
97
|
+
call.reject(ex.getLocalizedMessage());
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@PluginMethod
|
|
102
|
+
public void isEnabled(PluginCall call) {
|
|
103
|
+
try {
|
|
104
|
+
Boolean enabled = implementation.isEnabled();
|
|
105
|
+
JSObject result = new JSObject();
|
|
106
|
+
result.put("enabled", enabled);
|
|
107
|
+
call.resolve(result);
|
|
108
|
+
} catch (Exception ex) {
|
|
109
|
+
call.reject(ex.getLocalizedMessage());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
package/dist/docs.json
CHANGED
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"text": "0.1.0"
|
|
92
92
|
}
|
|
93
93
|
],
|
|
94
|
-
"docs": "Enables or disables performance monitoring.\
|
|
94
|
+
"docs": "Enables or disables performance monitoring.\nWill be applied with the next start of the app.",
|
|
95
95
|
"complexTypes": [
|
|
96
96
|
"SetEnabledOptions"
|
|
97
97
|
],
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"name": "since"
|
|
139
139
|
}
|
|
140
140
|
],
|
|
141
|
-
"docs": "Custom trace name.\
|
|
141
|
+
"docs": "Custom trace name.\n\nNames for custom code traces must meet the following requirements:\nno leading or trailing whitespace, no leading underscore (_) character,\nand max length is 100 characters.",
|
|
142
142
|
"complexTypes": [],
|
|
143
143
|
"type": "string"
|
|
144
144
|
}
|
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
export interface FirebasePerformancePlugin {
|
|
2
|
-
/**
|
|
3
|
-
* Starts a trace.
|
|
4
|
-
*
|
|
5
|
-
* @since 0.1.0
|
|
6
|
-
*/
|
|
7
|
-
startTrace(options: StartTraceOptions): Promise<void>;
|
|
8
|
-
/**
|
|
9
|
-
* Stops a trace.
|
|
10
|
-
*
|
|
11
|
-
* @since 0.1.0
|
|
12
|
-
*/
|
|
13
|
-
stopTrace(options: StopTraceOptions): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.
|
|
16
|
-
*
|
|
17
|
-
* @since 0.1.0
|
|
18
|
-
*/
|
|
19
|
-
incrementMetric(options: IncrementMetricOptions): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Enables or disables performance monitoring.
|
|
22
|
-
* Will be applied with the next start of the app.
|
|
23
|
-
*
|
|
24
|
-
* @since 0.1.0
|
|
25
|
-
*/
|
|
26
|
-
setEnabled(options: SetEnabledOptions): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Determines whether performance monitoring is enabled or disabled.
|
|
29
|
-
*
|
|
30
|
-
* @since 0.1.0
|
|
31
|
-
*/
|
|
32
|
-
isEnabled(): Promise<IsEnabledResult>;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @since 0.1.0
|
|
36
|
-
*/
|
|
37
|
-
export interface StartTraceOptions {
|
|
38
|
-
/**
|
|
39
|
-
* Custom trace name.
|
|
40
|
-
*
|
|
41
|
-
* Names for custom code traces must meet the following requirements:
|
|
42
|
-
* no leading or trailing whitespace, no leading underscore (_) character,
|
|
43
|
-
* and max length is 100 characters.
|
|
44
|
-
*
|
|
45
|
-
* @since 0.1.0
|
|
46
|
-
*/
|
|
47
|
-
traceName: string;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* @since 0.1.0
|
|
51
|
-
*/
|
|
52
|
-
export interface StopTraceOptions {
|
|
53
|
-
/**
|
|
54
|
-
* Name of the trace that was set with `startTrace`.
|
|
55
|
-
*
|
|
56
|
-
* @since 0.1.0
|
|
57
|
-
*/
|
|
58
|
-
traceName: string;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @since 0.1.0
|
|
62
|
-
*/
|
|
63
|
-
export interface IncrementMetricOptions {
|
|
64
|
-
/**
|
|
65
|
-
* Name of the trace that was set with `startTrace`.
|
|
66
|
-
*
|
|
67
|
-
* @since 0.1.0
|
|
68
|
-
*/
|
|
69
|
-
traceName: string;
|
|
70
|
-
/**
|
|
71
|
-
* Name of the metric to be incremented.
|
|
72
|
-
*
|
|
73
|
-
* @since 0.1.0
|
|
74
|
-
*/
|
|
75
|
-
metricName: string;
|
|
76
|
-
/**
|
|
77
|
-
* Amount by which the metric has to be incremented.
|
|
78
|
-
*
|
|
79
|
-
* @default 1
|
|
80
|
-
* @since 0.1.0
|
|
81
|
-
*/
|
|
82
|
-
incrementBy?: number;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @since 0.1.0
|
|
86
|
-
*/
|
|
87
|
-
export interface SetEnabledOptions {
|
|
88
|
-
/**
|
|
89
|
-
* Should performance monitoring be enabled.
|
|
90
|
-
*
|
|
91
|
-
* @since 0.1.0
|
|
92
|
-
*/
|
|
93
|
-
enabled: boolean;
|
|
94
|
-
}
|
|
95
|
-
export interface IsEnabledResult {
|
|
96
|
-
/**
|
|
97
|
-
* `true` if performance monitoring is enabled, otherwise `false`.
|
|
98
|
-
*
|
|
99
|
-
* @since 0.1.0
|
|
100
|
-
*/
|
|
101
|
-
enabled: boolean;
|
|
102
|
-
}
|
|
1
|
+
export interface FirebasePerformancePlugin {
|
|
2
|
+
/**
|
|
3
|
+
* Starts a trace.
|
|
4
|
+
*
|
|
5
|
+
* @since 0.1.0
|
|
6
|
+
*/
|
|
7
|
+
startTrace(options: StartTraceOptions): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Stops a trace.
|
|
10
|
+
*
|
|
11
|
+
* @since 0.1.0
|
|
12
|
+
*/
|
|
13
|
+
stopTrace(options: StopTraceOptions): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Atomically increments the metric with the given name for the selected trace by the `incrementBy` value.
|
|
16
|
+
*
|
|
17
|
+
* @since 0.1.0
|
|
18
|
+
*/
|
|
19
|
+
incrementMetric(options: IncrementMetricOptions): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Enables or disables performance monitoring.
|
|
22
|
+
* Will be applied with the next start of the app.
|
|
23
|
+
*
|
|
24
|
+
* @since 0.1.0
|
|
25
|
+
*/
|
|
26
|
+
setEnabled(options: SetEnabledOptions): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Determines whether performance monitoring is enabled or disabled.
|
|
29
|
+
*
|
|
30
|
+
* @since 0.1.0
|
|
31
|
+
*/
|
|
32
|
+
isEnabled(): Promise<IsEnabledResult>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* @since 0.1.0
|
|
36
|
+
*/
|
|
37
|
+
export interface StartTraceOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Custom trace name.
|
|
40
|
+
*
|
|
41
|
+
* Names for custom code traces must meet the following requirements:
|
|
42
|
+
* no leading or trailing whitespace, no leading underscore (_) character,
|
|
43
|
+
* and max length is 100 characters.
|
|
44
|
+
*
|
|
45
|
+
* @since 0.1.0
|
|
46
|
+
*/
|
|
47
|
+
traceName: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @since 0.1.0
|
|
51
|
+
*/
|
|
52
|
+
export interface StopTraceOptions {
|
|
53
|
+
/**
|
|
54
|
+
* Name of the trace that was set with `startTrace`.
|
|
55
|
+
*
|
|
56
|
+
* @since 0.1.0
|
|
57
|
+
*/
|
|
58
|
+
traceName: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @since 0.1.0
|
|
62
|
+
*/
|
|
63
|
+
export interface IncrementMetricOptions {
|
|
64
|
+
/**
|
|
65
|
+
* Name of the trace that was set with `startTrace`.
|
|
66
|
+
*
|
|
67
|
+
* @since 0.1.0
|
|
68
|
+
*/
|
|
69
|
+
traceName: string;
|
|
70
|
+
/**
|
|
71
|
+
* Name of the metric to be incremented.
|
|
72
|
+
*
|
|
73
|
+
* @since 0.1.0
|
|
74
|
+
*/
|
|
75
|
+
metricName: string;
|
|
76
|
+
/**
|
|
77
|
+
* Amount by which the metric has to be incremented.
|
|
78
|
+
*
|
|
79
|
+
* @default 1
|
|
80
|
+
* @since 0.1.0
|
|
81
|
+
*/
|
|
82
|
+
incrementBy?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @since 0.1.0
|
|
86
|
+
*/
|
|
87
|
+
export interface SetEnabledOptions {
|
|
88
|
+
/**
|
|
89
|
+
* Should performance monitoring be enabled.
|
|
90
|
+
*
|
|
91
|
+
* @since 0.1.0
|
|
92
|
+
*/
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface IsEnabledResult {
|
|
96
|
+
/**
|
|
97
|
+
* `true` if performance monitoring is enabled, otherwise `false`.
|
|
98
|
+
*
|
|
99
|
+
* @since 0.1.0
|
|
100
|
+
*/
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
}
|
package/dist/esm/definitions.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=definitions.js.map
|