Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions protocols/platform/android/ProtocolIAP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,18 @@ extern "C" {
ProtocolIAP* pIAP = dynamic_cast<ProtocolIAP*>(pPlugin);
if (pIAP != NULL)
{
pIAP->onPayResult((PayResultCode) ret, strMsg.c_str());
ProtocolIAP::ProtocolIAPCallback callback = pIAP->getCallback();
if (callback) {
PluginUtils::outputLog("ProtocolIAP", "IAP plugin callback function");
callback(ret, strMsg);
}else{
PluginUtils::outputLog("ProtocolIAP", "IAP plugin running onPayResult");
pIAP->onPayResult((PayResultCode) ret, strMsg.c_str());
}
}
else
{
ProtocolIAP::ProtocolIAPCallback callback = pIAP->getCallback();
if(callback)
callback(ret, strMsg);
PluginUtils::outputLog("ProtocolIAP", "Can't find the C++ object of the IAP plugin");
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions protocols/platform/ios/IAPWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@ + (void) onPayResult:(id) obj withRet:(IAPResult) ret withMsg:(NSString*) msg
{
PluginProtocol* plugin = PluginUtilsIOS::getPluginPtr(obj);
ProtocolIAP* iapPlugin = dynamic_cast<ProtocolIAP*>(plugin);
PayResultListener *listener = iapPlugin->getResultListener();
ProtocolIAP::ProtocolIAPCallback callback = iapPlugin->getCallback();
const char* chMsg = [msg UTF8String];
PayResultCode cRet = (PayResultCode) ret;
if (iapPlugin) {
iapPlugin->onPayResult(cRet, chMsg);
}else if(callback){
std::string stdmsg(chMsg);
callback(cRet,stdmsg);
if (callback) {
PluginUtilsIOS::outputLog("IAP plugin callback function");
std::string stdmsg(chMsg);
callback(cRet,stdmsg);
}else{
PluginUtilsIOS::outputLog("IAP plugin running onPayResult");
iapPlugin->onPayResult(cRet, chMsg);
}
} else {
PluginUtilsIOS::outputLog("Can't find the C++ object of the IAP plugin");
}
Expand Down