| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import 'dart:io';
- import 'package:clean/base/base_controller.dart';
- import 'package:clean/data/consts/constants.dart';
- import 'package:clean/dialog/privacy_dialog.dart';
- import 'package:clean/main.dart';
- import 'package:clean/module/main/main_view.dart';
- import 'package:clean/module/splash/intro/intro_view.dart';
- import 'package:flutter/Material.dart';
- import 'package:get/get.dart';
- import '../../data/consts/event_report_id.dart';
- import '../../handler/event_handler.dart';
- class SplashController extends BaseController {
- Animation<double>? animation;
- @override
- void onInit() {
- super.onInit();
- }
- @override
- void onReady() {
- print('SplashController onReady');
- super.onReady();
- final isAgreePrivacy = isAgreePrivacyPolicy();
- if (isAgreePrivacy) {
- onAgreePrivacy();
- EventHandler.report(EventId.event_01000);
- } else {
- Future.delayed(const Duration(seconds: 2), () {
- privacyDialog(
- onAgree: () {
- setPrivacyPolicy(true);
- onAgreePrivacy();
- EventHandler.report(EventId.event_01002);
- },
- onDisagree: () {
- setPrivacyPolicy(false);
- exit(0);
- },
- );
- });
- }
- }
- // 已经同意隐私
- void onAgreePrivacy() async {
- await initAfterGrant();
- Future.delayed(const Duration(seconds: 2), () {
- if (isFirstIntro()) {
- IntroPage.start();
- } else {
- MainTabPage.start();
- }
- });
- }
- @override
- void onClose() {
- print('SplashController onClose');
- super.onClose();
- }
- }
|