fix: 星图:1,统一项目中星图配置获取途径及有变化更新loginData2,星图:完成修复及验证APP首次注册账号登录后未上线导致呼叫对讲无反应问题
This commit is contained in:
parent
d2b3ce2a3b
commit
492b2e713d
@ -1,4 +1,5 @@
|
|||||||
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
import 'package:star_lock/mine/minePersonInfo/minePersonInfoPage/minePersonInfo_entity.dart';
|
||||||
|
import 'package:star_lock/talk/starChart/entity/star_chart_register_node_entity.dart';
|
||||||
|
|
||||||
class LoginData {
|
class LoginData {
|
||||||
LoginData(
|
LoginData(
|
||||||
@ -63,4 +64,13 @@ class LoginData {
|
|||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateStarchart(
|
||||||
|
StarChartRegisterNodeEntity starChartRegisterNodeEntity) {
|
||||||
|
starchart = Starchart(
|
||||||
|
starchartId: starChartRegisterNodeEntity.peer?.id,
|
||||||
|
starchartPeerPublicKey: starChartRegisterNodeEntity.peer?.publicKey,
|
||||||
|
starchartPeerPrivateKey: starChartRegisterNodeEntity.peer?.privateKey,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,17 +58,22 @@ class StarLockLoginLogic extends BaseGetXController {
|
|||||||
'login_res': '成功',
|
'login_res': '成功',
|
||||||
});
|
});
|
||||||
|
|
||||||
Storage.saveLoginData(entity.data);
|
|
||||||
Storage.setBool(saveIsVip, entity.data!.isVip == 1);
|
|
||||||
//如已有星图配置则保存 无需重复注册节点及重复绑定
|
//如已有星图配置则保存 无需重复注册节点及重复绑定
|
||||||
if (entity.data!.starchart != null) {
|
if (entity.data!.starchart != null) {
|
||||||
final Starchart starChart = entity.data!.starchart!;
|
final Starchart starChart = entity.data!.starchart!;
|
||||||
Storage.saveStarChartRegisterNodeInfo(StarChartRegisterNodeEntity(
|
final StarChartRegisterNodeEntity starChartRegisterNodeEntity =
|
||||||
peer: PeerData(
|
StarChartRegisterNodeEntity(
|
||||||
id: starChart.starchartId,
|
peer: PeerData(
|
||||||
publicKey: starChart.starchartPeerPublicKey,
|
id: starChart.starchartId,
|
||||||
privateKey: starChart.starchartPeerPrivateKey)));
|
publicKey: starChart.starchartPeerPublicKey,
|
||||||
|
privateKey: starChart.starchartPeerPrivateKey,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
Storage.saveStarChartRegisterNodeInfo(starChartRegisterNodeEntity);
|
||||||
|
entity.data!.updateStarchart(starChartRegisterNodeEntity);
|
||||||
}
|
}
|
||||||
|
Storage.saveLoginData(entity.data);
|
||||||
|
Storage.setBool(saveIsVip, entity.data!.isVip == 1);
|
||||||
eventBus.fire(MineInfoChangeRefreshUI());
|
eventBus.fire(MineInfoChangeRefreshUI());
|
||||||
if (Get.isRegistered<LockMainLogic>()) {
|
if (Get.isRegistered<LockMainLogic>()) {
|
||||||
Get.find<LockMainLogic>().getStarLockInfo(isUnShowLoading: true);
|
Get.find<LockMainLogic>().getStarLockInfo(isUnShowLoading: true);
|
||||||
|
|||||||
@ -53,9 +53,11 @@ class LockMainXHJLogic extends BaseGetXController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (entity.data!.starchart != null) {
|
if (entity.data!.starchart != null) {
|
||||||
if (entity.data!.starchart!.starchartId!.isEmpty) {
|
if (entity.data!.starchart!.starchartId == null) {
|
||||||
bindStarChart();
|
bindStarChart();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
StartChartManage().init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -146,23 +146,23 @@ class StartChartManage {
|
|||||||
await _requestStarChartRegisterNode();
|
await _requestStarChartRegisterNode();
|
||||||
await _saveStarChartRegisterNodeToStorage(requestStarChartRegisterNode);
|
await _saveStarChartRegisterNodeToStorage(requestStarChartRegisterNode);
|
||||||
FromPeerId = requestStarChartRegisterNode.peer!.id ?? '';
|
FromPeerId = requestStarChartRegisterNode.peer!.id ?? '';
|
||||||
bindUserStarchart();
|
bindUserStarchart(requestStarChartRegisterNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//绑定星图配置
|
//绑定星图配置
|
||||||
Future<void> bindUserStarchart() async {
|
Future<void> bindUserStarchart(
|
||||||
|
StarChartRegisterNodeEntity requestStarChartRegisterNode) async {
|
||||||
try {
|
try {
|
||||||
final StarChartRegisterNodeEntity? registerNodeEntity =
|
|
||||||
await Storage.getStarChartRegisterNodeInfo();
|
|
||||||
|
|
||||||
final LoginEntity entity = await ApiRepository.to.bindUserStarchart(
|
final LoginEntity entity = await ApiRepository.to.bindUserStarchart(
|
||||||
starchartId: registerNodeEntity?.peer?.id ?? '',
|
starchartId: requestStarChartRegisterNode.peer?.id ?? '',
|
||||||
starchartPeerPublicKey: registerNodeEntity?.peer?.publicKey ?? '',
|
starchartPeerPublicKey:
|
||||||
starchartPeerPrivateKey: registerNodeEntity?.peer?.privateKey ?? '',
|
requestStarChartRegisterNode.peer?.publicKey ?? '',
|
||||||
|
starchartPeerPrivateKey:
|
||||||
|
requestStarChartRegisterNode.peer?.privateKey ?? '',
|
||||||
);
|
);
|
||||||
registerNodeEntity?.peer?.id = entity.data?.starchart?.starchartId;
|
requestStarChartRegisterNode.peer?.id =
|
||||||
await Storage.saveStarChartRegisterNodeInfo(registerNodeEntity!);
|
entity.data?.starchart?.starchartId;
|
||||||
if (entity.errorCode!.codeIsSuccessful) {
|
if (entity.errorCode!.codeIsSuccessful) {
|
||||||
AppLog.log('绑定成功');
|
AppLog.log('绑定成功');
|
||||||
} else {
|
} else {
|
||||||
@ -762,6 +762,9 @@ class StartChartManage {
|
|||||||
StarChartRegisterNodeEntity starChartRegisterNodeEntity) async {
|
StarChartRegisterNodeEntity starChartRegisterNodeEntity) async {
|
||||||
if (starChartRegisterNodeEntity != null) {
|
if (starChartRegisterNodeEntity != null) {
|
||||||
await Storage.saveStarChartRegisterNodeInfo(starChartRegisterNodeEntity);
|
await Storage.saveStarChartRegisterNodeInfo(starChartRegisterNodeEntity);
|
||||||
|
final LoginData? loginData = await Storage.getLoginData();
|
||||||
|
loginData?.updateStarchart(starChartRegisterNodeEntity);
|
||||||
|
Storage.saveLoginData(loginData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -779,9 +782,9 @@ class StartChartManage {
|
|||||||
final RelayInfoEntity? relayInfoEntity = await Storage.getRelayInfo();
|
final RelayInfoEntity? relayInfoEntity = await Storage.getRelayInfo();
|
||||||
|
|
||||||
// 获取公钥
|
// 获取公钥
|
||||||
final publicKey = await getPublicKey();
|
final String publicKey = await getPublicKey();
|
||||||
// 获取私钥
|
// 获取私钥
|
||||||
final privateKey = await getPrivateKey();
|
final String privateKey = await getPrivateKey();
|
||||||
// 生成签名
|
// 生成签名
|
||||||
final sign = await DoSign().generateSign(
|
final sign = await DoSign().generateSign(
|
||||||
currentTimestamp: relayInfoEntity!.time ?? 0,
|
currentTimestamp: relayInfoEntity!.time ?? 0,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user