|
|
@@ -12,7 +12,6 @@ import 'package:electronic_assistant/utils/app_info_util.dart';
|
|
|
import 'package:electronic_assistant/device/device_info_util.dart';
|
|
|
import 'package:electronic_assistant/utils/desktop_shortcut_utils.dart';
|
|
|
import 'package:electronic_assistant/utils/mmkv_util.dart';
|
|
|
-import 'package:electronic_assistant/utils/notification_util.dart';
|
|
|
import 'package:electronic_assistant/utils/toast_util.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
|
|
|
@@ -57,10 +56,30 @@ void checkEnv() {
|
|
|
|
|
|
initChannel() async {
|
|
|
await AtmobChannelReader.default4Test(Constants.appDefaultChannel,
|
|
|
- Constants.appDefaultTgPlatformId, Constants.appDefaultAppId);
|
|
|
- atmobPlatformInfo.setChannelName(await AtmobChannelReader.getChannel());
|
|
|
- atmobPlatformInfo.setTgPlatform(await AtmobChannelReader.getTgPlatformId());
|
|
|
- atmobPlatformInfo.setAppId(await AtmobChannelReader.getAppId());
|
|
|
+ Constants.appDefaultAppId, Constants.appDefaultTgPlatformId);
|
|
|
+
|
|
|
+ String? channel = KVUtil.getString(
|
|
|
+ Constants.appChanelName, await AtmobChannelReader.getChannel());
|
|
|
+ KVUtil.putString(Constants.appChanelName, channel);
|
|
|
+
|
|
|
+ int? channelId = KVUtil.getInt(Constants.appChannelId, -1);
|
|
|
+ if (channelId == -1) {
|
|
|
+ channelId = await AtmobChannelReader.getAppId();
|
|
|
+ }
|
|
|
+ if (channelId != null) {
|
|
|
+ KVUtil.putInt(Constants.appChannelId, channelId);
|
|
|
+ }
|
|
|
+
|
|
|
+ int? appTgPlatformId = KVUtil.getInt(Constants.appTgPlatformId, -1);
|
|
|
+ if (appTgPlatformId == -1) {
|
|
|
+ appTgPlatformId = await AtmobChannelReader.getTgPlatformId();
|
|
|
+ }
|
|
|
+ if (appTgPlatformId != null) {
|
|
|
+ KVUtil.putInt(Constants.appTgPlatformId, appTgPlatformId);
|
|
|
+ }
|
|
|
+ atmobPlatformInfo.setChannelName(channel);
|
|
|
+ atmobPlatformInfo.setAppId(channelId);
|
|
|
+ atmobPlatformInfo.setTgPlatform(appTgPlatformId);
|
|
|
}
|
|
|
|
|
|
Future<void> initAfterGrant() async {
|