This commit is contained in:
blank
2021-06-07 15:13:32 +08:00
parent 74d5947e9d
commit 346fc42e67
500 changed files with 77303 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
#pragma once
#include "cxDefine.h"
class SystemIntf : public NativeIntfClass
{
public:
static SystemIntf* ins();
virtual std::string call(std::string fname, cc::ValueVector params, const DataCallback& callback) override;
private:
DataCallback dataCallback;
};

View File

@@ -0,0 +1,24 @@
#include "systemIntf.h"
#include "AppController.h"
static SystemIntf* s_sharedSystemIntf = nullptr;
SystemIntf* SystemIntf::ins()
{
if (!s_sharedSystemIntf)
s_sharedSystemIntf = new SystemIntf();
return s_sharedSystemIntf;
}
std::string SystemIntf::call(std::string fname, cc::ValueVector params, const DataCallback& callback)
{
// callPhone(std::string num);
if (fname == "callPhone")
{
NSString* strNum = [[NSString alloc] initWithUTF8String:params.at(0).asString().c_str()];
NSMutableString* msNum = [[NSMutableString alloc] initWithFormat:@"tel:%@", strNum];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: msNum] options:@{} completionHandler:nil];
}
return "";
}