# Conflicts:
#	lib/pages/tab_navigator.dart
pull/1/head
张萌 3 years ago
commit 9496071917

@ -44,6 +44,7 @@ class SAASAPI {
static _Vote vote = _Vote(); static _Vote vote = _Vote();
static _Facilities facilities = _Facilities(); static _Facilities facilities = _Facilities();
static _Bracelet bracelet = _Bracelet(); static _Bracelet bracelet = _Bracelet();
static _Updater updater = _Updater();
/// ///
static _ProfileApi profile = _ProfileApi(); static _ProfileApi profile = _ProfileApi();
@ -439,3 +440,10 @@ class _Facilities {
/// ///
String get cancel => '/app/user/facilities/cancel'; String get cancel => '/app/user/facilities/cancel';
} }
class _Updater{
///app
String get findNewVersion => '/app/version/findNewVersion';
///app
String get insert => '/app/version/insert';
}

@ -1,5 +1,4 @@
import 'package:aku_new_community/provider/old_age_provider.dart'; import 'package:aku_new_community/provider/old_age_provider.dart';
import 'package:aku_new_community/utils/updater_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

@ -18,6 +18,7 @@ import 'package:aku_new_community/utils/websocket/web_socket_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import 'account_manager_page.dart';
import 'feedback_page/feedback_page.dart'; import 'feedback_page/feedback_page.dart';
class SettingsPage extends StatefulWidget { class SettingsPage extends StatefulWidget {

@ -15,7 +15,6 @@ import 'package:aku_new_community/ui/market/market_page.dart';
import 'package:aku_new_community/utils/websocket/web_socket_util.dart'; import 'package:aku_new_community/utils/websocket/web_socket_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart'; import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:aku_new_community/widget/others/user_tool.dart'; import 'package:aku_new_community/widget/others/user_tool.dart';
import '../utils/updater_page.dart';
import 'home/home_page.dart'; import 'home/home_page.dart';
import 'opening_code_page/opening_code_page.dart'; import 'opening_code_page/opening_code_page.dart';
import 'personal/personal_page.dart'; import 'personal/personal_page.dart';
@ -50,7 +49,7 @@ class _TabNavigatorState extends State<TabNavigator>
flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin(); flutterLocalNotificationsPlugin = new FlutterLocalNotificationsPlugin();
var android = new AndroidInitializationSettings('@mipmap/ic_launcher'); var android = new AndroidInitializationSettings('@mipmap/ic_launcher');
var iOS = new IOSInitializationSettings(); var iOS = new IOSInitializationSettings();
var initSettings = new InitializationSettings(android: android, iOS: iOS); var initSettings = new InitializationSettings(android: android,iOS: iOS);
flutterLocalNotificationsPlugin.initialize(initSettings); flutterLocalNotificationsPlugin.initialize(initSettings);
//showNotification(); //showNotification();
@ -191,41 +190,42 @@ class _TabNavigatorState extends State<TabNavigator>
4, 4,
), ),
]; ];
return BeeScaffold( return
body: WillPopScope( BeeScaffold(
onWillPop: () async { body: WillPopScope(
if (_lastPressed == null || onWillPop: () async {
DateTime.now().difference(_lastPressed!) > Duration(seconds: 1)) { if (_lastPressed == null ||
//1 DateTime.now().difference(_lastPressed!) > Duration(seconds: 1)) {
_lastPressed = DateTime.now(); //1
BotToast.showText(text: '再点击一次返回退出'); _lastPressed = DateTime.now();
return false; BotToast.showText(text: '再点击一次返回退出');
} return false;
//app }
WebSocketUtil().closeWebSocket(); //app
return true; WebSocketUtil().closeWebSocket();
}, return true;
child: TabBarView( },
children: _pages, child: TabBarView(
controller: _tabController, children: _pages,
physics: NeverScrollableScrollPhysics(), controller: _tabController,
), physics: NeverScrollableScrollPhysics(),
), ),
bottomNavi: ConstrainedBox( ),
constraints: BoxConstraints(maxWidth: 750.w, maxHeight: 146.w), bottomNavi: ConstrainedBox(
child: Container( constraints: BoxConstraints(maxWidth: 750.w, maxHeight: 146.w),
margin: child: Container(
margin:
EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom), EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom),
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: Assets.home.imgTabdi, fit: BoxFit.fitWidth), image: Assets.home.imgTabdi, fit: BoxFit.fitWidth),
color: Colors.transparent), color: Colors.transparent),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: _bottomNav.cast<Widget>().toList(), children: _bottomNav.cast<Widget>().toList(),
),
),
), ),
),
),
); );
} }
@ -235,24 +235,19 @@ class _TabNavigatorState extends State<TabNavigator>
} }
//payload //payload
debugPrint('payload:$payload'); debugPrint('payload:$payload');
if (payload == "complete") { if(payload == "complete") {
await showDialog( await showDialog(context: context, builder: (_) => AlertDialog(
context: context, title: Text('Notification'),
builder: (_) => AlertDialog( content: Text('$payload'),
title: Text('Notification'), ),);
content: Text('$payload'),
),
);
} }
} }
showNotification() async { showNotification() async {
var android = new AndroidNotificationDetails( var android = new AndroidNotificationDetails(
'channel id', 'channel id', 'channel NAME',
'channel NAME',
priority: Priority.high, priority: Priority.high,
importance: Importance.max, importance: Importance.max,);
);
var iOS = new IOSNotificationDetails(); var iOS = new IOSNotificationDetails();
var platform = new NotificationDetails(android: android, iOS: iOS); var platform = new NotificationDetails(android: android, iOS: iOS);
await flutterLocalNotificationsPlugin.show( await flutterLocalNotificationsPlugin.show(

@ -0,0 +1,28 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
part 'updater_model.g.dart';
@JsonSerializable()
class UpdaterModel extends Equatable{
final int id;
final String versionNumber;
final String buildNo;
final int forceUpdate;
final String createDate;
factory UpdaterModel.fromJson(Map<String, dynamic> json) =>_$UpdaterModelFromJson(json);
const UpdaterModel({
required this.id,
required this.versionNumber,
required this.buildNo,
required this.forceUpdate,
required this.createDate,
});
@override
List<Object?> get props => [
id,versionNumber,buildNo,forceUpdate,createDate,
];
}

@ -0,0 +1,15 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'updater_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
UpdaterModel _$UpdaterModelFromJson(Map<String, dynamic> json) => UpdaterModel(
id: json['id'] as int,
versionNumber: json['versionNumber'] as String,
buildNo: json['buildNo'] as String,
forceUpdate: json['forceUpdate'] as int,
createDate: json['createDate'] as String,
);

@ -1,15 +1,17 @@
import 'package:aku_new_community/utils/updater/updater_model.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:sp_util/sp_util.dart'; import 'package:sp_util/sp_util.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'constants.dart'; import '../../constants/saas_api.dart';
import 'data_util.dart'; import '../constants.dart';
import '../data_util.dart';
import '../network/net_util.dart';
class UpdaterPage extends StatefulWidget { class UpdaterPage extends StatefulWidget {
final Widget child; final Widget child;
const UpdaterPage(this.child); const UpdaterPage(this.child);
@override @override
@ -17,6 +19,7 @@ class UpdaterPage extends StatefulWidget {
} }
class UpdatePagerState extends State<UpdaterPage> { class UpdatePagerState extends State<UpdaterPage> {
UpdaterModel? _model;
var _serviceVersionCode, var _serviceVersionCode,
_serviceVersionName, _serviceVersionName,
_serviceVersionPlatform, _serviceVersionPlatform,
@ -42,19 +45,13 @@ class UpdatePagerState extends State<UpdaterPage> {
// //
_getNewVersionAPP() async { _getNewVersionAPP() async {
String url = "/appversions/latest"; //URLURL var base =
try { await NetUtil().get(SAASAPI.updater.findNewVersion, params: {
Response response = await Dio().get(url); 'version': '1.8.12',
setState(() { });
var data = response.data; if (base.success) {
_serviceVersionCode = data["versionCode"].toString(); // _model = UpdaterModel.fromJson(base.data);
_serviceVersionName = data["versionName"].toString(); // setState(() {});
_serviceVersionPlatform = data["versionPlatform"].toString(); //
_serviceVersionApp = data["versionApp"].toString(); //URL
_checkVersionCode();
});
} catch (e) {
print(e);
} }
_checkVersionCode(); _checkVersionCode();
} }
Loading…
Cancel
Save