Skip to content

Commit

Permalink
chore: improve track api
Browse files Browse the repository at this point in the history
  • Loading branch information
SSebo committed Mar 1, 2023
1 parent 01429ad commit 590faf9
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-uniffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fp-mobile-uniffi"
version = "2.0.1"
version = "2.0.2"
edition = "2021"

[lib]
Expand Down
3 changes: 1 addition & 2 deletions rust-uniffi/src/featureprobe.udl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ interface FeatureProbe {
string json_value([ByRef] string key, string default_value);
FPJsonDetail json_detail([ByRef] string key, string default_value);

void track([ByRef] string event);
void track_value([ByRef] string event, double value);
void track([ByRef] string event, optional double? value = null);
};

interface FPUser {
Expand Down
8 changes: 2 additions & 6 deletions rust-uniffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,8 @@ impl FeatureProbe {
}
}

fn track(&self, event: &str) {
self.core.track_event(event, None);
}

fn track_value(&self, event: &str, value: f64) {
self.core.track_event(event, Some(value));
fn track(&self, event: &str, value: Option<f64>) {
self.core.track_event(event, value);
}

fn new_for_test(toggles: String) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion rust-uniffi/tests/bindings/test.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ val is_true = fp_for_test.boolValue("toggle_1", false)
assert(is_true == true)

fp_for_test.track("event")
fp_for_test.trackValue("eventWithValue", 1.0)
fp_for_test.track("eventWithValue", 1.0)
2 changes: 1 addition & 1 deletion rust-uniffi/tests/bindings/test.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ let is_true = fp2.boolValue(key: "toggle_1", defaultValue: false)
assert(is_true == true);

fp2.track(event: "event")
fp2.trackValue(event: "eventWithValue", value: 1.0)
fp2.track(event: "eventWithValue", value: 1.0)

2 changes: 1 addition & 1 deletion sdk-android/publish_aar.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext {path=
PUBLISH_GROUP_ID = 'com.featureprobe'
PUBLISH_ARTIFACT_ID = 'client-sdk-android'
PUBLISH_VERSION = '2.0.1' // update this version when release
PUBLISH_VERSION = '2.0.2' // update this version when release
}

ext["signing.keyId"] = System.getProperty("SIGN_KEYID")
Expand Down
12 changes: 12 additions & 0 deletions sdk-ios/ObjcFeatureProbe.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ public final class OcFeatureProbe: NSObject {
let d = fp.jsonDetail(key: key, defaultValue: defaultValue)
return OFpJsonDetail(detail: d)
}

@objc public func track(event: String) {
fp.track(event: event)
}

@objc public func track(event: String, value: Double) {
fp.track(event: event, value: value)
}

@objc public func close() {
fp.close()
}

}

Expand Down

0 comments on commit 590faf9

Please sign in to comment.