mirror of
https://github.com/blanking003/cx-cocos.git
synced 2025-11-07 06:45:31 +00:00
init
This commit is contained in:
16
cx3-demo/project/cxdemo.ios/Classes/system/systemIntf.h
Normal file
16
cx3-demo/project/cxdemo.ios/Classes/system/systemIntf.h
Normal 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;
|
||||
};
|
||||
|
||||
24
cx3-demo/project/cxdemo.ios/Classes/system/systemIntf.mm
Normal file
24
cx3-demo/project/cxdemo.ios/Classes/system/systemIntf.mm
Normal 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 "";
|
||||
}
|
||||
Reference in New Issue
Block a user