Files
featherVoice/Pods/TIMPush/TIMPush.xcframework/ios-arm64/TIMPush.framework/Headers/TIMPushManager.h

228 lines
9.4 KiB
C
Raw Normal View History

2025-08-08 10:49:36 +08:00
//
// Copyright (c) 2023 Tencent. All rights reserved.
//
//
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <UserNotifications/UserNotifications.h>
@protocol TIMPushDelegate;
@protocol TIMPushListener;
@class TIMPushMessage;
NS_ASSUME_NONNULL_BEGIN
typedef void(^TIMPushCallback)(void);
typedef void(^TIMPushValueCallback)(NSString *value);
typedef void(^TIMPushSuccessCallback)(NSData * deviceToken);
typedef void(^TIMPushFailedCallback)(int code, NSString * desc);
typedef void(^TIMPushCallExperimentalAPISucc)(NSObject *object);
typedef void(^TIMPushNotificationExtensionCallback)(UNNotificationContent *content) API_AVAILABLE(macos(10.14), ios(10.0), watchos(3.0), tvos(10.0));
@interface TIMPushManager : NSObject
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// (一)注册/反注册推送服务
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 1.1
*
* @param sdkAppId SDKAPPID
* @param appKey secretKey
*
* @note
* - 使 sdkAppId appkey
* - IM IM appKey nil线.
*/
+ (void)registerPush:(int)sdkAppId appKey:(NSString *)appKey
succ:(TIMPushSuccessCallback)successCallback
fail:(TIMPushFailedCallback)failedCallback NS_EXTENSION_UNAVAILABLE_IOS("This API is not supported in App Extension");
/**
* 1.2
*
* @note
* - 退
* - 使 [TUILogin](https://github.com/TencentCloud/TIMSDK/blob/master/iOS/TUIKit/TUICore/TUILogin.h) 提供的 login/logout无需再调用该接口
*/
+ (void)unRegisterPush:(TIMPushCallback)successCallback
fail:(TIMPushFailedCallback)failedCallback
NS_EXTENSION_UNAVAILABLE_IOS("This API is not supported in App Extension");
/**
* 1.3 线 ID , RegistrationID
*
* @note
* - callback registerPush userId
* - userId ID
*
*/
+ (void)getRegistrationID:(TIMPushValueCallback)callback NS_EXTENSION_UNAVAILABLE_IOS("This API is not supported in App Extension");
/**
* 1.4 线使 ID , RegistrationID
*
* @param registrationID ID
*
*/
+ (void)setRegistrationID:(NSString *)registrationID callback:(TIMPushCallback)callback NS_EXTENSION_UNAVAILABLE_IOS("This API is not supported in App Extension");
/**
* 1.5
*
* @param disable YES NO
*
*/
+ (void)disablePostNotificationInForeground:(BOOL)disable NS_SWIFT_NAME(disablePostNotificationInForeground(disable:));
/**
* 1.6 API
*
* @param api
* @param param
* @note
*/
+ (void)callExperimentalAPI:(NSString *)api
param:(NSObject * _Nullable)param
succ:(TIMPushCallExperimentalAPISucc)succ
fail:(TIMPushFailedCallback)fail NS_EXTENSION_UNAVAILABLE_IOS("This API is not supported in App Extension");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// (二) Push 全局监听
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 2.1 Push
*/
+ (void)addPushListener:(id<TIMPushListener>)listener NS_SWIFT_NAME(addPushListener(listener:)) NS_EXTENSION_UNAVAILABLE_IOS("This API is not supported in App Extension");
/**
* 2.2. Push
*/
+ (void)removePushListener:(id<TIMPushListener>)listener NS_SWIFT_NAME(removePushListener(listener:)) NS_EXTENSION_UNAVAILABLE_IOS("This API is not supported in App Extension");
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// (三)统计 TIMPush 的推送抵达率
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* 3.1 TIMPush
*
* @note
* - Notification Service Extension '- didReceiveNotificationRequest:withContentHandler:'
* - appGroup APP Extension APP Group APP Capability App Groups
* - [https://cloud.tencent.com/document/product/269/100627#a76b331f-3d49-48c9-99a9-5301c7d7fa99]查阅详细步骤
*/
+ (void)handleNotificationServiceRequest:(UNNotificationRequest *)request appGroupID:(NSString *)appGroupID callback:(TIMPushNotificationExtensionCallback)callback NS_SWIFT_NAME(handleNotificationServiceRequest(request:appGroupID:callback:));
@end
@protocol TIMPushListener <NSObject>
/**
* Push
*
* @param message
*/
- (void)onRecvPushMessage:(TIMPushMessage *)message;
/**
* Push
*
* @param messageID
*/
- (void)onRevokePushMessage:(NSString *)messageID;
/**
*
*
* @param ext 线
*
*/
- (void)onNotificationClicked:(NSString *)ext;
@end
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// 离线推送证书配置 与 点击事件处理回调
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@protocol TIMPushDelegate <UIApplicationDelegate>
@optional
/**
* 线 ID
* AppDelegate.m IM ID
*
* ID使用时需要对应您的运行环境
* 使IDXcode上运行测试Debug
* 使ID Archive release
*/
- (int)businessID;
/**
* APP NSNotification Service Extension App Group ID []
* : iOS 10
* https://cloud.tencent.com/document/product/269/100624#ae5590eb-b974-4226-9f1b-720fb0201c85
*/
- (NSString *)applicationGroupID;
/**
* 线线
* AppDelegate
*
* @note
* - YES TIMPush TUIKit 线
* - NOTIMPush TUIKit 线 - navigateToBuiltInChatViewController:groupID:
*/
- (BOOL)onRemoteNotificationReceived:(nullable NSString *)notice;
/**
* 线
* AppDelegate
*
* @note
* - TIMPush 线 userID groupID
* - groupID 线
* - groupID userID 线
*/
- (void)navigateToBuiltInChatViewController:(nullable NSString *)userID
groupID:(nullable NSString *)groupID NS_SWIFT_NAME(navigateToBuiltInChatViewController(userID:groupID:));
@end
@interface TIMPushMessage : NSObject
// 离线推送标题
@property (nonatomic, copy) NSString *title;
// 离线推送内容
@property (nonatomic, copy) NSString *desc;
// 离线推送透传内容
@property (nonatomic, copy) NSString *ext;
// 消息唯一标识 ID
@property (nonatomic, copy) NSString *messageID;
@end
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// 状态码
//
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
typedef NS_ENUM(NSInteger, TIMPushErrorCode) {
TIMPushErrorUndefinedCode = -1, ///< 未知错误
TIMPushErrorNotLogined = 800001, ///< 注册 Push 之前,未登录 IM 账号
TIMPushErrorInvalidSdkAppId = 800002, ///< 注册 Push 参数 sdkAppID 不合法
TIMPushErrorRegisterPushInitFailed = 800003, ///< 初始化 SDK 失败
TIMPushErrorCallExperimentalApiFailed = 800015, ///< 实验性接口调用失败
TIMPushErrortNotificationAuthorizationDenied = 800016, ///< 用户拒绝推送获取弹窗权限
};
NS_ASSUME_NONNULL_END