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

Added method for getting channel key or conversation ID #108

Merged
merged 2 commits into from
Nov 21, 2023

Conversation

AbhijeetRanjan308
Copy link
Contributor

Summary

  • Added a method to get channel key if you pass conversation ID or conversation ID if you pass channel key

Function

/// Just need to pass either 'clientChannelKey' or 'channelID' 
dynamic objc = {'clientChannelKey': 'pKC6riItFm7eMmogrJ2gz3LvjrD9nwaU', 'channelID': 95713948}   

KommunicateFlutterPlugin.getConversarionIdOrKey(objc).then((value) {
                     print('User Channel id : $value');
                    }
                  ).catchError((error) {
                      print('Error in channel user details : ' +
                          error.toString());
                    });

@@ -156,6 +156,50 @@ public void onFailure(Object error) {
result.error(ERROR, error.toString(), null);
}
});
} else if (call.method.equals("getConversarionIdOrKey")) {
try {
JSONObject searchObject = new JSONObject(call.arguments.toString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename the variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed the variable to 'conversationIdObjc'

return
}
alChannelService.getChannelInformation(nil, orClientChannelKey: clientChannelKey) { channel in
guard let channel = channel , let channelKey = channel.key else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename it to conversation id or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed the variable to 'conversationID'

self.sendSuccessResult(message: "\(channelKey)")
}
} else {
self.sendErrorResultWithCallback(result: result, message: "Wrong Object passed for searching conversation information")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error message is not contextual

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error message ""Object doesn't contain 'clientChannelKey' or 'channelID'""

@@ -51,6 +51,10 @@ class KommunicateFlutterPlugin {
return await _channel.invokeMethod('sendMessage', jsonEncode(messageObjc));
}

static Future<dynamic> getConversarionIdOrKey(dynamic searchObj) async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename the seachobj variable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed it to 'conversationIdObjc'

@pranaysaini04 pranaysaini04 merged commit b901fb3 into master Nov 21, 2023
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

Successfully merging this pull request may close these issues.

None yet

3 participants