Skip to content

Wrong callback code in IAPWrapper.mm (for iOS) and in ProtocolIAP.cpp (for Android) #168

@shkatulo

Description

@shkatulo

Current callback code in onPayResult:withRet:withMsg method is next:

...
if (iapPlugin) {
        iapPlugin->onPayResult(cRet, chMsg);
}else if(callback){
        std::string stdmsg(chMsg);
        callback(cRet,stdmsg);
} else {
        PluginUtilsIOS::outputLog("Can't find the C++ object of the IAP plugin");
}
...

So, if plugin was successfully instantiated callback(cRet,stdmsg); will be newer called.
I think, code should be equivalent to other plugins, where all works properly:

...
if (iapPlugin) {
        PayResultListener *listener = iapPlugin->getResultListener();
        if(listener) {
            iapPlugin->onPayResult(cRet, chMsg);
        }
        else if(callback) {
            std::string stdmsg(chMsg);
            callback(cRet,stdmsg);
        }
}
else {
        PluginUtilsIOS::outputLog("Can't find the C++ object of the IAP plugin");
}
...

The same problem on Android - in file ProtocolIAP.cpp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions