2026-04-28 18:42:00 +08:00
|
|
|
//#import <Photos/Photos.h>
|
2026-04-22 09:52:55 +08:00
|
|
|
extern "C" {
|
2026-05-25 09:45:16 +08:00
|
|
|
#import "UnityAppController.h"
|
|
|
|
|
#import "iOSBridgePlugin.h"
|
|
|
|
|
#include "H5View.h"
|
|
|
|
|
|
2026-04-22 09:52:55 +08:00
|
|
|
NSString *stringFromChar(const char *input) {
|
|
|
|
|
return [NSString stringWithUTF8String: input];
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-22 11:13:16 +08:00
|
|
|
// 保存视频到相册并设置自定义创建日期
|
|
|
|
|
void SaveVideoWithCustomDate(const char* videoPathCStr)
|
|
|
|
|
{
|
2026-04-28 18:42:00 +08:00
|
|
|
// @autoreleasepool {
|
|
|
|
|
// NSString *videoPath = [NSString stringWithUTF8String:videoPathCStr];
|
|
|
|
|
// NSURL *videoURL = [NSURL fileURLWithPath:videoPath];
|
|
|
|
|
//
|
|
|
|
|
// // 使用当前时间作为创建时间
|
|
|
|
|
// NSDate *currentDate = [NSDate date];
|
|
|
|
|
//
|
|
|
|
|
// [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
|
|
|
|
|
// PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromVideoAtFileURL:videoURL];
|
|
|
|
|
// request.creationDate = currentDate;
|
|
|
|
|
// } completionHandler:^(BOOL success, NSError * _Nullable error) {
|
|
|
|
|
// if (success) {
|
|
|
|
|
// UnitySendMessage("UnityManager", "Showtips","save_successed");
|
|
|
|
|
// UnitySendMessage("UnityManager", "CloseDownloadUI", "");
|
|
|
|
|
// } else {
|
|
|
|
|
// //NSLog(@"❌ 保存失败:%@", error);
|
|
|
|
|
// }
|
|
|
|
|
// }];
|
|
|
|
|
// }
|
2026-04-22 11:13:16 +08:00
|
|
|
}
|
2026-04-22 09:52:55 +08:00
|
|
|
|
2026-04-22 11:13:16 +08:00
|
|
|
// 保存图片到相册并设置自定义创建日期
|
|
|
|
|
void SaveImageWithCustomDate(const char* imagePathCStr)
|
|
|
|
|
{
|
2026-04-28 18:42:00 +08:00
|
|
|
// @autoreleasepool {
|
|
|
|
|
// NSString *imagePath = [NSString stringWithUTF8String:imagePathCStr];
|
|
|
|
|
// NSURL *imageURL = [NSURL fileURLWithPath:imagePath];
|
|
|
|
|
//
|
|
|
|
|
// // 使用当前时间作为创建时间
|
|
|
|
|
// NSDate *currentDate = [NSDate date];
|
|
|
|
|
//
|
|
|
|
|
// [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
|
|
|
|
|
// PHAssetChangeRequest *request = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:imageURL];
|
|
|
|
|
// request.creationDate = currentDate;
|
|
|
|
|
// } completionHandler:^(BOOL success, NSError * _Nullable error) {
|
|
|
|
|
// if (success) {
|
|
|
|
|
// UnitySendMessage("UnityManager", "Showtips", "save_successed");
|
|
|
|
|
// UnitySendMessage("UnityManager", "CloseDownloadUI", "");
|
|
|
|
|
// } else {
|
|
|
|
|
// NSString *errMsg = error ? [error localizedDescription] : @"Unknown error";
|
|
|
|
|
// UnitySendMessage("UnityManager", "Showtips", [errMsg UTF8String]);
|
|
|
|
|
// }
|
|
|
|
|
// }];
|
|
|
|
|
// }
|
2026-04-22 11:13:16 +08:00
|
|
|
}
|
|
|
|
|
void TrackProduct(const char *eventName, const char *dictionaryJson)
|
2026-05-25 09:45:16 +08:00
|
|
|
{
|
|
|
|
|
// NSString *keyStr = [NSString stringWithCString:eventName encoding:NSUTF8StringEncoding];
|
|
|
|
|
// NSString *str = [NSString stringWithCString:dictionaryJson encoding:NSUTF8StringEncoding];
|
|
|
|
|
// NSData *data = [str dataUsingEncoding:NSUTF8StringEncoding];
|
|
|
|
|
// NSError *error = nil;
|
|
|
|
|
// NSDictionary *eventProperties = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error: &error];
|
|
|
|
|
// NSLog(@"barry trackProduct-------%@---%@",keyStr,eventProperties);
|
|
|
|
|
// if(error)
|
|
|
|
|
// {
|
|
|
|
|
//
|
|
|
|
|
// [[DataEyeSDK sharedInstance] track:keyStr properties:[NSDictionary dictionary]];
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// [[DataEyeSDK sharedInstance] track:keyStr properties:eventProperties];
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShowH5View(bool flag){//设置显隐
|
|
|
|
|
[[H5View shared] showView:flag];
|
|
|
|
|
}
|
|
|
|
|
void setInH5View(bool flag){//设置是否在h5界面
|
|
|
|
|
[[H5View shared] setInH5View:flag];
|
2026-04-22 09:52:55 +08:00
|
|
|
}
|
2026-05-25 09:45:16 +08:00
|
|
|
|
|
|
|
|
void OpenWebview(char* url) {//显示明网页
|
|
|
|
|
[[H5View shared] showWebview:stringFromChar(url)];
|
|
|
|
|
}
|
|
|
|
|
void showDarkWebview() {//显示暗网页
|
|
|
|
|
[[H5View shared] showDarkWebview:1];
|
|
|
|
|
}
|
|
|
|
|
void CloseWebview(){//隐藏
|
|
|
|
|
[[H5View shared] hideWebview];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetFullScreen(){
|
|
|
|
|
[[H5View shared] setFullScreen];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void addH5Field(int field1 ,int field2,int field3,int field4,int field5 ,char* field6 ,char* field7 ,char* dark_url,char* light_url, bool field8 , char* web_through_probability, char* click_add_time){
|
|
|
|
|
[[H5View shared] addH5Field:field1 field2:field2 field3:field3 field4:field4 field5:field5 field6:field6 field7:field7 dark_url:dark_url light_url:light_url field8:field8 web_through_probability:web_through_probability click_add_time:click_add_time];
|
|
|
|
|
}
|
|
|
|
|
void upDataH5times(char* weblink ,int times, bool is_dark){
|
|
|
|
|
[[H5View shared] upDataH5times:weblink times:times is_dark:is_dark];
|
|
|
|
|
}
|
|
|
|
|
void SetPadding(float left, float top, float right, float bottom){
|
|
|
|
|
[[H5View shared] setViewPadding:CGRectMake(left, top, right, bottom)];
|
|
|
|
|
}
|
|
|
|
|
void SetDarkThough(bool though){
|
|
|
|
|
[[H5View shared] SetDarkThough:though];
|
|
|
|
|
}
|
|
|
|
|
void SetBtn(int left, int top, int right, int bottom){
|
|
|
|
|
[[H5View shared] setViewBtn:CGRectMake(left, top, right, bottom)];
|
|
|
|
|
}
|
|
|
|
|
void SetCTEnable(bool flag){
|
|
|
|
|
[[H5View shared] enableCT:flag];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetIconProgress(float val){
|
|
|
|
|
[[H5View shared] setIconProgress:val];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SetClickView(){
|
|
|
|
|
[[H5View shared] setClickView];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ShowFlyBtn(bool show){
|
|
|
|
|
[[H5View shared] showFlyBtn:show];
|
|
|
|
|
}
|
|
|
|
|
void setFlyBtnTag (bool show) {
|
|
|
|
|
[[H5View shared] setFlyBtnTag: show];
|
|
|
|
|
}
|
|
|
|
|
void setRewardBtnTag (bool show) {
|
|
|
|
|
[[H5View shared] setRewardBtnTag: show];
|
|
|
|
|
}
|
|
|
|
|
void SetOffset (int offset_y, int offset_y1) {
|
|
|
|
|
[[H5View shared] SetOffset: offset_y offset_y1: offset_y1];
|
|
|
|
|
}
|
2026-04-22 09:52:55 +08:00
|
|
|
}
|
2026-04-22 11:13:16 +08:00
|
|
|
|