7_3-核心common-数据
1 概述
数据模块位于polyvLiveCommonModul模块的data包下,数据模块包括的数据有:配置数据、http数据、业务模块数据等。这里把这些数据统一称为直播间数据,并且使用PLVLiveRoomDataManager管理它们。
2 核心类介绍
2.1 PLVLiveRoomDataManager
直播间数据管理器,实现IPLVLiveRoomDataManager接口。负责调用IPLVLiveRoomDataRequester获取http数据,存放http数据、配置数据、以及各个业务模块间公用的数据,因此需要每个业务模块间持有同个直播间数据管理器对象。使用示例:
PLVLCCloudClassActivity
// 直播间数据管理器,每个业务初始化所需的参数
private IPLVLiveRoomDataManager liveRoomDataManager;
private void initLiveRoomManager() {
// 使用PLVLiveChannelConfigFiller配置好直播参数后,用其创建直播间数据管理器实例
liveRoomDataManager = new PLVLiveRoomDataManager(PLVLiveChannelConfigFiller.generateNewChannelConfig());
// 进行网络请求,获取上报观看热度
liveRoomDataManager.requestPageViewer();
// 进行网络请求,获取直播详情数据
liveRoomDataManager.requestChannelDetail();
// 进行网络请求,获取功能开关数据
liveRoomDataManager.requestChannelSwitch();
}2.2 IPLVLiveRoomDataManager
直播间数据管理器实现的接口。定义了:
1、获取config
2、本地数据获取、设置
3、http接口请求
4、销毁
Last updated
Was this helpful?