Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assotiated device information #2

Open
priezz opened this issue Jun 29, 2017 · 3 comments
Open

Assotiated device information #2

priezz opened this issue Jun 29, 2017 · 3 comments

Comments

@priezz
Copy link

priezz commented Jun 29, 2017

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:

@galmis
Copy link
Owner

galmis commented Jul 29, 2017

Hi priezz, thanks for your comment. I'll try to add the setDevice* functionality in a few weeks time, when I'm less busy.

@rodrigoelp
Copy link

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", "[email protected]");
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:@"[email protected]" 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;
}

@rodrigoelp
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants