Open priezz opened 7 years ago
Hi priezz, thanks for your comment. I'll try to add the setDevice* functionality in a few weeks time, when I'm less busy.
Hi @priezz, I've created a pull request that brings one method that I am using... if that PR gets accepted I can produce the wrappers for setDeviceString
, setDeviceBoolean
and setDeviceNumber
(which would be in line with js types) and map it to the appropriate method in both iOS and Android.
Additionally, adding the removeDeviceKey
shouldn't be a problem while at it.
This is the code for android
Bugfender.setDeviceBoolean("user.is.logged", true);
Bugfender.setDeviceString("user.email", "john@john.com");
Bugfender.setDeviceFloat("user.children", 3f);
Bugfender.setDeviceInteger("user.photo.image.width", 600);
Bugfender.removeDeviceKey("profile_picture_change_count");
and this is for ios
[Bugfender setDeviceBOOL:YES forKey:@"user_logged_in"];
[Bugfender setDeviceString:@"john@example.com" forKey:@"user_email"];
[Bugfender setDeviceDouble:4.5 forKey:@"app_rating"];
[Bugfender setDeviceInteger:3 forKey:@"profile_picture_change_count"];
[Bugfender removeDeviceKey:@"profile_picture_change_count"]; // to remove
Proposed react-native api:
Bugfender.setDeviceBoolean("user_logged_in", true);
Bugfender.setDeviceNumber("profile_picture_changed_count", 5); // loading it to setDeviceInteger
Bugfender.setDeviceNumber("applying_math", 3.141593); // loading it to setDeviceFloat or setDeviceDouble. Depends on the platform and if the number passes `n % 1 === 0`
Bugfender.setDeviceString("say_something", "what is that? is that the world?");
Bugfender.removeDeviceKey("say_something");
Type definition:
interface Bugfender {
setDeviceBoolean(key: string, value: boolean): void;
setDeviceNumber(key: string, value: number): void;
setDeviceString(key: string, value: string): void;
removeDeviceKey(key: string): void;
}
Hi, I just created the new implementation as described above: Is available at my branch
Once the previous commit gets in, the new pull request can be created (or I can just create the second pull request if @galmis is happy with it)
First of all, thanks you for this integration with RN!
Could you please add the
setDevice*
method into the JS API? Without that it's rather hard to find the right device in the Bugfender UI.https://bugfender.com/blog/associated-device-information/ http://cocoadocs.org/docsets/BugfenderSDK/0.3.17/Classes/Bugfender.html#//api/name/setDeviceBOOL:forKey: