10.13下午跟新
This commit is contained in:
parent
dd9b2984b2
commit
8b1e9bcb41
12
10
Normal file
12
10
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
changed 1 package, and audited 42 packages in 5s
|
||||
|
||||
7 packages are looking for funding
|
||||
run `npm fund` for details
|
||||
|
||||
3 high severity vulnerabilities
|
||||
|
||||
Some issues need review, and may require choosing
|
||||
a different dependency.
|
||||
|
||||
Run `npm audit` for details.
|
||||
163
App.vue
163
App.vue
@ -8,6 +8,7 @@ import NIM from "nim-web-sdk-ng/dist/v2/NIM_UNIAPP_SDK";
|
||||
import { V2NIMConst } from "nim-web-sdk-ng/dist/esm/nim";
|
||||
|
||||
|
||||
|
||||
import {
|
||||
customRedirectTo,
|
||||
customReLaunch,
|
||||
@ -23,19 +24,51 @@ import BASE_URL from "@/utils/config.js"
|
||||
// #ifdef APP-PLUS
|
||||
/** 推送插件 */
|
||||
const nimPushPlugin = uni.requireNativePlugin("NIMUniPlugin-PluginModule");
|
||||
console.log("nimPushPlugin1111");
|
||||
console.log(nimPushPlugin);
|
||||
/** 音视频通话插件 */
|
||||
const nimCallKit = (uni.$UIKitCallKit =
|
||||
uni.requireNativePlugin("netease-CallKit"));
|
||||
// const nimCallKit = (uni.$UIKitCallKit =
|
||||
// uni.requireNativePlugin("netease-CallKit"));
|
||||
// #endif
|
||||
|
||||
const app = getApp()
|
||||
let startByNotificationId = "";
|
||||
|
||||
|
||||
export default {
|
||||
globalData: {
|
||||
plAd: true
|
||||
},
|
||||
onLaunch() {
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
/** 关闭启动画面,锁定竖屏 */
|
||||
plus.navigator.closeSplashscreen();
|
||||
plus.screen.lockOrientation("portrait-primary");
|
||||
try {
|
||||
plus.navigator.closeSplashscreen();
|
||||
plus.screen.lockOrientation("portrait-primary");
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
// 点击通知栏推送监听
|
||||
|
||||
nimPushPlugin.addOpenNotificationListener((res) => {
|
||||
console.log("推送监听");
|
||||
console.log("res",res);
|
||||
if (typeof res === 'object') {
|
||||
|
||||
console.log("=====addOpenNotificationListener success:", JSON.stringify(res))
|
||||
uni.redirectTo({
|
||||
url: `/pages_app/patientMsg/patientMsg?from=push`,
|
||||
success: () => {
|
||||
app.globalData.plAd=false;
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log("跳转失败", err);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log("=====addOpenNotificationListener unexpected:", res)
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// uni-app客户端获取push客户端标记,代码可以实现在App.vue中
|
||||
@ -142,19 +175,7 @@ export default {
|
||||
console.log("onShow");
|
||||
uni?.$UIKitNIM?.V2NIMSettingService?.setAppBackground(false);
|
||||
|
||||
// 点击通知栏推送监听
|
||||
nimPushPlugin.addOpenNotificationListener((res) => {
|
||||
console.log("推送监听");
|
||||
console.log("res",res);
|
||||
if (typeof res == "object" && res?.sessionId && res?.sessionType) {
|
||||
// 当前登录账号id 具体获取根据您的业务逻辑调整
|
||||
const imOptions = uni.getStorageSync(STORAGE_KEY);
|
||||
// 会话类型
|
||||
const type = res?.sessionType;
|
||||
// 拼装会话ID
|
||||
startByNotificationId = `${imOptions.account}|${type}|${res?.sessionId}`;
|
||||
}
|
||||
});
|
||||
|
||||
// #endif
|
||||
},
|
||||
onHide() {
|
||||
@ -250,21 +271,23 @@ export default {
|
||||
nim.V2NIMConversationIdUtil.parseConversationTargetId(
|
||||
conversationId
|
||||
);
|
||||
|
||||
const PACKAGE_NAME = 'cn.shangyu.gdxzExpert';
|
||||
let sessionId=conversationType == 1
|
||||
? uni.$UIKitStore.userStore.myUserInfo.accountId
|
||||
: targetId;
|
||||
// 设置离线强推,厂商相关推送在此处配置
|
||||
// 具体参考文档 https://doc.yunxin.163.com/messaging2/guide/zc4MTg5MDY?platform=client#%E7%AC%AC%E4%B8%80%E6%AD%A5%E4%B8%8A%E4%BC%A0%E6%8E%A8%E9%80%81%E8%AF%81%E4%B9%A6
|
||||
const pushPayload = JSON.stringify({
|
||||
pushTitle: "测试推送", // 必填,推送消息标题
|
||||
//pushTitle: "测试推送", // 必填,推送消息标题
|
||||
notify_effect: "2", //可选项,预定义通知栏消息的点击行为。1:通知栏点击后打开app的Launcher Activity,2:通知栏点击后打开app的任一Activity(开发者还需要传入intent_uri),3:通知栏点击后打开网页(开发者还需要传入web_uri)
|
||||
intent_uri:
|
||||
"intent:#Intent;action=com.netease.nimlib.uniapp.push.NotificationClickActivity;component=com.netease.nim.demo/com.netease.nimlib.uniapp.push.NotificationClickActivity;launchFlags=0x04000000;i.sessionType=0;S.sessionId=cs1;end", //可选项,打开当前app的任一组件。
|
||||
intent_uri: `intent:#Intent;action=com.netease.nimlib.uniapp.push.NotificationClickActivity;component=${PACKAGE_NAME}/com.netease.nimlib.uniapp.push.NotificationClickActivity;launchFlags=0x04000000;i.sessionType=${conversationType};S.sessionId=${sessionId};end`,
|
||||
hwField: {
|
||||
click_action: {
|
||||
//必填,消息点击行为
|
||||
type: 1, //必填,消息点击行为类型,取值如下:1:打开应用自定义页面 2:点击后打开特定URL 3:点击后打开应用
|
||||
// 自定义页面中intent的实现,请参见指定intent参数。当type为1时,字段intent和action至少二选一。scheme方式和指定activity方式都可以
|
||||
intent:
|
||||
"intent:#Intent;action=com.netease.nimlib.uniapp.push.NotificationClickActivity;component=com.netease.nim.demo/com.netease.nimlib.uniapp.push.NotificationClickActivity;launchFlags=0x04000000;i.sessionType=0;S.sessionId=cs1;end",
|
||||
`intent:#Intent;action=com.netease.nimlib.uniapp.push.NotificationClickActivity;component=${PACKAGE_NAME}/com.netease.nimlib.uniapp.push.NotificationClickActivity;launchFlags=0x04000000;i.sessionType=${conversationType};S.sessionId=${sessionId};end`
|
||||
},
|
||||
androidConfig: {
|
||||
category: "IM", //可选项,标识消息类型,用于标识高优先级透传场景,详见官方文档 AndroidConfig.category
|
||||
@ -277,14 +300,14 @@ export default {
|
||||
//必填,消息点击行为
|
||||
type: 1, //必填,消息点击行为类型,取值如下:1:打开应用自定义页面 2:点击后打开特定URL 3:点击后打开应用
|
||||
//自定义页面中intent的实现,请参见指定intent参数。当type为1时,字段intent和action至少二选一。
|
||||
intent: "",
|
||||
intent: `intent://com.honor.push/deeplink?#Intent;scheme=pushscheme;launchFlags=0x04000000;i.sessionType=${conversationType};S.sessionId=${sessionId};end`,
|
||||
},
|
||||
importance: "NORMAL", //可选项,Android通知消息分类,决定用户设备消息通知行为,取值如下:LOW:资讯营销类消息 NORMAL:服务与通讯类消息
|
||||
},
|
||||
},
|
||||
vivoField: {
|
||||
skipType: "4", //必填,点击跳转类型 1:打开APP首页 2:打开链接 3:自定义 4:打开app内指定页面,默认为1
|
||||
skipContent: "",
|
||||
skipContent: `intent:#Intent;action=com.netease.nimlib.uniapp.push.NotificationClickActivity;component=${PACKAGE_NAME}/com.netease.nimlib.uniapp.push.NotificationClickActivity;launchFlags=0x04000000;i.sessionType=${conversationType};S.sessionId=${sessionId};end`,
|
||||
classification: "1", //可选项,消息类型 0:运营类消息,1:系统类消息。默认为0
|
||||
category: "IM", // 可选项,二级分类
|
||||
},
|
||||
@ -293,16 +316,19 @@ export default {
|
||||
category: "IM", //可选项,通道类别名
|
||||
notify_level: 2, //通知栏消息提醒等级,1-通知栏;2-通知栏+锁屏;16-通知栏+锁屏+横幅+震动+铃声
|
||||
click_action_type: "1", //点击通知栏后触发的动作类型。0(默认0.启动应用;1.跳转指定应用内页(action标签名);2.跳转网页;4.跳转指定应用内页(全路径类名);5.跳转Intent scheme URL: "",
|
||||
click_action_activity: "",
|
||||
action_parameters: "",
|
||||
click_action_activity: "com.netease.nimlib.uniapp.push.NotificationClickActivity",
|
||||
action_parameters: JSON.stringify({
|
||||
sessionType: conversationType,
|
||||
sessionId: sessionId,
|
||||
}),
|
||||
},
|
||||
fcmFieldV1: {
|
||||
message: {
|
||||
android: {
|
||||
priority: "",
|
||||
data: {
|
||||
sessionType: "0",
|
||||
sessionId: "cs1",
|
||||
sessionType: conversationType,
|
||||
sessionId: sessionId,
|
||||
},
|
||||
notification: {
|
||||
click_action: "",
|
||||
@ -312,10 +338,7 @@ export default {
|
||||
},
|
||||
|
||||
// IOS apns
|
||||
sessionId:
|
||||
conversationType == 1
|
||||
? uni.$UIKitStore.userStore.myUserInfo.accountId
|
||||
: targetId,
|
||||
sessionId:sessionId,
|
||||
sessionType: conversationType,
|
||||
});
|
||||
|
||||
@ -340,37 +363,37 @@ export default {
|
||||
/** 注册推送 实际根据您在推送厂商申请的证书进行配置,具体参考文档 https://doc.yunxin.163.com/messaging2/guide/zc4MTg5MDY?platform=client#%E7%AC%AC%E4%B8%80%E6%AD%A5%E4%B8%8A%E4%BC%A0%E6%8E%A8%E9%80%81%E8%AF%81%E4%B9%A6
|
||||
*/
|
||||
nim.V2NIMSettingService.setOfflinePushConfig(nimPushPlugin, {
|
||||
// miPush: {
|
||||
// appId: "",
|
||||
// appKey: "",
|
||||
// certificateName: "",
|
||||
// },
|
||||
// hwPush: {
|
||||
// appId: "",
|
||||
// certificateName: "",
|
||||
// },
|
||||
// oppoPush: {
|
||||
// appId: "",
|
||||
// appKey: "",
|
||||
// certificateName: "",
|
||||
// secret: "",
|
||||
// },
|
||||
vivoPush: {
|
||||
appId: "100034326",
|
||||
appKey: "e789634c1f76c8f184b1def1101ce824",
|
||||
certificateName: "Expert_vivo_Push",
|
||||
miPush: {
|
||||
appId: "2882303761517470793",
|
||||
appKey: "5431747048793",
|
||||
certificateName: "Expert_Mi_Push",
|
||||
},
|
||||
hwPush: {
|
||||
appId: "10526652",
|
||||
certificateName: "Expert_Hw_push_f",
|
||||
},
|
||||
oppoPush: {
|
||||
appId: "3364888",
|
||||
appKey: "75D5Vqsg63wok0S0w4SKog0w8",
|
||||
certificateName: "Expert_Op_Push",
|
||||
secret: "416a4f5eF822ddcB73B627Cc310636D7",
|
||||
},
|
||||
vivoPush: {
|
||||
// appId: "100034326",
|
||||
// appKey: "e789634c1f76c8f184b1def1101ce824",
|
||||
certificateName: "Expert_Vi_Push",
|
||||
},
|
||||
fcmPush: {
|
||||
certificateName: "FCM_PUSH_CERT",
|
||||
},
|
||||
mzPush: {
|
||||
appId: "111",
|
||||
appKey: "111",
|
||||
certificateName: "MEIZU_PUSH_CERT",
|
||||
},
|
||||
apns: {
|
||||
certificateName: "专家端Pro",
|
||||
},
|
||||
// fcmPush: {
|
||||
// certificateName: "",
|
||||
// },
|
||||
// mzPush: {
|
||||
// appId: "",
|
||||
// appKey: "",
|
||||
// certificateName: "",
|
||||
// },
|
||||
// apns: {
|
||||
// certificateName: "",
|
||||
// },
|
||||
});
|
||||
// #endif
|
||||
|
||||
@ -438,13 +461,13 @@ export default {
|
||||
logout() {
|
||||
uni.removeStorageSync(STORAGE_KEY);
|
||||
try {
|
||||
nimCallKit.logout({}, (ret) => {
|
||||
if (ret.code != 200) {
|
||||
console.log("音视频通话插件退出失败");
|
||||
} else {
|
||||
console.log("音视频通话插件退出成功");
|
||||
}
|
||||
});
|
||||
// nimCallKit.logout({}, (ret) => {
|
||||
// if (ret.code != 200) {
|
||||
// console.log("音视频通话插件退出失败");
|
||||
// } else {
|
||||
// console.log("音视频通话插件退出成功");
|
||||
// }
|
||||
// });
|
||||
} catch (error) {
|
||||
console.log("音视频通话插件退出失败", error);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@
|
||||
activeColor: '#007aff',
|
||||
badge: 0,
|
||||
showRedDot: false,
|
||||
pagePath: '/pages/index/index'
|
||||
pagePath: '/pages/index/index?from=push'
|
||||
},
|
||||
{
|
||||
icon: classroom,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
"appid" : "__UNI__89F511F",
|
||||
"description" : "",
|
||||
"versionName" : "4.1.5",
|
||||
"versionCode" : 415,
|
||||
"versionCode" : 100,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
/* 5+App特有相关 */
|
||||
@ -46,7 +46,8 @@
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
],
|
||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
|
||||
"abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
|
||||
"minSdkVersion" : 21
|
||||
},
|
||||
"ios" : {
|
||||
"dSYMs" : false,
|
||||
@ -59,8 +60,7 @@
|
||||
"appid" : "wxbf3658f5e674667c",
|
||||
"appsecret" : "c4505a04a9910c65efea8e11ffc93f92",
|
||||
"UniversalLinks" : "https://doc.igandan.com/gdxzExpert/"
|
||||
},
|
||||
"univerify" : {}
|
||||
}
|
||||
},
|
||||
"payment" : {
|
||||
"weixin" : {
|
||||
@ -77,23 +77,7 @@
|
||||
}
|
||||
},
|
||||
"speech" : {},
|
||||
"push" : {
|
||||
"unipush" : {
|
||||
"version" : "2",
|
||||
"offline" : false,
|
||||
"hms" : {},
|
||||
"oppo" : {},
|
||||
"vivo" : {},
|
||||
"mi" : {},
|
||||
"meizu" : {},
|
||||
"honor" : {},
|
||||
"icons" : {
|
||||
"small" : {
|
||||
"xxhdpi" : "D:/uniapp/专家版图标/72.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"push" : {}
|
||||
},
|
||||
"splashscreen" : {
|
||||
"androidStyle" : "common",
|
||||
@ -126,7 +110,7 @@
|
||||
"NIMUniPlugin" : {
|
||||
"PUSH_VIVO_APPID" : "100034326",
|
||||
"PUSH_VIVO_APPKEY" : "e789634c1f76c8f184b1def1101ce824",
|
||||
"PUSH_HONOR_APPID" : "",
|
||||
"PUSH_HONOR_APPID" : "900782424",
|
||||
"__plugin_info__" : {
|
||||
"name" : "NIMUniPlugin",
|
||||
"description" : "uni消息推送插件",
|
||||
@ -155,20 +139,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"netease-CallKit" : {
|
||||
"__plugin_info__" : {
|
||||
"name" : "netease-CallKit",
|
||||
"description" : "网易云信音视频通话插件",
|
||||
"platforms" : "Android,iOS",
|
||||
"url" : "",
|
||||
"android_package_name" : "",
|
||||
"ios_bundle_id" : "",
|
||||
"isCloud" : false,
|
||||
"bought" : -1,
|
||||
"pid" : "",
|
||||
"parameters" : {}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,3 +1 @@
|
||||
{
|
||||
"comments": "请将此文件替换为华为开发者后台的配置文件"
|
||||
}
|
||||
{"agcgw":{"url":"connect-drcn.dbankcloud.cn","backurl":"connect-drcn.hispace.hicloud.com","websocketurl":"connect-ws-drcn.hispace.dbankcloud.cn","websocketbackurl":"connect-ws-drcn.hispace.dbankcloud.com"},"agcgw_all":{"SG":"connect-dra.dbankcloud.cn","SG_back":"connect-dra.hispace.hicloud.com","CN":"connect-drcn.dbankcloud.cn","CN_back":"connect-drcn.hispace.hicloud.com","RU":"connect-drru.hispace.dbankcloud.ru","RU_back":"connect-drru.hispace.dbankcloud.cn","DE":"connect-dre.dbankcloud.cn","DE_back":"connect-dre.hispace.hicloud.com"},"websocketgw_all":{"SG":"connect-ws-dra.hispace.dbankcloud.cn","SG_back":"connect-ws-dra.hispace.dbankcloud.com","CN":"connect-ws-drcn.hispace.dbankcloud.cn","CN_back":"connect-ws-drcn.hispace.dbankcloud.com","RU":"connect-ws-drru.hispace.dbankcloud.ru","RU_back":"connect-ws-drru.hispace.dbankcloud.cn","DE":"connect-ws-dre.hispace.dbankcloud.cn","DE_back":"connect-ws-dre.hispace.dbankcloud.com"},"client":{"cp_id":"890086000102014306","product_id":"9105163812218585677","client_id":"178572405214545024","client_secret":"B90774CD63B8A6AB5C2C587DC9D7C4C666EF53A19DBA70C4D549C6302ED6CFBE","project_id":"9105163812218585677","app_id":"10526652","api_key":"CV58Raxnpwbfazn6iLPkESUy7KoiUzZ5iTv8lFg/WuexwYZceAK6F9BjRf0HVmT+039dGKt5yecdkRdQ4FCHsmLZ1Zvh","package_name":"cn.shangyu.gdxzExpert"},"oauth_client":{"client_id":"10526652","client_type":1},"app_info":{"app_id":"10526652","package_name":"cn.shangyu.gdxzExpert"},"service":{"analytics":{"collector_url":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_cn":"datacollector-drcn.dt.hicloud.com,datacollector-drcn.dt.dbankcloud.cn","collector_url_de":"datacollector-dre.dt.hicloud.com,datacollector-dre.dt.dbankcloud.cn","collector_url_ru":"datacollector-drru.dt.dbankcloud.ru,datacollector-drru.dt.hicloud.com","collector_url_sg":"datacollector-dra.dt.hicloud.com,datacollector-dra.dt.dbankcloud.cn","resource_id":"p1","channel_id":""},"ml":{"mlservice_url":"ml-api-drcn.ai.dbankcloud.com,ml-api-drcn.ai.dbankcloud.cn"},"cloudstorage":{"storage_url":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg":"https://ops-dra.agcstorage.link","storage_url_de":"https://ops-dre.agcstorage.link","storage_url_cn":"https://agc-storage-drcn.platform.dbankcloud.cn","storage_url_ru_back":"https://agc-storage-drru.cloud.huawei.ru","storage_url_sg_back":"https://agc-storage-dra.cloud.huawei.asia","storage_url_de_back":"https://agc-storage-dre.cloud.huawei.eu","storage_url_cn_back":"https://agc-storage-drcn.cloud.huawei.com.cn"},"search":{"url":"https://search-drcn.cloud.huawei.com"},"edukit":{"edu_url":"edukit.cloud.huawei.com.cn","dh_url":"edukit.cloud.huawei.com.cn"}},"region":"CN","configuration_version":"3.0","appInfos":[{"package_name":"cn.shangyu.gdxzExpert","client":{"app_id":"10526652"},"app_info":{"package_name":"cn.shangyu.gdxzExpert","app_id":"10526652"},"oauth_client":{"client_type":1,"client_id":"10526652"}}]}
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"developer_id":"YOUR_HONOR_DEVELOPER_ID",
|
||||
"app_id":"YOUR_HONOR_APP_ID",
|
||||
"package_name":"YOUR_HONOR_PACKAGE_ID",
|
||||
"developer_id":"109999967097",
|
||||
"app_id":"900782424",
|
||||
"package_name":"cn.shangyu.gdxzExpert",
|
||||
"version":"1.0"
|
||||
}
|
||||
Binary file not shown.
BIN
nativeplugins/NIMUniPlugin/android/com.heytap.msp_3.5.1.aar
Normal file
BIN
nativeplugins/NIMUniPlugin/android/com.heytap.msp_3.5.1.aar
Normal file
Binary file not shown.
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "NIMUniPlugin",
|
||||
"id": "NIMUniPlugin",
|
||||
"version": "1.1.1",
|
||||
"git": "589334b",
|
||||
"buildAt": "4/26/2024, 10:00:33 AM",
|
||||
"version": "1.1.3",
|
||||
"git": "3ff8678",
|
||||
"buildAt": "7/21/2025, 10:17:00 AM",
|
||||
"description": "uni消息推送插件",
|
||||
"_dp_type": "nativeplugin",
|
||||
"_dp_nativeplugin": {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -1,54 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
|
||||
#if TARGET_OS_OSX
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class represents an NSColor replacement for CLI projects that don't link with AppKit
|
||||
**/
|
||||
@interface CLIColor : NSObject
|
||||
|
||||
/**
|
||||
* Convenience method for creating a `CLIColor` instance from RGBA params
|
||||
*
|
||||
* @param red red channel, between 0 and 1
|
||||
* @param green green channel, between 0 and 1
|
||||
* @param blue blue channel, between 0 and 1
|
||||
* @param alpha alpha channel, between 0 and 1
|
||||
*/
|
||||
+ (instancetype)colorWithCalibratedRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;
|
||||
|
||||
/**
|
||||
* Get the RGBA components from a `CLIColor`
|
||||
*
|
||||
* @param red red channel, between 0 and 1
|
||||
* @param green green channel, between 0 and 1
|
||||
* @param blue blue channel, between 0 and 1
|
||||
* @param alpha alpha channel, between 0 and 1
|
||||
*/
|
||||
- (void)getRed:(nullable CGFloat *)red green:(nullable CGFloat *)green blue:(nullable CGFloat *)blue alpha:(nullable CGFloat *)alpha NS_SWIFT_NAME(get(red:green:blue:alpha:));
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
@ -1,35 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import "CLIColor.h"
|
||||
#import "DDAbstractDatabaseLogger.h"
|
||||
#import "DDASLLogCapture.h"
|
||||
#import "DDASLLogger.h"
|
||||
#import "DDAssertMacros.h"
|
||||
#import "DDContextFilterLogFormatter+Deprecated.h"
|
||||
#import "DDContextFilterLogFormatter.h"
|
||||
#import "DDDispatchQueueLogFormatter.h"
|
||||
#import "DDFileLogger+Buffering.h"
|
||||
#import "DDFileLogger.h"
|
||||
#import "DDLog+LOGV.h"
|
||||
#import "DDLog.h"
|
||||
#import "DDLoggerNames.h"
|
||||
#import "DDLogMacros.h"
|
||||
#import "DDMultiFormatter.h"
|
||||
#import "DDOSLogger.h"
|
||||
#import "DDTTYLogger.h"
|
||||
#import "CocoaLumberjack.h"
|
||||
#import "DDLegacyMacros.h"
|
||||
|
||||
FOUNDATION_EXPORT double CocoaLumberjackVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char CocoaLumberjackVersionString[];
|
||||
|
||||
@ -1,104 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
/**
|
||||
* Welcome to CocoaLumberjack!
|
||||
*
|
||||
* The project page has a wealth of documentation if you have any questions.
|
||||
* https://github.com/CocoaLumberjack/CocoaLumberjack
|
||||
*
|
||||
* If you're new to the project you may wish to read "Getting Started" at:
|
||||
* Documentation/GettingStarted.md
|
||||
*
|
||||
* Otherwise, here is a quick refresher.
|
||||
* There are three steps to using the macros:
|
||||
*
|
||||
* Step 1:
|
||||
* Import the header in your implementation or prefix file:
|
||||
*
|
||||
* #import <CocoaLumberjack/CocoaLumberjack.h>
|
||||
*
|
||||
* Step 2:
|
||||
* Define your logging level in your implementation file:
|
||||
*
|
||||
* // Log levels: off, error, warn, info, verbose
|
||||
* static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
|
||||
*
|
||||
* Step 2 [3rd party frameworks]:
|
||||
*
|
||||
* Define your LOG_LEVEL_DEF to a different variable/function than ddLogLevel:
|
||||
*
|
||||
* // #undef LOG_LEVEL_DEF // Undefine first only if needed
|
||||
* #define LOG_LEVEL_DEF myLibLogLevel
|
||||
*
|
||||
* Define your logging level in your implementation file:
|
||||
*
|
||||
* // Log levels: off, error, warn, info, verbose
|
||||
* static const DDLogLevel myLibLogLevel = DDLogLevelVerbose;
|
||||
*
|
||||
* Step 3:
|
||||
* Replace your NSLog statements with DDLog statements according to the severity of the message.
|
||||
*
|
||||
* NSLog(@"Fatal error, no dohickey found!"); -> DDLogError(@"Fatal error, no dohickey found!");
|
||||
*
|
||||
* DDLog works exactly the same as NSLog.
|
||||
* This means you can pass it multiple variables just like NSLog.
|
||||
**/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for CocoaLumberjack.
|
||||
FOUNDATION_EXPORT double CocoaLumberjackVersionNumber;
|
||||
|
||||
//! Project version string for CocoaLumberjack.
|
||||
FOUNDATION_EXPORT const unsigned char CocoaLumberjackVersionString[];
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
// Core
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
// Main macros
|
||||
#import <CocoaLumberjack/DDLogMacros.h>
|
||||
#import <CocoaLumberjack/DDAssertMacros.h>
|
||||
|
||||
// Capture ASL
|
||||
#import <CocoaLumberjack/DDASLLogCapture.h>
|
||||
|
||||
// Loggers
|
||||
#import <CocoaLumberjack/DDLoggerNames.h>
|
||||
|
||||
#import <CocoaLumberjack/DDTTYLogger.h>
|
||||
#import <CocoaLumberjack/DDASLLogger.h>
|
||||
#import <CocoaLumberjack/DDFileLogger.h>
|
||||
#import <CocoaLumberjack/DDOSLogger.h>
|
||||
|
||||
// Extensions
|
||||
#import <CocoaLumberjack/DDContextFilterLogFormatter.h>
|
||||
#import <CocoaLumberjack/DDContextFilterLogFormatter+Deprecated.h>
|
||||
#import <CocoaLumberjack/DDDispatchQueueLogFormatter.h>
|
||||
#import <CocoaLumberjack/DDMultiFormatter.h>
|
||||
#import <CocoaLumberjack/DDFileLogger+Buffering.h>
|
||||
|
||||
// CLI
|
||||
#import <CocoaLumberjack/CLIColor.h>
|
||||
|
||||
// etc
|
||||
#import <CocoaLumberjack/DDAbstractDatabaseLogger.h>
|
||||
#import <CocoaLumberjack/DDLog+LOGV.h>
|
||||
#import <CocoaLumberjack/DDLegacyMacros.h>
|
||||
@ -1,46 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <CocoaLumberjack/DDASLLogger.h>
|
||||
|
||||
@protocol DDLogger;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides the ability to capture the ASL (Apple System Logs)
|
||||
*/
|
||||
API_DEPRECATED("Use DDOSLogger instead", macosx(10.4,10.12), ios(2.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0))
|
||||
@interface DDASLLogCapture : NSObject
|
||||
|
||||
/**
|
||||
* Start capturing logs
|
||||
*/
|
||||
+ (void)start;
|
||||
|
||||
/**
|
||||
* Stop capturing logs
|
||||
*/
|
||||
+ (void)stop;
|
||||
|
||||
/**
|
||||
* The current capture level.
|
||||
* @note Default log level: DDLogLevelVerbose (i.e. capture all ASL messages).
|
||||
*/
|
||||
@property (class) DDLogLevel captureLevel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,63 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// Custom key set on messages sent to ASL
|
||||
extern const char* const kDDASLKeyDDLog;
|
||||
|
||||
// Value set for kDDASLKeyDDLog
|
||||
extern const char* const kDDASLDDLogValue;
|
||||
|
||||
/**
|
||||
* This class provides a logger for the Apple System Log facility.
|
||||
*
|
||||
* As described in the "Getting Started" page,
|
||||
* the traditional NSLog() function directs its output to two places:
|
||||
*
|
||||
* - Apple System Log
|
||||
* - StdErr (if stderr is a TTY) so log statements show up in Xcode console
|
||||
*
|
||||
* To duplicate NSLog() functionality you can simply add this logger and a tty logger.
|
||||
* However, if you instead choose to use file logging (for faster performance),
|
||||
* you may choose to use a file logger and a tty logger.
|
||||
**/
|
||||
API_DEPRECATED("Use DDOSLogger instead", macosx(10.4,10.12), ios(2.0,10.0), watchos(2.0,3.0), tvos(9.0,10.0))
|
||||
@interface DDASLLogger : DDAbstractLogger <DDLogger>
|
||||
|
||||
/**
|
||||
* Singleton method
|
||||
*
|
||||
* @return the shared instance
|
||||
*/
|
||||
@property (nonatomic, class, readonly, strong) DDASLLogger *sharedInstance;
|
||||
|
||||
// Inherited from DDAbstractLogger
|
||||
|
||||
// - (id <DDLogFormatter>)logFormatter;
|
||||
// - (void)setLogFormatter:(id <DDLogFormatter>)formatter;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,127 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides an abstract implementation of a database logger.
|
||||
*
|
||||
* That is, it provides the base implementation for a database logger to build atop of.
|
||||
* All that is needed for a concrete database logger is to extend this class
|
||||
* and override the methods in the implementation file that are prefixed with "db_".
|
||||
**/
|
||||
@interface DDAbstractDatabaseLogger : DDAbstractLogger {
|
||||
|
||||
@protected
|
||||
NSUInteger _saveThreshold;
|
||||
NSTimeInterval _saveInterval;
|
||||
NSTimeInterval _maxAge;
|
||||
NSTimeInterval _deleteInterval;
|
||||
BOOL _deleteOnEverySave;
|
||||
|
||||
NSInteger _saveTimerSuspended;
|
||||
NSUInteger _unsavedCount;
|
||||
dispatch_time_t _unsavedTime;
|
||||
dispatch_source_t _saveTimer;
|
||||
dispatch_time_t _lastDeleteTime;
|
||||
dispatch_source_t _deleteTimer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies how often to save the data to disk.
|
||||
* Since saving is an expensive operation (disk io) it is not done after every log statement.
|
||||
* These properties allow you to configure how/when the logger saves to disk.
|
||||
*
|
||||
* A save is done when either (whichever happens first):
|
||||
*
|
||||
* - The number of unsaved log entries reaches saveThreshold
|
||||
* - The amount of time since the oldest unsaved log entry was created reaches saveInterval
|
||||
*
|
||||
* You can optionally disable the saveThreshold by setting it to zero.
|
||||
* If you disable the saveThreshold you are entirely dependent on the saveInterval.
|
||||
*
|
||||
* You can optionally disable the saveInterval by setting it to zero (or a negative value).
|
||||
* If you disable the saveInterval you are entirely dependent on the saveThreshold.
|
||||
*
|
||||
* It's not wise to disable both saveThreshold and saveInterval.
|
||||
*
|
||||
* The default saveThreshold is 500.
|
||||
* The default saveInterval is 60 seconds.
|
||||
**/
|
||||
@property (assign, readwrite) NSUInteger saveThreshold;
|
||||
|
||||
/**
|
||||
* See the description for the `saveThreshold` property
|
||||
*/
|
||||
@property (assign, readwrite) NSTimeInterval saveInterval;
|
||||
|
||||
/**
|
||||
* It is likely you don't want the log entries to persist forever.
|
||||
* Doing so would allow the database to grow infinitely large over time.
|
||||
*
|
||||
* The maxAge property provides a way to specify how old a log statement can get
|
||||
* before it should get deleted from the database.
|
||||
*
|
||||
* The deleteInterval specifies how often to sweep for old log entries.
|
||||
* Since deleting is an expensive operation (disk io) is is done on a fixed interval.
|
||||
*
|
||||
* An alternative to the deleteInterval is the deleteOnEverySave option.
|
||||
* This specifies that old log entries should be deleted during every save operation.
|
||||
*
|
||||
* You can optionally disable the maxAge by setting it to zero (or a negative value).
|
||||
* If you disable the maxAge then old log statements are not deleted.
|
||||
*
|
||||
* You can optionally disable the deleteInterval by setting it to zero (or a negative value).
|
||||
*
|
||||
* If you disable both deleteInterval and deleteOnEverySave then old log statements are not deleted.
|
||||
*
|
||||
* It's not wise to enable both deleteInterval and deleteOnEverySave.
|
||||
*
|
||||
* The default maxAge is 7 days.
|
||||
* The default deleteInterval is 5 minutes.
|
||||
* The default deleteOnEverySave is NO.
|
||||
**/
|
||||
@property (assign, readwrite) NSTimeInterval maxAge;
|
||||
|
||||
/**
|
||||
* See the description for the `maxAge` property
|
||||
*/
|
||||
@property (assign, readwrite) NSTimeInterval deleteInterval;
|
||||
|
||||
/**
|
||||
* See the description for the `maxAge` property
|
||||
*/
|
||||
@property (assign, readwrite) BOOL deleteOnEverySave;
|
||||
|
||||
/**
|
||||
* Forces a save of any pending log entries (flushes log entries to disk).
|
||||
**/
|
||||
- (void)savePendingLogEntries;
|
||||
|
||||
/**
|
||||
* Removes any log entries that are older than maxAge.
|
||||
**/
|
||||
- (void)deleteOldLogEntries;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,30 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
/**
|
||||
* NSAssert replacement that will output a log message even when assertions are disabled.
|
||||
**/
|
||||
#define DDAssert(condition, frmt, ...) \
|
||||
if (!(condition)) { \
|
||||
NSString *description = [NSString stringWithFormat:frmt, ## __VA_ARGS__]; \
|
||||
DDLogError(@"%@", description); \
|
||||
NSAssert(NO, @"%@", description); \
|
||||
}
|
||||
#define DDAssertCondition(condition) DDAssert(condition, @"Condition not satisfied: %s", #condition)
|
||||
|
||||
/**
|
||||
* Analog to `DDAssertionFailure` from DDAssert.swift for use in Objective C
|
||||
*/
|
||||
#define DDAssertionFailure(frmt, ...) DDAssert(NO, frmt, ##__VA_ARGS__)
|
||||
@ -1,119 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <CocoaLumberjack/DDContextFilterLogFormatter.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that filters log statements from a logging context not on the whitelist.
|
||||
* @deprecated Use DDContextAllowlistFilterLogFormatter instead.
|
||||
*
|
||||
* A log formatter can be added to any logger to format and/or filter its output.
|
||||
* You can learn more about log formatters here:
|
||||
* Documentation/CustomFormatters.md
|
||||
*
|
||||
* You can learn more about logging context's here:
|
||||
* Documentation/CustomContext.md
|
||||
*
|
||||
* But here's a quick overview / refresher:
|
||||
*
|
||||
* Every log statement has a logging context.
|
||||
* These come from the underlying logging macros defined in DDLog.h.
|
||||
* The default logging context is zero.
|
||||
* You can define multiple logging context's for use in your application.
|
||||
* For example, logically separate parts of your app each have a different logging context.
|
||||
* Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context.
|
||||
**/
|
||||
__attribute__((deprecated("Use DDContextAllowlistFilterLogFormatter instead")))
|
||||
typedef DDContextAllowlistFilterLogFormatter DDContextWhitelistFilterLogFormatter;
|
||||
|
||||
@interface DDContextAllowlistFilterLogFormatter (Deprecated)
|
||||
|
||||
/**
|
||||
* Add a context to the whitelist
|
||||
* @deprecated Use -addToAllowlist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)addToWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -addToAllowlist: instead")));
|
||||
|
||||
/**
|
||||
* Remove context from whitelist
|
||||
* @deprecated Use -removeFromAllowlist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)removeFromWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -removeFromAllowlist: instead")));
|
||||
|
||||
/**
|
||||
* Return the whitelist
|
||||
* @deprecated Use allowlist instead.
|
||||
*/
|
||||
@property (nonatomic, readonly, copy) NSArray<NSNumber *> *whitelist __attribute__((deprecated("Use allowlist instead")));
|
||||
|
||||
/**
|
||||
* Check if a context is on the whitelist
|
||||
* @deprecated Use -isOnAllowlist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (BOOL)isOnWhitelist:(NSInteger)loggingContext __attribute__((deprecated("Use -isOnAllowlist: instead")));
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that filters log statements from a logging context on the blacklist.
|
||||
* @deprecated Use DDContextDenylistFilterLogFormatter instead.
|
||||
**/
|
||||
__attribute__((deprecated("Use DDContextDenylistFilterLogFormatter instead")))
|
||||
typedef DDContextDenylistFilterLogFormatter DDContextBlacklistFilterLogFormatter;
|
||||
|
||||
@interface DDContextDenylistFilterLogFormatter (Deprecated)
|
||||
|
||||
/**
|
||||
* Add a context to the blacklist
|
||||
* @deprecated Use -addToDenylist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)addToBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -addToDenylist: instead")));
|
||||
|
||||
/**
|
||||
* Remove context from blacklist
|
||||
* @deprecated Use -removeFromDenylist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)removeFromBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -removeFromDenylist: instead")));
|
||||
|
||||
/**
|
||||
* Return the blacklist
|
||||
* @deprecated Use denylist instead.
|
||||
*/
|
||||
@property (readonly, copy) NSArray<NSNumber *> *blacklist __attribute__((deprecated("Use denylist instead")));
|
||||
|
||||
/**
|
||||
* Check if a context is on the blacklist
|
||||
* @deprecated Use -isOnDenylist: instead.
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (BOOL)isOnBlacklist:(NSInteger)loggingContext __attribute__((deprecated("Use -isOnDenylist: instead")));
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,117 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that filters log statements from a logging context not on the allowlist.
|
||||
*
|
||||
* A log formatter can be added to any logger to format and/or filter its output.
|
||||
* You can learn more about log formatters here:
|
||||
* Documentation/CustomFormatters.md
|
||||
*
|
||||
* You can learn more about logging context's here:
|
||||
* Documentation/CustomContext.md
|
||||
*
|
||||
* But here's a quick overview / refresher:
|
||||
*
|
||||
* Every log statement has a logging context.
|
||||
* These come from the underlying logging macros defined in DDLog.h.
|
||||
* The default logging context is zero.
|
||||
* You can define multiple logging context's for use in your application.
|
||||
* For example, logically separate parts of your app each have a different logging context.
|
||||
* Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context.
|
||||
**/
|
||||
@interface DDContextAllowlistFilterLogFormatter : NSObject <DDLogFormatter>
|
||||
|
||||
/**
|
||||
* Designated default initializer
|
||||
*/
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Add a context to the allowlist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)addToAllowlist:(NSInteger)loggingContext;
|
||||
|
||||
/**
|
||||
* Remove context from allowlist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)removeFromAllowlist:(NSInteger)loggingContext;
|
||||
|
||||
/**
|
||||
* Return the allowlist
|
||||
*/
|
||||
@property (nonatomic, readonly, copy) NSArray<NSNumber *> *allowlist;
|
||||
|
||||
/**
|
||||
* Check if a context is on the allowlist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (BOOL)isOnAllowlist:(NSInteger)loggingContext;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that filters log statements from a logging context on the denylist.
|
||||
**/
|
||||
@interface DDContextDenylistFilterLogFormatter : NSObject <DDLogFormatter>
|
||||
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Add a context to the denylist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)addToDenylist:(NSInteger)loggingContext;
|
||||
|
||||
/**
|
||||
* Remove context from denylist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (void)removeFromDenylist:(NSInteger)loggingContext;
|
||||
|
||||
/**
|
||||
* Return the denylist
|
||||
*/
|
||||
@property (readonly, copy) NSArray<NSNumber *> *denylist;
|
||||
|
||||
/**
|
||||
* Check if a context is on the denylist
|
||||
*
|
||||
* @param loggingContext the context
|
||||
*/
|
||||
- (BOOL)isOnDenylist:(NSInteger)loggingContext;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,223 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Log formatter mode
|
||||
*/
|
||||
__attribute__((deprecated("DDDispatchQueueLogFormatter is always shareable")))
|
||||
typedef NS_ENUM(NSUInteger, DDDispatchQueueLogFormatterMode){
|
||||
/**
|
||||
* This is the default option, means the formatter can be reused between multiple loggers and therefore is thread-safe.
|
||||
* There is, of course, a performance cost for the thread-safety
|
||||
*/
|
||||
DDDispatchQueueLogFormatterModeShareble = 0,
|
||||
/**
|
||||
* If the formatter will only be used by a single logger, then the thread-safety can be removed
|
||||
* @note: there is an assert checking if the formatter is added to multiple loggers and the mode is non-shareble
|
||||
*/
|
||||
DDDispatchQueueLogFormatterModeNonShareble,
|
||||
};
|
||||
|
||||
/**
|
||||
* Quality of Service names.
|
||||
*
|
||||
* Since macOS 10.10 and iOS 8.0, pthreads, dispatch queues and NSOperations express their
|
||||
* scheduling priority by using an abstract classification called Quality of Service (QOS).
|
||||
*
|
||||
* This formatter will add a representation of this QOS in the log message by using those
|
||||
* string constants.
|
||||
* For example:
|
||||
*
|
||||
* `2011-10-17 20:21:45.435 AppName[19928:5207 (QOS:DF)] Your log message here`
|
||||
*
|
||||
* Where QOS is one of:
|
||||
* `- UI = User Interactive`
|
||||
* `- IN = User Initiated`
|
||||
* `- DF = Default`
|
||||
* `- UT = Utility`
|
||||
* `- BG = Background`
|
||||
* `- UN = Unspecified`
|
||||
*
|
||||
* Note: QOS will be absent in the log messages if running on OS versions that don't support it.
|
||||
**/
|
||||
typedef NSString * DDQualityOfServiceName NS_STRING_ENUM;
|
||||
|
||||
FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceUserInteractive NS_SWIFT_NAME(DDQualityOfServiceName.userInteractive) API_AVAILABLE(macos(10.10), ios(8.0));
|
||||
FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceUserInitiated NS_SWIFT_NAME(DDQualityOfServiceName.userInitiated) API_AVAILABLE(macos(10.10), ios(8.0));
|
||||
FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceDefault NS_SWIFT_NAME(DDQualityOfServiceName.default) API_AVAILABLE(macos(10.10), ios(8.0));
|
||||
FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceUtility NS_SWIFT_NAME(DDQualityOfServiceName.utility) API_AVAILABLE(macos(10.10), ios(8.0));
|
||||
FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceBackground NS_SWIFT_NAME(DDQualityOfServiceName.background) API_AVAILABLE(macos(10.10), ios(8.0));
|
||||
FOUNDATION_EXPORT DDQualityOfServiceName const DDQualityOfServiceUnspecified NS_SWIFT_NAME(DDQualityOfServiceName.unspecified) API_AVAILABLE(macos(10.10), ios(8.0));
|
||||
|
||||
/**
|
||||
* This class provides a log formatter that prints the dispatch_queue label instead of the mach_thread_id.
|
||||
*
|
||||
* A log formatter can be added to any logger to format and/or filter its output.
|
||||
* You can learn more about log formatters here:
|
||||
* Documentation/CustomFormatters.md
|
||||
*
|
||||
* A typical `NSLog` (or `DDTTYLogger`) prints detailed info as `[<process_id>:<thread_id>]`.
|
||||
* For example:
|
||||
*
|
||||
* `2011-10-17 20:21:45.435 AppName[19928:5207] Your log message here`
|
||||
*
|
||||
* Where:
|
||||
* `- 19928 = process id`
|
||||
* `- 5207 = thread id (mach_thread_id printed in hex)`
|
||||
*
|
||||
* When using grand central dispatch (GCD), this information is less useful.
|
||||
* This is because a single serial dispatch queue may be run on any thread from an internally managed thread pool.
|
||||
* For example:
|
||||
*
|
||||
* `2011-10-17 20:32:31.111 AppName[19954:4d07] Message from my_serial_dispatch_queue`
|
||||
* `2011-10-17 20:32:31.112 AppName[19954:5207] Message from my_serial_dispatch_queue`
|
||||
* `2011-10-17 20:32:31.113 AppName[19954:2c55] Message from my_serial_dispatch_queue`
|
||||
*
|
||||
* This formatter allows you to replace the standard `[box:info]` with the dispatch_queue name.
|
||||
* For example:
|
||||
*
|
||||
* `2011-10-17 20:32:31.111 AppName[img-scaling] Message from my_serial_dispatch_queue`
|
||||
* `2011-10-17 20:32:31.112 AppName[img-scaling] Message from my_serial_dispatch_queue`
|
||||
* `2011-10-17 20:32:31.113 AppName[img-scaling] Message from my_serial_dispatch_queue`
|
||||
*
|
||||
* If the dispatch_queue doesn't have a set name, then it falls back to the thread name.
|
||||
* If the current thread doesn't have a set name, then it falls back to the mach_thread_id in hex (like normal).
|
||||
*
|
||||
* Note: If manually creating your own background threads (via `NSThread/alloc/init` or `NSThread/detachNeThread`),
|
||||
* you can use `[[NSThread currentThread] setName:(NSString *)]`.
|
||||
**/
|
||||
@interface DDDispatchQueueLogFormatter : NSObject <DDLogFormatter>
|
||||
|
||||
/**
|
||||
* Standard init method.
|
||||
* Configure using properties as desired.
|
||||
**/
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Initializer with ability to set the queue mode
|
||||
*
|
||||
* @param mode choose between DDDispatchQueueLogFormatterModeShareble and DDDispatchQueueLogFormatterModeNonShareble, depending if the formatter is shared between several loggers or not
|
||||
*/
|
||||
- (instancetype)initWithMode:(DDDispatchQueueLogFormatterMode)mode __attribute__((deprecated("DDDispatchQueueLogFormatter is always shareable")));
|
||||
|
||||
/**
|
||||
* The minQueueLength restricts the minimum size of the [detail box].
|
||||
* If the minQueueLength is set to 0, there is no restriction.
|
||||
*
|
||||
* For example, say a dispatch_queue has a label of "diskIO":
|
||||
*
|
||||
* If the minQueueLength is 0: [diskIO]
|
||||
* If the minQueueLength is 4: [diskIO]
|
||||
* If the minQueueLength is 5: [diskIO]
|
||||
* If the minQueueLength is 6: [diskIO]
|
||||
* If the minQueueLength is 7: [diskIO ]
|
||||
* If the minQueueLength is 8: [diskIO ]
|
||||
*
|
||||
* The default minQueueLength is 0 (no minimum, so [detail box] won't be padded).
|
||||
*
|
||||
* If you want every [detail box] to have the exact same width,
|
||||
* set both minQueueLength and maxQueueLength to the same value.
|
||||
**/
|
||||
@property (assign, atomic) NSUInteger minQueueLength;
|
||||
|
||||
/**
|
||||
* The maxQueueLength restricts the number of characters that will be inside the [detail box].
|
||||
* If the maxQueueLength is 0, there is no restriction.
|
||||
*
|
||||
* For example, say a dispatch_queue has a label of "diskIO":
|
||||
*
|
||||
* If the maxQueueLength is 0: [diskIO]
|
||||
* If the maxQueueLength is 4: [disk]
|
||||
* If the maxQueueLength is 5: [diskI]
|
||||
* If the maxQueueLength is 6: [diskIO]
|
||||
* If the maxQueueLength is 7: [diskIO]
|
||||
* If the maxQueueLength is 8: [diskIO]
|
||||
*
|
||||
* The default maxQueueLength is 0 (no maximum, so [detail box] won't be truncated).
|
||||
*
|
||||
* If you want every [detail box] to have the exact same width,
|
||||
* set both minQueueLength and maxQueueLength to the same value.
|
||||
**/
|
||||
@property (assign, atomic) NSUInteger maxQueueLength;
|
||||
|
||||
/**
|
||||
* Sometimes queue labels have long names like "com.apple.main-queue",
|
||||
* but you'd prefer something shorter like simply "main".
|
||||
*
|
||||
* This method allows you to set such preferred replacements.
|
||||
* The above example is set by default.
|
||||
*
|
||||
* To remove/undo a previous replacement, invoke this method with nil for the 'shortLabel' parameter.
|
||||
**/
|
||||
- (nullable NSString *)replacementStringForQueueLabel:(NSString *)longLabel;
|
||||
|
||||
/**
|
||||
* See the `replacementStringForQueueLabel:` description
|
||||
*/
|
||||
- (void)setReplacementString:(nullable NSString *)shortLabel forQueueLabel:(NSString *)longLabel;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
* Category on `DDDispatchQueueLogFormatter` to make method declarations easier to extend/modify
|
||||
**/
|
||||
@interface DDDispatchQueueLogFormatter (OverridableMethods)
|
||||
|
||||
/**
|
||||
* Date formatter default configuration
|
||||
*/
|
||||
- (void)configureDateFormatter:(NSDateFormatter *)dateFormatter;
|
||||
|
||||
/**
|
||||
* Formatter method to transfrom from date to string
|
||||
*/
|
||||
- (NSString *)stringFromDate:(NSDate *)date;
|
||||
|
||||
/**
|
||||
* Method to compute the queue thread label
|
||||
*/
|
||||
- (NSString *)queueThreadLabelForLogMessage:(DDLogMessage *)logMessage;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - DDAtomicCountable
|
||||
|
||||
__attribute__((deprecated("DDAtomicCountable is useless since DDDispatchQueueLogFormatter is always shareable now")))
|
||||
@protocol DDAtomicCountable <NSObject>
|
||||
|
||||
- (instancetype)initWithDefaultValue:(int32_t)defaultValue;
|
||||
- (int32_t)increment;
|
||||
- (int32_t)decrement;
|
||||
- (int32_t)value;
|
||||
|
||||
@end
|
||||
|
||||
__attribute__((deprecated("DDAtomicCountable is deprecated")))
|
||||
@interface DDAtomicCounter: NSObject<DDAtomicCountable>
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,27 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <CocoaLumberjack/DDFileLogger.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DDFileLogger (Buffering)
|
||||
|
||||
- (instancetype)wrapWithBuffer;
|
||||
- (instancetype)unwrapFromBuffer;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,530 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
@class DDLogFileInfo;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides a logger to write log statements to a file.
|
||||
**/
|
||||
|
||||
|
||||
// Default configuration and safety/sanity values.
|
||||
//
|
||||
// maximumFileSize -> kDDDefaultLogMaxFileSize
|
||||
// rollingFrequency -> kDDDefaultLogRollingFrequency
|
||||
// maximumNumberOfLogFiles -> kDDDefaultLogMaxNumLogFiles
|
||||
// logFilesDiskQuota -> kDDDefaultLogFilesDiskQuota
|
||||
//
|
||||
// You should carefully consider the proper configuration values for your application.
|
||||
|
||||
extern unsigned long long const kDDDefaultLogMaxFileSize;
|
||||
extern NSTimeInterval const kDDDefaultLogRollingFrequency;
|
||||
extern NSUInteger const kDDDefaultLogMaxNumLogFiles;
|
||||
extern unsigned long long const kDDDefaultLogFilesDiskQuota;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The LogFileManager protocol is designed to allow you to control all aspects of your log files.
|
||||
*
|
||||
* The primary purpose of this is to allow you to do something with the log files after they have been rolled.
|
||||
* Perhaps you want to compress them to save disk space.
|
||||
* Perhaps you want to upload them to an FTP server.
|
||||
* Perhaps you want to run some analytics on the file.
|
||||
*
|
||||
* A default LogFileManager is, of course, provided.
|
||||
* The default LogFileManager simply deletes old log files according to the maximumNumberOfLogFiles property.
|
||||
*
|
||||
* This protocol provides various methods to fetch the list of log files.
|
||||
*
|
||||
* There are two variants: sorted and unsorted.
|
||||
* If sorting is not necessary, the unsorted variant is obviously faster.
|
||||
* The sorted variant will return an array sorted by when the log files were created,
|
||||
* with the most recently created log file at index 0, and the oldest log file at the end of the array.
|
||||
*
|
||||
* You can fetch only the log file paths (full path including name), log file names (name only),
|
||||
* or an array of `DDLogFileInfo` objects.
|
||||
* The `DDLogFileInfo` class is documented below, and provides a handy wrapper that
|
||||
* gives you easy access to various file attributes such as the creation date or the file size.
|
||||
*/
|
||||
@protocol DDLogFileManager <NSObject>
|
||||
@required
|
||||
|
||||
// Public properties
|
||||
|
||||
/**
|
||||
* The maximum number of archived log files to keep on disk.
|
||||
* For example, if this property is set to 3,
|
||||
* then the LogFileManager will only keep 3 archived log files (plus the current active log file) on disk.
|
||||
* Once the active log file is rolled/archived, then the oldest of the existing 3 rolled/archived log files is deleted.
|
||||
*
|
||||
* You may optionally disable this option by setting it to zero.
|
||||
**/
|
||||
@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles;
|
||||
|
||||
/**
|
||||
* The maximum space that logs can take. On rolling logfile all old log files that exceed logFilesDiskQuota will
|
||||
* be deleted.
|
||||
*
|
||||
* You may optionally disable this option by setting it to zero.
|
||||
**/
|
||||
@property (readwrite, assign, atomic) unsigned long long logFilesDiskQuota;
|
||||
|
||||
// Public methods
|
||||
|
||||
/**
|
||||
* Returns the logs directory (path)
|
||||
*/
|
||||
@property (nonatomic, readonly, copy) NSString *logsDirectory;
|
||||
|
||||
/**
|
||||
* Returns an array of `NSString` objects,
|
||||
* each of which is the filePath to an existing log file on disk.
|
||||
**/
|
||||
@property (nonatomic, readonly, strong) NSArray<NSString *> *unsortedLogFilePaths;
|
||||
|
||||
/**
|
||||
* Returns an array of `NSString` objects,
|
||||
* each of which is the fileName of an existing log file on disk.
|
||||
**/
|
||||
@property (nonatomic, readonly, strong) NSArray<NSString *> *unsortedLogFileNames;
|
||||
|
||||
/**
|
||||
* Returns an array of `DDLogFileInfo` objects,
|
||||
* each representing an existing log file on disk,
|
||||
* and containing important information about the log file such as it's modification date and size.
|
||||
**/
|
||||
@property (nonatomic, readonly, strong) NSArray<DDLogFileInfo *> *unsortedLogFileInfos;
|
||||
|
||||
/**
|
||||
* Just like the `unsortedLogFilePaths` method, but sorts the array.
|
||||
* The items in the array are sorted by creation date.
|
||||
* The first item in the array will be the most recently created log file.
|
||||
**/
|
||||
@property (nonatomic, readonly, strong) NSArray<NSString *> *sortedLogFilePaths;
|
||||
|
||||
/**
|
||||
* Just like the `unsortedLogFileNames` method, but sorts the array.
|
||||
* The items in the array are sorted by creation date.
|
||||
* The first item in the array will be the most recently created log file.
|
||||
**/
|
||||
@property (nonatomic, readonly, strong) NSArray<NSString *> *sortedLogFileNames;
|
||||
|
||||
/**
|
||||
* Just like the `unsortedLogFileInfos` method, but sorts the array.
|
||||
* The items in the array are sorted by creation date.
|
||||
* The first item in the array will be the most recently created log file.
|
||||
**/
|
||||
@property (nonatomic, readonly, strong) NSArray<DDLogFileInfo *> *sortedLogFileInfos;
|
||||
|
||||
// Private methods (only to be used by DDFileLogger)
|
||||
|
||||
/**
|
||||
* Generates a new unique log file path, and creates the corresponding log file.
|
||||
* This method is executed directly on the file logger's internal queue.
|
||||
* The file has to exist by the time the method returns.
|
||||
**/
|
||||
- (nullable NSString *)createNewLogFileWithError:(NSError **)error;
|
||||
|
||||
@optional
|
||||
|
||||
// Private methods (only to be used by DDFileLogger)
|
||||
/**
|
||||
* Creates a new log file ignoring any errors. Deprecated in favor of `-createNewLogFileWithError:`.
|
||||
* Will only be called if `-createNewLogFileWithError:` is not implemented.
|
||||
**/
|
||||
- (nullable NSString *)createNewLogFile __attribute__((deprecated("Use -createNewLogFileWithError:"))) NS_SWIFT_UNAVAILABLE("Use -createNewLogFileWithError:");
|
||||
|
||||
// Notifications from DDFileLogger
|
||||
|
||||
/// Called when a log file was archived. Executed on global queue with default priority.
|
||||
/// @param logFilePath The path to the log file that was archived.
|
||||
/// @param wasRolled Whether or not the archiving happend after rolling the log file.
|
||||
- (void)didArchiveLogFile:(NSString *)logFilePath wasRolled:(BOOL)wasRolled NS_SWIFT_NAME(didArchiveLogFile(atPath:wasRolled:));
|
||||
|
||||
// Deprecated APIs
|
||||
/**
|
||||
* Called when a log file was archived. Executed on global queue with default priority.
|
||||
*/
|
||||
- (void)didArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didArchiveLogFile(atPath:)) __attribute__((deprecated("Use -didArchiveLogFile:wasRolled:")));
|
||||
|
||||
/**
|
||||
* Called when the roll action was executed and the log was archived.
|
||||
* Executed on global queue with default priority.
|
||||
*/
|
||||
- (void)didRollAndArchiveLogFile:(NSString *)logFilePath NS_SWIFT_NAME(didRollAndArchiveLogFile(atPath:)) __attribute__((deprecated("Use -didArchiveLogFile:wasRolled:")));
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Default log file manager.
|
||||
*
|
||||
* All log files are placed inside the logsDirectory.
|
||||
* If a specific logsDirectory isn't specified, the default directory is used.
|
||||
* On Mac, this is in `~/Library/Logs/<Application Name>`.
|
||||
* On iPhone, this is in `~/Library/Caches/Logs`.
|
||||
*
|
||||
* Log files are named `"<bundle identifier> <date> <time>.log"`
|
||||
* Example: `com.organization.myapp 2013-12-03 17-14.log`
|
||||
*
|
||||
* Archived log files are automatically deleted according to the `maximumNumberOfLogFiles` property.
|
||||
**/
|
||||
@interface DDLogFileManagerDefault : NSObject <DDLogFileManager>
|
||||
|
||||
/**
|
||||
* Default initializer
|
||||
*/
|
||||
- (instancetype)init;
|
||||
|
||||
/**
|
||||
* If logDirectory is not specified, then a folder called "Logs" is created in the app's cache directory.
|
||||
* While running on the simulator, the "Logs" folder is located in the library temporary directory.
|
||||
*/
|
||||
- (instancetype)initWithLogsDirectory:(nullable NSString *)logsDirectory NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
#if TARGET_OS_IPHONE
|
||||
/*
|
||||
* Calling this constructor you can override the default "automagically" chosen NSFileProtection level.
|
||||
* Useful if you are writing a command line utility / CydiaSubstrate addon for iOS that has no NSBundle
|
||||
* or like SpringBoard no BackgroundModes key in the NSBundle:
|
||||
* iPhone:~ root# cycript -p SpringBoard
|
||||
* cy# [NSBundle mainBundle]
|
||||
* #"NSBundle </System/Library/CoreServices/SpringBoard.app> (loaded)"
|
||||
* cy# [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIBackgroundModes"];
|
||||
* null
|
||||
* cy#
|
||||
**/
|
||||
- (instancetype)initWithLogsDirectory:(nullable NSString *)logsDirectory
|
||||
defaultFileProtectionLevel:(NSFileProtectionType)fileProtectionLevel;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Methods to override.
|
||||
*
|
||||
* Log files are named `"<bundle identifier> <date> <time>.log"`
|
||||
* Example: `com.organization.myapp 2013-12-03 17-14.log`
|
||||
*
|
||||
* If you wish to change default filename, you can override following two methods.
|
||||
* - `newLogFileName` method would be called on new logfile creation.
|
||||
* - `isLogFile:` method would be called to filter log files from all other files in logsDirectory.
|
||||
* You have to parse given filename and return YES if it is logFile.
|
||||
*
|
||||
* **NOTE**
|
||||
* `newLogFileName` returns filename. If appropriate file already exists, number would be added
|
||||
* to filename before extension. You have to handle this case in isLogFile: method.
|
||||
*
|
||||
* Example:
|
||||
* - newLogFileName returns `"com.organization.myapp 2013-12-03.log"`,
|
||||
* file `"com.organization.myapp 2013-12-03.log"` would be created.
|
||||
* - after some time `"com.organization.myapp 2013-12-03.log"` is archived
|
||||
* - newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`,
|
||||
* file `"com.organization.myapp 2013-12-03 2.log"` would be created.
|
||||
* - after some time `"com.organization.myapp 2013-12-03 1.log"` is archived
|
||||
* - newLogFileName again returns `"com.organization.myapp 2013-12-03.log"`,
|
||||
* file `"com.organization.myapp 2013-12-03 3.log"` would be created.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Generates log file name with default format `"<bundle identifier> <date> <time>.log"`
|
||||
* Example: `MobileSafari 2013-12-03 17-14.log`
|
||||
*
|
||||
* You can change it by overriding `newLogFileName` and `isLogFile:` methods.
|
||||
**/
|
||||
@property (readonly, copy) NSString *newLogFileName;
|
||||
|
||||
/**
|
||||
* Default log file name is `"<bundle identifier> <date> <time>.log"`.
|
||||
* Example: `MobileSafari 2013-12-03 17-14.log`
|
||||
*
|
||||
* You can change it by overriding `newLogFileName` and `isLogFile:` methods.
|
||||
**/
|
||||
- (BOOL)isLogFile:(NSString *)fileName NS_SWIFT_NAME(isLogFile(withName:));
|
||||
|
||||
/**
|
||||
* New log files are created empty by default in `createNewLogFile:` method
|
||||
*
|
||||
* If you wish to specify a common file header to use in your log files,
|
||||
* you can set the initial log file contents by overriding `logFileHeader`
|
||||
**/
|
||||
@property (readonly, copy, nullable) NSString *logFileHeader;
|
||||
|
||||
/* Inherited from DDLogFileManager protocol:
|
||||
|
||||
@property (readwrite, assign, atomic) NSUInteger maximumNumberOfLogFiles;
|
||||
@property (readwrite, assign, atomic) NSUInteger logFilesDiskQuota;
|
||||
|
||||
- (NSString *)logsDirectory;
|
||||
|
||||
- (NSArray *)unsortedLogFilePaths;
|
||||
- (NSArray *)unsortedLogFileNames;
|
||||
- (NSArray *)unsortedLogFileInfos;
|
||||
|
||||
- (NSArray *)sortedLogFilePaths;
|
||||
- (NSArray *)sortedLogFileNames;
|
||||
- (NSArray *)sortedLogFileInfos;
|
||||
*/
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Most users will want file log messages to be prepended with the date and time.
|
||||
* Rather than forcing the majority of users to write their own formatter,
|
||||
* we will supply a logical default formatter.
|
||||
* Users can easily replace this formatter with their own by invoking the `setLogFormatter:` method.
|
||||
* It can also be removed by calling `setLogFormatter:`, and passing a nil parameter.
|
||||
*
|
||||
* In addition to the convenience of having a logical default formatter,
|
||||
* it will also provide a template that makes it easy for developers to copy and change.
|
||||
**/
|
||||
@interface DDLogFileFormatterDefault : NSObject <DDLogFormatter>
|
||||
|
||||
/**
|
||||
* Default initializer
|
||||
*/
|
||||
- (instancetype)init;
|
||||
|
||||
/**
|
||||
* Designated initializer, requires a date formatter
|
||||
*/
|
||||
- (instancetype)initWithDateFormatter:(nullable NSDateFormatter *)dateFormatter NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The standard implementation for a file logger
|
||||
*/
|
||||
@interface DDFileLogger : DDAbstractLogger <DDLogger>
|
||||
|
||||
/**
|
||||
* Default initializer.
|
||||
*/
|
||||
- (instancetype)init;
|
||||
|
||||
/**
|
||||
* Designated initializer, requires a `DDLogFileManager` instance.
|
||||
* A global queue w/ default priority is used to run callbacks.
|
||||
* If needed, specify queue using `initWithLogFileManager:completionQueue:`.
|
||||
*/
|
||||
- (instancetype)initWithLogFileManager:(id <DDLogFileManager>)logFileManager;
|
||||
|
||||
/**
|
||||
* Designated initializer, requires a `DDLogFileManager` instance.
|
||||
* The completionQueue is used to execute `didArchiveLogFile:wasRolled:`,
|
||||
* and the callback in `rollLogFileWithCompletionBlock:`.
|
||||
* If nil, a global queue w/ default priority is used.
|
||||
*/
|
||||
- (instancetype)initWithLogFileManager:(id <DDLogFileManager>)logFileManager
|
||||
completionQueue:(nullable dispatch_queue_t)dispatchQueue NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Deprecated. Use `willLogMessage:`
|
||||
*/
|
||||
- (void)willLogMessage __attribute__((deprecated("Use -willLogMessage:"))) NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
* Deprecated. Use `didLogMessage:`
|
||||
*/
|
||||
- (void)didLogMessage __attribute__((deprecated("Use -didLogMessage:"))) NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
* Called when the logger is about to write message. Call super before your implementation.
|
||||
*/
|
||||
- (void)willLogMessage:(DDLogFileInfo *)logFileInfo NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
* Called when the logger wrote message. Call super after your implementation.
|
||||
*/
|
||||
- (void)didLogMessage:(DDLogFileInfo *)logFileInfo NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
* Writes all in-memory log data to the permanent storage. Call super before your implementation.
|
||||
* Don't call this method directly, instead use the `[DDLog flushLog]` to ensure all log messages are included in flush.
|
||||
*/
|
||||
- (void)flush NS_REQUIRES_SUPER;
|
||||
|
||||
/**
|
||||
* Called when the logger checks archive or not current log file.
|
||||
* Override this method to extend standard behavior. By default returns NO.
|
||||
* This is executed directly on the logger's internal queue, so keep processing light!
|
||||
*/
|
||||
- (BOOL)shouldArchiveRecentLogFileInfo:(DDLogFileInfo *)recentLogFileInfo;
|
||||
|
||||
/**
|
||||
* Log File Rolling:
|
||||
*
|
||||
* `maximumFileSize`:
|
||||
* The approximate maximum size (in bytes) to allow log files to grow.
|
||||
* If a log file is larger than this value after a log statement is appended,
|
||||
* then the log file is rolled.
|
||||
*
|
||||
* `rollingFrequency`
|
||||
* How often to roll the log file.
|
||||
* The frequency is given as an `NSTimeInterval`, which is a double that specifies the interval in seconds.
|
||||
* Once the log file gets to be this old, it is rolled.
|
||||
*
|
||||
* `doNotReuseLogFiles`
|
||||
* When set, will always create a new log file at application launch.
|
||||
*
|
||||
* Both the `maximumFileSize` and the `rollingFrequency` are used to manage rolling.
|
||||
* Whichever occurs first will cause the log file to be rolled.
|
||||
*
|
||||
* For example:
|
||||
* The `rollingFrequency` is 24 hours,
|
||||
* but the log file surpasses the `maximumFileSize` after only 20 hours.
|
||||
* The log file will be rolled at that 20 hour mark.
|
||||
* A new log file will be created, and the 24 hour timer will be restarted.
|
||||
*
|
||||
* You may optionally disable rolling due to filesize by setting `maximumFileSize` to zero.
|
||||
* If you do so, rolling is based solely on `rollingFrequency`.
|
||||
*
|
||||
* You may optionally disable rolling due to time by setting `rollingFrequency` to zero (or any non-positive number).
|
||||
* If you do so, rolling is based solely on `maximumFileSize`.
|
||||
*
|
||||
* If you disable both `maximumFileSize` and `rollingFrequency`, then the log file won't ever be rolled.
|
||||
* This is strongly discouraged.
|
||||
**/
|
||||
@property (readwrite, assign) unsigned long long maximumFileSize;
|
||||
|
||||
/**
|
||||
* See description for `maximumFileSize`
|
||||
*/
|
||||
@property (readwrite, assign) NSTimeInterval rollingFrequency;
|
||||
|
||||
/**
|
||||
* See description for `maximumFileSize`
|
||||
*/
|
||||
@property (readwrite, assign, atomic) BOOL doNotReuseLogFiles;
|
||||
|
||||
/**
|
||||
* The DDLogFileManager instance can be used to retrieve the list of log files,
|
||||
* and configure the maximum number of archived log files to keep.
|
||||
*
|
||||
* @see DDLogFileManager.maximumNumberOfLogFiles
|
||||
**/
|
||||
@property (strong, nonatomic, readonly) id <DDLogFileManager> logFileManager;
|
||||
|
||||
/**
|
||||
* When using a custom formatter you can set the `logMessage` method not to append
|
||||
* `\n` character after each output. This allows for some greater flexibility with
|
||||
* custom formatters. Default value is YES.
|
||||
**/
|
||||
@property (nonatomic, readwrite, assign) BOOL automaticallyAppendNewlineForCustomFormatters;
|
||||
|
||||
/**
|
||||
* You can optionally force the current log file to be rolled with this method.
|
||||
* CompletionBlock will be called on main queue.
|
||||
*/
|
||||
- (void)rollLogFileWithCompletionBlock:(nullable void (^)(void))completionBlock
|
||||
NS_SWIFT_NAME(rollLogFile(withCompletion:));
|
||||
|
||||
/**
|
||||
* Method is deprecated.
|
||||
* @deprecated Use `rollLogFileWithCompletionBlock:` method instead.
|
||||
*/
|
||||
- (void)rollLogFile __attribute__((deprecated("Use -rollLogFileWithCompletionBlock:")));
|
||||
|
||||
// Inherited from DDAbstractLogger
|
||||
|
||||
// - (id <DDLogFormatter>)logFormatter;
|
||||
// - (void)setLogFormatter:(id <DDLogFormatter>)formatter;
|
||||
|
||||
/**
|
||||
* Returns the log file that should be used.
|
||||
* If there is an existing log file that is suitable,
|
||||
* within the constraints of `maximumFileSize` and `rollingFrequency`, then it is returned.
|
||||
*
|
||||
* Otherwise a new file is created and returned. If this failes, `NULL` is returned.
|
||||
**/
|
||||
@property (nonatomic, nullable, readonly, strong) DDLogFileInfo *currentLogFileInfo;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* `DDLogFileInfo` is a simple class that provides access to various file attributes.
|
||||
* It provides good performance as it only fetches the information if requested,
|
||||
* and it caches the information to prevent duplicate fetches.
|
||||
*
|
||||
* It was designed to provide quick snapshots of the current state of log files,
|
||||
* and to help sort log files in an array.
|
||||
*
|
||||
* This class does not monitor the files, or update it's cached attribute values if the file changes on disk.
|
||||
* This is not what the class was designed for.
|
||||
*
|
||||
* If you absolutely must get updated values,
|
||||
* you can invoke the reset method which will clear the cache.
|
||||
**/
|
||||
@interface DDLogFileInfo : NSObject
|
||||
|
||||
@property (strong, nonatomic, readonly) NSString *filePath;
|
||||
@property (strong, nonatomic, readonly) NSString *fileName;
|
||||
|
||||
@property (strong, nonatomic, readonly) NSDictionary<NSFileAttributeKey, id> *fileAttributes;
|
||||
|
||||
@property (strong, nonatomic, nullable, readonly) NSDate *creationDate;
|
||||
@property (strong, nonatomic, nullable, readonly) NSDate *modificationDate;
|
||||
|
||||
@property (nonatomic, readonly) unsigned long long fileSize;
|
||||
|
||||
@property (nonatomic, readonly) NSTimeInterval age;
|
||||
|
||||
@property (nonatomic, readwrite) BOOL isArchived;
|
||||
|
||||
+ (nullable instancetype)logFileWithPath:(nullable NSString *)filePath NS_SWIFT_UNAVAILABLE("Use init(filePath:)");
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (instancetype)initWithFilePath:(NSString *)filePath NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (void)reset;
|
||||
- (void)renameFile:(NSString *)newFileName NS_SWIFT_NAME(renameFile(to:));
|
||||
|
||||
- (BOOL)hasExtendedAttributeWithName:(NSString *)attrName;
|
||||
|
||||
- (void)addExtendedAttributeWithName:(NSString *)attrName;
|
||||
- (void)removeExtendedAttributeWithName:(NSString *)attrName;
|
||||
|
||||
- (NSComparisonResult)reverseCompareByCreationDate:(DDLogFileInfo *)another;
|
||||
- (NSComparisonResult)reverseCompareByModificationDate:(DDLogFileInfo *)another;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,75 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
/**
|
||||
* Legacy macros used for 1.9.x backwards compatibility.
|
||||
*
|
||||
* Imported by default when importing a DDLog.h directly and DD_LEGACY_MACROS is not defined and set to 0.
|
||||
**/
|
||||
#if DD_LEGACY_MACROS
|
||||
|
||||
#warning CocoaLumberjack 1.9.x legacy macros enabled. \
|
||||
Disable legacy macros by importing CocoaLumberjack.h or DDLogMacros.h instead of DDLog.h or add `#define DD_LEGACY_MACROS 0` before importing DDLog.h.
|
||||
|
||||
#ifndef LOG_LEVEL_DEF
|
||||
#define LOG_LEVEL_DEF ddLogLevel
|
||||
#endif
|
||||
|
||||
#define LOG_FLAG_ERROR DDLogFlagError
|
||||
#define LOG_FLAG_WARN DDLogFlagWarning
|
||||
#define LOG_FLAG_INFO DDLogFlagInfo
|
||||
#define LOG_FLAG_DEBUG DDLogFlagDebug
|
||||
#define LOG_FLAG_VERBOSE DDLogFlagVerbose
|
||||
|
||||
#define LOG_LEVEL_OFF DDLogLevelOff
|
||||
#define LOG_LEVEL_ERROR DDLogLevelError
|
||||
#define LOG_LEVEL_WARN DDLogLevelWarning
|
||||
#define LOG_LEVEL_INFO DDLogLevelInfo
|
||||
#define LOG_LEVEL_DEBUG DDLogLevelDebug
|
||||
#define LOG_LEVEL_VERBOSE DDLogLevelVerbose
|
||||
#define LOG_LEVEL_ALL DDLogLevelAll
|
||||
|
||||
#define LOG_ASYNC_ENABLED YES
|
||||
|
||||
#define LOG_ASYNC_ERROR ( NO && LOG_ASYNC_ENABLED)
|
||||
#define LOG_ASYNC_WARN (YES && LOG_ASYNC_ENABLED)
|
||||
#define LOG_ASYNC_INFO (YES && LOG_ASYNC_ENABLED)
|
||||
#define LOG_ASYNC_DEBUG (YES && LOG_ASYNC_ENABLED)
|
||||
#define LOG_ASYNC_VERBOSE (YES && LOG_ASYNC_ENABLED)
|
||||
|
||||
#define LOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \
|
||||
[DDLog log : isAsynchronous \
|
||||
level : lvl \
|
||||
flag : flg \
|
||||
context : ctx \
|
||||
file : __FILE__ \
|
||||
function : fnct \
|
||||
line : __LINE__ \
|
||||
tag : atag \
|
||||
format : (frmt), ## __VA_ARGS__]
|
||||
|
||||
#define LOG_MAYBE(async, lvl, flg, ctx, fnct, frmt, ...) \
|
||||
do { if((lvl & flg) != 0) LOG_MACRO(async, lvl, flg, ctx, nil, fnct, frmt, ##__VA_ARGS__); } while(0)
|
||||
|
||||
#define LOG_OBJC_MAYBE(async, lvl, flg, ctx, frmt, ...) \
|
||||
LOG_MAYBE(async, lvl, flg, ctx, __PRETTY_FUNCTION__, frmt, ## __VA_ARGS__)
|
||||
|
||||
#define DDLogError(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, LOG_LEVEL_DEF, LOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__)
|
||||
#define DDLogWarn(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_WARN, LOG_LEVEL_DEF, LOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__)
|
||||
#define DDLogInfo(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_INFO, LOG_LEVEL_DEF, LOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__)
|
||||
#define DDLogDebug(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_DEBUG, LOG_LEVEL_DEF, LOG_FLAG_DEBUG, 0, frmt, ##__VA_ARGS__)
|
||||
#define DDLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, LOG_LEVEL_DEF, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)
|
||||
|
||||
#endif
|
||||
@ -1,82 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
/**
|
||||
* The constant/variable/method responsible for controlling the current log level.
|
||||
**/
|
||||
#ifndef LOG_LEVEL_DEF
|
||||
#define LOG_LEVEL_DEF ddLogLevel
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Whether async should be used by log messages, excluding error messages that are always sent sync.
|
||||
**/
|
||||
#ifndef LOG_ASYNC_ENABLED
|
||||
#define LOG_ASYNC_ENABLED YES
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This is the single macro that all other macros below compile into.
|
||||
* This big multiline macro makes all the other macros easier to read.
|
||||
**/
|
||||
#define LOGV_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, avalist) \
|
||||
[DDLog log : isAsynchronous \
|
||||
level : lvl \
|
||||
flag : flg \
|
||||
context : ctx \
|
||||
file : __FILE__ \
|
||||
function : fnct \
|
||||
line : __LINE__ \
|
||||
tag : atag \
|
||||
format : frmt \
|
||||
args : avalist]
|
||||
|
||||
/**
|
||||
* Define version of the macro that only execute if the log level is above the threshold.
|
||||
* The compiled versions essentially look like this:
|
||||
*
|
||||
* if (logFlagForThisLogMsg & ddLogLevel) { execute log message }
|
||||
*
|
||||
* When LOG_LEVEL_DEF is defined as ddLogLevel.
|
||||
*
|
||||
* As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels.
|
||||
* This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques.
|
||||
*
|
||||
* Note that when compiler optimizations are enabled (as they are for your release builds),
|
||||
* the log messages above your logging threshold will automatically be compiled out.
|
||||
*
|
||||
* (If the compiler sees LOG_LEVEL_DEF/ddLogLevel declared as a constant, the compiler simply checks to see
|
||||
* if the 'if' statement would execute, and if not it strips it from the binary.)
|
||||
*
|
||||
* We also define shorthand versions for asynchronous and synchronous logging.
|
||||
**/
|
||||
#define LOGV_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, avalist) \
|
||||
do { if(lvl & flg) LOGV_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, avalist); } while(0)
|
||||
|
||||
/**
|
||||
* Ready to use log macros with no context or tag.
|
||||
**/
|
||||
#define DDLogVError(frmt, avalist) LOGV_MAYBE(NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
||||
#define DDLogVWarn(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
||||
#define DDLogVInfo(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
||||
#define DDLogVDebug(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
||||
#define DDLogVVerbose(frmt, avalist) LOGV_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, avalist)
|
||||
@ -1,927 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// The Swift Package integration has no support for the legacy macros.
|
||||
#if __has_include(<CocoaLumberjack/DDLegacyMacros.h>)
|
||||
// Enable 1.9.x legacy macros if imported directly and it's not a swift package build.
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 1
|
||||
#endif
|
||||
// DD_LEGACY_MACROS is checked in the file itself
|
||||
#import <CocoaLumberjack/DDLegacyMacros.h>
|
||||
#endif
|
||||
|
||||
#ifndef DD_LEGACY_MESSAGE_TAG
|
||||
#define DD_LEGACY_MESSAGE_TAG 1
|
||||
#endif
|
||||
|
||||
// Names of loggers.
|
||||
#import <CocoaLumberjack/DDLoggerNames.h>
|
||||
|
||||
#if OS_OBJECT_USE_OBJC
|
||||
#define DISPATCH_QUEUE_REFERENCE_TYPE strong
|
||||
#else
|
||||
#define DISPATCH_QUEUE_REFERENCE_TYPE assign
|
||||
#endif
|
||||
|
||||
@class DDLogMessage;
|
||||
@class DDLoggerInformation;
|
||||
@protocol DDLogger;
|
||||
@protocol DDLogFormatter;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* Define the standard options.
|
||||
*
|
||||
* We default to only 4 levels because it makes it easier for beginners
|
||||
* to make the transition to a logging framework.
|
||||
*
|
||||
* More advanced users may choose to completely customize the levels (and level names) to suite their needs.
|
||||
* For more information on this see the "Custom Log Levels" page:
|
||||
* Documentation/CustomLogLevels.md
|
||||
*
|
||||
* Advanced users may also notice that we're using a bitmask.
|
||||
* This is to allow for custom fine grained logging:
|
||||
* Documentation/FineGrainedLogging.md
|
||||
*
|
||||
* -- Flags --
|
||||
*
|
||||
* Typically you will use the LOG_LEVELS (see below), but the flags may be used directly in certain situations.
|
||||
* For example, say you have a lot of warning log messages, and you wanted to disable them.
|
||||
* However, you still needed to see your error and info log messages.
|
||||
* You could accomplish that with the following:
|
||||
*
|
||||
* static const DDLogLevel ddLogLevel = DDLogFlagError | DDLogFlagInfo;
|
||||
*
|
||||
* When LOG_LEVEL_DEF is defined as ddLogLevel.
|
||||
*
|
||||
* Flags may also be consulted when writing custom log formatters,
|
||||
* as the DDLogMessage class captures the individual flag that caused the log message to fire.
|
||||
*
|
||||
* -- Levels --
|
||||
*
|
||||
* Log levels are simply the proper bitmask of the flags.
|
||||
*
|
||||
* -- Booleans --
|
||||
*
|
||||
* The booleans may be used when your logging code involves more than one line.
|
||||
* For example:
|
||||
*
|
||||
* if (LOG_VERBOSE) {
|
||||
* for (id sprocket in sprockets)
|
||||
* DDLogVerbose(@"sprocket: %@", [sprocket description])
|
||||
* }
|
||||
*
|
||||
* -- Async --
|
||||
*
|
||||
* Defines the default asynchronous options.
|
||||
* The default philosophy for asynchronous logging is very simple:
|
||||
*
|
||||
* Log messages with errors should be executed synchronously.
|
||||
* After all, an error just occurred. The application could be unstable.
|
||||
*
|
||||
* All other log messages, such as debug output, are executed asynchronously.
|
||||
* After all, if it wasn't an error, then it was just informational output,
|
||||
* or something the application was easily able to recover from.
|
||||
*
|
||||
* -- Changes --
|
||||
*
|
||||
* You are strongly discouraged from modifying this file.
|
||||
* If you do, you make it more difficult on yourself to merge future bug fixes and improvements from the project.
|
||||
* Instead, create your own MyLogging.h or ApplicationNameLogging.h or CompanyLogging.h
|
||||
*
|
||||
* For an example of customizing your logging experience, see the "Custom Log Levels" page:
|
||||
* Documentation/CustomLogLevels.md
|
||||
**/
|
||||
|
||||
/**
|
||||
* Flags accompany each log. They are used together with levels to filter out logs.
|
||||
*/
|
||||
typedef NS_OPTIONS(NSUInteger, DDLogFlag){
|
||||
/**
|
||||
* 0...00001 DDLogFlagError
|
||||
*/
|
||||
DDLogFlagError = (1 << 0),
|
||||
|
||||
/**
|
||||
* 0...00010 DDLogFlagWarning
|
||||
*/
|
||||
DDLogFlagWarning = (1 << 1),
|
||||
|
||||
/**
|
||||
* 0...00100 DDLogFlagInfo
|
||||
*/
|
||||
DDLogFlagInfo = (1 << 2),
|
||||
|
||||
/**
|
||||
* 0...01000 DDLogFlagDebug
|
||||
*/
|
||||
DDLogFlagDebug = (1 << 3),
|
||||
|
||||
/**
|
||||
* 0...10000 DDLogFlagVerbose
|
||||
*/
|
||||
DDLogFlagVerbose = (1 << 4)
|
||||
};
|
||||
|
||||
/**
|
||||
* Log levels are used to filter out logs. Used together with flags.
|
||||
*/
|
||||
typedef NS_ENUM(NSUInteger, DDLogLevel){
|
||||
/**
|
||||
* No logs
|
||||
*/
|
||||
DDLogLevelOff = 0,
|
||||
|
||||
/**
|
||||
* Error logs only
|
||||
*/
|
||||
DDLogLevelError = (DDLogFlagError),
|
||||
|
||||
/**
|
||||
* Error and warning logs
|
||||
*/
|
||||
DDLogLevelWarning = (DDLogLevelError | DDLogFlagWarning),
|
||||
|
||||
/**
|
||||
* Error, warning and info logs
|
||||
*/
|
||||
DDLogLevelInfo = (DDLogLevelWarning | DDLogFlagInfo),
|
||||
|
||||
/**
|
||||
* Error, warning, info and debug logs
|
||||
*/
|
||||
DDLogLevelDebug = (DDLogLevelInfo | DDLogFlagDebug),
|
||||
|
||||
/**
|
||||
* Error, warning, info, debug and verbose logs
|
||||
*/
|
||||
DDLogLevelVerbose = (DDLogLevelDebug | DDLogFlagVerbose),
|
||||
|
||||
/**
|
||||
* All logs (1...11111)
|
||||
*/
|
||||
DDLogLevelAll = NSUIntegerMax
|
||||
};
|
||||
|
||||
/**
|
||||
* Extracts just the file name, no path or extension
|
||||
*
|
||||
* @param filePath input file path
|
||||
* @param copy YES if we want the result to be copied
|
||||
*
|
||||
* @return the file name
|
||||
*/
|
||||
FOUNDATION_EXTERN NSString * __nullable DDExtractFileNameWithoutExtension(const char *filePath, BOOL copy);
|
||||
|
||||
/**
|
||||
* The THIS_FILE macro gives you an NSString of the file name.
|
||||
* For simplicity and clarity, the file name does not include the full path or file extension.
|
||||
*
|
||||
* For example: DDLogWarn(@"%@: Unable to find thingy", THIS_FILE) -> @"MyViewController: Unable to find thingy"
|
||||
**/
|
||||
#define THIS_FILE (DDExtractFileNameWithoutExtension(__FILE__, NO))
|
||||
|
||||
/**
|
||||
* The THIS_METHOD macro gives you the name of the current objective-c method.
|
||||
*
|
||||
* For example: DDLogWarn(@"%@ - Requires non-nil strings", THIS_METHOD) -> @"setMake:model: requires non-nil strings"
|
||||
*
|
||||
* Note: This does NOT work in straight C functions (non objective-c).
|
||||
* Instead you should use the predefined __FUNCTION__ macro.
|
||||
**/
|
||||
#define THIS_METHOD NSStringFromSelector(_cmd)
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The main class, exposes all logging mechanisms, loggers, ...
|
||||
* For most of the users, this class is hidden behind the logging functions like `DDLogInfo`
|
||||
*/
|
||||
@interface DDLog : NSObject
|
||||
|
||||
/**
|
||||
* Returns the singleton `DDLog`.
|
||||
* The instance is used by `DDLog` class methods.
|
||||
*/
|
||||
@property (class, nonatomic, strong, readonly) DDLog *sharedInstance;
|
||||
|
||||
/**
|
||||
* Provides access to the underlying logging queue.
|
||||
* This may be helpful to Logger classes for things like thread synchronization.
|
||||
**/
|
||||
@property (class, nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggingQueue;
|
||||
|
||||
/**
|
||||
* Logging Primitive.
|
||||
*
|
||||
* This method is used by the macros or logging functions.
|
||||
* It is suggested you stick with the macros as they're easier to use.
|
||||
*
|
||||
* @param asynchronous YES if the logging is done async, NO if you want to force sync
|
||||
* @param level the log level
|
||||
* @param flag the log flag
|
||||
* @param context the context (if any is defined)
|
||||
* @param file the current file
|
||||
* @param function the current function
|
||||
* @param line the current code line
|
||||
* @param tag potential tag
|
||||
* @param format the log format
|
||||
*/
|
||||
+ (void)log:(BOOL)asynchronous
|
||||
level:(DDLogLevel)level
|
||||
flag:(DDLogFlag)flag
|
||||
context:(NSInteger)context
|
||||
file:(const char *)file
|
||||
function:(nullable const char *)function
|
||||
line:(NSUInteger)line
|
||||
tag:(nullable id)tag
|
||||
format:(NSString *)format, ... NS_FORMAT_FUNCTION(9,10);
|
||||
|
||||
/**
|
||||
* Logging Primitive.
|
||||
*
|
||||
* This method is used by the macros or logging functions.
|
||||
* It is suggested you stick with the macros as they're easier to use.
|
||||
*
|
||||
* @param asynchronous YES if the logging is done async, NO if you want to force sync
|
||||
* @param level the log level
|
||||
* @param flag the log flag
|
||||
* @param context the context (if any is defined)
|
||||
* @param file the current file
|
||||
* @param function the current function
|
||||
* @param line the current code line
|
||||
* @param tag potential tag
|
||||
* @param format the log format
|
||||
*/
|
||||
- (void)log:(BOOL)asynchronous
|
||||
level:(DDLogLevel)level
|
||||
flag:(DDLogFlag)flag
|
||||
context:(NSInteger)context
|
||||
file:(const char *)file
|
||||
function:(nullable const char *)function
|
||||
line:(NSUInteger)line
|
||||
tag:(nullable id)tag
|
||||
format:(NSString *)format, ... NS_FORMAT_FUNCTION(9,10);
|
||||
|
||||
/**
|
||||
* Logging Primitive.
|
||||
*
|
||||
* This method can be used if you have a prepared va_list.
|
||||
* Similar to `log:level:flag:context:file:function:line:tag:format:...`
|
||||
*
|
||||
* @param asynchronous YES if the logging is done async, NO if you want to force sync
|
||||
* @param level the log level
|
||||
* @param flag the log flag
|
||||
* @param context the context (if any is defined)
|
||||
* @param file the current file
|
||||
* @param function the current function
|
||||
* @param line the current code line
|
||||
* @param tag potential tag
|
||||
* @param format the log format
|
||||
* @param argList the arguments list as a va_list
|
||||
*/
|
||||
+ (void)log:(BOOL)asynchronous
|
||||
level:(DDLogLevel)level
|
||||
flag:(DDLogFlag)flag
|
||||
context:(NSInteger)context
|
||||
file:(const char *)file
|
||||
function:(nullable const char *)function
|
||||
line:(NSUInteger)line
|
||||
tag:(nullable id)tag
|
||||
format:(NSString *)format
|
||||
args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:));
|
||||
|
||||
/**
|
||||
* Logging Primitive.
|
||||
*
|
||||
* This method can be used if you have a prepared va_list.
|
||||
* Similar to `log:level:flag:context:file:function:line:tag:format:...`
|
||||
*
|
||||
* @param asynchronous YES if the logging is done async, NO if you want to force sync
|
||||
* @param level the log level
|
||||
* @param flag the log flag
|
||||
* @param context the context (if any is defined)
|
||||
* @param file the current file
|
||||
* @param function the current function
|
||||
* @param line the current code line
|
||||
* @param tag potential tag
|
||||
* @param format the log format
|
||||
* @param argList the arguments list as a va_list
|
||||
*/
|
||||
- (void)log:(BOOL)asynchronous
|
||||
level:(DDLogLevel)level
|
||||
flag:(DDLogFlag)flag
|
||||
context:(NSInteger)context
|
||||
file:(const char *)file
|
||||
function:(nullable const char *)function
|
||||
line:(NSUInteger)line
|
||||
tag:(nullable id)tag
|
||||
format:(NSString *)format
|
||||
args:(va_list)argList NS_SWIFT_NAME(log(asynchronous:level:flag:context:file:function:line:tag:format:arguments:));
|
||||
|
||||
/**
|
||||
* Logging Primitive.
|
||||
*
|
||||
* This method can be used if you manually prepared DDLogMessage.
|
||||
*
|
||||
* @param asynchronous YES if the logging is done async, NO if you want to force sync
|
||||
* @param logMessage the log message stored in a `DDLogMessage` model object
|
||||
*/
|
||||
+ (void)log:(BOOL)asynchronous
|
||||
message:(DDLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:));
|
||||
|
||||
/**
|
||||
* Logging Primitive.
|
||||
*
|
||||
* This method can be used if you manually prepared DDLogMessage.
|
||||
*
|
||||
* @param asynchronous YES if the logging is done async, NO if you want to force sync
|
||||
* @param logMessage the log message stored in a `DDLogMessage` model object
|
||||
*/
|
||||
- (void)log:(BOOL)asynchronous
|
||||
message:(DDLogMessage *)logMessage NS_SWIFT_NAME(log(asynchronous:message:));
|
||||
|
||||
/**
|
||||
* Since logging can be asynchronous, there may be times when you want to flush the logs.
|
||||
* The framework invokes this automatically when the application quits.
|
||||
**/
|
||||
+ (void)flushLog;
|
||||
|
||||
/**
|
||||
* Since logging can be asynchronous, there may be times when you want to flush the logs.
|
||||
* The framework invokes this automatically when the application quits.
|
||||
**/
|
||||
- (void)flushLog;
|
||||
|
||||
/**
|
||||
* Loggers
|
||||
*
|
||||
* In order for your log statements to go somewhere, you should create and add a logger.
|
||||
*
|
||||
* You can add multiple loggers in order to direct your log statements to multiple places.
|
||||
* And each logger can be configured separately.
|
||||
* So you could have, for example, verbose logging to the console, but a concise log file with only warnings & errors.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Adds the logger to the system.
|
||||
*
|
||||
* This is equivalent to invoking `[DDLog addLogger:logger withLogLevel:DDLogLevelAll]`.
|
||||
**/
|
||||
+ (void)addLogger:(id <DDLogger>)logger;
|
||||
|
||||
/**
|
||||
* Adds the logger to the system.
|
||||
*
|
||||
* This is equivalent to invoking `[DDLog addLogger:logger withLogLevel:DDLogLevelAll]`.
|
||||
**/
|
||||
- (void)addLogger:(id <DDLogger>)logger;
|
||||
|
||||
/**
|
||||
* Adds the logger to the system.
|
||||
*
|
||||
* The level that you provide here is a preemptive filter (for performance).
|
||||
* That is, the level specified here will be used to filter out logMessages so that
|
||||
* the logger is never even invoked for the messages.
|
||||
*
|
||||
* More information:
|
||||
* When you issue a log statement, the logging framework iterates over each logger,
|
||||
* and checks to see if it should forward the logMessage to the logger.
|
||||
* This check is done using the level parameter passed to this method.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* `[DDLog addLogger:consoleLogger withLogLevel:DDLogLevelVerbose];`
|
||||
* `[DDLog addLogger:fileLogger withLogLevel:DDLogLevelWarning];`
|
||||
*
|
||||
* `DDLogError(@"oh no");` => gets forwarded to consoleLogger & fileLogger
|
||||
* `DDLogInfo(@"hi");` => gets forwarded to consoleLogger only
|
||||
*
|
||||
* It is important to remember that Lumberjack uses a BITMASK.
|
||||
* Many developers & third party frameworks may define extra log levels & flags.
|
||||
* For example:
|
||||
*
|
||||
* `#define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0...1000000`
|
||||
*
|
||||
* So if you specify `DDLogLevelVerbose` to this method, you won't see the framework's trace messages.
|
||||
*
|
||||
* `(SOME_FRAMEWORK_LOG_FLAG_TRACE & DDLogLevelVerbose) => (01000000 & 00011111) => NO`
|
||||
*
|
||||
* Consider passing `DDLogLevelAll` to this method, which has all bits set.
|
||||
* You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set,
|
||||
* except the ones you explicitly don't want. For example, if you wanted everything except verbose & debug:
|
||||
*
|
||||
* `((DDLogLevelAll ^ DDLogLevelVerbose) | DDLogLevelInfo)`
|
||||
**/
|
||||
+ (void)addLogger:(id <DDLogger>)logger withLevel:(DDLogLevel)level;
|
||||
|
||||
/**
|
||||
* Adds the logger to the system.
|
||||
*
|
||||
* The level that you provide here is a preemptive filter (for performance).
|
||||
* That is, the level specified here will be used to filter out logMessages so that
|
||||
* the logger is never even invoked for the messages.
|
||||
*
|
||||
* More information:
|
||||
* When you issue a log statement, the logging framework iterates over each logger,
|
||||
* and checks to see if it should forward the logMessage to the logger.
|
||||
* This check is done using the level parameter passed to this method.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
* `[DDLog addLogger:consoleLogger withLogLevel:DDLogLevelVerbose];`
|
||||
* `[DDLog addLogger:fileLogger withLogLevel:DDLogLevelWarning];`
|
||||
*
|
||||
* `DDLogError(@"oh no");` => gets forwarded to consoleLogger & fileLogger
|
||||
* `DDLogInfo(@"hi");` => gets forwarded to consoleLogger only
|
||||
*
|
||||
* It is important to remember that Lumberjack uses a BITMASK.
|
||||
* Many developers & third party frameworks may define extra log levels & flags.
|
||||
* For example:
|
||||
*
|
||||
* `#define SOME_FRAMEWORK_LOG_FLAG_TRACE (1 << 6) // 0...1000000`
|
||||
*
|
||||
* So if you specify `DDLogLevelVerbose` to this method, you won't see the framework's trace messages.
|
||||
*
|
||||
* `(SOME_FRAMEWORK_LOG_FLAG_TRACE & DDLogLevelVerbose) => (01000000 & 00011111) => NO`
|
||||
*
|
||||
* Consider passing `DDLogLevelAll` to this method, which has all bits set.
|
||||
* You can also use the exclusive-or bitwise operator to get a bitmask that has all flags set,
|
||||
* except the ones you explicitly don't want. For example, if you wanted everything except verbose & debug:
|
||||
*
|
||||
* `((DDLogLevelAll ^ DDLogLevelVerbose) | DDLogLevelInfo)`
|
||||
**/
|
||||
- (void)addLogger:(id <DDLogger>)logger withLevel:(DDLogLevel)level;
|
||||
|
||||
/**
|
||||
* Remove the logger from the system
|
||||
*/
|
||||
+ (void)removeLogger:(id <DDLogger>)logger;
|
||||
|
||||
/**
|
||||
* Remove the logger from the system
|
||||
*/
|
||||
- (void)removeLogger:(id <DDLogger>)logger;
|
||||
|
||||
/**
|
||||
* Remove all the current loggers
|
||||
*/
|
||||
+ (void)removeAllLoggers;
|
||||
|
||||
/**
|
||||
* Remove all the current loggers
|
||||
*/
|
||||
- (void)removeAllLoggers;
|
||||
|
||||
/**
|
||||
* Return all the current loggers
|
||||
*/
|
||||
@property (class, nonatomic, copy, readonly) NSArray<id<DDLogger>> *allLoggers;
|
||||
|
||||
/**
|
||||
* Return all the current loggers
|
||||
*/
|
||||
@property (nonatomic, copy, readonly) NSArray<id<DDLogger>> *allLoggers;
|
||||
|
||||
/**
|
||||
* Return all the current loggers with their level (aka DDLoggerInformation).
|
||||
*/
|
||||
@property (class, nonatomic, copy, readonly) NSArray<DDLoggerInformation *> *allLoggersWithLevel;
|
||||
|
||||
/**
|
||||
* Return all the current loggers with their level (aka DDLoggerInformation).
|
||||
*/
|
||||
@property (nonatomic, copy, readonly) NSArray<DDLoggerInformation *> *allLoggersWithLevel;
|
||||
|
||||
/**
|
||||
* Registered Dynamic Logging
|
||||
*
|
||||
* These methods allow you to obtain a list of classes that are using registered dynamic logging,
|
||||
* and also provides methods to get and set their log level during run time.
|
||||
**/
|
||||
|
||||
/**
|
||||
* Returns an array with the classes that are using registered dynamic logging
|
||||
*/
|
||||
@property (class, nonatomic, copy, readonly) NSArray<Class> *registeredClasses;
|
||||
|
||||
/**
|
||||
* Returns an array with the classes names that are using registered dynamic logging
|
||||
*/
|
||||
@property (class, nonatomic, copy, readonly) NSArray<NSString*> *registeredClassNames;
|
||||
|
||||
/**
|
||||
* Returns the current log level for a certain class
|
||||
*
|
||||
* @param aClass `Class` param
|
||||
*/
|
||||
+ (DDLogLevel)levelForClass:(Class)aClass;
|
||||
|
||||
/**
|
||||
* Returns the current log level for a certain class
|
||||
*
|
||||
* @param aClassName string param
|
||||
*/
|
||||
+ (DDLogLevel)levelForClassWithName:(NSString *)aClassName;
|
||||
|
||||
/**
|
||||
* Set the log level for a certain class
|
||||
*
|
||||
* @param level the new level
|
||||
* @param aClass `Class` param
|
||||
*/
|
||||
+ (void)setLevel:(DDLogLevel)level forClass:(Class)aClass;
|
||||
|
||||
/**
|
||||
* Set the log level for a certain class
|
||||
*
|
||||
* @param level the new level
|
||||
* @param aClassName string param
|
||||
*/
|
||||
+ (void)setLevel:(DDLogLevel)level forClassWithName:(NSString *)aClassName;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* This protocol describes a basic logger behavior.
|
||||
* Basically, it can log messages, store a logFormatter plus a bunch of optional behaviors.
|
||||
* (i.e. flush, get its loggerQueue, get its name, ...
|
||||
*/
|
||||
@protocol DDLogger <NSObject>
|
||||
|
||||
/**
|
||||
* The log message method
|
||||
*
|
||||
* @param logMessage the message (model)
|
||||
*/
|
||||
- (void)logMessage:(DDLogMessage *)logMessage NS_SWIFT_NAME(log(message:));
|
||||
|
||||
/**
|
||||
* Formatters may optionally be added to any logger.
|
||||
*
|
||||
* If no formatter is set, the logger simply logs the message as it is given in logMessage,
|
||||
* or it may use its own built in formatting style.
|
||||
**/
|
||||
@property (nonatomic, strong, nullable) id <DDLogFormatter> logFormatter;
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
* Since logging is asynchronous, adding and removing loggers is also asynchronous.
|
||||
* In other words, the loggers are added and removed at appropriate times with regards to log messages.
|
||||
*
|
||||
* - Loggers will not receive log messages that were executed prior to when they were added.
|
||||
* - Loggers will not receive log messages that were executed after they were removed.
|
||||
*
|
||||
* These methods are executed in the logging thread/queue.
|
||||
* This is the same thread/queue that will execute every logMessage: invocation.
|
||||
* Loggers may use these methods for thread synchronization or other setup/teardown tasks.
|
||||
**/
|
||||
- (void)didAddLogger;
|
||||
|
||||
/**
|
||||
* Since logging is asynchronous, adding and removing loggers is also asynchronous.
|
||||
* In other words, the loggers are added and removed at appropriate times with regards to log messages.
|
||||
*
|
||||
* - Loggers will not receive log messages that were executed prior to when they were added.
|
||||
* - Loggers will not receive log messages that were executed after they were removed.
|
||||
*
|
||||
* These methods are executed in the logging thread/queue given in parameter.
|
||||
* This is the same thread/queue that will execute every logMessage: invocation.
|
||||
* Loggers may use the queue parameter to set specific values on the queue with dispatch_set_specific() function.
|
||||
**/
|
||||
- (void)didAddLoggerInQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* See the above description for `didAddLogger`
|
||||
*/
|
||||
- (void)willRemoveLogger;
|
||||
|
||||
/**
|
||||
* Some loggers may buffer IO for optimization purposes.
|
||||
* For example, a database logger may only save occasionally as the disk IO is slow.
|
||||
* In such loggers, this method should be implemented to flush any pending IO.
|
||||
*
|
||||
* This allows invocations of DDLog's flushLog method to be propagated to loggers that need it.
|
||||
*
|
||||
* Note that DDLog's flushLog method is invoked automatically when the application quits,
|
||||
* and it may be also invoked manually by the developer prior to application crashes, or other such reasons.
|
||||
**/
|
||||
- (void)flush;
|
||||
|
||||
/**
|
||||
* Each logger is executed concurrently with respect to the other loggers.
|
||||
* Thus, a dedicated dispatch queue is used for each logger.
|
||||
* Logger implementations may optionally choose to provide their own dispatch queue.
|
||||
**/
|
||||
@property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE, readonly) dispatch_queue_t loggerQueue;
|
||||
|
||||
/**
|
||||
* If the logger implementation does not choose to provide its own queue,
|
||||
* one will automatically be created for it.
|
||||
* The created queue will receive its name from this method.
|
||||
* This may be helpful for debugging or profiling reasons.
|
||||
**/
|
||||
@property (copy, nonatomic, readonly) DDLoggerName loggerName;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* This protocol describes the behavior of a log formatter
|
||||
*/
|
||||
@protocol DDLogFormatter <NSObject>
|
||||
@required
|
||||
|
||||
/**
|
||||
* Formatters may optionally be added to any logger.
|
||||
* This allows for increased flexibility in the logging environment.
|
||||
* For example, log messages for log files may be formatted differently than log messages for the console.
|
||||
*
|
||||
* For more information about formatters, see the "Custom Formatters" page:
|
||||
* Documentation/CustomFormatters.md
|
||||
*
|
||||
* The formatter may also optionally filter the log message by returning nil,
|
||||
* in which case the logger will not log the message.
|
||||
**/
|
||||
- (nullable NSString *)formatLogMessage:(DDLogMessage *)logMessage NS_SWIFT_NAME(format(message:));
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
* A single formatter instance can be added to multiple loggers.
|
||||
* These methods provides hooks to notify the formatter of when it's added/removed.
|
||||
*
|
||||
* This is primarily for thread-safety.
|
||||
* If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers.
|
||||
* Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter with 10.0 behavior),
|
||||
* it could possibly use these hooks to switch to thread-safe versions of the code.
|
||||
**/
|
||||
- (void)didAddToLogger:(id <DDLogger>)logger;
|
||||
|
||||
/**
|
||||
* A single formatter instance can be added to multiple loggers.
|
||||
* These methods provides hooks to notify the formatter of when it's added/removed.
|
||||
*
|
||||
* This is primarily for thread-safety.
|
||||
* If a formatter is explicitly not thread-safe, it may wish to throw an exception if added to multiple loggers.
|
||||
* Or if a formatter has potentially thread-unsafe code (e.g. NSDateFormatter with 10.0 behavior),
|
||||
* it could possibly use these hooks to switch to thread-safe versions of the code or use dispatch_set_specific()
|
||||
.* to add its own specific values.
|
||||
**/
|
||||
- (void)didAddToLogger:(id <DDLogger>)logger inQueue:(dispatch_queue_t)queue;
|
||||
|
||||
/**
|
||||
* See the above description for `didAddToLogger:`
|
||||
*/
|
||||
- (void)willRemoveFromLogger:(id <DDLogger>)logger;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* This protocol describes a dynamic logging component
|
||||
*/
|
||||
@protocol DDRegisteredDynamicLogging
|
||||
|
||||
/**
|
||||
* Implement these methods to allow a file's log level to be managed from a central location.
|
||||
*
|
||||
* This is useful if you'd like to be able to change log levels for various parts
|
||||
* of your code from within the running application.
|
||||
*
|
||||
* Imagine pulling up the settings for your application,
|
||||
* and being able to configure the logging level on a per file basis.
|
||||
*
|
||||
* The implementation can be very straight-forward:
|
||||
*
|
||||
* ```
|
||||
* + (int)ddLogLevel
|
||||
* {
|
||||
* return ddLogLevel;
|
||||
* }
|
||||
*
|
||||
* + (void)ddSetLogLevel:(DDLogLevel)level
|
||||
* {
|
||||
* ddLogLevel = level;
|
||||
* }
|
||||
* ```
|
||||
**/
|
||||
@property (class, nonatomic, readwrite, setter=ddSetLogLevel:) DDLogLevel ddLogLevel;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef NS_DESIGNATED_INITIALIZER
|
||||
#define NS_DESIGNATED_INITIALIZER
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Log message options, allow copying certain log elements
|
||||
*/
|
||||
typedef NS_OPTIONS(NSInteger, DDLogMessageOptions){
|
||||
/**
|
||||
* Use this to use a copy of the file path
|
||||
*/
|
||||
DDLogMessageCopyFile = 1 << 0,
|
||||
/**
|
||||
* Use this to use a copy of the function name
|
||||
*/
|
||||
DDLogMessageCopyFunction = 1 << 1,
|
||||
/**
|
||||
* Use this to use avoid a copy of the message
|
||||
*/
|
||||
DDLogMessageDontCopyMessage = 1 << 2
|
||||
};
|
||||
|
||||
/**
|
||||
* The `DDLogMessage` class encapsulates information about the log message.
|
||||
* If you write custom loggers or formatters, you will be dealing with objects of this class.
|
||||
**/
|
||||
@interface DDLogMessage : NSObject <NSCopying>
|
||||
{
|
||||
// Direct accessors to be used only for performance
|
||||
@public
|
||||
NSString *_message;
|
||||
DDLogLevel _level;
|
||||
DDLogFlag _flag;
|
||||
NSInteger _context;
|
||||
NSString *_file;
|
||||
NSString *_fileName;
|
||||
NSString *_function;
|
||||
NSUInteger _line;
|
||||
#if DD_LEGACY_MESSAGE_TAG
|
||||
id _tag __attribute__((deprecated("Use _representedObject instead", "_representedObject")));;
|
||||
#endif
|
||||
id _representedObject;
|
||||
DDLogMessageOptions _options;
|
||||
NSDate * _timestamp;
|
||||
NSString *_threadID;
|
||||
NSString *_threadName;
|
||||
NSString *_queueLabel;
|
||||
NSUInteger _qos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default `init` for empty messages.
|
||||
*/
|
||||
- (instancetype)init NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Standard init method for a log message object.
|
||||
* Used by the logging primitives. (And the macros use the logging primitives.)
|
||||
*
|
||||
* If you find need to manually create logMessage objects, there is one thing you should be aware of:
|
||||
*
|
||||
* If no flags are passed, the method expects the file and function parameters to be string literals.
|
||||
* That is, it expects the given strings to exist for the duration of the object's lifetime,
|
||||
* and it expects the given strings to be immutable.
|
||||
* In other words, it does not copy these strings, it simply points to them.
|
||||
* This is due to the fact that __FILE__ and __FUNCTION__ are usually used to specify these parameters,
|
||||
* so it makes sense to optimize and skip the unnecessary allocations.
|
||||
* However, if you need them to be copied you may use the options parameter to specify this.
|
||||
*
|
||||
* @param message the message
|
||||
* @param level the log level
|
||||
* @param flag the log flag
|
||||
* @param context the context (if any is defined)
|
||||
* @param file the current file
|
||||
* @param function the current function
|
||||
* @param line the current code line
|
||||
* @param tag potential tag
|
||||
* @param options a bitmask which supports DDLogMessageCopyFile and DDLogMessageCopyFunction.
|
||||
* @param timestamp the log timestamp
|
||||
*
|
||||
* @return a new instance of a log message model object
|
||||
*/
|
||||
- (instancetype)initWithMessage:(NSString *)message
|
||||
level:(DDLogLevel)level
|
||||
flag:(DDLogFlag)flag
|
||||
context:(NSInteger)context
|
||||
file:(NSString *)file
|
||||
function:(nullable NSString *)function
|
||||
line:(NSUInteger)line
|
||||
tag:(nullable id)tag
|
||||
options:(DDLogMessageOptions)options
|
||||
timestamp:(nullable NSDate *)timestamp NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
/**
|
||||
* Read-only properties
|
||||
**/
|
||||
|
||||
/**
|
||||
* The log message
|
||||
*/
|
||||
@property (readonly, nonatomic) NSString *message;
|
||||
@property (readonly, nonatomic) DDLogLevel level;
|
||||
@property (readonly, nonatomic) DDLogFlag flag;
|
||||
@property (readonly, nonatomic) NSInteger context;
|
||||
@property (readonly, nonatomic) NSString *file;
|
||||
@property (readonly, nonatomic) NSString *fileName;
|
||||
@property (readonly, nonatomic, nullable) NSString * function;
|
||||
@property (readonly, nonatomic) NSUInteger line;
|
||||
#if DD_LEGACY_MESSAGE_TAG
|
||||
@property (readonly, nonatomic, nullable) id tag __attribute__((deprecated("Use representedObject instead", "representedObject")));
|
||||
#endif
|
||||
@property (readonly, nonatomic, nullable) id representedObject;
|
||||
@property (readonly, nonatomic) DDLogMessageOptions options;
|
||||
@property (readonly, nonatomic) NSDate *timestamp;
|
||||
@property (readonly, nonatomic) NSString *threadID; // ID as it appears in NSLog calculated from the machThreadID
|
||||
@property (readonly, nonatomic, nullable) NSString *threadName;
|
||||
@property (readonly, nonatomic) NSString *queueLabel;
|
||||
@property (readonly, nonatomic) NSUInteger qos API_AVAILABLE(macos(10.10), ios(8.0));
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* The `DDLogger` protocol specifies that an optional formatter can be added to a logger.
|
||||
* Most (but not all) loggers will want to support formatters.
|
||||
*
|
||||
* However, writing getters and setters in a thread safe manner,
|
||||
* while still maintaining maximum speed for the logging process, is a difficult task.
|
||||
*
|
||||
* To do it right, the implementation of the getter/setter has strict requirements:
|
||||
* - Must NOT require the `logMessage:` method to acquire a lock.
|
||||
* - Must NOT require the `logMessage:` method to access an atomic property (also a lock of sorts).
|
||||
*
|
||||
* To simplify things, an abstract logger is provided that implements the getter and setter.
|
||||
*
|
||||
* Logger implementations may simply extend this class,
|
||||
* and they can ACCESS THE FORMATTER VARIABLE DIRECTLY from within their `logMessage:` method!
|
||||
**/
|
||||
@interface DDAbstractLogger : NSObject <DDLogger>
|
||||
{
|
||||
// Direct accessors to be used only for performance
|
||||
@public
|
||||
id <DDLogFormatter> _logFormatter;
|
||||
dispatch_queue_t _loggerQueue;
|
||||
}
|
||||
|
||||
@property (nonatomic, strong, nullable) id <DDLogFormatter> logFormatter;
|
||||
@property (nonatomic, DISPATCH_QUEUE_REFERENCE_TYPE) dispatch_queue_t loggerQueue;
|
||||
|
||||
// For thread-safety assertions
|
||||
|
||||
/**
|
||||
* Return YES if the current logger uses a global queue for logging
|
||||
*/
|
||||
@property (nonatomic, readonly, getter=isOnGlobalLoggingQueue) BOOL onGlobalLoggingQueue;
|
||||
|
||||
/**
|
||||
* Return YES if the current logger uses the internal designated queue for logging
|
||||
*/
|
||||
@property (nonatomic, readonly, getter=isOnInternalLoggerQueue) BOOL onInternalLoggerQueue;
|
||||
|
||||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@interface DDLoggerInformation : NSObject
|
||||
|
||||
@property (nonatomic, readonly) id <DDLogger> logger;
|
||||
@property (nonatomic, readonly) DDLogLevel level;
|
||||
|
||||
+ (instancetype)informationWithLogger:(id <DDLogger>)logger
|
||||
andLevel:(DDLogLevel)level;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,101 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
/**
|
||||
* The constant/variable/method responsible for controlling the current log level.
|
||||
**/
|
||||
#ifndef LOG_LEVEL_DEF
|
||||
#define LOG_LEVEL_DEF ddLogLevel
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Whether async should be used by log messages, excluding error messages that are always sent sync.
|
||||
**/
|
||||
#ifndef LOG_ASYNC_ENABLED
|
||||
#define LOG_ASYNC_ENABLED YES
|
||||
#endif
|
||||
|
||||
/**
|
||||
* These are the two macros that all other macros below compile into.
|
||||
* These big multiline macros makes all the other macros easier to read.
|
||||
**/
|
||||
#define LOG_MACRO(isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \
|
||||
[DDLog log : isAsynchronous \
|
||||
level : lvl \
|
||||
flag : flg \
|
||||
context : ctx \
|
||||
file : __FILE__ \
|
||||
function : fnct \
|
||||
line : __LINE__ \
|
||||
tag : atag \
|
||||
format : (frmt), ## __VA_ARGS__]
|
||||
|
||||
#define LOG_MACRO_TO_DDLOG(ddlog, isAsynchronous, lvl, flg, ctx, atag, fnct, frmt, ...) \
|
||||
[ddlog log : isAsynchronous \
|
||||
level : lvl \
|
||||
flag : flg \
|
||||
context : ctx \
|
||||
file : __FILE__ \
|
||||
function : fnct \
|
||||
line : __LINE__ \
|
||||
tag : atag \
|
||||
format : (frmt), ## __VA_ARGS__]
|
||||
|
||||
/**
|
||||
* Define version of the macro that only execute if the log level is above the threshold.
|
||||
* The compiled versions essentially look like this:
|
||||
*
|
||||
* if (logFlagForThisLogMsg & ddLogLevel) { execute log message }
|
||||
*
|
||||
* When LOG_LEVEL_DEF is defined as ddLogLevel.
|
||||
*
|
||||
* As shown further below, Lumberjack actually uses a bitmask as opposed to primitive log levels.
|
||||
* This allows for a great amount of flexibility and some pretty advanced fine grained logging techniques.
|
||||
*
|
||||
* Note that when compiler optimizations are enabled (as they are for your release builds),
|
||||
* the log messages above your logging threshold will automatically be compiled out.
|
||||
*
|
||||
* (If the compiler sees LOG_LEVEL_DEF/ddLogLevel declared as a constant, the compiler simply checks to see
|
||||
* if the 'if' statement would execute, and if not it strips it from the binary.)
|
||||
*
|
||||
* We also define shorthand versions for asynchronous and synchronous logging.
|
||||
**/
|
||||
#define LOG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, ...) \
|
||||
do { if((lvl & flg) != 0) LOG_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0)
|
||||
|
||||
#define LOG_MAYBE_TO_DDLOG(ddlog, async, lvl, flg, ctx, tag, fnct, frmt, ...) \
|
||||
do { if((lvl & flg) != 0) LOG_MACRO_TO_DDLOG(ddlog, async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0)
|
||||
|
||||
/**
|
||||
* Ready to use log macros with no context or tag.
|
||||
**/
|
||||
#define DDLogError(frmt, ...) LOG_MAYBE(NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
#define DDLogWarn(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
#define DDLogInfo(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
#define DDLogDebug(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
#define DDLogVerbose(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
|
||||
#define DDLogErrorToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
#define DDLogWarnToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
#define DDLogInfoToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
#define DDLogDebugToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
#define DDLogVerboseToDDLog(ddlog, frmt, ...) LOG_MAYBE_TO_DDLOG(ddlog, LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
|
||||
@ -1,30 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NSString *DDLoggerName NS_EXTENSIBLE_STRING_ENUM;
|
||||
|
||||
FOUNDATION_EXPORT DDLoggerName const DDLoggerNameOS NS_SWIFT_NAME(DDLoggerName.os); // DDOSLogger
|
||||
FOUNDATION_EXPORT DDLoggerName const DDLoggerNameFile NS_SWIFT_NAME(DDLoggerName.file); // DDFileLogger
|
||||
|
||||
FOUNDATION_EXPORT DDLoggerName const DDLoggerNameTTY NS_SWIFT_NAME(DDLoggerName.tty); // DDTTYLogger
|
||||
|
||||
API_DEPRECATED("Use DDOSLogger instead", macosx(10.4, 10.12), ios(2.0, 10.0), watchos(2.0, 3.0), tvos(9.0, 10.0))
|
||||
FOUNDATION_EXPORT DDLoggerName const DDLoggerNameASL NS_SWIFT_NAME(DDLoggerName.asl); // DDASLLogger
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,60 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This formatter can be used to chain different formatters together.
|
||||
* The log message will processed in the order of the formatters added.
|
||||
**/
|
||||
@interface DDMultiFormatter : NSObject <DDLogFormatter>
|
||||
|
||||
/**
|
||||
* Array of chained formatters
|
||||
*/
|
||||
@property (nonatomic, readonly) NSArray<id<DDLogFormatter>> *formatters;
|
||||
|
||||
/**
|
||||
* Add a new formatter
|
||||
*/
|
||||
- (void)addFormatter:(id<DDLogFormatter>)formatter NS_SWIFT_NAME(add(_:));
|
||||
|
||||
/**
|
||||
* Remove a formatter
|
||||
*/
|
||||
- (void)removeFormatter:(id<DDLogFormatter>)formatter NS_SWIFT_NAME(remove(_:));
|
||||
|
||||
/**
|
||||
* Remove all existing formatters
|
||||
*/
|
||||
- (void)removeAllFormatters NS_SWIFT_NAME(removeAll());
|
||||
|
||||
/**
|
||||
* Check if a certain formatter is used
|
||||
*/
|
||||
- (BOOL)isFormattingWithFormatter:(id<DDLogFormatter>)formatter;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,55 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides a logger for the Apple os_log facility.
|
||||
**/
|
||||
API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0))
|
||||
@interface DDOSLogger : DDAbstractLogger <DDLogger>
|
||||
|
||||
/**
|
||||
* Singleton method
|
||||
*
|
||||
* @return the shared instance with OS_LOG_DEFAULT.
|
||||
*/
|
||||
@property (nonatomic, class, readonly, strong) DDOSLogger *sharedInstance;
|
||||
|
||||
/**
|
||||
Designated initializer
|
||||
|
||||
@param subsystem Desired subsystem in log. E.g. "org.example"
|
||||
@param category Desired category in log. E.g. "Point of interests."
|
||||
@return New instance of DDOSLogger.
|
||||
|
||||
@discussion This method requires either both or no parameter to be set. Much like `(String, String)?` in Swift.
|
||||
If both parameters are nil, this method will return a logger configured with `OS_LOG_DEFAULT`.
|
||||
If both parameters are non-nil, it will return a logger configured with `os_log_create(subsystem, category)`
|
||||
*/
|
||||
- (instancetype)initWithSubsystem:(nullable NSString *)subsystem category:(nullable NSString *)category NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,186 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
// Disable legacy macros
|
||||
#ifndef DD_LEGACY_MACROS
|
||||
#define DD_LEGACY_MACROS 0
|
||||
#endif
|
||||
|
||||
#import <CocoaLumberjack/DDLog.h>
|
||||
|
||||
#define LOG_CONTEXT_ALL INT_MAX
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-function"
|
||||
#if !(TARGET_OS_OSX)
|
||||
// iOS or tvOS or watchOS
|
||||
#import <UIKit/UIColor.h>
|
||||
typedef UIColor DDColor;
|
||||
static inline DDColor* _Nonnull DDMakeColor(CGFloat r, CGFloat g, CGFloat b) {return [DDColor colorWithRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0f];}
|
||||
#elif defined(DD_CLI) || !__has_include(<AppKit/NSColor.h>)
|
||||
// OS X CLI
|
||||
#import <CocoaLumberjack/CLIColor.h>
|
||||
typedef CLIColor DDColor;
|
||||
static inline DDColor* _Nonnull DDMakeColor(CGFloat r, CGFloat g, CGFloat b) {return [DDColor colorWithCalibratedRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0f];}
|
||||
#else
|
||||
// OS X with AppKit
|
||||
#import <AppKit/NSColor.h>
|
||||
typedef NSColor DDColor;
|
||||
static inline DDColor * _Nonnull DDMakeColor(CGFloat r, CGFloat g, CGFloat b) {return [DDColor colorWithCalibratedRed:(r/255.0f) green:(g/255.0f) blue:(b/255.0f) alpha:1.0f];}
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
* This class provides a logger for Terminal output or Xcode console output,
|
||||
* depending on where you are running your code.
|
||||
*
|
||||
* As described in the "Getting Started" page,
|
||||
* the traditional NSLog() function directs it's output to two places:
|
||||
*
|
||||
* - Apple System Log (so it shows up in Console.app)
|
||||
* - StdErr (if stderr is a TTY, so log statements show up in Xcode console)
|
||||
*
|
||||
* To duplicate NSLog() functionality you can simply add this logger and an asl logger.
|
||||
* However, if you instead choose to use file logging (for faster performance),
|
||||
* you may choose to use only a file logger and a tty logger.
|
||||
**/
|
||||
@interface DDTTYLogger : DDAbstractLogger <DDLogger>
|
||||
|
||||
/**
|
||||
* Singleton instance. Returns `nil` if the initialization of the DDTTYLogger fails.
|
||||
*/
|
||||
@property (nonatomic, class, readonly, strong, nullable) DDTTYLogger *sharedInstance;
|
||||
|
||||
/* Inherited from the DDLogger protocol:
|
||||
*
|
||||
* Formatters may optionally be added to any logger.
|
||||
*
|
||||
* If no formatter is set, the logger simply logs the message as it is given in logMessage,
|
||||
* or it may use its own built in formatting style.
|
||||
*
|
||||
* More information about formatters can be found here:
|
||||
* Documentation/CustomFormatters.md
|
||||
*
|
||||
* The actual implementation of these methods is inherited from DDAbstractLogger.
|
||||
|
||||
- (id <DDLogFormatter>)logFormatter;
|
||||
- (void)setLogFormatter:(id <DDLogFormatter>)formatter;
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* Want to use different colors for different log levels?
|
||||
* Enable this property.
|
||||
*
|
||||
* If you run the application via the Terminal (not Xcode),
|
||||
* the logger will map colors to xterm-256color or xterm-color (if available).
|
||||
*
|
||||
* Xcode does NOT natively support colors in the Xcode debugging console.
|
||||
* You'll need to install the XcodeColors plugin to see colors in the Xcode console.
|
||||
* https://github.com/robbiehanson/XcodeColors
|
||||
*
|
||||
* The default value is NO.
|
||||
**/
|
||||
@property (readwrite, assign) BOOL colorsEnabled;
|
||||
|
||||
/**
|
||||
* When using a custom formatter you can set the `logMessage` method not to append
|
||||
* `\n` character after each output. This allows for some greater flexibility with
|
||||
* custom formatters. Default value is YES.
|
||||
**/
|
||||
@property (nonatomic, readwrite, assign) BOOL automaticallyAppendNewlineForCustomFormatters;
|
||||
|
||||
/**
|
||||
Using this initializer is not supported. Please use `DDTTYLogger.sharedInstance`.
|
||||
**/
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
/**
|
||||
* The default color set (foregroundColor, backgroundColor) is:
|
||||
*
|
||||
* - DDLogFlagError = (red, nil)
|
||||
* - DDLogFlagWarning = (orange, nil)
|
||||
*
|
||||
* You can customize the colors however you see fit.
|
||||
* Please note that you are passing a flag, NOT a level.
|
||||
*
|
||||
* GOOD : [ttyLogger setForegroundColor:pink backgroundColor:nil forFlag:DDLogFlagInfo]; // <- Good :)
|
||||
* BAD : [ttyLogger setForegroundColor:pink backgroundColor:nil forFlag:DDLogLevelInfo]; // <- BAD! :(
|
||||
*
|
||||
* DDLogFlagInfo = 0...00100
|
||||
* DDLogLevelInfo = 0...00111 <- Would match DDLogFlagInfo and DDLogFlagWarning and DDLogFlagError
|
||||
*
|
||||
* If you run the application within Xcode, then the XcodeColors plugin is required.
|
||||
*
|
||||
* If you run the application from a shell, then DDTTYLogger will automatically map the given color to
|
||||
* the closest available color. (xterm-256color or xterm-color which have 256 and 16 supported colors respectively.)
|
||||
*
|
||||
* This method invokes setForegroundColor:backgroundColor:forFlag:context: and applies it to `LOG_CONTEXT_ALL`.
|
||||
**/
|
||||
- (void)setForegroundColor:(nullable DDColor *)txtColor backgroundColor:(nullable DDColor *)bgColor forFlag:(DDLogFlag)mask;
|
||||
|
||||
/**
|
||||
* Just like setForegroundColor:backgroundColor:flag, but allows you to specify a particular logging context.
|
||||
*
|
||||
* A logging context is often used to identify log messages coming from a 3rd party framework,
|
||||
* although logging context's can be used for many different functions.
|
||||
*
|
||||
* Use LOG_CONTEXT_ALL to set the default color for all contexts that have no specific color set defined.
|
||||
*
|
||||
* Logging context's are explained in further detail here:
|
||||
* Documentation/CustomContext.md
|
||||
**/
|
||||
- (void)setForegroundColor:(nullable DDColor *)txtColor backgroundColor:(nullable DDColor *)bgColor forFlag:(DDLogFlag)mask context:(NSInteger)ctxt;
|
||||
|
||||
/**
|
||||
* Similar to the methods above, but allows you to map DDLogMessage->tag to a particular color profile.
|
||||
* For example, you could do something like this:
|
||||
*
|
||||
* static NSString *const PurpleTag = @"PurpleTag";
|
||||
*
|
||||
* #define DDLogPurple(frmt, ...) LOG_OBJC_TAG_MACRO(NO, 0, 0, 0, PurpleTag, frmt, ##__VA_ARGS__)
|
||||
*
|
||||
* And then where you configure CocoaLumberjack:
|
||||
*
|
||||
* purple = DDMakeColor((64/255.0), (0/255.0), (128/255.0));
|
||||
*
|
||||
* or any UIColor/NSColor constructor.
|
||||
*
|
||||
* Note: For CLI OS X projects that don't link with AppKit use CLIColor objects instead
|
||||
*
|
||||
* [[DDTTYLogger sharedInstance] setForegroundColor:purple backgroundColor:nil forTag:PurpleTag];
|
||||
* [DDLog addLogger:[DDTTYLogger sharedInstance]];
|
||||
*
|
||||
* This would essentially give you a straight NSLog replacement that prints in purple:
|
||||
*
|
||||
* DDLogPurple(@"I'm a purple log message!");
|
||||
**/
|
||||
- (void)setForegroundColor:(nullable DDColor *)txtColor backgroundColor:(nullable DDColor *)bgColor forTag:(id <NSCopying>)tag;
|
||||
|
||||
/**
|
||||
* Clearing color profiles.
|
||||
**/
|
||||
- (void)clearColorsForFlag:(DDLogFlag)mask;
|
||||
- (void)clearColorsForFlag:(DDLogFlag)mask context:(NSInteger)context;
|
||||
- (void)clearColorsForTag:(id <NSCopying>)tag;
|
||||
- (void)clearColorsForAllFlags;
|
||||
- (void)clearColorsForAllTags;
|
||||
- (void)clearAllColors;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Binary file not shown.
@ -1,6 +0,0 @@
|
||||
framework module CocoaLumberjack {
|
||||
umbrella header "CocoaLumberjack-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
@ -1,31 +0,0 @@
|
||||
// Software License Agreement (BSD License)
|
||||
//
|
||||
// Copyright (c) 2010-2021, Deusty, LLC
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use of this software in source and binary forms,
|
||||
// with or without modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// * Neither the name of Deusty nor the names of its contributors may be used
|
||||
// to endorse or promote products derived from this software without specific
|
||||
// prior written permission of Deusty, LLC.
|
||||
|
||||
#import <CocoaLumberjack/DDFileLogger.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface DDFileLogger (Internal)
|
||||
|
||||
- (void)logData:(NSData *)data;
|
||||
|
||||
// Will assert if used outside logger's queue.
|
||||
- (void)lt_logData:(NSData *)data;
|
||||
|
||||
- (nullable NSData *)lt_dataForMessage:(DDLogMessage *)message;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,16 +0,0 @@
|
||||
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AVAsset (NIMKit)
|
||||
|
||||
- (AVMutableVideoComposition *)nim_videoComposition;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,340 +0,0 @@
|
||||
|
||||
#if defined(__arm64__) && __arm64__ || (__x86_64__) && __x86_64__
|
||||
// Generated by Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
|
||||
#ifndef NECOMMONKIT_SWIFT_H
|
||||
#define NECOMMONKIT_SWIFT_H
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
#if !defined(__has_include)
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
#if !defined(__has_attribute)
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
#if !defined(__has_feature)
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
#if !defined(__has_warning)
|
||||
# define __has_warning(x) 0
|
||||
#endif
|
||||
|
||||
#if __has_include(<swift/objc-prologue.h>)
|
||||
# include <swift/objc-prologue.h>
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wduplicate-method-match"
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#if defined(__OBJC__)
|
||||
#include <Foundation/Foundation.h>
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <cstdbool>
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_TYPEDEFS)
|
||||
# define SWIFT_TYPEDEFS 1
|
||||
# if __has_include(<uchar.h>)
|
||||
# include <uchar.h>
|
||||
# elif !defined(__cplusplus)
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
# endif
|
||||
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PASTE)
|
||||
# define SWIFT_PASTE_HELPER(x, y) x##y
|
||||
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
|
||||
#endif
|
||||
#if !defined(SWIFT_METATYPE)
|
||||
# define SWIFT_METATYPE(X) Class
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_PROPERTY)
|
||||
# if __has_feature(objc_class_property)
|
||||
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
|
||||
# else
|
||||
# define SWIFT_CLASS_PROPERTY(...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if __has_attribute(objc_runtime_name)
|
||||
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
|
||||
#else
|
||||
# define SWIFT_RUNTIME_NAME(X)
|
||||
#endif
|
||||
#if __has_attribute(swift_name)
|
||||
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
|
||||
#else
|
||||
# define SWIFT_COMPILE_NAME(X)
|
||||
#endif
|
||||
#if __has_attribute(objc_method_family)
|
||||
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
|
||||
#else
|
||||
# define SWIFT_METHOD_FAMILY(X)
|
||||
#endif
|
||||
#if __has_attribute(noescape)
|
||||
# define SWIFT_NOESCAPE __attribute__((noescape))
|
||||
#else
|
||||
# define SWIFT_NOESCAPE
|
||||
#endif
|
||||
#if __has_attribute(ns_consumed)
|
||||
# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
|
||||
#else
|
||||
# define SWIFT_RELEASES_ARGUMENT
|
||||
#endif
|
||||
#if __has_attribute(warn_unused_result)
|
||||
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
#else
|
||||
# define SWIFT_WARN_UNUSED_RESULT
|
||||
#endif
|
||||
#if __has_attribute(noreturn)
|
||||
# define SWIFT_NORETURN __attribute__((noreturn))
|
||||
#else
|
||||
# define SWIFT_NORETURN
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_EXTRA)
|
||||
# define SWIFT_CLASS_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_PROTOCOL_EXTRA)
|
||||
# define SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_EXTRA)
|
||||
# define SWIFT_ENUM_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS)
|
||||
# if __has_attribute(objc_subclassing_restricted)
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# else
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_RESILIENT_CLASS)
|
||||
# if __has_attribute(objc_class_stub)
|
||||
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
|
||||
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
|
||||
# else
|
||||
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
|
||||
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PROTOCOL)
|
||||
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_EXTENSION)
|
||||
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
|
||||
#endif
|
||||
|
||||
#if !defined(OBJC_DESIGNATED_INITIALIZER)
|
||||
# if __has_attribute(objc_designated_initializer)
|
||||
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
|
||||
# else
|
||||
# define OBJC_DESIGNATED_INITIALIZER
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_ATTR)
|
||||
# if defined(__has_attribute) && __has_attribute(enum_extensibility)
|
||||
# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
|
||||
# else
|
||||
# define SWIFT_ENUM_ATTR(_extensibility)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM)
|
||||
# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
|
||||
# if __has_feature(generalized_swift_name)
|
||||
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
|
||||
# else
|
||||
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_UNAVAILABLE)
|
||||
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
|
||||
#endif
|
||||
#if !defined(SWIFT_UNAVAILABLE_MSG)
|
||||
# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
|
||||
#endif
|
||||
#if !defined(SWIFT_AVAILABILITY)
|
||||
# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
|
||||
#endif
|
||||
#if !defined(SWIFT_WEAK_IMPORT)
|
||||
# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED)
|
||||
# define SWIFT_DEPRECATED __attribute__((deprecated))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED_MSG)
|
||||
# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
|
||||
#endif
|
||||
#if __has_feature(attribute_diagnose_if_objc)
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
|
||||
#else
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
#endif
|
||||
#if defined(__OBJC__)
|
||||
#if !defined(IBSegueAction)
|
||||
# define IBSegueAction
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(SWIFT_EXTERN)
|
||||
# if defined(__cplusplus)
|
||||
# define SWIFT_EXTERN extern "C"
|
||||
# else
|
||||
# define SWIFT_EXTERN extern
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_CALL)
|
||||
# define SWIFT_CALL __attribute__((swiftcall))
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#if !defined(SWIFT_NOEXCEPT)
|
||||
# define SWIFT_NOEXCEPT noexcept
|
||||
#endif
|
||||
#else
|
||||
#if !defined(SWIFT_NOEXCEPT)
|
||||
# define SWIFT_NOEXCEPT
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#if !defined(SWIFT_CXX_INT_DEFINED)
|
||||
#define SWIFT_CXX_INT_DEFINED
|
||||
namespace swift {
|
||||
using Int = ptrdiff_t;
|
||||
using UInt = size_t;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__OBJC__)
|
||||
#if __has_feature(modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import CoreFoundation;
|
||||
@import Foundation;
|
||||
@import ObjectiveC;
|
||||
@import UIKit;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
|
||||
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
|
||||
#if __has_warning("-Wpragma-clang-attribute")
|
||||
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wnullability"
|
||||
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma push_macro("any")
|
||||
# undef any
|
||||
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="NECommonKit",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
|
||||
# pragma pop_macro("any")
|
||||
#endif
|
||||
|
||||
#if defined(__OBJC__)
|
||||
|
||||
SWIFT_CLASS("_TtC11NECommonKit10CommonTool")
|
||||
@interface CommonTool : NSObject
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
|
||||
SWIFT_CLASS("_TtC11NECommonKit13NEAuthManager")
|
||||
@interface NEAuthManager : NSObject
|
||||
/// 查询麦克风权限
|
||||
+ (BOOL)hasAudioAuthoriztion SWIFT_WARN_UNUSED_RESULT;
|
||||
/// 请求麦克风权限
|
||||
/// @param completion 结果
|
||||
+ (void)requestAudioAuthorization:(void (^ _Nullable)(BOOL))completion;
|
||||
/// 查询相机授权
|
||||
+ (BOOL)hasCameraAuthorization SWIFT_WARN_UNUSED_RESULT;
|
||||
/// 请求相机权限
|
||||
/// @param completion 结果
|
||||
+ (void)requestCameraAuthorization:(void (^ _Nullable)(BOOL))completion;
|
||||
/// 查询相册授权
|
||||
+ (BOOL)hasPhotoAuthorization SWIFT_WARN_UNUSED_RESULT;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
@class NSString;
|
||||
|
||||
SWIFT_CLASS("_TtC11NECommonKit12NECommonUtil")
|
||||
@interface NECommonUtil : NSObject
|
||||
+ (NSString * _Nonnull)getJSONStringFromDictionary:(NSDictionary<NSString *, id> * _Nonnull)dictionary SWIFT_WARN_UNUSED_RESULT;
|
||||
+ (NSDictionary * _Nullable)getDictionaryFromJSONString:(NSString * _Nonnull)jsonString SWIFT_WARN_UNUSED_RESULT;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
@class UIFont;
|
||||
@class UIColor;
|
||||
|
||||
SWIFT_CLASS("_TtC11NECommonKit10NEConstant")
|
||||
@interface NEConstant : NSObject
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) CGFloat screenWidth;)
|
||||
+ (CGFloat)screenWidth SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) CGFloat screenHeight;)
|
||||
+ (CGFloat)screenHeight SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) CGFloat sreenWidthScale;)
|
||||
+ (CGFloat)sreenWidthScale SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) CGFloat sreenHeightScale;)
|
||||
+ (CGFloat)sreenHeightScale SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) double navigationHeight;)
|
||||
+ (double)navigationHeight SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) CGFloat statusBarHeight;)
|
||||
+ (CGFloat)statusBarHeight SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) double navigationAndStatusHeight;)
|
||||
+ (double)navigationAndStatusHeight SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) CGFloat screenInterval;)
|
||||
+ (CGFloat)screenInterval SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) UIFont * _Nonnull (^ _Nonnull textFont)(NSString * _Nonnull, float);)
|
||||
+ (UIFont * _Nonnull (^ _Nonnull)(NSString * _Nonnull, float))textFont SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) UIFont * _Nonnull (^ _Nonnull defaultTextFont)(float);)
|
||||
+ (UIFont * _Nonnull (^ _Nonnull)(float))defaultTextFont SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) UIColor * _Nonnull (^ _Nonnull hexRGB)(NSInteger);)
|
||||
+ (UIColor * _Nonnull (^ _Nonnull)(NSInteger))hexRGB SWIFT_WARN_UNUSED_RESULT;
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) UIColor * _Nonnull (^ _Nonnull hexRGBAlpha)(NSInteger, float);)
|
||||
+ (UIColor * _Nonnull (^ _Nonnull)(NSInteger, float))hexRGBAlpha SWIFT_WARN_UNUSED_RESULT;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
|
||||
@interface UIColor (SWIFT_EXTENSION(NECommonKit))
|
||||
+ (UIColor * _Nonnull)colorWithStringWithString:(NSString * _Nullable)string SWIFT_WARN_UNUSED_RESULT;
|
||||
@end
|
||||
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#endif
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma clang attribute pop
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error unsupported Swift architecture
|
||||
#endif
|
||||
@ -1,22 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import "YXNetworkReachabilityManager.h"
|
||||
#import "AVAsset+NIMKit.h"
|
||||
#import "NIMInputAtCache.h"
|
||||
#import "NIMKitFileLocationHelper.h"
|
||||
#import "NSString+NIMKit.h"
|
||||
#import "VideoFormatConvert.h"
|
||||
|
||||
FOUNDATION_EXPORT double NECommonKitVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char NECommonKitVersionString[];
|
||||
|
||||
@ -1,33 +0,0 @@
|
||||
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#define NIMInputAtStartChar @"@"
|
||||
#define NIMInputAtEndChar @"\u2004"
|
||||
|
||||
@interface NIMInputAtItem : NSObject
|
||||
|
||||
@property(nonatomic, copy) NSString *name;
|
||||
|
||||
@property(nonatomic, copy) NSString *uid;
|
||||
|
||||
@property(nonatomic, assign) NSRange range;
|
||||
|
||||
@end
|
||||
|
||||
@interface NIMInputAtCache : NSObject
|
||||
|
||||
- (NSArray *)allAtUid:(NSString *)sendText;
|
||||
|
||||
- (void)clean;
|
||||
|
||||
- (void)addAtItem:(NIMInputAtItem *)item;
|
||||
|
||||
- (NIMInputAtItem *)item:(NSString *)name;
|
||||
|
||||
- (NIMInputAtItem *)removeName:(NSString *)name;
|
||||
|
||||
@end
|
||||
@ -1,26 +0,0 @@
|
||||
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface NIMKitFileLocationHelper : NSObject
|
||||
|
||||
+ (void)setStaticAppkey:(NSString *)appkey;
|
||||
|
||||
+ (void)setStaticUserId:(NSString *)userid;
|
||||
|
||||
+ (NSString *)getAppDocumentPath;
|
||||
|
||||
+ (NSString *)getAppTempPath;
|
||||
|
||||
+ (NSString *)userDirectory;
|
||||
|
||||
+ (NSString *)genFilenameWithExt:(NSString *)ext;
|
||||
|
||||
+ (NSString *)filepathForVideo:(NSString *)filename;
|
||||
|
||||
+ (NSString *)filepathForImage:(NSString *)filename;
|
||||
|
||||
@end
|
||||
@ -1,12 +0,0 @@
|
||||
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface NSString (NIMKit)
|
||||
|
||||
- (BOOL)nim_containsEmoji;
|
||||
|
||||
@end
|
||||
@ -1,20 +0,0 @@
|
||||
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef void (^NIMKitCameraFetchResult)(NSString *path, UIImage *image);
|
||||
|
||||
@interface VideoFormatConvert : NSObject
|
||||
|
||||
/// convertToMP4
|
||||
/// @param inputURL inputurl
|
||||
/// @param quality av quality default is AVAssetExportPresetHighestQuality
|
||||
/// @param completion call back
|
||||
+ (void)convertToMP4WithURL:(NSURL *)inputURL
|
||||
avQuality:(NSString *)quality
|
||||
withCompletion:(_Nonnull NIMKitCameraFetchResult)completion;
|
||||
|
||||
@end
|
||||
@ -1,63 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#if !TARGET_OS_WATCH
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
|
||||
typedef NS_ENUM(NSInteger, YXNetworkReachabilityStatus) {
|
||||
YXNetworkReachabilityStatusUnknown = -1,
|
||||
YXNetworkReachabilityStatusNotReachable = 0,
|
||||
YXNetworkReachabilityStatusReachableViaWWAN = 1,
|
||||
YXNetworkReachabilityStatusReachableViaWiFi = 2,
|
||||
};
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface YXNetworkReachabilityManager : NSObject
|
||||
|
||||
@property(readonly, nonatomic, assign) YXNetworkReachabilityStatus networkReachabilityStatus;
|
||||
|
||||
@property(readonly, nonatomic, assign, getter=isReachable) BOOL reachable;
|
||||
|
||||
@property(readonly, nonatomic, assign, getter=isReachableViaWWAN) BOOL reachableViaWWAN;
|
||||
|
||||
@property(readonly, nonatomic, assign, getter=isReachableViaWiFi) BOOL reachableViaWiFi;
|
||||
|
||||
+ (instancetype)sharedManager;
|
||||
|
||||
+ (instancetype)manager;
|
||||
|
||||
+ (instancetype)managerForDomain:(NSString *)domain;
|
||||
|
||||
+ (instancetype)managerForAddress:(const void *)address;
|
||||
|
||||
- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
+ (instancetype)new NS_UNAVAILABLE;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
- (void)startMonitoring;
|
||||
|
||||
- (void)stopMonitoring;
|
||||
|
||||
- (NSString *)localizedNetworkReachabilityStatusString;
|
||||
|
||||
- (void)setReachabilityStatusChangeBlock:
|
||||
(nullable void (^)(YXNetworkReachabilityStatus status))block;
|
||||
|
||||
@end
|
||||
|
||||
FOUNDATION_EXPORT NSString *const YXNetworkingReachabilityDidChangeNotification;
|
||||
FOUNDATION_EXPORT NSString *const YXNetworkingReachabilityNotificationStatusItem;
|
||||
|
||||
FOUNDATION_EXPORT NSString *YXStringFromNetworkReachabilityStatus(
|
||||
YXNetworkReachabilityStatus status);
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
#endif
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,187 +0,0 @@
|
||||
// swift-interface-format-version: 1.0
|
||||
// swift-compiler-version: Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
|
||||
// swift-module-flags: -target arm64-apple-ios10.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name NECommonKit
|
||||
// swift-module-flags-ignorable: -enable-bare-slash-regex
|
||||
import AVFoundation
|
||||
import Foundation
|
||||
@_exported import NECommonKit
|
||||
import Photos
|
||||
import Swift
|
||||
import SystemConfiguration
|
||||
import UIKit
|
||||
import _Concurrency
|
||||
import _StringProcessing
|
||||
extension Swift.Array {
|
||||
public func chunk(_ chunkSize: Swift.Int) -> [[Element]]
|
||||
}
|
||||
@propertyWrapper public struct Atomic<Value> {
|
||||
public init(wrappedValue value: Value)
|
||||
public var wrappedValue: Value {
|
||||
get
|
||||
set
|
||||
}
|
||||
}
|
||||
public class CommonLoader<T> where T : AnyObject {
|
||||
public init()
|
||||
public func localizable(_ key: Swift.String) -> Swift.String
|
||||
public func loadImage(_ name: Swift.String) -> UIKit.UIImage?
|
||||
public func loadString(source: Swift.String?, type: Swift.String?) -> Swift.String?
|
||||
@objc deinit
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers public class CommonTool : ObjectiveC.NSObject {
|
||||
public static func getCurrentLanguage() -> Swift.String
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
public typealias NEAuthCompletion = (_ granted: Swift.Bool) -> Swift.Void
|
||||
@_inheritsConvenienceInitializers @objc public class NEAuthManager : ObjectiveC.NSObject {
|
||||
@objc public class func hasAudioAuthoriztion() -> Swift.Bool
|
||||
@objc public class func requestAudioAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc public class func hasCameraAuthorization() -> Swift.Bool
|
||||
@objc public class func requestCameraAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc public class func hasPhotoAuthorization() -> Swift.Bool
|
||||
public class func requestPhotoAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
public enum ReachabilityStatus {
|
||||
case notReachable
|
||||
case unknown
|
||||
case ethernetOrWiFi
|
||||
case wwan
|
||||
public static func == (a: NECommonKit.ReachabilityStatus, b: NECommonKit.ReachabilityStatus) -> Swift.Bool
|
||||
public func hash(into hasher: inout Swift.Hasher)
|
||||
public var hashValue: Swift.Int {
|
||||
get
|
||||
}
|
||||
}
|
||||
@_hasMissingDesignatedInitializers public class NEChatDetectNetworkTool {
|
||||
public static let shareInstance: NECommonKit.NEChatDetectNetworkTool
|
||||
final public let manager: NECommonKit.NENetworkReachabilityManager?
|
||||
public func isNetworkRecahability() -> Swift.Bool
|
||||
public func netWorkReachability(reachabilityStatus: @escaping (NECommonKit.ReachabilityStatus) -> Swift.Void)
|
||||
@objc deinit
|
||||
}
|
||||
extension UIKit.UIColor {
|
||||
public static let ne_darkText: UIKit.UIColor
|
||||
public static let ne_greyText: UIKit.UIColor
|
||||
public static let ne_lightText: UIKit.UIColor
|
||||
public static let ne_blueText: UIKit.UIColor
|
||||
public static let ne_redText: UIKit.UIColor
|
||||
public static let ne_disableRedText: UIKit.UIColor
|
||||
public static let ne_backcolor: UIKit.UIColor
|
||||
public static let ne_emptyTitleColor: UIKit.UIColor
|
||||
public static let ne_greenText: UIKit.UIColor
|
||||
public static let ne_lightBackgroundColor: UIKit.UIColor
|
||||
public static let ne_defautAvatarColor: UIKit.UIColor
|
||||
public static let ne_greenColor: UIKit.UIColor
|
||||
public static let ne_yellowBackgroundColor: UIKit.UIColor
|
||||
public static let ne_borderColor: UIKit.UIColor
|
||||
public static let ne_operationBorderColor: UIKit.UIColor
|
||||
public static let ne_greyLine: UIKit.UIColor
|
||||
public static let ne_redColor: UIKit.UIColor
|
||||
public static let ne_backgroundColor: UIKit.UIColor
|
||||
public static let ne_navLineColor: UIKit.UIColor
|
||||
public static let ne_outlineColor: UIKit.UIColor
|
||||
convenience public init(hexString: Swift.String, _ alpha: CoreFoundation.CGFloat = 1.0)
|
||||
public var hexString: Swift.String? {
|
||||
get
|
||||
}
|
||||
public class func colorWithNumber(number: Swift.UInt64?) -> UIKit.UIColor
|
||||
@objc dynamic public class func colorWithString(string: Swift.String?) -> UIKit.UIColor
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers @objcMembers public class NECommonUtil : ObjectiveC.NSObject {
|
||||
@objc public class func getJSONStringFromDictionary(_ dictionary: [Swift.String : Any]) -> Swift.String
|
||||
@objc public class func getDictionaryFromJSONString(_ jsonString: Swift.String) -> Foundation.NSDictionary?
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers @objcMembers public class NEConstant : ObjectiveC.NSObject {
|
||||
@objc public static let screenWidth: CoreFoundation.CGFloat
|
||||
@objc public static let screenHeight: CoreFoundation.CGFloat
|
||||
@objc public static let sreenWidthScale: CoreFoundation.CGFloat
|
||||
@objc public static let sreenHeightScale: CoreFoundation.CGFloat
|
||||
@objc public static let navigationHeight: Swift.Double
|
||||
@objc public static let statusBarHeight: CoreFoundation.CGFloat
|
||||
@objc public static let navigationAndStatusHeight: Swift.Double
|
||||
@objc public static let screenInterval: CoreFoundation.CGFloat
|
||||
@objc public static let textFont: (_ fontName: Swift.String, _ fontSize: Swift.Float) -> UIKit.UIFont
|
||||
@objc public static let defaultTextFont: (_ fontSize: Swift.Float) -> UIKit.UIFont
|
||||
@objc public static let hexRGB: (_ rgbValue: Swift.Int) -> UIKit.UIColor
|
||||
@objc public static let hexRGBAlpha: (_ rgbValue: Swift.Int, _ alpha: Swift.Float) -> UIKit.UIColor
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
extension Foundation.Date {
|
||||
public static func utcFormattedDate(_ from: Foundation.Date, withDate: Swift.Bool) -> Swift.String
|
||||
public static func getFormatPlayTime(_ secounds: Foundation.TimeInterval) -> Swift.String
|
||||
public static func getTimeString(_ time: Foundation.TimeInterval) -> Swift.String
|
||||
public func isToday() -> Swift.Bool
|
||||
public func isThisYear() -> Swift.Bool
|
||||
}
|
||||
@_hasMissingDesignatedInitializers open class NENetworkReachabilityManager {
|
||||
public enum NetworkReachabilityStatus {
|
||||
case unknown
|
||||
case notReachable
|
||||
case reachable(NECommonKit.NENetworkReachabilityManager.ConnectionType)
|
||||
}
|
||||
public enum ConnectionType {
|
||||
case ethernetOrWiFi
|
||||
case wwan
|
||||
public static func == (a: NECommonKit.NENetworkReachabilityManager.ConnectionType, b: NECommonKit.NENetworkReachabilityManager.ConnectionType) -> Swift.Bool
|
||||
public func hash(into hasher: inout Swift.Hasher)
|
||||
public var hashValue: Swift.Int {
|
||||
get
|
||||
}
|
||||
}
|
||||
public typealias Listener = (NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus) -> Swift.Void
|
||||
open var isReachable: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var isReachableOnWWAN: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var isReachableOnEthernetOrWiFi: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var networkReachabilityStatus: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus {
|
||||
get
|
||||
}
|
||||
open var listenerQueue: Dispatch.DispatchQueue
|
||||
open var listener: NECommonKit.NENetworkReachabilityManager.Listener?
|
||||
open var flags: SystemConfiguration.SCNetworkReachabilityFlags? {
|
||||
get
|
||||
}
|
||||
open var previousFlags: SystemConfiguration.SCNetworkReachabilityFlags
|
||||
convenience public init?(host: Swift.String)
|
||||
convenience public init?()
|
||||
@objc deinit
|
||||
@discardableResult
|
||||
open func startListening() -> Swift.Bool
|
||||
open func stopListening()
|
||||
}
|
||||
extension NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus : Swift.Equatable {
|
||||
}
|
||||
public func == (lhs: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus, rhs: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus) -> Swift.Bool
|
||||
extension ObjectiveC.NSObject {
|
||||
public class func className() -> Swift.String
|
||||
public func className() -> Swift.String
|
||||
}
|
||||
extension Swift.String {
|
||||
public func finalSize(_ font: UIKit.UIFont, _ size: CoreFoundation.CGSize, _ numberOfLines: Swift.Int = 0) -> CoreFoundation.CGSize
|
||||
}
|
||||
extension Foundation.NSAttributedString {
|
||||
public func finalSize(_ font: UIKit.UIFont, _ size: CoreFoundation.CGSize, _ numberOfLines: Swift.Int = 0) -> CoreFoundation.CGSize
|
||||
}
|
||||
extension Swift.String {
|
||||
@available(*, deprecated, message: "This method is deprecated")
|
||||
public func findAllIndex(_ string: Swift.String) -> [Foundation.NSRange]
|
||||
public static func stringFromDate(date: Foundation.Date) -> Swift.String
|
||||
public static func firstDayInYear() -> Foundation.Date?
|
||||
public static func stringFromDictionary(dictionary: [Swift.String : Any]) -> Swift.String?
|
||||
public static func dictionaryFromString(string: Swift.String) -> [Swift.String : Any]?
|
||||
}
|
||||
extension NECommonKit.ReachabilityStatus : Swift.Equatable {}
|
||||
extension NECommonKit.ReachabilityStatus : Swift.Hashable {}
|
||||
extension NECommonKit.NENetworkReachabilityManager.ConnectionType : Swift.Equatable {}
|
||||
extension NECommonKit.NENetworkReachabilityManager.ConnectionType : Swift.Hashable {}
|
||||
Binary file not shown.
@ -1,187 +0,0 @@
|
||||
// swift-interface-format-version: 1.0
|
||||
// swift-compiler-version: Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
|
||||
// swift-module-flags: -target arm64-apple-ios10.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name NECommonKit
|
||||
// swift-module-flags-ignorable: -enable-bare-slash-regex
|
||||
import AVFoundation
|
||||
import Foundation
|
||||
@_exported import NECommonKit
|
||||
import Photos
|
||||
import Swift
|
||||
import SystemConfiguration
|
||||
import UIKit
|
||||
import _Concurrency
|
||||
import _StringProcessing
|
||||
extension Swift.Array {
|
||||
public func chunk(_ chunkSize: Swift.Int) -> [[Element]]
|
||||
}
|
||||
@propertyWrapper public struct Atomic<Value> {
|
||||
public init(wrappedValue value: Value)
|
||||
public var wrappedValue: Value {
|
||||
get
|
||||
set
|
||||
}
|
||||
}
|
||||
public class CommonLoader<T> where T : AnyObject {
|
||||
public init()
|
||||
public func localizable(_ key: Swift.String) -> Swift.String
|
||||
public func loadImage(_ name: Swift.String) -> UIKit.UIImage?
|
||||
public func loadString(source: Swift.String?, type: Swift.String?) -> Swift.String?
|
||||
@objc deinit
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers public class CommonTool : ObjectiveC.NSObject {
|
||||
public static func getCurrentLanguage() -> Swift.String
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
public typealias NEAuthCompletion = (_ granted: Swift.Bool) -> Swift.Void
|
||||
@_inheritsConvenienceInitializers @objc public class NEAuthManager : ObjectiveC.NSObject {
|
||||
@objc public class func hasAudioAuthoriztion() -> Swift.Bool
|
||||
@objc public class func requestAudioAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc public class func hasCameraAuthorization() -> Swift.Bool
|
||||
@objc public class func requestCameraAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc public class func hasPhotoAuthorization() -> Swift.Bool
|
||||
public class func requestPhotoAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
public enum ReachabilityStatus {
|
||||
case notReachable
|
||||
case unknown
|
||||
case ethernetOrWiFi
|
||||
case wwan
|
||||
public static func == (a: NECommonKit.ReachabilityStatus, b: NECommonKit.ReachabilityStatus) -> Swift.Bool
|
||||
public func hash(into hasher: inout Swift.Hasher)
|
||||
public var hashValue: Swift.Int {
|
||||
get
|
||||
}
|
||||
}
|
||||
@_hasMissingDesignatedInitializers public class NEChatDetectNetworkTool {
|
||||
public static let shareInstance: NECommonKit.NEChatDetectNetworkTool
|
||||
final public let manager: NECommonKit.NENetworkReachabilityManager?
|
||||
public func isNetworkRecahability() -> Swift.Bool
|
||||
public func netWorkReachability(reachabilityStatus: @escaping (NECommonKit.ReachabilityStatus) -> Swift.Void)
|
||||
@objc deinit
|
||||
}
|
||||
extension UIKit.UIColor {
|
||||
public static let ne_darkText: UIKit.UIColor
|
||||
public static let ne_greyText: UIKit.UIColor
|
||||
public static let ne_lightText: UIKit.UIColor
|
||||
public static let ne_blueText: UIKit.UIColor
|
||||
public static let ne_redText: UIKit.UIColor
|
||||
public static let ne_disableRedText: UIKit.UIColor
|
||||
public static let ne_backcolor: UIKit.UIColor
|
||||
public static let ne_emptyTitleColor: UIKit.UIColor
|
||||
public static let ne_greenText: UIKit.UIColor
|
||||
public static let ne_lightBackgroundColor: UIKit.UIColor
|
||||
public static let ne_defautAvatarColor: UIKit.UIColor
|
||||
public static let ne_greenColor: UIKit.UIColor
|
||||
public static let ne_yellowBackgroundColor: UIKit.UIColor
|
||||
public static let ne_borderColor: UIKit.UIColor
|
||||
public static let ne_operationBorderColor: UIKit.UIColor
|
||||
public static let ne_greyLine: UIKit.UIColor
|
||||
public static let ne_redColor: UIKit.UIColor
|
||||
public static let ne_backgroundColor: UIKit.UIColor
|
||||
public static let ne_navLineColor: UIKit.UIColor
|
||||
public static let ne_outlineColor: UIKit.UIColor
|
||||
convenience public init(hexString: Swift.String, _ alpha: CoreFoundation.CGFloat = 1.0)
|
||||
public var hexString: Swift.String? {
|
||||
get
|
||||
}
|
||||
public class func colorWithNumber(number: Swift.UInt64?) -> UIKit.UIColor
|
||||
@objc dynamic public class func colorWithString(string: Swift.String?) -> UIKit.UIColor
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers @objcMembers public class NECommonUtil : ObjectiveC.NSObject {
|
||||
@objc public class func getJSONStringFromDictionary(_ dictionary: [Swift.String : Any]) -> Swift.String
|
||||
@objc public class func getDictionaryFromJSONString(_ jsonString: Swift.String) -> Foundation.NSDictionary?
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers @objcMembers public class NEConstant : ObjectiveC.NSObject {
|
||||
@objc public static let screenWidth: CoreFoundation.CGFloat
|
||||
@objc public static let screenHeight: CoreFoundation.CGFloat
|
||||
@objc public static let sreenWidthScale: CoreFoundation.CGFloat
|
||||
@objc public static let sreenHeightScale: CoreFoundation.CGFloat
|
||||
@objc public static let navigationHeight: Swift.Double
|
||||
@objc public static let statusBarHeight: CoreFoundation.CGFloat
|
||||
@objc public static let navigationAndStatusHeight: Swift.Double
|
||||
@objc public static let screenInterval: CoreFoundation.CGFloat
|
||||
@objc public static let textFont: (_ fontName: Swift.String, _ fontSize: Swift.Float) -> UIKit.UIFont
|
||||
@objc public static let defaultTextFont: (_ fontSize: Swift.Float) -> UIKit.UIFont
|
||||
@objc public static let hexRGB: (_ rgbValue: Swift.Int) -> UIKit.UIColor
|
||||
@objc public static let hexRGBAlpha: (_ rgbValue: Swift.Int, _ alpha: Swift.Float) -> UIKit.UIColor
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
extension Foundation.Date {
|
||||
public static func utcFormattedDate(_ from: Foundation.Date, withDate: Swift.Bool) -> Swift.String
|
||||
public static func getFormatPlayTime(_ secounds: Foundation.TimeInterval) -> Swift.String
|
||||
public static func getTimeString(_ time: Foundation.TimeInterval) -> Swift.String
|
||||
public func isToday() -> Swift.Bool
|
||||
public func isThisYear() -> Swift.Bool
|
||||
}
|
||||
@_hasMissingDesignatedInitializers open class NENetworkReachabilityManager {
|
||||
public enum NetworkReachabilityStatus {
|
||||
case unknown
|
||||
case notReachable
|
||||
case reachable(NECommonKit.NENetworkReachabilityManager.ConnectionType)
|
||||
}
|
||||
public enum ConnectionType {
|
||||
case ethernetOrWiFi
|
||||
case wwan
|
||||
public static func == (a: NECommonKit.NENetworkReachabilityManager.ConnectionType, b: NECommonKit.NENetworkReachabilityManager.ConnectionType) -> Swift.Bool
|
||||
public func hash(into hasher: inout Swift.Hasher)
|
||||
public var hashValue: Swift.Int {
|
||||
get
|
||||
}
|
||||
}
|
||||
public typealias Listener = (NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus) -> Swift.Void
|
||||
open var isReachable: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var isReachableOnWWAN: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var isReachableOnEthernetOrWiFi: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var networkReachabilityStatus: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus {
|
||||
get
|
||||
}
|
||||
open var listenerQueue: Dispatch.DispatchQueue
|
||||
open var listener: NECommonKit.NENetworkReachabilityManager.Listener?
|
||||
open var flags: SystemConfiguration.SCNetworkReachabilityFlags? {
|
||||
get
|
||||
}
|
||||
open var previousFlags: SystemConfiguration.SCNetworkReachabilityFlags
|
||||
convenience public init?(host: Swift.String)
|
||||
convenience public init?()
|
||||
@objc deinit
|
||||
@discardableResult
|
||||
open func startListening() -> Swift.Bool
|
||||
open func stopListening()
|
||||
}
|
||||
extension NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus : Swift.Equatable {
|
||||
}
|
||||
public func == (lhs: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus, rhs: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus) -> Swift.Bool
|
||||
extension ObjectiveC.NSObject {
|
||||
public class func className() -> Swift.String
|
||||
public func className() -> Swift.String
|
||||
}
|
||||
extension Swift.String {
|
||||
public func finalSize(_ font: UIKit.UIFont, _ size: CoreFoundation.CGSize, _ numberOfLines: Swift.Int = 0) -> CoreFoundation.CGSize
|
||||
}
|
||||
extension Foundation.NSAttributedString {
|
||||
public func finalSize(_ font: UIKit.UIFont, _ size: CoreFoundation.CGSize, _ numberOfLines: Swift.Int = 0) -> CoreFoundation.CGSize
|
||||
}
|
||||
extension Swift.String {
|
||||
@available(*, deprecated, message: "This method is deprecated")
|
||||
public func findAllIndex(_ string: Swift.String) -> [Foundation.NSRange]
|
||||
public static func stringFromDate(date: Foundation.Date) -> Swift.String
|
||||
public static func firstDayInYear() -> Foundation.Date?
|
||||
public static func stringFromDictionary(dictionary: [Swift.String : Any]) -> Swift.String?
|
||||
public static func dictionaryFromString(string: Swift.String) -> [Swift.String : Any]?
|
||||
}
|
||||
extension NECommonKit.ReachabilityStatus : Swift.Equatable {}
|
||||
extension NECommonKit.ReachabilityStatus : Swift.Hashable {}
|
||||
extension NECommonKit.NENetworkReachabilityManager.ConnectionType : Swift.Equatable {}
|
||||
extension NECommonKit.NENetworkReachabilityManager.ConnectionType : Swift.Hashable {}
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,187 +0,0 @@
|
||||
// swift-interface-format-version: 1.0
|
||||
// swift-compiler-version: Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
|
||||
// swift-module-flags: -target x86_64-apple-ios10.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name NECommonKit
|
||||
// swift-module-flags-ignorable: -enable-bare-slash-regex
|
||||
import AVFoundation
|
||||
import Foundation
|
||||
@_exported import NECommonKit
|
||||
import Photos
|
||||
import Swift
|
||||
import SystemConfiguration
|
||||
import UIKit
|
||||
import _Concurrency
|
||||
import _StringProcessing
|
||||
extension Swift.Array {
|
||||
public func chunk(_ chunkSize: Swift.Int) -> [[Element]]
|
||||
}
|
||||
@propertyWrapper public struct Atomic<Value> {
|
||||
public init(wrappedValue value: Value)
|
||||
public var wrappedValue: Value {
|
||||
get
|
||||
set
|
||||
}
|
||||
}
|
||||
public class CommonLoader<T> where T : AnyObject {
|
||||
public init()
|
||||
public func localizable(_ key: Swift.String) -> Swift.String
|
||||
public func loadImage(_ name: Swift.String) -> UIKit.UIImage?
|
||||
public func loadString(source: Swift.String?, type: Swift.String?) -> Swift.String?
|
||||
@objc deinit
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers public class CommonTool : ObjectiveC.NSObject {
|
||||
public static func getCurrentLanguage() -> Swift.String
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
public typealias NEAuthCompletion = (_ granted: Swift.Bool) -> Swift.Void
|
||||
@_inheritsConvenienceInitializers @objc public class NEAuthManager : ObjectiveC.NSObject {
|
||||
@objc public class func hasAudioAuthoriztion() -> Swift.Bool
|
||||
@objc public class func requestAudioAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc public class func hasCameraAuthorization() -> Swift.Bool
|
||||
@objc public class func requestCameraAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc public class func hasPhotoAuthorization() -> Swift.Bool
|
||||
public class func requestPhotoAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
public enum ReachabilityStatus {
|
||||
case notReachable
|
||||
case unknown
|
||||
case ethernetOrWiFi
|
||||
case wwan
|
||||
public static func == (a: NECommonKit.ReachabilityStatus, b: NECommonKit.ReachabilityStatus) -> Swift.Bool
|
||||
public func hash(into hasher: inout Swift.Hasher)
|
||||
public var hashValue: Swift.Int {
|
||||
get
|
||||
}
|
||||
}
|
||||
@_hasMissingDesignatedInitializers public class NEChatDetectNetworkTool {
|
||||
public static let shareInstance: NECommonKit.NEChatDetectNetworkTool
|
||||
final public let manager: NECommonKit.NENetworkReachabilityManager?
|
||||
public func isNetworkRecahability() -> Swift.Bool
|
||||
public func netWorkReachability(reachabilityStatus: @escaping (NECommonKit.ReachabilityStatus) -> Swift.Void)
|
||||
@objc deinit
|
||||
}
|
||||
extension UIKit.UIColor {
|
||||
public static let ne_darkText: UIKit.UIColor
|
||||
public static let ne_greyText: UIKit.UIColor
|
||||
public static let ne_lightText: UIKit.UIColor
|
||||
public static let ne_blueText: UIKit.UIColor
|
||||
public static let ne_redText: UIKit.UIColor
|
||||
public static let ne_disableRedText: UIKit.UIColor
|
||||
public static let ne_backcolor: UIKit.UIColor
|
||||
public static let ne_emptyTitleColor: UIKit.UIColor
|
||||
public static let ne_greenText: UIKit.UIColor
|
||||
public static let ne_lightBackgroundColor: UIKit.UIColor
|
||||
public static let ne_defautAvatarColor: UIKit.UIColor
|
||||
public static let ne_greenColor: UIKit.UIColor
|
||||
public static let ne_yellowBackgroundColor: UIKit.UIColor
|
||||
public static let ne_borderColor: UIKit.UIColor
|
||||
public static let ne_operationBorderColor: UIKit.UIColor
|
||||
public static let ne_greyLine: UIKit.UIColor
|
||||
public static let ne_redColor: UIKit.UIColor
|
||||
public static let ne_backgroundColor: UIKit.UIColor
|
||||
public static let ne_navLineColor: UIKit.UIColor
|
||||
public static let ne_outlineColor: UIKit.UIColor
|
||||
convenience public init(hexString: Swift.String, _ alpha: CoreFoundation.CGFloat = 1.0)
|
||||
public var hexString: Swift.String? {
|
||||
get
|
||||
}
|
||||
public class func colorWithNumber(number: Swift.UInt64?) -> UIKit.UIColor
|
||||
@objc dynamic public class func colorWithString(string: Swift.String?) -> UIKit.UIColor
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers @objcMembers public class NECommonUtil : ObjectiveC.NSObject {
|
||||
@objc public class func getJSONStringFromDictionary(_ dictionary: [Swift.String : Any]) -> Swift.String
|
||||
@objc public class func getDictionaryFromJSONString(_ jsonString: Swift.String) -> Foundation.NSDictionary?
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers @objcMembers public class NEConstant : ObjectiveC.NSObject {
|
||||
@objc public static let screenWidth: CoreFoundation.CGFloat
|
||||
@objc public static let screenHeight: CoreFoundation.CGFloat
|
||||
@objc public static let sreenWidthScale: CoreFoundation.CGFloat
|
||||
@objc public static let sreenHeightScale: CoreFoundation.CGFloat
|
||||
@objc public static let navigationHeight: Swift.Double
|
||||
@objc public static let statusBarHeight: CoreFoundation.CGFloat
|
||||
@objc public static let navigationAndStatusHeight: Swift.Double
|
||||
@objc public static let screenInterval: CoreFoundation.CGFloat
|
||||
@objc public static let textFont: (_ fontName: Swift.String, _ fontSize: Swift.Float) -> UIKit.UIFont
|
||||
@objc public static let defaultTextFont: (_ fontSize: Swift.Float) -> UIKit.UIFont
|
||||
@objc public static let hexRGB: (_ rgbValue: Swift.Int) -> UIKit.UIColor
|
||||
@objc public static let hexRGBAlpha: (_ rgbValue: Swift.Int, _ alpha: Swift.Float) -> UIKit.UIColor
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
extension Foundation.Date {
|
||||
public static func utcFormattedDate(_ from: Foundation.Date, withDate: Swift.Bool) -> Swift.String
|
||||
public static func getFormatPlayTime(_ secounds: Foundation.TimeInterval) -> Swift.String
|
||||
public static func getTimeString(_ time: Foundation.TimeInterval) -> Swift.String
|
||||
public func isToday() -> Swift.Bool
|
||||
public func isThisYear() -> Swift.Bool
|
||||
}
|
||||
@_hasMissingDesignatedInitializers open class NENetworkReachabilityManager {
|
||||
public enum NetworkReachabilityStatus {
|
||||
case unknown
|
||||
case notReachable
|
||||
case reachable(NECommonKit.NENetworkReachabilityManager.ConnectionType)
|
||||
}
|
||||
public enum ConnectionType {
|
||||
case ethernetOrWiFi
|
||||
case wwan
|
||||
public static func == (a: NECommonKit.NENetworkReachabilityManager.ConnectionType, b: NECommonKit.NENetworkReachabilityManager.ConnectionType) -> Swift.Bool
|
||||
public func hash(into hasher: inout Swift.Hasher)
|
||||
public var hashValue: Swift.Int {
|
||||
get
|
||||
}
|
||||
}
|
||||
public typealias Listener = (NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus) -> Swift.Void
|
||||
open var isReachable: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var isReachableOnWWAN: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var isReachableOnEthernetOrWiFi: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var networkReachabilityStatus: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus {
|
||||
get
|
||||
}
|
||||
open var listenerQueue: Dispatch.DispatchQueue
|
||||
open var listener: NECommonKit.NENetworkReachabilityManager.Listener?
|
||||
open var flags: SystemConfiguration.SCNetworkReachabilityFlags? {
|
||||
get
|
||||
}
|
||||
open var previousFlags: SystemConfiguration.SCNetworkReachabilityFlags
|
||||
convenience public init?(host: Swift.String)
|
||||
convenience public init?()
|
||||
@objc deinit
|
||||
@discardableResult
|
||||
open func startListening() -> Swift.Bool
|
||||
open func stopListening()
|
||||
}
|
||||
extension NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus : Swift.Equatable {
|
||||
}
|
||||
public func == (lhs: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus, rhs: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus) -> Swift.Bool
|
||||
extension ObjectiveC.NSObject {
|
||||
public class func className() -> Swift.String
|
||||
public func className() -> Swift.String
|
||||
}
|
||||
extension Swift.String {
|
||||
public func finalSize(_ font: UIKit.UIFont, _ size: CoreFoundation.CGSize, _ numberOfLines: Swift.Int = 0) -> CoreFoundation.CGSize
|
||||
}
|
||||
extension Foundation.NSAttributedString {
|
||||
public func finalSize(_ font: UIKit.UIFont, _ size: CoreFoundation.CGSize, _ numberOfLines: Swift.Int = 0) -> CoreFoundation.CGSize
|
||||
}
|
||||
extension Swift.String {
|
||||
@available(*, deprecated, message: "This method is deprecated")
|
||||
public func findAllIndex(_ string: Swift.String) -> [Foundation.NSRange]
|
||||
public static func stringFromDate(date: Foundation.Date) -> Swift.String
|
||||
public static func firstDayInYear() -> Foundation.Date?
|
||||
public static func stringFromDictionary(dictionary: [Swift.String : Any]) -> Swift.String?
|
||||
public static func dictionaryFromString(string: Swift.String) -> [Swift.String : Any]?
|
||||
}
|
||||
extension NECommonKit.ReachabilityStatus : Swift.Equatable {}
|
||||
extension NECommonKit.ReachabilityStatus : Swift.Hashable {}
|
||||
extension NECommonKit.NENetworkReachabilityManager.ConnectionType : Swift.Equatable {}
|
||||
extension NECommonKit.NENetworkReachabilityManager.ConnectionType : Swift.Hashable {}
|
||||
Binary file not shown.
@ -1,187 +0,0 @@
|
||||
// swift-interface-format-version: 1.0
|
||||
// swift-compiler-version: Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
|
||||
// swift-module-flags: -target x86_64-apple-ios10.0-simulator -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name NECommonKit
|
||||
// swift-module-flags-ignorable: -enable-bare-slash-regex
|
||||
import AVFoundation
|
||||
import Foundation
|
||||
@_exported import NECommonKit
|
||||
import Photos
|
||||
import Swift
|
||||
import SystemConfiguration
|
||||
import UIKit
|
||||
import _Concurrency
|
||||
import _StringProcessing
|
||||
extension Swift.Array {
|
||||
public func chunk(_ chunkSize: Swift.Int) -> [[Element]]
|
||||
}
|
||||
@propertyWrapper public struct Atomic<Value> {
|
||||
public init(wrappedValue value: Value)
|
||||
public var wrappedValue: Value {
|
||||
get
|
||||
set
|
||||
}
|
||||
}
|
||||
public class CommonLoader<T> where T : AnyObject {
|
||||
public init()
|
||||
public func localizable(_ key: Swift.String) -> Swift.String
|
||||
public func loadImage(_ name: Swift.String) -> UIKit.UIImage?
|
||||
public func loadString(source: Swift.String?, type: Swift.String?) -> Swift.String?
|
||||
@objc deinit
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers public class CommonTool : ObjectiveC.NSObject {
|
||||
public static func getCurrentLanguage() -> Swift.String
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
public typealias NEAuthCompletion = (_ granted: Swift.Bool) -> Swift.Void
|
||||
@_inheritsConvenienceInitializers @objc public class NEAuthManager : ObjectiveC.NSObject {
|
||||
@objc public class func hasAudioAuthoriztion() -> Swift.Bool
|
||||
@objc public class func requestAudioAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc public class func hasCameraAuthorization() -> Swift.Bool
|
||||
@objc public class func requestCameraAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc public class func hasPhotoAuthorization() -> Swift.Bool
|
||||
public class func requestPhotoAuthorization(_ completion: NECommonKit.NEAuthCompletion?)
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
public enum ReachabilityStatus {
|
||||
case notReachable
|
||||
case unknown
|
||||
case ethernetOrWiFi
|
||||
case wwan
|
||||
public static func == (a: NECommonKit.ReachabilityStatus, b: NECommonKit.ReachabilityStatus) -> Swift.Bool
|
||||
public func hash(into hasher: inout Swift.Hasher)
|
||||
public var hashValue: Swift.Int {
|
||||
get
|
||||
}
|
||||
}
|
||||
@_hasMissingDesignatedInitializers public class NEChatDetectNetworkTool {
|
||||
public static let shareInstance: NECommonKit.NEChatDetectNetworkTool
|
||||
final public let manager: NECommonKit.NENetworkReachabilityManager?
|
||||
public func isNetworkRecahability() -> Swift.Bool
|
||||
public func netWorkReachability(reachabilityStatus: @escaping (NECommonKit.ReachabilityStatus) -> Swift.Void)
|
||||
@objc deinit
|
||||
}
|
||||
extension UIKit.UIColor {
|
||||
public static let ne_darkText: UIKit.UIColor
|
||||
public static let ne_greyText: UIKit.UIColor
|
||||
public static let ne_lightText: UIKit.UIColor
|
||||
public static let ne_blueText: UIKit.UIColor
|
||||
public static let ne_redText: UIKit.UIColor
|
||||
public static let ne_disableRedText: UIKit.UIColor
|
||||
public static let ne_backcolor: UIKit.UIColor
|
||||
public static let ne_emptyTitleColor: UIKit.UIColor
|
||||
public static let ne_greenText: UIKit.UIColor
|
||||
public static let ne_lightBackgroundColor: UIKit.UIColor
|
||||
public static let ne_defautAvatarColor: UIKit.UIColor
|
||||
public static let ne_greenColor: UIKit.UIColor
|
||||
public static let ne_yellowBackgroundColor: UIKit.UIColor
|
||||
public static let ne_borderColor: UIKit.UIColor
|
||||
public static let ne_operationBorderColor: UIKit.UIColor
|
||||
public static let ne_greyLine: UIKit.UIColor
|
||||
public static let ne_redColor: UIKit.UIColor
|
||||
public static let ne_backgroundColor: UIKit.UIColor
|
||||
public static let ne_navLineColor: UIKit.UIColor
|
||||
public static let ne_outlineColor: UIKit.UIColor
|
||||
convenience public init(hexString: Swift.String, _ alpha: CoreFoundation.CGFloat = 1.0)
|
||||
public var hexString: Swift.String? {
|
||||
get
|
||||
}
|
||||
public class func colorWithNumber(number: Swift.UInt64?) -> UIKit.UIColor
|
||||
@objc dynamic public class func colorWithString(string: Swift.String?) -> UIKit.UIColor
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers @objcMembers public class NECommonUtil : ObjectiveC.NSObject {
|
||||
@objc public class func getJSONStringFromDictionary(_ dictionary: [Swift.String : Any]) -> Swift.String
|
||||
@objc public class func getDictionaryFromJSONString(_ jsonString: Swift.String) -> Foundation.NSDictionary?
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
@objc @_inheritsConvenienceInitializers @objcMembers public class NEConstant : ObjectiveC.NSObject {
|
||||
@objc public static let screenWidth: CoreFoundation.CGFloat
|
||||
@objc public static let screenHeight: CoreFoundation.CGFloat
|
||||
@objc public static let sreenWidthScale: CoreFoundation.CGFloat
|
||||
@objc public static let sreenHeightScale: CoreFoundation.CGFloat
|
||||
@objc public static let navigationHeight: Swift.Double
|
||||
@objc public static let statusBarHeight: CoreFoundation.CGFloat
|
||||
@objc public static let navigationAndStatusHeight: Swift.Double
|
||||
@objc public static let screenInterval: CoreFoundation.CGFloat
|
||||
@objc public static let textFont: (_ fontName: Swift.String, _ fontSize: Swift.Float) -> UIKit.UIFont
|
||||
@objc public static let defaultTextFont: (_ fontSize: Swift.Float) -> UIKit.UIFont
|
||||
@objc public static let hexRGB: (_ rgbValue: Swift.Int) -> UIKit.UIColor
|
||||
@objc public static let hexRGBAlpha: (_ rgbValue: Swift.Int, _ alpha: Swift.Float) -> UIKit.UIColor
|
||||
@objc override dynamic public init()
|
||||
@objc deinit
|
||||
}
|
||||
extension Foundation.Date {
|
||||
public static func utcFormattedDate(_ from: Foundation.Date, withDate: Swift.Bool) -> Swift.String
|
||||
public static func getFormatPlayTime(_ secounds: Foundation.TimeInterval) -> Swift.String
|
||||
public static func getTimeString(_ time: Foundation.TimeInterval) -> Swift.String
|
||||
public func isToday() -> Swift.Bool
|
||||
public func isThisYear() -> Swift.Bool
|
||||
}
|
||||
@_hasMissingDesignatedInitializers open class NENetworkReachabilityManager {
|
||||
public enum NetworkReachabilityStatus {
|
||||
case unknown
|
||||
case notReachable
|
||||
case reachable(NECommonKit.NENetworkReachabilityManager.ConnectionType)
|
||||
}
|
||||
public enum ConnectionType {
|
||||
case ethernetOrWiFi
|
||||
case wwan
|
||||
public static func == (a: NECommonKit.NENetworkReachabilityManager.ConnectionType, b: NECommonKit.NENetworkReachabilityManager.ConnectionType) -> Swift.Bool
|
||||
public func hash(into hasher: inout Swift.Hasher)
|
||||
public var hashValue: Swift.Int {
|
||||
get
|
||||
}
|
||||
}
|
||||
public typealias Listener = (NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus) -> Swift.Void
|
||||
open var isReachable: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var isReachableOnWWAN: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var isReachableOnEthernetOrWiFi: Swift.Bool {
|
||||
get
|
||||
}
|
||||
open var networkReachabilityStatus: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus {
|
||||
get
|
||||
}
|
||||
open var listenerQueue: Dispatch.DispatchQueue
|
||||
open var listener: NECommonKit.NENetworkReachabilityManager.Listener?
|
||||
open var flags: SystemConfiguration.SCNetworkReachabilityFlags? {
|
||||
get
|
||||
}
|
||||
open var previousFlags: SystemConfiguration.SCNetworkReachabilityFlags
|
||||
convenience public init?(host: Swift.String)
|
||||
convenience public init?()
|
||||
@objc deinit
|
||||
@discardableResult
|
||||
open func startListening() -> Swift.Bool
|
||||
open func stopListening()
|
||||
}
|
||||
extension NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus : Swift.Equatable {
|
||||
}
|
||||
public func == (lhs: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus, rhs: NECommonKit.NENetworkReachabilityManager.NetworkReachabilityStatus) -> Swift.Bool
|
||||
extension ObjectiveC.NSObject {
|
||||
public class func className() -> Swift.String
|
||||
public func className() -> Swift.String
|
||||
}
|
||||
extension Swift.String {
|
||||
public func finalSize(_ font: UIKit.UIFont, _ size: CoreFoundation.CGSize, _ numberOfLines: Swift.Int = 0) -> CoreFoundation.CGSize
|
||||
}
|
||||
extension Foundation.NSAttributedString {
|
||||
public func finalSize(_ font: UIKit.UIFont, _ size: CoreFoundation.CGSize, _ numberOfLines: Swift.Int = 0) -> CoreFoundation.CGSize
|
||||
}
|
||||
extension Swift.String {
|
||||
@available(*, deprecated, message: "This method is deprecated")
|
||||
public func findAllIndex(_ string: Swift.String) -> [Foundation.NSRange]
|
||||
public static func stringFromDate(date: Foundation.Date) -> Swift.String
|
||||
public static func firstDayInYear() -> Foundation.Date?
|
||||
public static func stringFromDictionary(dictionary: [Swift.String : Any]) -> Swift.String?
|
||||
public static func dictionaryFromString(string: Swift.String) -> [Swift.String : Any]?
|
||||
}
|
||||
extension NECommonKit.ReachabilityStatus : Swift.Equatable {}
|
||||
extension NECommonKit.ReachabilityStatus : Swift.Hashable {}
|
||||
extension NECommonKit.NENetworkReachabilityManager.ConnectionType : Swift.Equatable {}
|
||||
extension NECommonKit.NENetworkReachabilityManager.ConnectionType : Swift.Hashable {}
|
||||
Binary file not shown.
@ -1,11 +0,0 @@
|
||||
framework module NECommonKit {
|
||||
umbrella header "NECommonKit-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
|
||||
module NECommonKit.Swift {
|
||||
header "NECommonKit-Swift.h"
|
||||
requires objc
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,17 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import "UIView+YXToast.h"
|
||||
|
||||
FOUNDATION_EXPORT double NECommonUIKitVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char NECommonUIKitVersionString[];
|
||||
|
||||
@ -1,212 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
extern const NSString * YXToastPositionTop;
|
||||
extern const NSString * YXToastPositionCenter;
|
||||
extern const NSString * YXToastPositionBottom;
|
||||
|
||||
@class YXToastStyle;
|
||||
|
||||
|
||||
@interface UIView (YXToast)
|
||||
|
||||
- (void)ne_makeToast:(NSString *)message;
|
||||
|
||||
- (void)ne_makeToast:(NSString *)message
|
||||
duration:(NSTimeInterval)duration
|
||||
position:(id)position;
|
||||
|
||||
- (void)ne_makeToast:(NSString *)message
|
||||
duration:(NSTimeInterval)duration
|
||||
position:(id)position
|
||||
style:(YXToastStyle *)style;
|
||||
|
||||
|
||||
- (void)ne_makeToast:(NSString *)message
|
||||
duration:(NSTimeInterval)duration
|
||||
position:(id)position
|
||||
title:(NSString *)title
|
||||
image:(UIImage *)image
|
||||
style:(YXToastStyle *)style
|
||||
completion:(void(^)(BOOL didTap))completion;
|
||||
|
||||
- (UIView *)toastViewForMessage:(NSString *)message
|
||||
title:(NSString *)title
|
||||
image:(UIImage *)image
|
||||
style:(YXToastStyle *)style;
|
||||
|
||||
- (void)ne_hideToast;
|
||||
|
||||
- (void)ne_hideToast:(UIView *)toast;
|
||||
|
||||
- (void)ne_hideAllToasts;
|
||||
|
||||
- (void)ne_hideAllToasts:(BOOL)includeActivity clearQueue:(BOOL)clearQueue;
|
||||
|
||||
- (void)clearToastQueue;
|
||||
|
||||
- (void)makeToastActivity:(id)position;
|
||||
|
||||
- (void)ne_hideToastActivity;
|
||||
|
||||
- (void)ne_showToast:(UIView *)toast;
|
||||
|
||||
- (void)ne_showToast:(UIView *)toast
|
||||
duration:(NSTimeInterval)duration
|
||||
position:(id)position
|
||||
completion:(void(^)(BOOL didTap))completion;
|
||||
|
||||
@end
|
||||
|
||||
@interface YXToastStyle : NSObject
|
||||
|
||||
/**
|
||||
The background color. Default is `[UIColor blackColor]` at 80% opacity.
|
||||
*/
|
||||
@property (strong, nonatomic) UIColor *backgroundColor;
|
||||
|
||||
/**
|
||||
The title color. Default is `[UIColor whiteColor]`.
|
||||
*/
|
||||
@property (strong, nonatomic) UIColor *titleColor;
|
||||
|
||||
/**
|
||||
The message color. Default is `[UIColor whiteColor]`.
|
||||
*/
|
||||
@property (strong, nonatomic) UIColor *messageColor;
|
||||
|
||||
/**
|
||||
A percentage value from 0.0 to 1.0, representing the maximum width of the toast
|
||||
view relative to it's superview. Default is 0.8 (80% of the superview's width).
|
||||
*/
|
||||
@property (assign, nonatomic) CGFloat maxWidthPercentage;
|
||||
|
||||
/**
|
||||
A percentage value from 0.0 to 1.0, representing the maximum height of the toast
|
||||
view relative to it's superview. Default is 0.8 (80% of the superview's height).
|
||||
*/
|
||||
@property (assign, nonatomic) CGFloat maxHeightPercentage;
|
||||
|
||||
/**
|
||||
The spacing from the horizontal edge of the toast view to the content. When an image
|
||||
is present, this is also used as the padding between the image and the text.
|
||||
Default is 10.0.
|
||||
*/
|
||||
@property (assign, nonatomic) CGFloat horizontalPadding;
|
||||
|
||||
/**
|
||||
The spacing from the vertical edge of the toast view to the content. When a title
|
||||
is present, this is also used as the padding between the title and the message.
|
||||
Default is 10.0.
|
||||
*/
|
||||
@property (assign, nonatomic) CGFloat verticalPadding;
|
||||
|
||||
/**
|
||||
The corner radius. Default is 10.0.
|
||||
*/
|
||||
@property (assign, nonatomic) CGFloat cornerRadius;
|
||||
|
||||
/**
|
||||
The title font. Default is `[UIFont boldSystemFontOfSize:16.0]`.
|
||||
*/
|
||||
@property (strong, nonatomic) UIFont *titleFont;
|
||||
|
||||
/**
|
||||
The message font. Default is `[UIFont systemFontOfSize:16.0]`.
|
||||
*/
|
||||
@property (strong, nonatomic) UIFont *messageFont;
|
||||
|
||||
/**
|
||||
The title text alignment. Default is `NSTextAlignmentLeft`.
|
||||
*/
|
||||
@property (assign, nonatomic) NSTextAlignment titleAlignment;
|
||||
|
||||
/**
|
||||
The message text alignment. Default is `NSTextAlignmentLeft`.
|
||||
*/
|
||||
@property (assign, nonatomic) NSTextAlignment messageAlignment;
|
||||
|
||||
/**
|
||||
The maximum number of lines for the title. The default is 0 (no limit).
|
||||
*/
|
||||
@property (assign, nonatomic) NSInteger titleNumberOfLines;
|
||||
|
||||
/**
|
||||
The maximum number of lines for the message. The default is 0 (no limit).
|
||||
*/
|
||||
@property (assign, nonatomic) NSInteger messageNumberOfLines;
|
||||
|
||||
/**
|
||||
Enable or disable a shadow on the toast view. Default is `NO`.
|
||||
*/
|
||||
@property (assign, nonatomic) BOOL displayShadow;
|
||||
|
||||
/**
|
||||
The shadow color. Default is `[UIColor blackColor]`.
|
||||
*/
|
||||
@property (strong, nonatomic) UIColor *shadowColor;
|
||||
|
||||
/**
|
||||
A value from 0.0 to 1.0, representing the opacity of the shadow.
|
||||
Default is 0.8 (80% opacity).
|
||||
*/
|
||||
@property (assign, nonatomic) CGFloat shadowOpacity;
|
||||
|
||||
/**
|
||||
The shadow radius. Default is 6.0.
|
||||
*/
|
||||
@property (assign, nonatomic) CGFloat shadowRadius;
|
||||
|
||||
/**
|
||||
The shadow offset. The default is `CGSizeMake(4.0, 4.0)`.
|
||||
*/
|
||||
@property (assign, nonatomic) CGSize shadowOffset;
|
||||
|
||||
/**
|
||||
The image size. The default is `CGSizeMake(80.0, 80.0)`.
|
||||
*/
|
||||
@property (assign, nonatomic) CGSize imageSize;
|
||||
|
||||
/**
|
||||
The size of the toast activity view when `makeToastActivity:` is called.
|
||||
Default is `CGSizeMake(100.0, 100.0)`.
|
||||
*/
|
||||
@property (assign, nonatomic) CGSize activitySize;
|
||||
|
||||
/**
|
||||
The fade in/out animation duration. Default is 0.2.
|
||||
*/
|
||||
@property (assign, nonatomic) NSTimeInterval fadeDuration;
|
||||
|
||||
- (instancetype)initWithDefaultStyle NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
|
||||
@end
|
||||
|
||||
@interface YXToastManager : NSObject
|
||||
|
||||
+ (void)setSharedStyle:(YXToastStyle *)sharedStyle;
|
||||
|
||||
+ (YXToastStyle *)sharedStyle;
|
||||
|
||||
+ (void)setTapToDismissEnabled:(BOOL)tapToDismissEnabled;
|
||||
|
||||
+ (BOOL)isTapToDismissEnabled;
|
||||
|
||||
+ (void)setQueueEnabled:(BOOL)queueEnabled;
|
||||
|
||||
+ (BOOL)isQueueEnabled;
|
||||
|
||||
+ (void)setDefaultDuration:(NSTimeInterval)duration;
|
||||
|
||||
+ (NSTimeInterval)defaultDuration;
|
||||
|
||||
+ (void)setDefaultPosition:(id)position;
|
||||
|
||||
+ (id)defaultPosition;
|
||||
|
||||
@end
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,11 +0,0 @@
|
||||
framework module NECommonUIKit {
|
||||
umbrella header "NECommonUIKit-umbrella.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
||||
|
||||
module NECommonUIKit.Swift {
|
||||
header "NECommonUIKit-Swift.h"
|
||||
requires objc
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,39 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ReportConfig.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface BaseReportData : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSString *appKey;
|
||||
// 用户版本号
|
||||
@property(nonatomic, strong) NSString *version;
|
||||
// 组件名称,如 QChatKit, ContactKit, CallKit
|
||||
@property(nonatomic, strong) NSString *component;
|
||||
// 应用平台 iOS、MAC 等
|
||||
@property(nonatomic, strong) NSString *platform;
|
||||
// 系统时间戳
|
||||
@property(nonatomic, assign) NSInteger timeStamp;
|
||||
// Rtc SDK 版本
|
||||
@property(nonatomic, strong) NSString *nertcVersion;
|
||||
// IM SDK 版本
|
||||
@property(nonatomic, strong) NSString *imVersion;
|
||||
// 上报类型,可根据需要统计的特性填写,便于统计检索
|
||||
@property(nonatomic, strong) NSString *reportType;
|
||||
// 上报渠道
|
||||
@property(nonatomic, strong) NSString *channel;
|
||||
// 上报渠道
|
||||
@property(nonatomic, strong) NSString *framework;
|
||||
// 上报的内容
|
||||
@property(nonatomic, strong) id data;
|
||||
|
||||
- (instancetype)init;
|
||||
|
||||
- (instancetype)initWithConfig:(ReportConfig *)config;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,39 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ReportEvent.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NECoreApiEvent : NSObject <NECoreEvent>
|
||||
|
||||
/// 用户标识
|
||||
@property(nonatomic, copy) NSString *userId;
|
||||
/// ID标识1
|
||||
@property(nonatomic, copy) NSString *id1;
|
||||
/// ID标识2
|
||||
@property(nonatomic, copy) NSString *id2;
|
||||
/// 额外可带信息
|
||||
@property(nonatomic, copy) NSString *extension;
|
||||
|
||||
/// 创建一个API埋点对象
|
||||
/// - Parameters:
|
||||
/// - methodName: API名称
|
||||
/// - params: API参数
|
||||
- (instancetype)initWithMethodName:(NSString *)methodName params:(NSDictionary *__nullable)params;
|
||||
|
||||
/// 设置API埋点的结果
|
||||
/// - Parameters:
|
||||
/// - code: API调用结果
|
||||
/// - message: API调用结果描述
|
||||
- (void)setResult:(NSInteger)code message:(NSString *__nullable)message;
|
||||
|
||||
/// 强制设置字符串类型的params,调用这个接口后通过init传入的params将失效
|
||||
/// - Parameter params: API参数
|
||||
- (void)setParamsForce:(NSString *_Nonnull)params;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,34 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ReportEvent.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NECoreTimeConsumingOperation : NSObject
|
||||
- (void)setResult:(NSInteger)code
|
||||
message:(NSString *__nullable)message
|
||||
requestId:(NSString *__nullable)requestId
|
||||
serverCost:(double)serverCost;
|
||||
- (void)setParams:(NSDictionary *)params;
|
||||
- (void)addParams:(NSString *)key value:(id)value;
|
||||
- (void)removeParams:(NSString *)key;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
|
||||
@interface NECoreIntervalStep : NECoreTimeConsumingOperation
|
||||
@property(nonatomic, copy) NSString *name;
|
||||
- (instancetype)initWithName:(NSString *)name;
|
||||
@end
|
||||
|
||||
@interface NECoreIntervalEvent : NECoreTimeConsumingOperation <NECoreEvent>
|
||||
- (instancetype)initWithEventId:(NSString *)eventId;
|
||||
|
||||
- (NECoreIntervalStep *)beginStep:(NSString *)name;
|
||||
- (NECoreIntervalStep *_Nullable)currentStep;
|
||||
- (NECoreIntervalStep *_Nullable)getStep:(NSString *)name;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,3 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
@ -1,398 +0,0 @@
|
||||
|
||||
#if defined(__arm64__) && __arm64__ || (__x86_64__) && __x86_64__
|
||||
// Generated by Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
|
||||
#ifndef NECOREKIT_SWIFT_H
|
||||
#define NECOREKIT_SWIFT_H
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wgcc-compat"
|
||||
|
||||
#if !defined(__has_include)
|
||||
# define __has_include(x) 0
|
||||
#endif
|
||||
#if !defined(__has_attribute)
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
#if !defined(__has_feature)
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
#if !defined(__has_warning)
|
||||
# define __has_warning(x) 0
|
||||
#endif
|
||||
|
||||
#if __has_include(<swift/objc-prologue.h>)
|
||||
# include <swift/objc-prologue.h>
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic ignored "-Wauto-import"
|
||||
#if defined(__OBJC__)
|
||||
#include <Foundation/Foundation.h>
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
#include <cstdbool>
|
||||
#include <cstring>
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#if defined(__arm64e__) && __has_include(<ptrauth.h>)
|
||||
# include <ptrauth.h>
|
||||
#else
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreserved-macro-identifier"
|
||||
# ifndef __ptrauth_swift_value_witness_function_pointer
|
||||
# define __ptrauth_swift_value_witness_function_pointer(x)
|
||||
# endif
|
||||
# ifndef __ptrauth_swift_class_method_pointer
|
||||
# define __ptrauth_swift_class_method_pointer(x)
|
||||
# endif
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_TYPEDEFS)
|
||||
# define SWIFT_TYPEDEFS 1
|
||||
# if __has_include(<uchar.h>)
|
||||
# include <uchar.h>
|
||||
# elif !defined(__cplusplus)
|
||||
typedef uint_least16_t char16_t;
|
||||
typedef uint_least32_t char32_t;
|
||||
# endif
|
||||
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
|
||||
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
|
||||
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
|
||||
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
|
||||
#endif
|
||||
|
||||
#if !defined(SWIFT_PASTE)
|
||||
# define SWIFT_PASTE_HELPER(x, y) x##y
|
||||
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
|
||||
#endif
|
||||
#if !defined(SWIFT_METATYPE)
|
||||
# define SWIFT_METATYPE(X) Class
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_PROPERTY)
|
||||
# if __has_feature(objc_class_property)
|
||||
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
|
||||
# else
|
||||
# define SWIFT_CLASS_PROPERTY(...)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_RUNTIME_NAME)
|
||||
# if __has_attribute(objc_runtime_name)
|
||||
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
|
||||
# else
|
||||
# define SWIFT_RUNTIME_NAME(X)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_COMPILE_NAME)
|
||||
# if __has_attribute(swift_name)
|
||||
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
|
||||
# else
|
||||
# define SWIFT_COMPILE_NAME(X)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_METHOD_FAMILY)
|
||||
# if __has_attribute(objc_method_family)
|
||||
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
|
||||
# else
|
||||
# define SWIFT_METHOD_FAMILY(X)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_NOESCAPE)
|
||||
# if __has_attribute(noescape)
|
||||
# define SWIFT_NOESCAPE __attribute__((noescape))
|
||||
# else
|
||||
# define SWIFT_NOESCAPE
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_RELEASES_ARGUMENT)
|
||||
# if __has_attribute(ns_consumed)
|
||||
# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
|
||||
# else
|
||||
# define SWIFT_RELEASES_ARGUMENT
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_WARN_UNUSED_RESULT)
|
||||
# if __has_attribute(warn_unused_result)
|
||||
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
||||
# else
|
||||
# define SWIFT_WARN_UNUSED_RESULT
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_NORETURN)
|
||||
# if __has_attribute(noreturn)
|
||||
# define SWIFT_NORETURN __attribute__((noreturn))
|
||||
# else
|
||||
# define SWIFT_NORETURN
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS_EXTRA)
|
||||
# define SWIFT_CLASS_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_PROTOCOL_EXTRA)
|
||||
# define SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_EXTRA)
|
||||
# define SWIFT_ENUM_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_CLASS)
|
||||
# if __has_attribute(objc_subclassing_restricted)
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# else
|
||||
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_RESILIENT_CLASS)
|
||||
# if __has_attribute(objc_class_stub)
|
||||
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
|
||||
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
|
||||
# else
|
||||
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
|
||||
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_PROTOCOL)
|
||||
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
|
||||
#endif
|
||||
#if !defined(SWIFT_EXTENSION)
|
||||
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
|
||||
#endif
|
||||
#if !defined(OBJC_DESIGNATED_INITIALIZER)
|
||||
# if __has_attribute(objc_designated_initializer)
|
||||
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
|
||||
# else
|
||||
# define OBJC_DESIGNATED_INITIALIZER
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM_ATTR)
|
||||
# if __has_attribute(enum_extensibility)
|
||||
# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
|
||||
# else
|
||||
# define SWIFT_ENUM_ATTR(_extensibility)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_ENUM)
|
||||
# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
|
||||
# if __has_feature(generalized_swift_name)
|
||||
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
|
||||
# else
|
||||
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_UNAVAILABLE)
|
||||
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
|
||||
#endif
|
||||
#if !defined(SWIFT_UNAVAILABLE_MSG)
|
||||
# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
|
||||
#endif
|
||||
#if !defined(SWIFT_AVAILABILITY)
|
||||
# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
|
||||
#endif
|
||||
#if !defined(SWIFT_WEAK_IMPORT)
|
||||
# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED)
|
||||
# define SWIFT_DEPRECATED __attribute__((deprecated))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED_MSG)
|
||||
# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
|
||||
#endif
|
||||
#if !defined(SWIFT_DEPRECATED_OBJC)
|
||||
# if __has_feature(attribute_diagnose_if_objc)
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
|
||||
# else
|
||||
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
|
||||
# endif
|
||||
#endif
|
||||
#if defined(__OBJC__)
|
||||
#if !defined(IBSegueAction)
|
||||
# define IBSegueAction
|
||||
#endif
|
||||
#endif
|
||||
#if !defined(SWIFT_EXTERN)
|
||||
# if defined(__cplusplus)
|
||||
# define SWIFT_EXTERN extern "C"
|
||||
# else
|
||||
# define SWIFT_EXTERN extern
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(SWIFT_CALL)
|
||||
# define SWIFT_CALL __attribute__((swiftcall))
|
||||
#endif
|
||||
#if !defined(SWIFT_INDIRECT_RESULT)
|
||||
# define SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result))
|
||||
#endif
|
||||
#if !defined(SWIFT_CONTEXT)
|
||||
# define SWIFT_CONTEXT __attribute__((swift_context))
|
||||
#endif
|
||||
#if !defined(SWIFT_ERROR_RESULT)
|
||||
# define SWIFT_ERROR_RESULT __attribute__((swift_error_result))
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
# define SWIFT_NOEXCEPT noexcept
|
||||
#else
|
||||
# define SWIFT_NOEXCEPT
|
||||
#endif
|
||||
#if !defined(SWIFT_C_INLINE_THUNK)
|
||||
# if __has_attribute(always_inline)
|
||||
# if __has_attribute(nodebug)
|
||||
# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) __attribute__((nodebug))
|
||||
# else
|
||||
# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline))
|
||||
# endif
|
||||
# else
|
||||
# define SWIFT_C_INLINE_THUNK inline
|
||||
# endif
|
||||
#endif
|
||||
#if defined(_WIN32)
|
||||
#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
|
||||
# define SWIFT_IMPORT_STDLIB_SYMBOL __declspec(dllimport)
|
||||
#endif
|
||||
#else
|
||||
#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
|
||||
# define SWIFT_IMPORT_STDLIB_SYMBOL
|
||||
#endif
|
||||
#endif
|
||||
#if defined(__OBJC__)
|
||||
#if __has_feature(objc_modules)
|
||||
#if __has_warning("-Watimport-in-framework-header")
|
||||
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
|
||||
#endif
|
||||
@import Foundation;
|
||||
@import ObjectiveC;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
|
||||
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
|
||||
#if __has_warning("-Wpragma-clang-attribute")
|
||||
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
|
||||
#endif
|
||||
#pragma clang diagnostic ignored "-Wunknown-pragmas"
|
||||
#pragma clang diagnostic ignored "-Wnullability"
|
||||
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
|
||||
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma push_macro("any")
|
||||
# undef any
|
||||
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="NECoreKit",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
|
||||
# pragma pop_macro("any")
|
||||
#endif
|
||||
|
||||
#if defined(__OBJC__)
|
||||
@class NSString;
|
||||
|
||||
/// 路径处理封装
|
||||
SWIFT_CLASS("_TtC9NECoreKit11NEPathUtils")
|
||||
@interface NEPathUtils : NSObject
|
||||
/// 获取document目录下的某个文件夹,支持传入多级,如不存在会新建该文件夹
|
||||
/// \param dir 文件夹名称,支持子路径,如 “123/456/789”
|
||||
///
|
||||
///
|
||||
/// returns:
|
||||
/// 文件夹的绝对路径
|
||||
+ (NSString * _Nullable)getDirectoryForDocumentsWithDir:(NSString * _Nonnull)dir SWIFT_WARN_UNUSED_RESULT;
|
||||
/// 获取document目录路径
|
||||
///
|
||||
/// returns:
|
||||
/// document目录路径
|
||||
+ (NSString * _Nullable)getDocumentPath SWIFT_WARN_UNUSED_RESULT;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
|
||||
/// 字符串处理封装
|
||||
SWIFT_CLASS("_TtC9NECoreKit13NEStringUtils")
|
||||
@interface NEStringUtils : NSObject
|
||||
/// 脱敏字符串,比如将 “appkey:123456789” 脱敏为 “appkey:123***789”
|
||||
/// \param string 待脱敏的字符串
|
||||
///
|
||||
/// \param sensitive 脱敏关键字
|
||||
///
|
||||
///
|
||||
/// returns:
|
||||
/// 脱敏后的字符串
|
||||
+ (NSString * _Nonnull)desensitizeWithString:(NSString * _Nonnull)string sensitive:(NSString * _Nonnull)sensitive SWIFT_WARN_UNUSED_RESULT;
|
||||
/// 脱敏字符串,比如将 “123456789” 脱敏为 “123***789”
|
||||
/// \param string 待脱敏的字符串
|
||||
///
|
||||
/// \param left 左边显示几个字符
|
||||
///
|
||||
/// \param right 右边显示几个字符
|
||||
///
|
||||
/// \param template 用什么字符来脱敏,比如 “*”
|
||||
///
|
||||
///
|
||||
/// returns:
|
||||
/// 脱敏后的字符串
|
||||
+ (NSString * _Nonnull)aroundWithString:(NSString * _Nonnull)string left:(NSInteger)left right:(NSInteger)right template:(NSString * _Nonnull)template_ SWIFT_WARN_UNUSED_RESULT;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
@class NSCoder;
|
||||
|
||||
SWIFT_CLASS("_TtC9NECoreKit7Regular")
|
||||
@interface Regular : NSRegularExpression
|
||||
- (nullable instancetype)initWithPattern:(NSString * _Nonnull)pattern options:(NSRegularExpressionOptions)options error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
|
||||
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder SWIFT_UNAVAILABLE;
|
||||
@end
|
||||
|
||||
enum RouterState : NSInteger;
|
||||
|
||||
SWIFT_CLASS("_TtC9NECoreKit6Router")
|
||||
@interface Router : NSObject
|
||||
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong) Router * _Nonnull shared;)
|
||||
+ (Router * _Nonnull)shared SWIFT_WARN_UNUSED_RESULT;
|
||||
/// Register route
|
||||
- (void)register:(NSString * _Nonnull)url closure:(void (^ _Nonnull)(NSDictionary<NSString *, id> * _Nonnull))closure;
|
||||
/// Use Route
|
||||
/// \param url route address
|
||||
///
|
||||
/// \param parameters route parameters
|
||||
///
|
||||
/// \param closure handle callback closure
|
||||
///
|
||||
- (void)use:(NSString * _Nonnull)url parameters:(NSDictionary<NSString *, id> * _Nullable)parameters closure:(void (^ _Nullable)(id _Nullable, enum RouterState, NSString * _Nonnull))closure;
|
||||
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
|
||||
@end
|
||||
|
||||
/// Routing state
|
||||
typedef SWIFT_ENUM(NSInteger, RouterState, open) {
|
||||
RouterStateBusinessError = -1,
|
||||
RouterStateSystemError = 0,
|
||||
RouterStateSuccess = 1,
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#if __has_attribute(external_source_symbol)
|
||||
# pragma clang attribute pop
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error unsupported Swift architecture
|
||||
#endif
|
||||
@ -1,42 +0,0 @@
|
||||
#ifdef __OBJC__
|
||||
#import <UIKit/UIKit.h>
|
||||
#else
|
||||
#ifndef FOUNDATION_EXPORT
|
||||
#if defined(__cplusplus)
|
||||
#define FOUNDATION_EXPORT extern "C"
|
||||
#else
|
||||
#define FOUNDATION_EXPORT extern
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#import "NSObject+YXModel.h"
|
||||
#import "YXClassInfo.h"
|
||||
#import "YXModel.h"
|
||||
#import "BaseReportData.h"
|
||||
#import "NEReportConstans.h"
|
||||
#import "NECoreApiEvent.h"
|
||||
#import "NECoreIntervalEvent.h"
|
||||
#import "NECoreModuleEvent.h"
|
||||
#import "NECoreModuleInitEvent.h"
|
||||
#import "NECorePVInfoEvent.h"
|
||||
#import "NECoreUVInfoEvent.h"
|
||||
#import "ReportConfig.h"
|
||||
#import "ReportEvent.h"
|
||||
#import "ReportModuleInfo.h"
|
||||
#import "NEThreadSafeDictionary.h"
|
||||
#import "XKitReportStrategy.h"
|
||||
#import "XKitDeviceId.h"
|
||||
#import "XKitEventPropertyProviders.h"
|
||||
#import "XKitNetwork.h"
|
||||
#import "XKitReporter.h"
|
||||
#import "XKitReporterLog.h"
|
||||
#import "NECoreKit-Bridging-Header.h"
|
||||
#import "XKit.h"
|
||||
#import "XKitLog.h"
|
||||
#import "XKitLogOptions.h"
|
||||
#import "XKitServiceManager.h"
|
||||
|
||||
FOUNDATION_EXPORT double NECoreKitVersionNumber;
|
||||
FOUNDATION_EXPORT const unsigned char NECoreKitVersionString[];
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ReportEvent.h"
|
||||
#import "ReportModuleInfo.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NECoreModuleEvent : NSObject <NECoreEvent>
|
||||
@property(nonatomic, strong, readonly) ReportModuleInfo *moduleInfo;
|
||||
- (instancetype)initWithModuleInfo:(ReportModuleInfo *)moduleInfo
|
||||
userId:(NSString *)userId
|
||||
event:(id<NECoreEvent>)event;
|
||||
- (NSString *)getAppKey;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,14 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ReportEvent.h"
|
||||
#import "ReportModuleInfo.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NECoreModuleInitEvent : NSObject <NECoreEvent>
|
||||
- (instancetype)initWithAppKey:(NSString *)appKey moduleInfo:(ReportModuleInfo *)moduleInfo;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,27 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ReportEvent.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NECorePVInfoEvent : NSObject <NECoreEvent>
|
||||
|
||||
/// 用户标识
|
||||
@property(nonatomic, strong, nullable) NSString *user;
|
||||
/// 当前页面
|
||||
@property(nonatomic, strong, nullable) NSString *page;
|
||||
/// 扩展信息
|
||||
@property(nonatomic, strong, nullable) NSString *extra;
|
||||
/// 事件名称
|
||||
@property(nonatomic, strong) NSString *eventName;
|
||||
/// 前一个页面
|
||||
@property(nonatomic, strong, nullable) NSString *prePage;
|
||||
/// accid
|
||||
@property(nonatomic, strong, nullable) NSString *accid;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ReportEvent.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NECoreUVInfoEvent : NSObject <NECoreEvent>
|
||||
|
||||
/// 用户标识
|
||||
@property(nonatomic, strong, nullable) NSString *user;
|
||||
/// 当前页面
|
||||
@property(nonatomic, strong) NSString *page;
|
||||
/// 扩展信息
|
||||
@property(nonatomic, strong, nullable) NSString *extra;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,105 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef NEReportConstans_h
|
||||
#define NEReportConstans_h
|
||||
|
||||
#define URL_REPORT @"https://statistic.live.126.net/statics/report/xkit/action"
|
||||
#define URL_REPORT_V2 @"https://statistic.live.126.net/statics/report/common/form"
|
||||
|
||||
// ----------- report key start ----------
|
||||
|
||||
#define KEY_APP_KEY @"appKey"
|
||||
|
||||
#define KEY_COMPONENT @"component"
|
||||
|
||||
#define KEY_VERSION @"version"
|
||||
|
||||
#define KEY_PLATFORM @"platform"
|
||||
|
||||
#define KEY_TIMESTAMP @"timeStamp"
|
||||
|
||||
#define KEY_NERTC_VERSION @"nertcVersion"
|
||||
|
||||
#define KEY_IM_VERSION @"imVersion"
|
||||
|
||||
#define KEY_REPORT_TYPE @"reportType"
|
||||
|
||||
#define KEY_DATA @"data"
|
||||
|
||||
#define KEY_EXTRA @"extra"
|
||||
|
||||
#define KEY_PV_EVENT_NAME @"eventName"
|
||||
#define KEY_PV_PAGE @"page"
|
||||
#define KEY_PV_PRE_PAGE @"prePage"
|
||||
#define KEY_PV_ACCID @"accid"
|
||||
#define KEY_PV_USER @"user"
|
||||
|
||||
#define KEY_UV_PAGE @"page"
|
||||
#define KEY_UV_USER @"user"
|
||||
|
||||
#define KEY_CODE @"code"
|
||||
#define KEY_MSG @"message"
|
||||
#define KEY_COST_TIME @"costTime"
|
||||
#define KEY_RESPONSE @"response"
|
||||
|
||||
#define KEY_API @"api"
|
||||
#define KEY_API_NAME @"methodName"
|
||||
#define KEY_API_EXTENSION @"extension"
|
||||
#define KEY_API_ID_1 @"id1"
|
||||
#define KEY_API_ID_2 @"id2"
|
||||
|
||||
#define KEY_API_CALLBACK @"apiCallback"
|
||||
|
||||
#define KEY_CALL_BACK @"callback"
|
||||
|
||||
#define KEY_EVENT_USER @"user"
|
||||
|
||||
#define KEY_EVENT_RESULT @"result"
|
||||
|
||||
#define KEY_EVENT_PARAM @"params"
|
||||
|
||||
#define KEY_EVENT_TAG @"tag"
|
||||
|
||||
#define KEY_EVENT_REQUEST_ID @"requestId"
|
||||
|
||||
#define KEY_EVENT_START_TIME @"startTime"
|
||||
#define KEY_EVENT_END_TIME @"endTime"
|
||||
#define KEY_EVENT_DURATION @"duration"
|
||||
|
||||
#define KEY_DEVICE_ID @"deviceId"
|
||||
#define KEY_DEVICE_MODEL @"model"
|
||||
#define KEY_DEVICE_MANUFACTURER @"manufacturer"
|
||||
#define KEY_OS_VERSION @"osVer"
|
||||
#define KEY_APP_NAME @"appName"
|
||||
#define KEY_APP_VERSION @"appVer"
|
||||
#define KEY_PACKAGE_ID @"packageId"
|
||||
#define KEY_FRAMEWORK @"framework"
|
||||
#define KEY_CHANNEL @"channel"
|
||||
#define KEY_USER_ID @"userId"
|
||||
#define KEY_NETWORK_TYPE @"networkType"
|
||||
// ----------- report key end ----------
|
||||
|
||||
// ----------- report type start -------
|
||||
|
||||
#define REPORT_TYPE_INIT @"init"
|
||||
|
||||
#define REPORT_TYPE_PV @"pv"
|
||||
|
||||
#define REPORT_TYPE_UV @"uv"
|
||||
|
||||
#define REPORT_TYPE_EVENT_API @"apiEvent"
|
||||
|
||||
#define REPORT_TYPE_EVENT_CALLBACK @"callbackEvent"
|
||||
|
||||
#define REPORT_TYPE_EVENT_COMMON @"commonEvent"
|
||||
// ----------- report type end ---------
|
||||
|
||||
// --------- platform type start -------
|
||||
|
||||
#define PLATFORM_iOS @"iOS"
|
||||
|
||||
// --------- platform type end ---------
|
||||
|
||||
#endif /* NEReportConstans_h */
|
||||
@ -1,14 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 线程安全 字典
|
||||
@interface NEThreadSafeDictionary<KeyType, ObjectType> : NSMutableDictionary <KeyType, ObjectType>
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,418 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/**
|
||||
Provide some data-model method:
|
||||
|
||||
* Convert json to any object, or convert any object to json.
|
||||
* Set object properties with a key-value dictionary (like KVC).
|
||||
* Implementations of `NSCoding`, `NSCopying`, `-hash` and `-isEqual:`.
|
||||
|
||||
See `YXModel` protocol for custom methods.
|
||||
|
||||
|
||||
Sample Code:
|
||||
|
||||
********************** json convertor *********************
|
||||
@interface YXAuthor : NSObject
|
||||
@property (nonatomic, strong) NSString *name;
|
||||
@property (nonatomic, assign) NSDate *birthday;
|
||||
@end
|
||||
@implementation YXAuthor
|
||||
@end
|
||||
|
||||
@interface YXBook : NSObject
|
||||
@property (nonatomic, copy) NSString *name;
|
||||
@property (nonatomic, assign) NSUInteger pages;
|
||||
@property (nonatomic, strong) YXAuthor *author;
|
||||
@end
|
||||
@implementation YXBook
|
||||
@end
|
||||
|
||||
int main() {
|
||||
// create model from json
|
||||
YXBook *book = [YXBook yx_modelWithJSON:@"{\"name\": \"Harry Potter\", \"pages\": 256,
|
||||
\"author\": {\"name\": \"J.K.Rowling\", \"birthday\": \"1965-07-31\" }}"];
|
||||
|
||||
// convert model to json
|
||||
NSString *json = [book yx_modelToJSONString];
|
||||
// {"author":{"name":"J.K.Rowling","birthday":"1965-07-31T00:00:00+0000"},"name":"Harry
|
||||
Potter","pages":256}
|
||||
}
|
||||
|
||||
********************** Coding/Copying/hash/equal *********************
|
||||
@interface YXShadow :NSObject <NSCoding, NSCopying>
|
||||
@property (nonatomic, copy) NSString *name;
|
||||
@property (nonatomic, assign) CGSize size;
|
||||
@end
|
||||
|
||||
@implementation YXShadow
|
||||
- (void)encodeWithCoder:(NSCoder *)aCoder { [self yx_modelEncodeWithCoder:aCoder]; }
|
||||
- (id)initWithCoder:(NSCoder *)aDecoder { self = [super init]; return [self
|
||||
yx_modelInitWithCoder:aDecoder]; }
|
||||
- (id)copyWithZone:(NSZone *)zone { return [self yx_modelCopy]; }
|
||||
- (NSUInteger)hash { return [self yx_modelHash]; }
|
||||
- (BOOL)isEqual:(id)object { return [self yx_modelIsEqual:object]; }
|
||||
@end
|
||||
|
||||
*/
|
||||
@interface NSObject (YXModel)
|
||||
|
||||
/**
|
||||
Creates and returns a new instance of the receiver from a json.
|
||||
This method is thread-safe.
|
||||
|
||||
@param json A json object in `NSDictionary`, `NSString` or `NSData`.
|
||||
|
||||
@return A new instance created from the json, or nil if an error occurs.
|
||||
*/
|
||||
+ (nullable instancetype)yx_modelWithJSON:(id)json;
|
||||
|
||||
/**
|
||||
Creates and returns a new instance of the receiver from a key-value dictionary.
|
||||
This method is thread-safe.
|
||||
|
||||
@param dictionary A key-value dictionary mapped to the instance's properties.
|
||||
Any invalid key-value pair in dictionary will be ignored.
|
||||
|
||||
@return A new instance created from the dictionary, or nil if an error occurs.
|
||||
|
||||
@discussion The key in `dictionary` will mapped to the reciever's property name,
|
||||
and the value will set to the property. If the value's type does not match the
|
||||
property, this method will try to convert the value based on these rules:
|
||||
|
||||
`NSString` or `NSNumber` -> c number, such as BOOL, int, long, float, NSUInteger...
|
||||
`NSString` -> NSDate, parsed with format "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd HH:mm:ss" or
|
||||
"yyyy-MM-dd". `NSString` -> NSURL. `NSValue` -> struct or union, such as CGRect, CGSize, ...
|
||||
`NSString` -> SEL, Class.
|
||||
*/
|
||||
+ (nullable instancetype)yx_modelWithDictionary:(NSDictionary *)dictionary;
|
||||
|
||||
/**
|
||||
Set the receiver's properties with a json object.
|
||||
|
||||
@discussion Any invalid data in json will be ignored.
|
||||
|
||||
@param json A json object of `NSDictionary`, `NSString` or `NSData`, mapped to the
|
||||
receiver's properties.
|
||||
|
||||
@return Whether succeed.
|
||||
*/
|
||||
- (BOOL)yx_modelSetWithJSON:(id)json;
|
||||
|
||||
/**
|
||||
Set the receiver's properties with a key-value dictionary.
|
||||
|
||||
@param dic A key-value dictionary mapped to the receiver's properties.
|
||||
Any invalid key-value pair in dictionary will be ignored.
|
||||
|
||||
@discussion The key in `dictionary` will mapped to the reciever's property name,
|
||||
and the value will set to the property. If the value's type doesn't match the
|
||||
property, this method will try to convert the value based on these rules:
|
||||
|
||||
`NSString`, `NSNumber` -> c number, such as BOOL, int, long, float, NSUInteger...
|
||||
`NSString` -> NSDate, parsed with format "yyyy-MM-dd'T'HH:mm:ssZ", "yyyy-MM-dd HH:mm:ss" or
|
||||
"yyyy-MM-dd". `NSString` -> NSURL. `NSValue` -> struct or union, such as CGRect, CGSize, ...
|
||||
`NSString` -> SEL, Class.
|
||||
|
||||
@return Whether succeed.
|
||||
*/
|
||||
- (BOOL)yx_modelSetWithDictionary:(NSDictionary *)dic;
|
||||
|
||||
/**
|
||||
Generate a json object from the receiver's properties.
|
||||
|
||||
@return A json object in `NSDictionary` or `NSArray`, or nil if an error occurs.
|
||||
See [NSJSONSerialization isValidJSONObject] for more information.
|
||||
|
||||
@discussion Any of the invalid property is ignored.
|
||||
If the reciver is `NSArray`, `NSDictionary` or `NSSet`, it just convert
|
||||
the inner object to json object.
|
||||
*/
|
||||
- (nullable id)yx_modelToJSONObject;
|
||||
|
||||
/**
|
||||
Generate a json string's data from the receiver's properties.
|
||||
|
||||
@return A json string's data, or nil if an error occurs.
|
||||
|
||||
@discussion Any of the invalid property is ignored.
|
||||
If the reciver is `NSArray`, `NSDictionary` or `NSSet`, it will also convert the
|
||||
inner object to json string.
|
||||
*/
|
||||
- (nullable NSData *)yx_modelToJSONData;
|
||||
|
||||
/**
|
||||
Generate a json string from the receiver's properties.
|
||||
|
||||
@return A json string, or nil if an error occurs.
|
||||
|
||||
@discussion Any of the invalid property is ignored.
|
||||
If the reciver is `NSArray`, `NSDictionary` or `NSSet`, it will also convert the
|
||||
inner object to json string.
|
||||
*/
|
||||
- (nullable NSString *)yx_modelToJSONString;
|
||||
|
||||
/**
|
||||
Copy a instance with the receiver's properties.
|
||||
|
||||
@return A copied instance, or nil if an error occurs.
|
||||
*/
|
||||
- (nullable id)yx_modelCopy;
|
||||
|
||||
/**
|
||||
Encode the receiver's properties to a coder.
|
||||
|
||||
@param aCoder An archiver object.
|
||||
*/
|
||||
- (void)yx_modelEncodeWithCoder:(NSCoder *)aCoder;
|
||||
|
||||
/**
|
||||
Decode the receiver's properties from a decoder.
|
||||
|
||||
@param aDecoder An archiver object.
|
||||
|
||||
@return self
|
||||
*/
|
||||
- (id)yx_modelInitWithCoder:(NSCoder *)aDecoder;
|
||||
|
||||
/**
|
||||
Get a hash code with the receiver's properties.
|
||||
|
||||
@return Hash code.
|
||||
*/
|
||||
- (NSUInteger)yx_modelHash;
|
||||
|
||||
/**
|
||||
Compares the receiver with another object for equality, based on properties.
|
||||
|
||||
@param model Another object.
|
||||
|
||||
@return `YES` if the reciever is equal to the object, otherwise `NO`.
|
||||
*/
|
||||
- (BOOL)yx_modelIsEqual:(id)model;
|
||||
|
||||
/**
|
||||
Description method for debugging purposes based on properties.
|
||||
|
||||
@return A string that describes the contents of the receiver.
|
||||
*/
|
||||
- (NSString *)yx_modelDescription;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
Provide some data-model method for NSArray.
|
||||
*/
|
||||
@interface NSArray (YXModel)
|
||||
|
||||
/**
|
||||
Creates and returns an array from a json-array.
|
||||
This method is thread-safe.
|
||||
|
||||
@param cls The instance's class in array.
|
||||
@param json A json array of `NSArray`, `NSString` or `NSData`.
|
||||
Example: [{"name","Mary"},{name:"Joe"}]
|
||||
|
||||
@return A array, or nil if an error occurs.
|
||||
*/
|
||||
+ (nullable NSArray *)yx_modelArrayWithClass:(Class)cls json:(id)json;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
Provide some data-model method for NSDictionary.
|
||||
*/
|
||||
@interface NSDictionary (YXModel)
|
||||
|
||||
/**
|
||||
Creates and returns a dictionary from a json.
|
||||
This method is thread-safe.
|
||||
|
||||
@param cls The value instance's class in dictionary.
|
||||
@param json A json dictionary of `NSDictionary`, `NSString` or `NSData`.
|
||||
Example: {"user1":{"name","Mary"}, "user2": {name:"Joe"}}
|
||||
|
||||
@return A dictionary, or nil if an error occurs.
|
||||
*/
|
||||
+ (nullable NSDictionary *)yx_modelDictionaryWithClass:(Class)cls json:(id)json;
|
||||
@end
|
||||
|
||||
/**
|
||||
If the default model transform does not fit to your model class, implement one or
|
||||
more method in this protocol to change the default key-value transform process.
|
||||
There's no need to add '<YXModel>' to your class header.
|
||||
*/
|
||||
@protocol YXModel <NSObject>
|
||||
@optional
|
||||
|
||||
/**
|
||||
Custom property mapper.
|
||||
|
||||
@discussion If the key in JSON/Dictionary does not match to the model's property name,
|
||||
implements this method and returns the additional mapper.
|
||||
|
||||
Example:
|
||||
|
||||
json:
|
||||
{
|
||||
"n":"Harry Pottery",
|
||||
"p": 256,
|
||||
"ext" : {
|
||||
"desc" : "A book written by J.K.Rowling."
|
||||
},
|
||||
"ID" : 100010
|
||||
}
|
||||
|
||||
model:
|
||||
@interface YXBook : NSObject
|
||||
@property NSString *name;
|
||||
@property NSInteger page;
|
||||
@property NSString *desc;
|
||||
@property NSString *bookID;
|
||||
@end
|
||||
|
||||
@implementation YXBook
|
||||
+ (NSDictionary *)modelCustomPropertyMapper {
|
||||
return @{@"name" : @"n",
|
||||
@"page" : @"p",
|
||||
@"desc" : @"ext.desc",
|
||||
@"bookID": @[@"id", @"ID", @"book_id"]};
|
||||
}
|
||||
@end
|
||||
|
||||
@return A custom mapper for properties.
|
||||
*/
|
||||
+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper;
|
||||
|
||||
/**
|
||||
The generic class mapper for container properties.
|
||||
|
||||
@discussion If the property is a container object, such as NSArray/NSSet/NSDictionary,
|
||||
implements this method and returns a property->class mapper, tells which kind of
|
||||
object will be add to the array/set/dictionary.
|
||||
|
||||
Example:
|
||||
@class YXShadow, YXBorder, YXAttachment;
|
||||
|
||||
@interface YXAttributes
|
||||
@property NSString *name;
|
||||
@property NSArray *shadows;
|
||||
@property NSSet *borders;
|
||||
@property NSDictionary *attachments;
|
||||
@end
|
||||
|
||||
@implementation YXAttributes
|
||||
+ (NSDictionary *)modelContainerPropertyGenericClass {
|
||||
return @{@"shadows" : [YXShadow class],
|
||||
@"borders" : YXBorder.class,
|
||||
@"attachments" : @"YXAttachment" };
|
||||
}
|
||||
@end
|
||||
|
||||
@return A class mapper.
|
||||
*/
|
||||
+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass;
|
||||
|
||||
/**
|
||||
If you need to create instances of different classes during json->object transform,
|
||||
use the method to choose custom class based on dictionary data.
|
||||
|
||||
@discussion If the model implements this method, it will be called to determine resulting class
|
||||
during `+modelWithJSON:`, `+modelWithDictionary:`, conveting object of properties of parent objects
|
||||
(both singular and containers via `+modelContainerPropertyGenericClass`).
|
||||
|
||||
Example:
|
||||
@class YXCircle, YXRectangle, YXLine;
|
||||
|
||||
@implementation YXShape
|
||||
|
||||
+ (Class)modelCustomClassForDictionary:(NSDictionary*)dictionary {
|
||||
if (dictionary[@"radius"] != nil) {
|
||||
return [YXCircle class];
|
||||
} else if (dictionary[@"width"] != nil) {
|
||||
return [YXRectangle class];
|
||||
} else if (dictionary[@"y2"] != nil) {
|
||||
return [YXLine class];
|
||||
} else {
|
||||
return [self class];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@param dictionary The json/kv dictionary.
|
||||
|
||||
@return Class to create from this dictionary, `nil` to use current class.
|
||||
|
||||
*/
|
||||
+ (nullable Class)modelCustomClassForDictionary:(NSDictionary *)dictionary;
|
||||
|
||||
/**
|
||||
All the properties in blacklist will be ignored in model transform process.
|
||||
Returns nil to ignore this feature.
|
||||
|
||||
@return An array of property's name.
|
||||
*/
|
||||
+ (nullable NSArray<NSString *> *)modelPropertyBlacklist;
|
||||
|
||||
/**
|
||||
If a property is not in the whitelist, it will be ignored in model transform process.
|
||||
Returns nil to ignore this feature.
|
||||
|
||||
@return An array of property's name.
|
||||
*/
|
||||
+ (nullable NSArray<NSString *> *)modelPropertyWhitelist;
|
||||
|
||||
/**
|
||||
This method's behavior is similar to `- (BOOL)modelCustomTransformFromDictionary:(NSDictionary
|
||||
*)dic;`, but be called before the model transform.
|
||||
|
||||
@discussion If the model implements this method, it will be called before
|
||||
`+modelWithJSON:`, `+modelWithDictionary:`, `-modelSetWithJSON:` and `-modelSetWithDictionary:`.
|
||||
If this method returns nil, the transform process will ignore this model.
|
||||
|
||||
@param dic The json/kv dictionary.
|
||||
|
||||
@return Returns the modified dictionary, or nil to ignore this model.
|
||||
*/
|
||||
- (NSDictionary *)modelCustomWillTransformFromDictionary:(NSDictionary *)dic;
|
||||
|
||||
/**
|
||||
If the default json-to-model transform does not fit to your model object, implement
|
||||
this method to do additional process. You can also use this method to validate the
|
||||
model's properties.
|
||||
|
||||
@discussion If the model implements this method, it will be called at the end of
|
||||
`+modelWithJSON:`, `+modelWithDictionary:`, `-modelSetWithJSON:` and `-modelSetWithDictionary:`.
|
||||
If this method returns NO, the transform process will ignore this model.
|
||||
|
||||
@param dic The json/kv dictionary.
|
||||
|
||||
@return Returns YES if the model is valid, or NO to ignore this model.
|
||||
*/
|
||||
- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic;
|
||||
|
||||
/**
|
||||
If the default model-to-json transform does not fit to your model class, implement
|
||||
this method to do additional process. You can also use this method to validate the
|
||||
json dictionary.
|
||||
|
||||
@discussion If the model implements this method, it will be called at the end of
|
||||
`-modelToJSONObject` and `-modelToJSONString`.
|
||||
If this method returns NO, the transform process will ignore this json dictionary.
|
||||
|
||||
@param dic The json dictionary.
|
||||
|
||||
@return Returns YES if the model is valid, or NO to ignore this model.
|
||||
*/
|
||||
- (BOOL)modelCustomTransformToDictionary:(NSMutableDictionary *)dic;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,25 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ReportConfig : NSObject
|
||||
|
||||
@property(nonatomic, strong) NSString *appKey;
|
||||
// Rtc SDK 版本
|
||||
@property(nonatomic, strong) NSString *nertcVersion;
|
||||
// IM SDK 版本
|
||||
@property(nonatomic, strong) NSString *imVersion;
|
||||
|
||||
@property(nonatomic, assign) NSInteger cacheCount;
|
||||
// 组件平台信息,开发者无需关心
|
||||
@property(nonatomic, strong) NSString *framework;
|
||||
// 组件平台信息,开发者无需关心
|
||||
@property(nonatomic, strong) NSString *channel;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,33 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/// 事件优先级
|
||||
typedef NS_ENUM(NSInteger, NECoreEventPriority) {
|
||||
/// 低优先级
|
||||
NECoreEventPriorityLow,
|
||||
/// 中优先级
|
||||
NECoreEventPriorityNormal,
|
||||
/// 高优先级
|
||||
NECoreEventPriorityHigh
|
||||
};
|
||||
|
||||
@protocol NECoreEvent <NSObject>
|
||||
- (NSString *)eventId;
|
||||
- (NECoreEventPriority)priorty;
|
||||
- (NSDictionary<NSString *, id> *)toMap;
|
||||
@end
|
||||
|
||||
@protocol NECoreEventPropertyProvider <NSObject>
|
||||
+ (NSDictionary<NSString *, id> *)provideProperties;
|
||||
@end
|
||||
|
||||
@interface NECoreRawEvent : NSObject <NECoreEvent>
|
||||
|
||||
@property(nonatomic, copy, readonly) NSDictionary<NSString *, id> *data;
|
||||
- (instancetype)initWithEventId:(NSString *)eventId
|
||||
priority:(NECoreEventPriority)priority
|
||||
data:(NSDictionary<NSString *, id> *)data;
|
||||
@end
|
||||
@ -1,27 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface ReportModuleInfo : NSObject
|
||||
|
||||
@property(nonatomic, copy) NSString *serviceName;
|
||||
|
||||
@property(nonatomic, copy) NSString *versionName;
|
||||
|
||||
@property(nonatomic, copy, nullable) NSString *appkey;
|
||||
@property(nonatomic, copy, nullable) NSString *framework;
|
||||
@property(nonatomic, copy, nullable) NSString *channel;
|
||||
|
||||
- (instancetype)initWithName:(NSString *)name
|
||||
version:(NSString *)version
|
||||
appKey:(NSString *__nullable)appKey
|
||||
framework:(NSString *__nullable)framework
|
||||
channel:(NSString *__nullable)channel;
|
||||
- (NSDictionary *)toMap;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XKitService <NSObject>
|
||||
@optional
|
||||
@property(nonatomic, strong) NSString *serviceName;
|
||||
|
||||
@property(nonatomic, strong) NSString *versionName;
|
||||
|
||||
@property(nonatomic, strong) NSString *appKey;
|
||||
|
||||
- (id)onMethodCall:(NSString *)method param:(NSDictionary *)param;
|
||||
|
||||
@end
|
||||
|
||||
@interface XKit : NSObject
|
||||
|
||||
+ (instancetype)instance;
|
||||
+ (void)setDefaultKey:(NSString *)appKey;
|
||||
- (void)registerService:(id<XKitService>)service;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,14 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XKitDeviceId : NSObject
|
||||
/// 设备UUID
|
||||
+ (NSString *)deviceId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "ReportEvent.h"
|
||||
|
||||
@interface XKitSDKVersionsProvider : NSObject <NECoreEventPropertyProvider>
|
||||
|
||||
@end
|
||||
|
||||
@interface XKitApplicationInfoProvider : NSObject <NECoreEventPropertyProvider>
|
||||
|
||||
@end
|
||||
|
||||
@interface XKitDeviceInfoProvider : NSObject <NECoreEventPropertyProvider>
|
||||
|
||||
@end
|
||||
|
||||
@interface XKitNetworkTypeProvider : NSObject <NECoreEventPropertyProvider>
|
||||
|
||||
@end
|
||||
@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "XKitLogOptions.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XKitLog : NSObject
|
||||
|
||||
+ (XKitLog *)setUp:(XKitLogOptions *)options;
|
||||
|
||||
- (void)apiLog:(NSString *)className desc:(NSString *)desc;
|
||||
|
||||
- (void)infoLog:(NSString *)className desc:(NSString *)desc;
|
||||
|
||||
- (void)warnLog:(NSString *)className desc:(NSString *)desc;
|
||||
|
||||
- (void)errorLog:(NSString *)className desc:(NSString *)desc;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2022 NetEase, Inc. All rights reserved.
|
||||
// Use of this source code is governed by a MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
/// 日志级别
|
||||
typedef enum {
|
||||
XKitLogLevelVerbose = 0,
|
||||
XKitLogLevelDebug,
|
||||
XKitLogLevelInfo,
|
||||
XKitLogLevelWarn,
|
||||
XKitLogLevelError,
|
||||
XKitLogLevelNone,
|
||||
} XKitLogLevel;
|
||||
|
||||
@interface XKitLogOptions : NSObject
|
||||
|
||||
@property(nonatomic, assign) XKitLogLevel level;
|
||||
@property(nonatomic, copy) NSString *moduleName;
|
||||
|
||||
/// 敏感词,匹配到之后日志会对其进行脱敏处理
|
||||
@property(nonatomic, strong) NSArray<NSString *> *sensitives;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user