1,新增APP推送绑定设备ID接口
2,修改APP推送的标志字符串
This commit is contained in:
parent
d3eb981844
commit
707ebf9e9f
@ -10,11 +10,11 @@
|
||||
|
||||
|
||||
/** 信号通道,须与flutter里一致*/
|
||||
#define XSflutterMethodChannel @"flutter_native_ios"
|
||||
#define XSflutterMethodChannel @"talkPlugin"
|
||||
/** 交互方法字段名,须与flutter里一致*/
|
||||
#define XSflutterMethodSharePassword @"flutter_sharePassword_to_ios"//分享密码
|
||||
#define XSflutterMethodPresent @"flutter_present_to_ios"
|
||||
#define XSflutterMethodVideoTalk @"flutter_videoTalk_to_ios"//视频对讲
|
||||
#define XSflutterMethodVideoTalk @"videoTalk"//视频对讲
|
||||
|
||||
|
||||
#endif /* CommonDefine_h */
|
||||
|
||||
@ -22,7 +22,6 @@ import 'dart:io';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
void main() async {
|
||||
|
||||
await _setCommonServices();
|
||||
|
||||
// 设置国际化信息
|
||||
@ -31,7 +30,8 @@ void main() async {
|
||||
runApp(MyApp());
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
||||
SystemUiOverlayStyle systemUiOverlayStyle =
|
||||
const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
|
||||
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
|
||||
}
|
||||
}
|
||||
@ -135,16 +135,18 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver, BaseWidget {
|
||||
}
|
||||
|
||||
//暂不使用DeviceID推送
|
||||
_aliyunPush.getDeviceId().then((deviceId) {
|
||||
setState(() {
|
||||
_deviceId = deviceId;
|
||||
});
|
||||
_aliyunPush.getDeviceId().then((deviceId) async {
|
||||
final data = await Storage.getString('userLoginData');
|
||||
if (data!.isNotEmpty) {
|
||||
XSAliyunPushProvider()
|
||||
.pushBindDeviceID(deviceId, Platform.isAndroid ? 10 : 20);
|
||||
}
|
||||
});
|
||||
|
||||
//使用userid根据账号推送
|
||||
_aliyunPush.bindAccount(Storage.getUid().toString()).then((value) {
|
||||
print("得到了value$value");
|
||||
});
|
||||
// //使用userid根据账号推送
|
||||
// _aliyunPush.bindAccount(Storage.getUid().toString()).then((value) {
|
||||
// print("得到了value$value");
|
||||
// });
|
||||
}
|
||||
|
||||
@override
|
||||
@ -177,4 +179,4 @@ Future _setCommonServices() async {
|
||||
await Get.putAsync(() => PlatformInfoService().init());
|
||||
await Get.putAsync(() => DeviceInfoService().init());
|
||||
// Get.log(PlatformInfoService.to.info.version);
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ class SendElectronicKeyPage extends StatefulWidget {
|
||||
class _SendElectronicKeyPageState extends State<SendElectronicKeyPage> {
|
||||
final logic = Get.put(SendElectronicKeyLogic());
|
||||
final state = Get.find<SendElectronicKeyLogic>().state;
|
||||
static const methodChannel = MethodChannel('flutter_native_ios');
|
||||
static const methodChannel = MethodChannel('talkPlugin');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@ -30,7 +30,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
// with RouteAware
|
||||
final logic = Get.put(LockDetailLogic());
|
||||
final state = Get.find<LockDetailLogic>().state;
|
||||
static const methodChannel = MethodChannel('flutter_native_ios');
|
||||
static const methodChannel = MethodChannel('talkPlugin');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -369,7 +369,7 @@ class _LockDetailPageState extends State<LockDetailPage>
|
||||
"fromType": 3
|
||||
}); // Toast.show(msg: "功能暂未开放");
|
||||
|
||||
// tokNative('flutter_videoTalk_to_ios',
|
||||
// tokNative('videoTalk',
|
||||
// arguments: {'videoTalk': 'videoTalk'}).then((result) {
|
||||
// print('$result');
|
||||
// });
|
||||
|
||||
@ -28,7 +28,7 @@ class _PasswordKeyDetailPageState extends State<PasswordKeyDetailPage> {
|
||||
PasswordKeyListItem itemData = PasswordKeyListItem();
|
||||
late TextEditingController _inputPwdController;
|
||||
late TextEditingController _inputNameController;
|
||||
static const methodChannel = MethodChannel('flutter_native_ios');
|
||||
static const methodChannel = MethodChannel('talkPlugin');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:date_format/date_format.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@ -27,17 +26,19 @@ class PasswordKeyPerpetualPage extends StatefulWidget {
|
||||
final LockListInfoItemEntity getKeyInfo;
|
||||
|
||||
const PasswordKeyPerpetualPage(
|
||||
{Key? key, required this.type, required this.getKeyInfo}) : super(key: key);
|
||||
{Key? key, required this.type, required this.getKeyInfo})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<PasswordKeyPerpetualPage> createState() => _PasswordKeyPerpetualPageState();
|
||||
State<PasswordKeyPerpetualPage> createState() =>
|
||||
_PasswordKeyPerpetualPageState();
|
||||
}
|
||||
|
||||
class _PasswordKeyPerpetualPageState extends State<PasswordKeyPerpetualPage> {
|
||||
final TextEditingController _nameController = TextEditingController();
|
||||
final TextEditingController _pwdController = TextEditingController();
|
||||
final logic = Get.put(PasswordKeyPerpetualLogic());
|
||||
static const methodChannel = MethodChannel('flutter_native_ios');
|
||||
static const methodChannel = MethodChannel('talkPlugin');
|
||||
|
||||
late bool _isSendSuccess; //是否发送成功
|
||||
late bool _isPermanent; //是否永久
|
||||
|
||||
@ -144,4 +144,5 @@ abstract class Api {
|
||||
'/user/getUpToken'; //上传头像 先获取upToken 再调用updateUserInfo
|
||||
final String unbindPhoneTokenURL = '/user/unbindPhoneToken'; //获取解绑手机号Token
|
||||
final String unbindEmailTokenURL = '/user/unbindEmailToken'; //获取解绑邮箱Token
|
||||
final String pushBindAppIdURL = '/user/bindAppId'; //推送绑定APP设备
|
||||
}
|
||||
|
||||
@ -1332,6 +1332,11 @@ class ApiProvider extends BaseProvider {
|
||||
Future<Response> unbindEmailToken(String verificationCode) => post(
|
||||
unbindEmailTokenURL.toUrl,
|
||||
jsonEncode({"verificationCode": verificationCode}));
|
||||
|
||||
//推送绑定DeviceID
|
||||
Future<Response> pushBindAppId(String deviceId, int deviceType) => post(
|
||||
pushBindAppIdURL.toUrl,
|
||||
jsonEncode({"deviceId": deviceId, "deviceType": deviceType}));
|
||||
}
|
||||
|
||||
extension ExtensionString on String {
|
||||
|
||||
@ -1348,4 +1348,11 @@ class ApiRepository {
|
||||
final res = await apiProvider.unbindEmailToken(verificationCode);
|
||||
return MineUnbindPhoneOrEmailEntity.fromJson(res.body);
|
||||
}
|
||||
|
||||
//推送绑定DeviceID
|
||||
Future<MineUnbindPhoneOrEmailEntity> pushBindAppId(
|
||||
String deviceId, int deviceType) async {
|
||||
final res = await apiProvider.pushBindAppId(deviceId, deviceType);
|
||||
return MineUnbindPhoneOrEmailEntity.fromJson(res.body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:aliyun_push/aliyun_push.dart';
|
||||
import 'package:star_lock/network/api_repository.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import 'package:star_lock/tools/toast.dart';
|
||||
|
||||
class XSAliyunPushProvider {
|
||||
@ -113,4 +115,9 @@ class XSAliyunPushProvider {
|
||||
// message was in flight, we want to discard the reply rather than calling
|
||||
// setState to update our non-existent appearance.
|
||||
}
|
||||
|
||||
void pushBindDeviceID(String deviceID, int deviceType) async {
|
||||
var entity = await ApiRepository.to.pushBindAppId(deviceID, deviceType);
|
||||
if (entity.errorCode!.codeIsSuccessful) {}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user