
- Removed YuMi/Library/ (138 MB, not tracked) - Removed YuMi/Resources/ (23 MB, not tracked) - Removed old version assets (566 files, not tracked) - Excluded Pods/, xcuserdata/ and other build artifacts - Clean repository optimized for company server deployment
122 lines
2.7 KiB
Objective-C
122 lines
2.7 KiB
Objective-C
//
|
|
// BuglyManager.h
|
|
// YuMi
|
|
//
|
|
// Created by BuglyManager
|
|
// Copyright © 2024 YuMi. All rights reserved.
|
|
//
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@class BuglyManager;
|
|
|
|
/**
|
|
* BuglyManager 代理协议
|
|
* 用于监听卡顿和性能问题
|
|
*/
|
|
@protocol BuglyManagerDelegate <NSObject>
|
|
|
|
@optional
|
|
/**
|
|
* 检测到卡顿时的回调
|
|
* @param manager BuglyManager 实例
|
|
* @param duration 卡顿持续时间(秒)
|
|
*/
|
|
- (void)buglyManager:(BuglyManager *)manager didDetectLag:(NSTimeInterval)duration;
|
|
|
|
/**
|
|
* 检测到主线程阻塞时的回调
|
|
* @param manager BuglyManager 实例
|
|
* @param duration 阻塞持续时间(秒)
|
|
*/
|
|
- (void)buglyManager:(BuglyManager *)manager didDetectBlock:(NSTimeInterval)duration;
|
|
|
|
@end
|
|
|
|
/**
|
|
* Bugly 统一管理类
|
|
* 封装所有 Bugly 相关操作,提供统一的错误上报和性能监控接口
|
|
*/
|
|
@interface BuglyManager : NSObject
|
|
|
|
/**
|
|
* 单例访问方法
|
|
* @return BuglyManager 单例实例
|
|
*/
|
|
+ (instancetype)sharedManager;
|
|
|
|
/**
|
|
* 设置代理对象
|
|
*/
|
|
@property (nonatomic, assign) id<BuglyManagerDelegate> delegate;
|
|
|
|
/**
|
|
* 配置并启动 Bugly
|
|
* @param appId Bugly 应用 ID
|
|
* @param isDebug 是否为调试模式
|
|
*/
|
|
- (void)configureWithAppId:(NSString *)appId debug:(BOOL)isDebug;
|
|
|
|
/**
|
|
* 上报错误信息
|
|
* @param domain 错误域
|
|
* @param code 错误码
|
|
* @param userInfo 错误详细信息
|
|
*/
|
|
- (void)reportError:(NSString *)domain
|
|
code:(NSInteger)code
|
|
userInfo:(NSDictionary *)userInfo;
|
|
|
|
/**
|
|
* 上报业务错误(简化版)
|
|
* @param message 错误消息
|
|
* @param code 错误码
|
|
* @param context 错误上下文信息
|
|
*/
|
|
- (void)reportBusinessError:(NSString *)message
|
|
code:(NSInteger)code
|
|
context:(NSDictionary *)context;
|
|
|
|
/**
|
|
* 上报网络请求异常
|
|
* @param uid 用户ID
|
|
* @param api 接口路径
|
|
* @param code 错误码
|
|
* @param userInfo 额外信息
|
|
*/
|
|
- (void)reportNetworkError:(NSString *)uid
|
|
api:(NSString *)api
|
|
code:(NSInteger)code
|
|
userInfo:(NSDictionary *)userInfo;
|
|
|
|
/**
|
|
* 上报内购相关错误
|
|
* @param uid 用户ID
|
|
* @param transactionId 交易ID
|
|
* @param orderId 订单ID
|
|
* @param status 状态码
|
|
* @param context 上下文信息
|
|
*/
|
|
- (void)reportIAPError:(NSString *)uid
|
|
transactionId:(NSString *)transactionId
|
|
orderId:(NSString *)orderId
|
|
status:(NSInteger)status
|
|
context:(NSDictionary *)context;
|
|
|
|
/**
|
|
* 手动触发卡顿检测
|
|
*/
|
|
- (void)startLagDetection;
|
|
|
|
/**
|
|
* 模拟卡顿检测(测试用)
|
|
* 用于测试按钮,直接增加计数
|
|
*/
|
|
- (void)simulateLagDetection;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|