modified: android/app/build.gradle
modified: android/app/src/main/AndroidManifest.xml modified: lib/controller/firebase/firbase_messge.dart modified: lib/controller/functions/call_controller.dart modified: lib/controller/functions/crud.dart modified: lib/views/home/map_widget.dart/call_passenger_page.dart modified: macos/Flutter/GeneratedPluginRegistrant.swift modified: pubspec.lock modified: pubspec.yaml modified: windows/flutter/generated_plugin_registrant.cc modified: windows/flutter/generated_plugins.cmake
This commit is contained in:
@@ -32,7 +32,7 @@ def keystorePropertiesFile = rootProject.file('key.properties')
|
||||
|
||||
android {
|
||||
namespace "com.mobileapp.store.ride"
|
||||
compileSdkVersion 33
|
||||
compileSdkVersion 34
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
@@ -54,9 +54,9 @@ android {
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 33
|
||||
versionCode 49
|
||||
versionName '1.5.49'
|
||||
targetSdkVersion 34
|
||||
versionCode 50
|
||||
versionName '1.5.50'
|
||||
// manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml']
|
||||
}
|
||||
|
||||
|
||||
@@ -1,67 +1,53 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<!-- Optional: Add this permission if you want to use bluetooth telephony device like
|
||||
headset/earbuds (min SDK: 23) -->
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<!-- Optional: Add this permission if you want to save your recordings in public folders -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||
<uses-permission android:name="android.permission.VIBRATE" />
|
||||
<uses-permission android:name="android.permission.CALL_PHONE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
|
||||
|
||||
<!-- Permissions required by the SDK -->
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" />
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
|
||||
<!-- Permissions required by the Demo App -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
|
||||
<uses-feature android:name="android.hardware.camera" />
|
||||
<uses-feature android:name="android.hardware.camera.autofocus" />
|
||||
|
||||
|
||||
<application android:label="SEFER" android:name="${applicationName}"
|
||||
<application
|
||||
android:label="SEFER"
|
||||
android:name="${applicationName}"
|
||||
android:icon="@mipmap/launcher_icon">
|
||||
<activity android:name=".MainActivity" android:exported="true" android:launchMode="singleTop"
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTop"
|
||||
android:theme="@style/LaunchTheme"
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
|
||||
android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
|
||||
<!-- Specifies an Android theme to apply to this Activity as soon as
|
||||
the Android process has started. This theme is visible to the user
|
||||
while the Flutter UI initializes. After that, this theme continues
|
||||
to determine the Window background behind the Flutter UI. -->
|
||||
<meta-data android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:hardwareAccelerated="true"
|
||||
android:windowSoftInputMode="adjustResize">
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.NormalTheme"
|
||||
android:resource="@style/NormalTheme" />
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<meta-data android:name="com.google.android.geo.API_KEY" android:value="@string/api_key" />
|
||||
|
||||
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
<meta-data
|
||||
android:name="com.google.android.geo.API_KEY"
|
||||
android:value="@string/api_key" />
|
||||
<meta-data
|
||||
android:name="com.google.firebase.messaging.default_notification_channel_id"
|
||||
android:value="@string/default_notification_channel_id" />
|
||||
<meta-data android:name="com.android.application.versionCode" android:value="1" />
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
<meta-data android:name="flutterEmbedding" android:value="2" />
|
||||
<activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait"
|
||||
<meta-data
|
||||
android:name="com.android.application.versionCode"
|
||||
android:value="1" />
|
||||
<meta-data
|
||||
android:name="flutterEmbedding"
|
||||
android:value="2" />
|
||||
<activity
|
||||
android:name="com.yalantis.ucrop.UCropActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
|
||||
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
@@ -228,11 +228,11 @@ class FirebaseMessagesController extends GetxController {
|
||||
);
|
||||
// }
|
||||
// Assuming GetMaterialApp is initialized and context is valid for navigation
|
||||
Get.to(() => PassengerCallPage(
|
||||
channelName: driverList[1].toString(),
|
||||
token: driverList[0].toString(),
|
||||
remoteID: driverList[2].toString(),
|
||||
));
|
||||
// Get.to(() => PassengerCallPage(
|
||||
// channelName: driverList[1].toString(),
|
||||
// token: driverList[0].toString(),
|
||||
// remoteID: driverList[2].toString(),
|
||||
// ));
|
||||
} catch (e) {}
|
||||
} else if (message.notification!.title! == 'Call Income from Driver'.tr) {
|
||||
try {
|
||||
@@ -246,11 +246,11 @@ class FirebaseMessagesController extends GetxController {
|
||||
);
|
||||
// }
|
||||
// Assuming GetMaterialApp is initialized and context is valid for navigation
|
||||
Get.to(() => PassengerCallPage(
|
||||
channelName: driverList[1].toString(),
|
||||
token: driverList[0].toString(),
|
||||
remoteID: driverList[2].toString(),
|
||||
));
|
||||
// Get.to(() => PassengerCallPage(
|
||||
// channelName: driverList[1].toString(),
|
||||
// token: driverList[0].toString(),
|
||||
// remoteID: driverList[2].toString(),
|
||||
// ));
|
||||
} catch (e) {}
|
||||
} else if (message.notification!.title! == 'Call End'.tr) {
|
||||
try {
|
||||
|
||||
@@ -1,134 +1,134 @@
|
||||
import 'package:SEFER/constant/api_key.dart';
|
||||
import 'package:SEFER/controller/functions/crud.dart';
|
||||
import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
// import 'package:SEFER/constant/api_key.dart';
|
||||
// import 'package:SEFER/controller/functions/crud.dart';
|
||||
// import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
// import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../firebase/firbase_messge.dart';
|
||||
import '../../main.dart';
|
||||
// import '../../constant/box_name.dart';
|
||||
// import '../firebase/firbase_messge.dart';
|
||||
// import '../../main.dart';
|
||||
|
||||
class CallController extends GetxController {
|
||||
String channelName = ''; // Get.find<MapDriverController>().rideId;
|
||||
String token = '';
|
||||
// int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user
|
||||
int uid = 0;
|
||||
int? remoteUid; // uid of the remote user
|
||||
bool _isJoined = false; // Indicates if the local user has joined the channel
|
||||
String status = '';
|
||||
late RtcEngine agoraEngine; // Agora engine instance
|
||||
// class CallController extends GetxController {
|
||||
// String channelName = ''; // Get.find<MapDriverController>().rideId;
|
||||
// String token = '';
|
||||
// // int uid = int.parse(box.read(BoxName.phoneDriver)); // uid of the local user
|
||||
// int uid = 0;
|
||||
// int? remoteUid; // uid of the remote user
|
||||
// bool _isJoined = false; // Indicates if the local user has joined the channel
|
||||
// String status = '';
|
||||
// late RtcEngine agoraEngine; // Agora engine instance
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// if (box.read(BoxName.passengerID) != null) {
|
||||
channelName = Get.find<MapPassengerController>().rideId; // 'sefer300'; //
|
||||
remoteUid = int.parse(Get.find<MapPassengerController>().driverPhone);
|
||||
uid = int.parse(box.read(BoxName.phone));
|
||||
// } else {
|
||||
// channelName = Get.find<MapDriverController>().rideId; // 'sefer300'; //
|
||||
// remoteUid = int.parse(Get.find<MapDriverController>().passengerPhone);
|
||||
// uid = int.parse(box.read(BoxName.phoneDriver));
|
||||
// }
|
||||
// @override
|
||||
// void onInit() {
|
||||
// super.onInit();
|
||||
// // if (box.read(BoxName.passengerID) != null) {
|
||||
// channelName = Get.find<MapPassengerController>().rideId; // 'sefer300'; //
|
||||
// remoteUid = int.parse(Get.find<MapPassengerController>().driverPhone);
|
||||
// uid = int.parse(box.read(BoxName.phone));
|
||||
// // } else {
|
||||
// // channelName = Get.find<MapDriverController>().rideId; // 'sefer300'; //
|
||||
// // remoteUid = int.parse(Get.find<MapDriverController>().passengerPhone);
|
||||
// // uid = int.parse(box.read(BoxName.phoneDriver));
|
||||
// // }
|
||||
|
||||
initAgoraFull();
|
||||
}
|
||||
// initAgoraFull();
|
||||
// }
|
||||
|
||||
initAgoraFull() async {
|
||||
await fetchToken();
|
||||
// Set up an instance of Agora engine
|
||||
setupVoiceSDKEngine();
|
||||
// join();
|
||||
FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
'Call Income from Passenger',
|
||||
'${'You have call from Passenger'.tr} ${box.read(BoxName.name)}',
|
||||
Get.find<MapPassengerController>().driverToken,
|
||||
[
|
||||
token,
|
||||
channelName,
|
||||
uid.toString(),
|
||||
remoteUid.toString(),
|
||||
],
|
||||
'iphone_ringtone.wav',
|
||||
);
|
||||
join();
|
||||
}
|
||||
// initAgoraFull() async {
|
||||
// await fetchToken();
|
||||
// // Set up an instance of Agora engine
|
||||
// setupVoiceSDKEngine();
|
||||
// // join();
|
||||
// FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
// 'Call Income from Passenger',
|
||||
// '${'You have call from Passenger'.tr} ${box.read(BoxName.name)}',
|
||||
// Get.find<MapPassengerController>().driverToken,
|
||||
// [
|
||||
// token,
|
||||
// channelName,
|
||||
// uid.toString(),
|
||||
// remoteUid.toString(),
|
||||
// ],
|
||||
// 'iphone_ringtone.wav',
|
||||
// );
|
||||
// join();
|
||||
// }
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
agoraEngine.leaveChannel();
|
||||
super.onClose();
|
||||
}
|
||||
// @override
|
||||
// void onClose() {
|
||||
// agoraEngine.leaveChannel();
|
||||
// super.onClose();
|
||||
// }
|
||||
|
||||
Future<void> setupVoiceSDKEngine() async {
|
||||
// retrieve or request microphone permission
|
||||
await [Permission.microphone].request();
|
||||
// Future<void> setupVoiceSDKEngine() async {
|
||||
// // retrieve or request microphone permission
|
||||
// await [Permission.microphone].request();
|
||||
|
||||
//create an instance of the Agora engine
|
||||
agoraEngine = createAgoraRtcEngine();
|
||||
await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId));
|
||||
// Register the event handler
|
||||
agoraEngine.registerEventHandler(
|
||||
RtcEngineEventHandler(
|
||||
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||
// Get.snackbar(
|
||||
// "Local user uid:${connection.localUid} joined the channel", '');
|
||||
status = 'joined'.tr;
|
||||
_isJoined = true;
|
||||
update();
|
||||
},
|
||||
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
// Get.snackbar("Remote user uid:$remoteUid joined the channel", '');
|
||||
status = Get.find<MapPassengerController>().driverName.toString();
|
||||
' joined'.tr;
|
||||
remoteUid = remoteUid;
|
||||
update();
|
||||
},
|
||||
onUserOffline: (RtcConnection connection, int? remoteUid,
|
||||
UserOfflineReasonType reason) {
|
||||
// Get.snackbar("Remote user uid:$remoteUid left the channel", '');
|
||||
status = 'Call left'.tr;
|
||||
remoteUid = null;
|
||||
update();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
// //create an instance of the Agora engine
|
||||
// agoraEngine = createAgoraRtcEngine();
|
||||
// await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId));
|
||||
// // Register the event handler
|
||||
// agoraEngine.registerEventHandler(
|
||||
// RtcEngineEventHandler(
|
||||
// onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||
// // Get.snackbar(
|
||||
// // "Local user uid:${connection.localUid} joined the channel", '');
|
||||
// status = 'joined'.tr;
|
||||
// _isJoined = true;
|
||||
// update();
|
||||
// },
|
||||
// onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
// // Get.snackbar("Remote user uid:$remoteUid joined the channel", '');
|
||||
// status = Get.find<MapPassengerController>().driverName.toString();
|
||||
// ' joined'.tr;
|
||||
// remoteUid = remoteUid;
|
||||
// update();
|
||||
// },
|
||||
// onUserOffline: (RtcConnection connection, int? remoteUid,
|
||||
// UserOfflineReasonType reason) {
|
||||
// // Get.snackbar("Remote user uid:$remoteUid left the channel", '');
|
||||
// status = 'Call left'.tr;
|
||||
// remoteUid = null;
|
||||
// update();
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
void join() async {
|
||||
// Set channel options including the client role and channel profile
|
||||
ChannelMediaOptions options = const ChannelMediaOptions(
|
||||
clientRoleType: ClientRoleType.clientRoleBroadcaster,
|
||||
channelProfile: ChannelProfileType.channelProfileCommunication,
|
||||
);
|
||||
// void join() async {
|
||||
// // Set channel options including the client role and channel profile
|
||||
// ChannelMediaOptions options = const ChannelMediaOptions(
|
||||
// clientRoleType: ClientRoleType.clientRoleBroadcaster,
|
||||
// channelProfile: ChannelProfileType.channelProfileCommunication,
|
||||
// );
|
||||
|
||||
await agoraEngine.joinChannel(
|
||||
token: token,
|
||||
channelId: channelName,
|
||||
options: options,
|
||||
uid: uid,
|
||||
);
|
||||
}
|
||||
// await agoraEngine.joinChannel(
|
||||
// token: token,
|
||||
// channelId: channelName,
|
||||
// options: options,
|
||||
// uid: uid,
|
||||
// );
|
||||
// }
|
||||
|
||||
void leave() {
|
||||
_isJoined = false;
|
||||
remoteUid = null;
|
||||
update();
|
||||
agoraEngine.leaveChannel();
|
||||
}
|
||||
// void leave() {
|
||||
// _isJoined = false;
|
||||
// remoteUid = null;
|
||||
// update();
|
||||
// agoraEngine.leaveChannel();
|
||||
// }
|
||||
|
||||
// Clean up the resources when you leave
|
||||
@override
|
||||
void dispose() async {
|
||||
await agoraEngine.leaveChannel();
|
||||
super.dispose();
|
||||
}
|
||||
// // Clean up the resources when you leave
|
||||
// @override
|
||||
// void dispose() async {
|
||||
// await agoraEngine.leaveChannel();
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
fetchToken() async {
|
||||
var res = await CRUD()
|
||||
.getAgoraToken(channelName: channelName, uid: uid.toString());
|
||||
token = res;
|
||||
update();
|
||||
}
|
||||
}
|
||||
// fetchToken() async {
|
||||
// var res = await CRUD()
|
||||
// .getAgoraToken(channelName: channelName, uid: uid.toString());
|
||||
// token = res;
|
||||
// update();
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -29,6 +29,7 @@ class CRUD {
|
||||
);
|
||||
print(response.request);
|
||||
print(response.body);
|
||||
print(payload);
|
||||
// if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
|
||||
@@ -1,258 +1,258 @@
|
||||
import 'dart:async';
|
||||
import 'package:SEFER/constant/box_name.dart';
|
||||
import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
import 'package:SEFER/main.dart';
|
||||
import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
// import 'dart:async';
|
||||
// import 'package:SEFER/constant/box_name.dart';
|
||||
// import 'package:SEFER/controller/home/map_passenger_controller.dart';
|
||||
// import 'package:SEFER/main.dart';
|
||||
// import 'package:SEFER/views/widgets/my_scafold.dart';
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:get/get.dart';
|
||||
// import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
// import 'package:agora_rtc_engine/agora_rtc_engine.dart';
|
||||
|
||||
import '../../../../constant/api_key.dart';
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/firebase/firbase_messge.dart';
|
||||
// import '../../../../constant/api_key.dart';
|
||||
// import '../../../constant/colors.dart';
|
||||
// import '../../../constant/style.dart';
|
||||
// import '../../../controller/firebase/firbase_messge.dart';
|
||||
|
||||
String appId = AK.agoraAppId;
|
||||
// String appId = AK.agoraAppId;
|
||||
|
||||
class PassengerCallPage extends StatefulWidget {
|
||||
const PassengerCallPage({
|
||||
super.key,
|
||||
required this.channelName,
|
||||
required this.token,
|
||||
required this.remoteID,
|
||||
});
|
||||
final String channelName, token, remoteID;
|
||||
@override
|
||||
State<PassengerCallPage> createState() => _PassengerCallPageState();
|
||||
}
|
||||
// class PassengerCallPage extends StatefulWidget {
|
||||
// const PassengerCallPage({
|
||||
// super.key,
|
||||
// required this.channelName,
|
||||
// required this.token,
|
||||
// required this.remoteID,
|
||||
// });
|
||||
// final String channelName, token, remoteID;
|
||||
// @override
|
||||
// State<PassengerCallPage> createState() => _PassengerCallPageState();
|
||||
// }
|
||||
|
||||
class _PassengerCallPageState extends State<PassengerCallPage> {
|
||||
int uid = 0;
|
||||
int? _remoteUid = 0; // uid of the remote user
|
||||
bool _isJoined = false; // Indicates if the local user has joined the channel
|
||||
late RtcEngine agoraEngine; // Agora engine instance
|
||||
String status = '';
|
||||
final GlobalKey<ScaffoldMessengerState> scaffoldMessengerKey =
|
||||
GlobalKey<ScaffoldMessengerState>(); // Global key to access the scaffold
|
||||
// class _PassengerCallPageState extends State<PassengerCallPage> {
|
||||
// int uid = 0;
|
||||
// int? _remoteUid = 0; // uid of the remote user
|
||||
// bool _isJoined = false; // Indicates if the local user has joined the channel
|
||||
// late RtcEngine agoraEngine; // Agora engine instance
|
||||
// String status = '';
|
||||
// final GlobalKey<ScaffoldMessengerState> scaffoldMessengerKey =
|
||||
// GlobalKey<ScaffoldMessengerState>(); // Global key to access the scaffold
|
||||
|
||||
showMessage(String message) {
|
||||
scaffoldMessengerKey.currentState?.showSnackBar(SnackBar(
|
||||
content: Text(message),
|
||||
));
|
||||
}
|
||||
// showMessage(String message) {
|
||||
// scaffoldMessengerKey.currentState?.showSnackBar(SnackBar(
|
||||
// content: Text(message),
|
||||
// ));
|
||||
// }
|
||||
|
||||
initAgora() async {
|
||||
await setupVoiceSDKEngine();
|
||||
}
|
||||
// initAgora() async {
|
||||
// await setupVoiceSDKEngine();
|
||||
// }
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_remoteUid = int.parse(widget.remoteID);
|
||||
uid = int.parse(box.read(BoxName.phone));
|
||||
// Set up an instance of Agora engine
|
||||
initAgora();
|
||||
}
|
||||
// @override
|
||||
// void initState() {
|
||||
// super.initState();
|
||||
// _remoteUid = int.parse(widget.remoteID);
|
||||
// uid = int.parse(box.read(BoxName.phone));
|
||||
// // Set up an instance of Agora engine
|
||||
// initAgora();
|
||||
// }
|
||||
|
||||
Future<void> setupVoiceSDKEngine() async {
|
||||
// retrieve or request microphone permission
|
||||
await [Permission.microphone].request();
|
||||
// Future<void> setupVoiceSDKEngine() async {
|
||||
// // retrieve or request microphone permission
|
||||
// await [Permission.microphone].request();
|
||||
|
||||
//create an instance of the Agora engine
|
||||
agoraEngine = createAgoraRtcEngine();
|
||||
await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId));
|
||||
// Register the event handler
|
||||
agoraEngine.registerEventHandler(
|
||||
RtcEngineEventHandler(
|
||||
onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||
showMessage(
|
||||
"Local user uid:${connection.localUid} joined the channel");
|
||||
setState(() {
|
||||
_isJoined = true;
|
||||
status = 'joined'.tr;
|
||||
});
|
||||
},
|
||||
onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
showMessage("Driver joined the channel".tr);
|
||||
setState(() {
|
||||
status = "Driver joined the channel".tr;
|
||||
_remoteUid = remoteUid;
|
||||
});
|
||||
},
|
||||
onUserOffline: (RtcConnection connection, int? remoteUid,
|
||||
UserOfflineReasonType reason) {
|
||||
showMessage("Driver left the channel".tr);
|
||||
setState(() {
|
||||
status = "Driver left the channel".tr;
|
||||
_remoteUid = null;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
// //create an instance of the Agora engine
|
||||
// agoraEngine = createAgoraRtcEngine();
|
||||
// await agoraEngine.initialize(RtcEngineContext(appId: AK.agoraAppId));
|
||||
// // Register the event handler
|
||||
// agoraEngine.registerEventHandler(
|
||||
// RtcEngineEventHandler(
|
||||
// onJoinChannelSuccess: (RtcConnection connection, int elapsed) {
|
||||
// showMessage(
|
||||
// "Local user uid:${connection.localUid} joined the channel");
|
||||
// setState(() {
|
||||
// _isJoined = true;
|
||||
// status = 'joined'.tr;
|
||||
// });
|
||||
// },
|
||||
// onUserJoined: (RtcConnection connection, int remoteUid, int elapsed) {
|
||||
// showMessage("Driver joined the channel".tr);
|
||||
// setState(() {
|
||||
// status = "Driver joined the channel".tr;
|
||||
// _remoteUid = remoteUid;
|
||||
// });
|
||||
// },
|
||||
// onUserOffline: (RtcConnection connection, int? remoteUid,
|
||||
// UserOfflineReasonType reason) {
|
||||
// showMessage("Driver left the channel".tr);
|
||||
// setState(() {
|
||||
// status = "Driver left the channel".tr;
|
||||
// _remoteUid = null;
|
||||
// });
|
||||
// },
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
void join() async {
|
||||
// Set channel options including the client role and channel profile
|
||||
ChannelMediaOptions options = const ChannelMediaOptions(
|
||||
clientRoleType: ClientRoleType.clientRoleBroadcaster,
|
||||
channelProfile: ChannelProfileType.channelProfileCommunication,
|
||||
);
|
||||
// void join() async {
|
||||
// // Set channel options including the client role and channel profile
|
||||
// ChannelMediaOptions options = const ChannelMediaOptions(
|
||||
// clientRoleType: ClientRoleType.clientRoleBroadcaster,
|
||||
// channelProfile: ChannelProfileType.channelProfileCommunication,
|
||||
// );
|
||||
|
||||
await agoraEngine.joinChannel(
|
||||
token: widget.token,
|
||||
channelId: widget.channelName,
|
||||
options: options,
|
||||
uid: uid,
|
||||
);
|
||||
}
|
||||
//https://console.agora.io/invite?sign=5e9e22d06f22caeeada9954c9e908572%253A5ba8aed978a35eab5a5113742502ded2a41478b2a81cb19c71a30776e125b58a
|
||||
// await agoraEngine.joinChannel(
|
||||
// token: widget.token,
|
||||
// channelId: widget.channelName,
|
||||
// options: options,
|
||||
// uid: uid,
|
||||
// );
|
||||
// }
|
||||
// //https://console.agora.io/invite?sign=5e9e22d06f22caeeada9954c9e908572%253A5ba8aed978a35eab5a5113742502ded2a41478b2a81cb19c71a30776e125b58a
|
||||
|
||||
void leave() {
|
||||
setState(() {
|
||||
_isJoined = false;
|
||||
_remoteUid = null;
|
||||
});
|
||||
agoraEngine.leaveChannel();
|
||||
}
|
||||
// void leave() {
|
||||
// setState(() {
|
||||
// _isJoined = false;
|
||||
// _remoteUid = null;
|
||||
// });
|
||||
// agoraEngine.leaveChannel();
|
||||
// }
|
||||
|
||||
// Clean up the resources when you leave
|
||||
@override
|
||||
void dispose() async {
|
||||
await agoraEngine.leaveChannel();
|
||||
super.dispose();
|
||||
}
|
||||
// // Clean up the resources when you leave
|
||||
// @override
|
||||
// void dispose() async {
|
||||
// await agoraEngine.leaveChannel();
|
||||
// super.dispose();
|
||||
// }
|
||||
|
||||
// Build UI
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
scaffoldMessengerKey: scaffoldMessengerKey,
|
||||
home: MyScafolld(
|
||||
// appBar: AppBar(
|
||||
// title: const Text('Get started with Voice Calling'),
|
||||
// ),
|
||||
title: 'Call Page'.tr,
|
||||
isleading: true,
|
||||
body: [
|
||||
Positioned(
|
||||
top: Get.height * .2,
|
||||
child: Container(
|
||||
height: 100, width: Get.width,
|
||||
decoration: AppStyle.boxDecoration,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
// await callController.initAgoraFull();
|
||||
// callController.join();
|
||||
// FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
// 'Call Income',
|
||||
// '${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}',
|
||||
// Get.find<MapDriverController>().tokenPassenger,
|
||||
// [
|
||||
// callController.token,
|
||||
// callController.channelName,
|
||||
// callController.uid.toString(),
|
||||
// callController.remoteUid.toString(),
|
||||
// ],
|
||||
// );
|
||||
join();
|
||||
// callController.fetchToken();
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: AppColor.greenColor),
|
||||
child: const Icon(
|
||||
Icons.phone,
|
||||
size: 35,
|
||||
color: AppColor.secondaryColor,
|
||||
)),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
status,
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text('Driver Name'),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
FirebaseMessagesController()
|
||||
.sendNotificationToPassengerToken(
|
||||
'Call End'.tr,
|
||||
'Call End',
|
||||
Get.find<MapPassengerController>().driverToken,
|
||||
[],
|
||||
'iphone_ringtone.wav',
|
||||
);
|
||||
leave();
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: const BoxDecoration(
|
||||
shape: BoxShape.circle, color: AppColor.redColor),
|
||||
child: const Icon(
|
||||
Icons.phone_disabled_sharp,
|
||||
size: 35,
|
||||
color: AppColor.secondaryColor,
|
||||
)),
|
||||
)
|
||||
],
|
||||
),
|
||||
// ignore: prefer_const_constructors
|
||||
),
|
||||
),
|
||||
// ListView(
|
||||
// padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
// children: [
|
||||
// // Status text
|
||||
// Container(height: 40, child: Center(child: _status())),
|
||||
// // Button Row
|
||||
// Row(
|
||||
// children: <Widget>[
|
||||
// Expanded(
|
||||
// child: ElevatedButton(
|
||||
// child: Text("Join".tr),
|
||||
// onPressed: () => {join()},
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(width: 10),
|
||||
// Expanded(
|
||||
// child: ElevatedButton(
|
||||
// child: Text("Leave".tr),
|
||||
// onPressed: () => {leave()},
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
]),
|
||||
);
|
||||
}
|
||||
// // Build UI
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return MaterialApp(
|
||||
// scaffoldMessengerKey: scaffoldMessengerKey,
|
||||
// home: MyScafolld(
|
||||
// // appBar: AppBar(
|
||||
// // title: const Text('Get started with Voice Calling'),
|
||||
// // ),
|
||||
// title: 'Call Page'.tr,
|
||||
// isleading: true,
|
||||
// body: [
|
||||
// Positioned(
|
||||
// top: Get.height * .2,
|
||||
// child: Container(
|
||||
// height: 100, width: Get.width,
|
||||
// decoration: AppStyle.boxDecoration,
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
// children: [
|
||||
// GestureDetector(
|
||||
// onTap: () async {
|
||||
// // await callController.initAgoraFull();
|
||||
// // callController.join();
|
||||
// // FirebaseMessagesController().sendNotificationToPassengerToken(
|
||||
// // 'Call Income',
|
||||
// // '${'You have call from driver'.tr} ${box.read(BoxName.nameDriver)}',
|
||||
// // Get.find<MapDriverController>().tokenPassenger,
|
||||
// // [
|
||||
// // callController.token,
|
||||
// // callController.channelName,
|
||||
// // callController.uid.toString(),
|
||||
// // callController.remoteUid.toString(),
|
||||
// // ],
|
||||
// // );
|
||||
// join();
|
||||
// // callController.fetchToken();
|
||||
// },
|
||||
// child: Container(
|
||||
// width: 50,
|
||||
// height: 50,
|
||||
// decoration: const BoxDecoration(
|
||||
// shape: BoxShape.circle,
|
||||
// color: AppColor.greenColor),
|
||||
// child: const Icon(
|
||||
// Icons.phone,
|
||||
// size: 35,
|
||||
// color: AppColor.secondaryColor,
|
||||
// )),
|
||||
// ),
|
||||
// Column(
|
||||
// children: [
|
||||
// Text(
|
||||
// status,
|
||||
// style: AppStyle.title,
|
||||
// ),
|
||||
// Text('Driver Name'),
|
||||
// ],
|
||||
// ),
|
||||
// GestureDetector(
|
||||
// onTap: () async {
|
||||
// FirebaseMessagesController()
|
||||
// .sendNotificationToPassengerToken(
|
||||
// 'Call End'.tr,
|
||||
// 'Call End',
|
||||
// Get.find<MapPassengerController>().driverToken,
|
||||
// [],
|
||||
// 'iphone_ringtone.wav',
|
||||
// );
|
||||
// leave();
|
||||
// Get.back();
|
||||
// // },
|
||||
// child: Container(
|
||||
// width: 50,
|
||||
// height: 50,
|
||||
// decoration: const BoxDecoration(
|
||||
// shape: BoxShape.circle, color: AppColor.redColor),
|
||||
// child: const Icon(
|
||||
// Icons.phone_disabled_sharp,
|
||||
// size: 35,
|
||||
// color: AppColor.secondaryColor,
|
||||
// )),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
// // ignore: prefer_const_constructors
|
||||
// ),
|
||||
// ),
|
||||
// // ListView(
|
||||
// // padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||
// // children: [
|
||||
// // // Status text
|
||||
// // Container(height: 40, child: Center(child: _status())),
|
||||
// // // Button Row
|
||||
// // Row(
|
||||
// // children: <Widget>[
|
||||
// // Expanded(
|
||||
// // child: ElevatedButton(
|
||||
// // child: Text("Join".tr),
|
||||
// // onPressed: () => {join()},
|
||||
// // ),
|
||||
// // ),
|
||||
// // const SizedBox(width: 10),
|
||||
// // Expanded(
|
||||
// // child: ElevatedButton(
|
||||
// // child: Text("Leave".tr),
|
||||
// // onPressed: () => {leave()},
|
||||
// // ),
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// // ],
|
||||
// // ),
|
||||
// ]),
|
||||
// );
|
||||
// }
|
||||
|
||||
// Widget _status() {
|
||||
// String statusText;
|
||||
//
|
||||
// if (!_isJoined) {
|
||||
// statusText = 'Join a channel'.tr;
|
||||
// } else if (_remoteUid == null)
|
||||
// statusText = 'Waiting for a remote user to join...';
|
||||
// else
|
||||
// statusText = 'Connected to remote user, uid:$_remoteUid';
|
||||
//
|
||||
// return Text(
|
||||
// statusText,
|
||||
// );
|
||||
// }
|
||||
}
|
||||
// // Widget _status() {
|
||||
// // String statusText;
|
||||
// //
|
||||
// // if (!_isJoined) {
|
||||
// // statusText = 'Join a channel'.tr;
|
||||
// // } else if (_remoteUid == null)
|
||||
// // statusText = 'Waiting for a remote user to join...';
|
||||
// // else
|
||||
// // statusText = 'Connected to remote user, uid:$_remoteUid';
|
||||
// //
|
||||
// // return Text(
|
||||
// // statusText,
|
||||
// // );
|
||||
// // }
|
||||
// }
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import agora_rtc_engine
|
||||
import audio_session
|
||||
import device_info_plus
|
||||
import file_selector_macos
|
||||
@@ -17,7 +16,6 @@ import flutter_secure_storage_macos
|
||||
import flutter_tts
|
||||
import geolocator_apple
|
||||
import google_sign_in_ios
|
||||
import iris_method_channel
|
||||
import just_audio
|
||||
import location
|
||||
import package_info_plus
|
||||
@@ -30,7 +28,6 @@ import video_player_avfoundation
|
||||
import wakelock_plus
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
AgoraRtcNgPlugin.register(with: registry.registrar(forPlugin: "AgoraRtcNgPlugin"))
|
||||
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
|
||||
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
|
||||
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
|
||||
@@ -42,7 +39,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin"))
|
||||
GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin"))
|
||||
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
|
||||
IrisMethodChannelPlugin.register(with: registry.registrar(forPlugin: "IrisMethodChannelPlugin"))
|
||||
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
|
||||
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))
|
||||
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
|
||||
|
||||
16
pubspec.lock
16
pubspec.lock
@@ -17,14 +17,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.34"
|
||||
agora_rtc_engine:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: agora_rtc_engine
|
||||
sha256: ec84db08cd6727e3e480abe9089df4a9522aa4315f688ac2abf25a82f26c4055
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.3.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1064,14 +1056,6 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.4"
|
||||
iris_method_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: iris_method_channel
|
||||
sha256: "78caede20be4a1dd258262fb13704aab2f16fd05ef414bed06e7b1e3b95b3413"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
js:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -42,7 +42,7 @@ dependencies:
|
||||
envied: ^0.5.2
|
||||
# cached_network_image: ^3.3.0
|
||||
calendar_builder: ^0.0.6
|
||||
agora_rtc_engine: ^6.2.6
|
||||
# agora_rtc_engine: ^6.2.6
|
||||
flutter_tts: ^3.8.5
|
||||
permission_handler: ^11.3.0
|
||||
# google_generative_ai: ^0.0.1-dev
|
||||
|
||||
@@ -6,22 +6,18 @@
|
||||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <agora_rtc_engine/agora_rtc_engine_plugin.h>
|
||||
#include <file_selector_windows/file_selector_windows.h>
|
||||
#include <firebase_auth/firebase_auth_plugin_c_api.h>
|
||||
#include <firebase_core/firebase_core_plugin_c_api.h>
|
||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||
#include <flutter_tts/flutter_tts_plugin.h>
|
||||
#include <geolocator_windows/geolocator_windows.h>
|
||||
#include <iris_method_channel/iris_method_channel_plugin_c_api.h>
|
||||
#include <local_auth_windows/local_auth_plugin.h>
|
||||
#include <permission_handler_windows/permission_handler_windows_plugin.h>
|
||||
#include <record_windows/record_windows_plugin_c_api.h>
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
AgoraRtcEnginePluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("AgoraRtcEnginePlugin"));
|
||||
FileSelectorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("FileSelectorWindows"));
|
||||
FirebaseAuthPluginCApiRegisterWithRegistrar(
|
||||
@@ -34,8 +30,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
registry->GetRegistrarForPlugin("FlutterTtsPlugin"));
|
||||
GeolocatorWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("GeolocatorWindows"));
|
||||
IrisMethodChannelPluginCApiRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("IrisMethodChannelPluginCApi"));
|
||||
LocalAuthPluginRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("LocalAuthPlugin"));
|
||||
PermissionHandlerWindowsPluginRegisterWithRegistrar(
|
||||
|
||||
@@ -3,14 +3,12 @@
|
||||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
agora_rtc_engine
|
||||
file_selector_windows
|
||||
firebase_auth
|
||||
firebase_core
|
||||
flutter_secure_storage_windows
|
||||
flutter_tts
|
||||
geolocator_windows
|
||||
iris_method_channel
|
||||
local_auth_windows
|
||||
permission_handler_windows
|
||||
record_windows
|
||||
|
||||
Reference in New Issue
Block a user