/*
 * @Author: XianKaiQun
 * @Date: 2020-04-21 15:20:44
 * @LastEditors  : WuWei
 * @LastEditTime : 2023-07-05 16:05:46
 * @Descripttion: 
 */
part of 'index.dart';

class _Store with ChangeNotifier {
  final BuildContext context;
//这是获取路由传参的例子
//Map args;
//_Store(this.context) {
//args = ModalRoute.of(context).settings.arguments??{};
//}
  _Store(this.context);

  ///极光推送初始化

  final appGlobalStore = GetIt.I.get<AppGlobalStore>();

  onInit() async {
    // GetIt.I.get<PushGlobalStore>().setup();
    await UpdateAppStore.instance.getUpdateInfo();
    onGetPageSet();
  }

  int currentIndex = 0;

  changeCurrentIndex(i) {
    appGlobalStore.onSetCurrentPage(i);
    if (currentIndex != i) {
      currentIndex = i;
      notifyListeners();
    }
  }

  List appList = [];

  /// app页面设置列表
  Future onGetPageSet() async {
    var res = await appGlobalStore.getPageSettingList();
    appList = res;
    appGlobalStore.onSetCurrentPage(0);
    notifyListeners();
  }

  /// app页面设置详情
  // Future getPageSetting(id) async {
  //   var res = await RootApi.getAppPageSettingDetail(id);
  //   print(res);
  // }
}
