
主要变更: 1. 新增 EPMomentAPIHelper_Deprecated.h 和 EPMomentAPIHelper_Deprecated.m 文件,提供与旧版 Objective-C API 的兼容性。 2. 该文件已被 EPMomentAPISwiftHelper.swift 替代,保留仅供参考,后续可删除。 3. 更新 EPMomentListView 以使用新的 Swift 版本 API,提升代码的现代化和类型安全。 此更新旨在确保旧版 API 的平滑过渡,同时鼓励使用新的 Swift 实现。
45 lines
1.6 KiB
Objective-C
45 lines
1.6 KiB
Objective-C
//
|
|
// EPMomentAPIHelper_Deprecated.m
|
|
// YuMi
|
|
//
|
|
// Created by AI on 2025-10-10.
|
|
//
|
|
// ⚠️ DEPRECATED: 已被 EPMomentAPISwiftHelper.swift 替代
|
|
// 保留此文件仅供参考,后续可删除
|
|
|
|
#import <UIKit/UIKit.h>
|
|
#import "EPMomentAPIHelper_Deprecated.h"
|
|
#import "Api+Moments.h"
|
|
#import "AccountInfoStorage.h"
|
|
#import "BaseModel.h"
|
|
|
|
|
|
@implementation EPMomentAPIHelper
|
|
// [Api momentsRecommendList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
// if (code == 200 && data.data) {
|
|
// NSArray *array = [MomentsInfoModel modelsWithArray:data.data];
|
|
// if (completion) completion(array ?: @[], 200, @"success");
|
|
// } else {
|
|
// if (completion) completion(@[], code, msg);
|
|
// }
|
|
// } page:pageStr pageSize:pageSizeStr types:types];
|
|
|
|
- (void)fetchLatestMomentsWithNextID:(NSString *)nextID
|
|
completion:(void (^)(NSArray <MomentsInfoModel *>* _Nullable list, NSString *nextMomentID))completion
|
|
failure:(void(^)(NSInteger code, NSString * _Nullable msg))failure {
|
|
NSString *pageSizeStr = @"20";
|
|
NSString *types = @"0,2"; // 图片+文字
|
|
|
|
[Api momentsLatestList:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
|
MomentsListInfoModel *listInfo = [MomentsListInfoModel modelWithDictionary:data.data];
|
|
if (completion) completion(listInfo.dynamicList ?: @[],
|
|
listInfo.nextDynamicId);
|
|
} fail:^(NSInteger code, NSString * _Nullable msg) {
|
|
if (failure) failure(code, msg);
|
|
}] dynamicId:nextID pageSize:pageSizeStr types:types];
|
|
}
|
|
|
|
@end
|
|
|
|
|