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