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

Set name and email #6

Closed
luisfuertes opened this issue Feb 22, 2019 · 2 comments
Closed

Set name and email #6

luisfuertes opened this issue Feb 22, 2019 · 2 comments

Comments

@luisfuertes
Copy link

luisfuertes commented Feb 22, 2019

Can you add this functions to RNZendeskBridge.java? (Tested)

    @ReactMethod
    public void identifyAnonymous() {
        Identity identity = new AnonymousIdentity();
        Zendesk.INSTANCE.setIdentity(identity);
    }

    @ReactMethod
    public void identifyAnonymousWithName(String name) {
        Identity identity = new AnonymousIdentity.Builder()
            .withNameIdentifier(name).build();
            
        Zendesk.INSTANCE.setIdentity(identity);
    }

    @ReactMethod
    public void identifyAnonymousWithEmail(String email) {
        Identity identity = new AnonymousIdentity.Builder()
            .withEmailIdentifier(email).build();

        Zendesk.INSTANCE.setIdentity(identity);
    }

    @ReactMethod
    public void identifyAnonymousWithNameAndEmail(String name, String email) {
        Identity identity = new AnonymousIdentity.Builder()
        .withNameIdentifier(name)
        .withEmailIdentifier(email)
        .build();

        Zendesk.INSTANCE.setIdentity(identity);
    }
@luisfuertes luisfuertes changed the title Set email Set name and email Feb 22, 2019
@luisfuertes
Copy link
Author

luisfuertes commented Feb 22, 2019

And iOS (Not tested):

RNZendeskBridge.m:

RCT_EXTERN_METHOD(identifyAnonymousWithName:(NSString *)name);
RCT_EXTERN_METHOD(identifyAnonymousWithEmail:(NSString *)email);
RCT_EXTERN_METHOD(identifyAnonymousWithNameAndEmail: (NSString *)name email:(NSString *)email);

And RNZendesk.swift:

    @objc(identifyAnonymousWithName)
    func identifyAnonymousWithName(name: String?) {
        let identity = Identity.createAnonymous(name: name, email: "")

        Zendesk.instance?.setIdentity(identity)
    }

    @objc(identifyAnonymousWithEmail)
    func identifyAnonymousWithEmail(email: String?) {
        let identity = Identity.createAnonymous(name: "", email: email)

        Zendesk.instance?.setIdentity(identity)
    }

    @objc(identifyAnonymousWithNameAndEmail)
    func identifyAnonymousWithNameAndEmail(name: String?, email: String?) {
        let identity = Identity.createAnonymous(name: name, email: email)

        Zendesk.instance?.setIdentity(identity)
    }

@dcvz
Copy link
Owner

dcvz commented Jul 16, 2019

A new version has been published which has added support for anonymous authentication: https://github.com/dcvz/react-native-zendesk/releases/tag/v2.0.0

@dcvz dcvz closed this as completed Jul 16, 2019
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

2 participants