//
//  ZdkBridge.m
//  Unity-iPhone
//
//  Created by PhantomJ on 2020/1/2.
//

#import "NativeTool.h"
#import "UnityAppController.h"

#import <Foundation/Foundation.h>

@interface NativeTool (CPart)
{
    
}
@end

@implementation NativeTool (CPart)

extern "C"
{
    typedef void (*BoolResultDelegate)(bool pResult);
    
    NSString* cStr2NSStr(const char* string)
    {
        NSString* tNSStr = [NSString stringWithUTF8String:string];
        
        return tNSStr;
    }
    
    const void mShake(int pType,float pIntensity)
    {
        [[NativeTool getInstance] shake:pType Intensity:pIntensity];
    }
    
    const void mShare(char* pTitle,char* pUrl,BoolResultDelegate pResultCallback)
    {
        NSString* tTitle = [NSString stringWithUTF8String:pTitle];
        NSString* tUrl = [NSString stringWithUTF8String:pUrl];
        
        [[NativeTool getInstance] shareWithTitle:tTitle Url:tUrl ResultCallback:^(BOOL pShareSucceed)
        {
            if(pResultCallback != NULL)
            {
                pResultCallback(pShareSucceed);
            }
        }];
    }
}

@end
