更新打包apk配置文件信息和代码修改

This commit is contained in:
apple 2022-08-11 18:30:23 +08:00
parent ba45554dfa
commit e7c60497ad
4 changed files with 118 additions and 60 deletions

View File

@ -25,6 +25,10 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystorePropertiesFile = rootProject.file("key.properties")
def keystoreProperties = new Properties()
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
android { android {
compileSdkVersion flutter.compileSdkVersion compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion ndkVersion flutter.ndkVersion
@ -48,18 +52,37 @@ android {
// You can update the following values to match your application needs. // You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion // targetSdkVersion flutter.targetSdkVersion
targetSdkVersion 33
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
} }
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
buildTypes { buildTypes {
release { release {
// TODO: Add your own signing config for the release build. signingConfig signingConfigs.release
// Signing with the debug keys for now, so `flutter run --release` works. }
debug {
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
} }
} }
// buildTypes {
// release {
// // TODO: Add your own signing config for the release build.
// // Signing with the debug keys for now, so `flutter run --release` works.
// signingConfig signingConfigs.debug
// }
// }
} }
flutter { flutter {

View File

@ -84,10 +84,6 @@ class _CreateRoomPageState extends State<CreateRoomPage> {
_onJoin(agoraToken, userName, roomId, ClientRole.Broadcaster); _onJoin(agoraToken, userName, roomId, ClientRole.Broadcaster);
// Future.delayed(Duration(seconds: 3), () {
// _onJoin(agoraToken, userName, roomId, ClientRole.Broadcaster);
// });
// if (agoraToken != null && agoraToken.isNotEmpty) { // if (agoraToken != null && agoraToken.isNotEmpty) {
// _engine = await RtcEngine.create(APP_ID); // // _engine = await RtcEngine.create(APP_ID); //
// _engine.joinChannel(agoraToken, roomId, null, int.parse(uid)); // // _engine.joinChannel(agoraToken, roomId, null, int.parse(uid)); //

View File

@ -54,7 +54,7 @@ class _PalRoomPageState extends State<PalRoomPage> {
late RtcEngine _engine; // RtcEngine late RtcEngine _engine; // RtcEngine
late IOWebSocketChannel _wsChannel; // webSocket late IOWebSocketChannel _wsChannel; // webSocket
late Timer timer; //
// //
List _list = [ List _list = [
{'nickname': '', 'flag': false, 'image': 'images/palRoom/voice2.png'}, {'nickname': '', 'flag': false, 'image': 'images/palRoom/voice2.png'},
@ -75,14 +75,6 @@ class _PalRoomPageState extends State<PalRoomPage> {
super.initState(); super.initState();
initialize(); initialize();
// if (widget.role == ClientRole.Broadcaster) {
// _infoStrings.insert(0, {'type': 'system', 'content': '您身份为主播,已经上麦状态'});
// } else if (widget.role == ClientRole.Audience) {
// _infoStrings.insert(0, {'type': 'system', 'content': '您身份为观众,点击麦克风图标上麦'});
// }
wsInitalize();
} }
@override @override
@ -92,14 +84,15 @@ class _PalRoomPageState extends State<PalRoomPage> {
_engine.leaveChannel(); _engine.leaveChannel();
_engine.destroy(); _engine.destroy();
_wsChannel.sink.close(); _wsChannel.sink.close();
timer.cancel();
} }
Future<void> initialize() async { Future<void> initialize() async {
_infoStrings.insert(0, { // _infoStrings.insert(0, {
'type': 'system', // 'type': 'system',
'content': // 'content':
'|令牌:${widget.agoraToken}|用户名:${widget.userName}|房间:${widget.channelName}|身份:${widget.role}' // '|令牌:${widget.agoraToken}|用户名:${widget.userName}|房间:${widget.channelName}|身份:${widget.role}'
}); // });
// appid是否存在 // appid是否存在
if (APP_ID.isEmpty) { if (APP_ID.isEmpty) {
@ -113,6 +106,12 @@ class _PalRoomPageState extends State<PalRoomPage> {
return; return;
} }
if (widget.role == ClientRole.Broadcaster) {
_infoStrings.insert(0, {'type': 'system', 'content': '您身份为主播,已经上麦状态'});
} else if (widget.role == ClientRole.Audience) {
_infoStrings.insert(0, {'type': 'system', 'content': '您身份为观众,点击麦克风图标上麦'});
}
_engine = await RtcEngine.create(APP_ID); // _engine = await RtcEngine.create(APP_ID); //
await _engine.enableAudio(); // await _engine.enableAudio(); //
await _engine.setDefaultAudioRouteToSpeakerphone( await _engine.setDefaultAudioRouteToSpeakerphone(
@ -120,35 +119,62 @@ class _PalRoomPageState extends State<PalRoomPage> {
await _engine.setAudioProfile(AudioProfile.SpeechStandard, await _engine.setAudioProfile(AudioProfile.SpeechStandard,
AudioScenario.ChatRoomEntertainment); // AudioScenario.ChatRoomEntertainment); //
await _engine.setChannelProfile(ChannelProfile.LiveBroadcasting); await _engine.setChannelProfile(ChannelProfile.LiveBroadcasting);
await _engine.setClientRole(widget.role!);
_addAgoraEventHandlers(); // _addAgoraEventHandlers(); //
if (widget.role == ClientRole.Broadcaster) { // if (widget.role == ClientRole.Broadcaster) {
await _engine.setClientRole(ClientRole.Broadcaster); // await _engine.setClientRole(ClientRole.Broadcaster);
} // }
String uid = await Storage.get('id'); String uid = await Storage.get('id');
await _engine.joinChannel( await _engine.joinChannel(
widget.agoraToken, widget.channelName, null, int.parse(uid)); // widget.agoraToken, widget.channelName, null, int.parse(uid)); //
_detail(); timer = Timer.periodic(Duration(seconds: 1), (timer) async {
_lodingCreate();
});
} }
wsInitalize() async { void _lodingCreate() async {
String uid = await Storage.get('id'); var res =
_wsChannel = IOWebSocketChannel.connect( await MyHttpUtil().get("/chat/api/room/create/${widget.channelName}");
'ws://101.35.117.69:9093/chat/api/chat/room/${int.parse(uid)}'); // String userName = await Storage.get('userName'); //
print('_lodingCreate${res.data}');
if (res.data == true) {
timer.cancel();
wsInitalize();
_detail();
}
}
Future<void> wsInitalize() async {
Map<String, dynamic> headers = new Map();
var token = await Storage.get('token');
print('/=/=/=/=/=//=/=/=/=/=//=/=/=/=/=//=/=/=/=/=/');
headers['Authorization'] = 'Bearer ${token}';
print(headers);
print(widget.channelName);
_wsChannel = IOWebSocketChannel.connect(
'ws://101.35.117.69:9093/chat/api/chat/room/${widget.channelName}',
headers: headers,
); //
print('/=/=/=/=/=//=/=/=/=/=//=/=/=/=/=//=/=/=/=/=/');
print('object');
_wsChannel.stream.listen((data) { _wsChannel.stream.listen((data) {
var aa = jsonDecode(data); var information = jsonDecode(data);
print('收到服务器数据:${aa}'); print('收到服务器数据:${information}');
setState(() { setState(() {
_infoStrings.insert(0, { _infoStrings.insert(0, {
'type': 'speak', 'type': 'speak',
'content': '${aa['message']}', 'content': '${information['message']}',
'name': '${aa['username']}' 'name': '${information['nickname']}'
}); });
}); });
}, onDone: () { }, onDone: () {
@ -194,6 +220,12 @@ class _PalRoomPageState extends State<PalRoomPage> {
} }
print('-----------------${_list}-----------------'); print('-----------------${_list}-----------------');
// //
// if (newUserList.isEmpty) {
// Navigator.of(context).pushReplacementNamed('/');
// return;
// }
} }
void _addAgoraEventHandlers() { void _addAgoraEventHandlers() {
@ -209,7 +241,7 @@ class _PalRoomPageState extends State<PalRoomPage> {
_detail(); _detail();
// //
setState(() { setState(() {
final info = '用户加入: uid $uid'; final info = '用户用户$uid加入房间';
_infoStrings.insert(0, {'type': 'system', 'content': info}); _infoStrings.insert(0, {'type': 'system', 'content': info});
// _users.add(uid); // _users.add(uid);
}); });
@ -218,7 +250,7 @@ class _PalRoomPageState extends State<PalRoomPage> {
_detail(); _detail();
// //
setState(() { setState(() {
final info = '加入频道成功: $channel, uid: $uid'; final info = '用户$uid加入频道号$channel成功';
_infoStrings.insert(0, {'type': 'system', 'content': info}); _infoStrings.insert(0, {'type': 'system', 'content': info});
}); });
}, },
@ -234,7 +266,7 @@ class _PalRoomPageState extends State<PalRoomPage> {
_detail(); _detail();
// //
setState(() { setState(() {
final info = '用户离开当前频道: $uid , reason: $reason'; final info = '用户$uid离开当前频道, reason: $reason';
_infoStrings.insert(0, {'type': 'system', 'content': info}); _infoStrings.insert(0, {'type': 'system', 'content': info});
// _users.remove(uid); // _users.remove(uid);
}); });
@ -251,7 +283,7 @@ class _PalRoomPageState extends State<PalRoomPage> {
_detail(); _detail();
// //
setState(() { setState(() {
final info = '用户成功重新加入: $uid'; final info = '用户$uid重新加入成功';
_infoStrings.insert(0, {'type': 'system', 'content': info}); _infoStrings.insert(0, {'type': 'system', 'content': info});
// _users.add(uid); // _users.add(uid);
}); });
@ -330,6 +362,12 @@ class _PalRoomPageState extends State<PalRoomPage> {
// //
_engine.setClientRole(ClientRole.Audience); _engine.setClientRole(ClientRole.Audience);
Navigator.pop(context); Navigator.pop(context);
// //
if (newUserList.isEmpty) {
Navigator.of(context).pushReplacementNamed('/');
return;
}
}, },
), ),
ListTile( ListTile(
@ -383,7 +421,8 @@ class _PalRoomPageState extends State<PalRoomPage> {
), ),
), ),
SizedBox(width: 5), SizedBox(width: 5),
Text('以冬', style: TextStyle(color: Colors.white, fontSize: 14)), Text(_list.length > 0 ? _list[0]['nickname'] : '加入中',
style: TextStyle(color: Colors.white, fontSize: 14)),
], ],
), ),
), ),
@ -578,27 +617,16 @@ class _PalRoomPageState extends State<PalRoomPage> {
), ),
child: TextField( child: TextField(
textInputAction: TextInputAction.send, // textInputAction: TextInputAction.send, //
// onEditingComplete: () async { onSubmitted: (value) {
// late String speak = _controller.text.trim(); late String speak = _controller.text.trim();
// if (speak.isEmpty) {
// showToast("请输入聊天内容~");
// return;
// }
// String userName = await Storage.get('userName'); //
// _wsChannel.sink.add(speak);
// // _controller.text = '';
// },
onSubmitted: (value) async {
late String speak = value.trim();
if (speak.isEmpty) { if (speak.isEmpty) {
showToast("请输入聊天内容~"); showToast("请输入聊天内容~");
return; return;
} }
String userName = await Storage.get('userName'); // print(speak);
_wsChannel.sink.add(speak); _wsChannel.sink.add(speak);
_controller.clear();
}, },
controller: _controller, controller: _controller,
decoration: InputDecoration( decoration: InputDecoration(
@ -618,6 +646,17 @@ class _PalRoomPageState extends State<PalRoomPage> {
), ),
GestureDetector( GestureDetector(
// //
onTap: () {
late String speak = _controller.text.trim();
if (speak.isEmpty) {
showToast("请输入聊天内容~");
return;
}
print(speak);
_wsChannel.sink.add(speak);
_controller.clear();
},
child: Icon(Icons.add, child: Icon(Icons.add,
color: Color.fromRGBO(201, 201, 201, 1), size: 25.0), color: Color.fromRGBO(201, 201, 201, 1), size: 25.0),
), ),
@ -670,7 +709,7 @@ class _PalRoomPageState extends State<PalRoomPage> {
Row( Row(
children: [ children: [
Text( Text(
'以冬', _list.length > 0 ? _list[0]['nickname'] : '加入中',
style: TextStyle(color: Colors.white, fontSize: 12), style: TextStyle(color: Colors.white, fontSize: 12),
), ),
SizedBox(width: 5), SizedBox(width: 5),

View File

@ -389,7 +389,7 @@ class _ViewsWidgetState extends State<ViewsWidget> {
), ),
SizedBox(width: 5), SizedBox(width: 5),
Text( Text(
_data[index]['id'], '${_data[index]['userCount']}',
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
color: Color.fromRGBO( color: Color.fromRGBO(