/// 视频模块controller
library;

import 'package:get/get.dart';

class VideoModuleController extends GetxController {
  // tabbar
  RxInt layoutPageCurrent = 0.obs;
  void init() {
    layoutPageCurrent.value = 0;
    videoTabIndex.value = 2;
    videoPlayIndex.value = 0;
    videoPlayFriend.value = 0;
    videoPlayIndexFoucs.value = 0;
    needRefresh.value = true;
  }

  // 更新tabbar
  void updateLayoutPage(int index) {
    layoutPageCurrent.value = index;
  }

  // 顶部tab索引(短视频模块)
  RxInt videoTabIndex = 2.obs;
  // 更新
  void updateVideoTabIndex(index) {
    videoTabIndex.value = index;
    update();
  }

  // 推荐视频索引
  RxInt videoPlayIndex = 0.obs;

  void updateVideoPlayIndex(index) {
    videoPlayIndex.value = index;
    update();
  }

  // 朋友视频索引
  RxInt videoPlayFriend = 0.obs;

  void updateVideoPlayIndex1(index) {
    videoPlayFriend.value = index;
    update();
  }

  // 关注视频索引
  RxInt videoPlayIndexFoucs = 0.obs;

  void updateVideoPlayIndex2(index) {
    videoPlayIndexFoucs.value = index;
    update();
  }

  // 登录成功后是否需要刷新视频页
  RxBool needRefresh = false.obs;

  void markNeedRefresh() {
    needRefresh.value = true;
  }

  void clearNeedRefresh() {
    needRefresh.value = false;
  }
}
