2025-12-25 17:20:24 +08:00
|
|
|
//
|
|
|
|
|
// KBMaiPointReporter.h
|
|
|
|
|
// keyBoard
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
|
|
|
|
|
|
#ifndef KB_MAI_POINT_BASE_URL
|
2025-12-26 15:51:27 +08:00
|
|
|
#define KB_MAI_POINT_BASE_URL @"http://192.168.2.188:35310/api"
|
2025-12-25 17:20:24 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifndef KB_MAI_POINT_PATH_NEW_ACCOUNT
|
|
|
|
|
#define KB_MAI_POINT_PATH_NEW_ACCOUNT @"/newAccount"
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-12-30 15:27:35 +08:00
|
|
|
#ifndef KB_MAI_POINT_PATH_GENERIC_DATA
|
|
|
|
|
#define KB_MAI_POINT_PATH_GENERIC_DATA @"/genericData"
|
|
|
|
|
#endif
|
|
|
|
|
|
2025-12-25 17:20:24 +08:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
|
|
extern NSString * const KBMaiPointErrorDomain;
|
|
|
|
|
|
|
|
|
|
typedef void (^KBMaiPointReportCompletion)(BOOL success, NSError * _Nullable error);
|
|
|
|
|
|
2025-12-30 15:27:35 +08:00
|
|
|
typedef NS_ENUM(NSInteger, KBMaiPointGenericReportType) {
|
|
|
|
|
/// 未知/默认类型(按需扩展,具体含义以服务端约定为准)
|
|
|
|
|
KBMaiPointGenericReportTypeUnknown = 0,
|
|
|
|
|
/// 点击
|
|
|
|
|
KBMaiPointGenericReportTypeClick = 1,
|
|
|
|
|
/// 曝光
|
|
|
|
|
KBMaiPointGenericReportTypeExposure = 2,
|
|
|
|
|
/// 页面/进入
|
|
|
|
|
KBMaiPointGenericReportTypePage = 3,
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-25 17:20:24 +08:00
|
|
|
/// Lightweight reporter for Mai point tracking. Safe for app + extension.
|
|
|
|
|
@interface KBMaiPointReporter : NSObject
|
|
|
|
|
|
|
|
|
|
+ (instancetype)sharedReporter;
|
|
|
|
|
|
|
|
|
|
/// POST /newAccount with type + account.
|
|
|
|
|
- (void)reportNewAccountWithType:(NSString *)type
|
2025-12-30 15:27:35 +08:00
|
|
|
account:(nullable NSString *)account
|
2025-12-25 17:20:24 +08:00
|
|
|
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
|
|
|
|
|
2025-12-30 15:27:35 +08:00
|
|
|
//- (void)reportGenericDataWithEvent:(NSString *)event
|
|
|
|
|
// account:(nullable NSString *)account
|
|
|
|
|
// completion:(KBMaiPointReportCompletion _Nullable)completion;
|
|
|
|
|
|
|
|
|
|
/// POST /genericData with type + event + account.
|
|
|
|
|
- (void)reportGenericDataWithEventType:(KBMaiPointGenericReportType)type
|
|
|
|
|
account:(nullable NSString *)account
|
|
|
|
|
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
|
|
|
|
|
2025-12-25 17:20:24 +08:00
|
|
|
/// Generic POST for future endpoints.
|
|
|
|
|
- (void)postPath:(NSString *)path
|
|
|
|
|
parameters:(NSDictionary *)parameters
|
|
|
|
|
completion:(KBMaiPointReportCompletion _Nullable)completion;
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|