diff --git a/ios/Flutter/.last_build_id b/ios/Flutter/.last_build_id index 528604ac..6a25a472 100644 --- a/ios/Flutter/.last_build_id +++ b/ios/Flutter/.last_build_id @@ -1 +1 @@ -dd448b9c97933af58f6a55258c72b577 \ No newline at end of file +50490a6c8b8edc222bf5a068ab13e251 \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a040a43c..32250691 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -37,49 +37,45 @@ PODS: - file_picker (0.0.1): - DKImagePickerController/PhotoGallery - Flutter - - Firebase/CoreOnly (6.26.0): - - FirebaseCore (= 6.7.2) - - Firebase/Messaging (6.26.0): + - Firebase/CoreOnly (6.33.0): + - FirebaseCore (= 6.10.3) + - Firebase/Messaging (6.33.0): - Firebase/CoreOnly - - FirebaseMessaging (~> 4.4.1) - - firebase_core (0.5.0-1): - - Firebase/CoreOnly (~> 6.26.0) + - FirebaseMessaging (~> 4.7.0) + - firebase_core (0.5.2): + - Firebase/CoreOnly (~> 6.33.0) - Flutter - firebase_messaging (7.0.3): - - Firebase/CoreOnly (~> 6.26.0) - - Firebase/Messaging (~> 6.26.0) + - Firebase/CoreOnly (~> 6.33.0) + - Firebase/Messaging (~> 6.33.0) - firebase_core - Flutter - - FirebaseAnalyticsInterop (1.5.0) - - FirebaseCore (6.7.2): - - FirebaseCoreDiagnostics (~> 1.3) - - FirebaseCoreDiagnosticsInterop (~> 1.2) - - GoogleUtilities/Environment (~> 6.5) - - GoogleUtilities/Logger (~> 6.5) + - FirebaseCore (6.10.3): + - FirebaseCoreDiagnostics (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Logger (~> 6.7) - FirebaseCoreDiagnostics (1.7.0): - GoogleDataTransport (~> 7.4) - GoogleUtilities/Environment (~> 6.7) - GoogleUtilities/Logger (~> 6.7) - nanopb (~> 1.30906.0) - - FirebaseCoreDiagnosticsInterop (1.2.0) - - FirebaseInstallations (1.3.0): - - FirebaseCore (~> 6.6) - - GoogleUtilities/Environment (~> 6.6) - - GoogleUtilities/UserDefaults (~> 6.6) + - FirebaseInstallations (1.7.0): + - FirebaseCore (~> 6.10) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) - PromisesObjC (~> 1.2) - - FirebaseInstanceID (4.3.4): - - FirebaseCore (~> 6.6) - - FirebaseInstallations (~> 1.0) - - GoogleUtilities/Environment (~> 6.5) - - GoogleUtilities/UserDefaults (~> 6.5) - - FirebaseMessaging (4.4.1): - - FirebaseAnalyticsInterop (~> 1.5) - - FirebaseCore (~> 6.6) - - FirebaseInstanceID (~> 4.3) - - GoogleUtilities/AppDelegateSwizzler (~> 6.5) - - GoogleUtilities/Environment (~> 6.5) - - GoogleUtilities/Reachability (~> 6.5) - - GoogleUtilities/UserDefaults (~> 6.5) + - FirebaseInstanceID (4.8.0): + - FirebaseCore (~> 6.10) + - FirebaseInstallations (~> 1.6) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) + - FirebaseMessaging (4.7.1): + - FirebaseCore (~> 6.10) + - FirebaseInstanceID (~> 4.7) + - GoogleUtilities/AppDelegateSwizzler (~> 6.7) + - GoogleUtilities/Environment (~> 6.7) + - GoogleUtilities/Reachability (~> 6.7) + - GoogleUtilities/UserDefaults (~> 6.7) - Protobuf (>= 3.9.2, ~> 3.9) - Flutter (1.0.0) - flutter_keyboard_visibility (0.0.1): @@ -91,8 +87,10 @@ PODS: - OLMKit - flutter_secure_storage (3.3.1): - Flutter - - flutter_sound (0.0.1): + - "flutter_sound (6.4.2+1)": - Flutter + - mobile-ffmpeg-audio (= 4.3.1.LTS) + - "TauEngine (= 6.4.2+1)" - FMDB (2.7.5): - FMDB/standard (= 2.7.5) - FMDB/standard (2.7.5) @@ -117,6 +115,7 @@ PODS: - GoogleUtilities/Logger - image_picker (0.0.1): - Flutter + - mobile-ffmpeg-audio (4.3.1.LTS) - nanopb (1.30906.0): - nanopb/decode (= 1.30906.0) - nanopb/encode (= 1.30906.0) @@ -173,6 +172,7 @@ PODS: - sqlite3/perf-threadsafe - sqlite3/rtree - SwiftyGif (5.3.0) + - "TauEngine (6.4.2+1)" - url_launcher (0.0.1): - Flutter - webview_flutter (0.0.1): @@ -209,16 +209,15 @@ SPEC REPOS: - DKImagePickerController - DKPhotoGallery - Firebase - - FirebaseAnalyticsInterop - FirebaseCore - FirebaseCoreDiagnostics - - FirebaseCoreDiagnosticsInterop - FirebaseInstallations - FirebaseInstanceID - FirebaseMessaging - FMDB - GoogleDataTransport - GoogleUtilities + - mobile-ffmpeg-audio - nanopb - OLMKit - PromisesObjC @@ -227,6 +226,7 @@ SPEC REPOS: - SQLCipher - sqlite3 - SwiftyGif + - TauEngine EXTERNAL SOURCES: android_path_provider: @@ -282,26 +282,25 @@ SPEC CHECKSUMS: DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 - Firebase: 7cf5f9c67f03cb3b606d1d6535286e1080e57eb6 - firebase_core: 00e54a4744164a6b5a250b96dd1ad5afaba7a342 - firebase_messaging: 666d9994651b1ecf8c582b52dd913f3fa58c17ef - FirebaseAnalyticsInterop: 3f86269c38ae41f47afeb43ebf32a001f58fcdae - FirebaseCore: f42e5e5f382cdcf6b617ed737bf6c871a6947b17 + Firebase: 8db6f2d1b2c5e2984efba4949a145875a8f65fe5 + firebase_core: 350ba329d1641211bc6183a3236893cafdacfea7 + firebase_messaging: 0aea2cd5885b65e19ede58ee3507f485c992cc75 + FirebaseCore: d889d9e12535b7f36ac8bfbf1713a0836a3012cd FirebaseCoreDiagnostics: 770ac5958e1372ce67959ae4b4f31d8e127c3ac1 - FirebaseCoreDiagnosticsInterop: 296e2c5f5314500a850ad0b83e9e7c10b011a850 - FirebaseInstallations: 6f5f680e65dc374397a483c32d1799ba822a395b - FirebaseInstanceID: cef67c4967c7cecb56ea65d8acbb4834825c587b - FirebaseMessaging: 29543feb343b09546ab3aa04d008ee8595b43c44 + FirebaseInstallations: 466c7b4d1f58fe16707693091da253726a731ed2 + FirebaseInstanceID: bd3ffc24367f901a43c063b36c640b345a4a5dd1 + FirebaseMessaging: 5eca4ef173de76253352511aafef774caa1cba2a Flutter: 0e3d915762c693b495b44d77113d4970485de6ec flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069 flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 flutter_olm: be36ebeb6388f7d7b3097d39feaf459a3cad2091 flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec - flutter_sound: 0e8163ceac1e00eb6d894e2ae4641ba726a2c479 + flutter_sound: 0ab66750f6d5a83198c54d343a9b34b58a5ff86d FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a GoogleDataTransport: f56af7caa4ed338dc8e138a5d7c5973e66440833 GoogleUtilities: 7f2f5a07f888cdb145101d6042bc4422f57e70b3 image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 + mobile-ffmpeg-audio: adc36047b8032bc0f8e5c4e6ab7cb110189d9b37 nanopb: 59317e09cf1f1a0af72f12af412d54edf52603fc native_imaging: 633687fc14422729cc67ed80c3435e359ef7a92b OLMKit: 4ee0159d63feeb86d836fdcfefe418e163511639 @@ -319,6 +318,7 @@ SPEC CHECKSUMS: sqlite3: 8f7d2078ae27778699a622a94b853285793422a2 sqlite3_flutter_libs: 5651f8ff48e3b44d910863c4ea5916085b1b245f SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40 + TauEngine: 9b2bd3acc575cea2c77b91a16c34c52751da3935 url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index e437b11b..83f2bcec 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -275,6 +275,7 @@ "${BUILT_PRODUCTS_DIR}/SDWebImage/SDWebImage.framework", "${BUILT_PRODUCTS_DIR}/SQLCipher/SQLCipher.framework", "${BUILT_PRODUCTS_DIR}/SwiftyGif/SwiftyGif.framework", + "${BUILT_PRODUCTS_DIR}/TauEngine/TauEngine.framework", "${BUILT_PRODUCTS_DIR}/android_path_provider/android_path_provider.framework", "${BUILT_PRODUCTS_DIR}/disk_space/disk_space.framework", "${BUILT_PRODUCTS_DIR}/file_picker/file_picker.framework", @@ -282,7 +283,6 @@ "${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework", "${BUILT_PRODUCTS_DIR}/flutter_olm/flutter_olm.framework", "${BUILT_PRODUCTS_DIR}/flutter_secure_storage/flutter_secure_storage.framework", - "${BUILT_PRODUCTS_DIR}/flutter_sound/flutter_sound.framework", "${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework", "${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework", "${BUILT_PRODUCTS_DIR}/native_imaging/native_imaging.framework", @@ -310,6 +310,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SDWebImage.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SQLCipher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyGif.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TauEngine.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/android_path_provider.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/disk_space.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/file_picker.framework", @@ -317,7 +318,6 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_olm.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_secure_storage.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_sound.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/native_imaging.framework", diff --git a/lib/components/audio_player.dart b/lib/components/audio_player.dart index 940fa0f8..e7047da3 100644 --- a/lib/components/audio_player.dart +++ b/lib/components/audio_player.dart @@ -30,7 +30,7 @@ enum AudioPlayerStatus { NOT_DOWNLOADED, DOWNLOADING, DOWNLOADED } class _AudioPlayerState extends State { AudioPlayerStatus status = AudioPlayerStatus.NOT_DOWNLOADED; - FlutterSound flutterSound = FlutterSound(); + FlutterSoundPlayer flutterSound = FlutterSoundPlayer(); StreamSubscription soundSubscription; Uint8List audioFile; @@ -57,10 +57,12 @@ class _AudioPlayerState extends State { @override void dispose() { - if (flutterSound.audioState == t_AUDIO_STATE.IS_PLAYING) { + if (flutterSound.playerState == PlayerState.isPlaying) { flutterSound.stopPlayer(); } soundSubscription?.cancel(); + flutterSound?.closeAudioSession(); + flutterSound = null; super.dispose(); } @@ -79,28 +81,25 @@ class _AudioPlayerState extends State { void _playAction() async { if (AudioPlayer.currentId != widget.event.eventId) { if (AudioPlayer.currentId != null) { - if (flutterSound.audioState != t_AUDIO_STATE.IS_STOPPED) { + if (flutterSound.playerState != PlayerState.isStopped) { await flutterSound.stopPlayer(); setState(() => null); } } AudioPlayer.currentId = widget.event.eventId; } - switch (flutterSound.audioState) { - case t_AUDIO_STATE.IS_PLAYING: + switch (flutterSound.playerState) { + case PlayerState.isPlaying: await flutterSound.pausePlayer(); break; - case t_AUDIO_STATE.IS_PAUSED: + case PlayerState.isPaused: await flutterSound.resumePlayer(); break; - case t_AUDIO_STATE.IS_RECORDING: - break; - case t_AUDIO_STATE.IS_STOPPED: - await flutterSound.startPlayerFromBuffer( - audioFile, - codec: t_CODEC.CODEC_AAC, + case PlayerState.isStopped: + await flutterSound.startPlayer( + fromDataBuffer: audioFile, ); - soundSubscription ??= flutterSound.onPlayerStateChanged.listen((e) { + soundSubscription ??= flutterSound.onProgress.listen((disposition) { if (AudioPlayer.currentId != widget.event.eventId) { soundSubscription?.cancel()?.then((f) => soundSubscription = null); setState(() { @@ -108,16 +107,16 @@ class _AudioPlayerState extends State { statusText = '00:00'; }); AudioPlayer.currentId = null; - } else if (e != null) { - var date = - DateTime.fromMillisecondsSinceEpoch(e.currentPosition.toInt()); + } else if (disposition != null) { + var date = DateTime.fromMillisecondsSinceEpoch( + disposition.position.inMilliseconds.toInt()); var txt = DateFormat('mm:ss', 'en_US').format(date); setState(() { - maxPosition = e.duration; - currentPosition = e.currentPosition; + maxPosition = disposition.duration.inMilliseconds.toDouble(); + currentPosition = disposition.position.inMilliseconds.toDouble(); statusText = txt; }); - if (e.duration == e.currentPosition) { + if (disposition.duration == disposition.position) { soundSubscription ?.cancel() ?.then((f) => soundSubscription = null); @@ -151,7 +150,7 @@ class _AudioPlayerState extends State { ? CircularProgressIndicator(strokeWidth: 2) : IconButton( icon: Icon( - flutterSound.audioState == t_AUDIO_STATE.IS_PLAYING + flutterSound.playerState == PlayerState.isPlaying ? Icons.pause : Icons.play_arrow, color: widget.color, @@ -168,8 +167,8 @@ class _AudioPlayerState extends State { Expanded( child: Slider( value: currentPosition, - onChanged: (double position) => - flutterSound.seekToPlayer(position.toInt()), + onChanged: (double position) => flutterSound + .seekToPlayer(Duration(milliseconds: position.toInt())), max: status == AudioPlayerStatus.DOWNLOADED ? maxPosition : 0, min: 0, ), diff --git a/lib/components/dialogs/recording_dialog.dart b/lib/components/dialogs/recording_dialog.dart index 80d879eb..760af374 100644 --- a/lib/components/dialogs/recording_dialog.dart +++ b/lib/components/dialogs/recording_dialog.dart @@ -6,16 +6,14 @@ import 'package:flutter_sound/flutter_sound.dart'; import 'package:intl/intl.dart'; class RecordingDialog extends StatefulWidget { - final Function onFinished; - - const RecordingDialog({this.onFinished, Key key}) : super(key: key); + const RecordingDialog({Key key}) : super(key: key); @override _RecordingDialogState createState() => _RecordingDialogState(); } class _RecordingDialogState extends State { - FlutterSound flutterSound = FlutterSound(); + FlutterSoundRecorder flutterSound = FlutterSoundRecorder(); String time = '00:00:00'; StreamSubscription _recorderSubscription; @@ -24,12 +22,11 @@ class _RecordingDialogState extends State { void startRecording() async { try { - await flutterSound.startRecorder( - codec: t_CODEC.CODEC_AAC, - ); - _recorderSubscription = flutterSound.onRecorderStateChanged.listen((e) { - var date = - DateTime.fromMillisecondsSinceEpoch(e.currentPosition.toInt()); + final recorder = await flutterSound.openAudioSession(); + await recorder.startRecorder(); + _recorderSubscription = flutterSound.onProgress.listen((disposition) { + var date = DateTime.fromMillisecondsSinceEpoch( + disposition.duration.inMilliseconds.toInt()); setState(() => time = DateFormat('mm:ss:SS', 'en_US').format(date)); }); } catch (e) { @@ -47,6 +44,8 @@ class _RecordingDialogState extends State { void dispose() { if (flutterSound.isRecording) flutterSound.stopRecorder(); _recorderSubscription?.cancel(); + flutterSound?.closeAudioSession(); + flutterSound = null; super.dispose(); } @@ -83,7 +82,7 @@ class _RecordingDialogState extends State { color: Theme.of(context).textTheme.bodyText2.color.withAlpha(150), ), ), - onPressed: () => Navigator.of(context).pop(), + onPressed: () => Navigator.of(context).pop(null), ), FlatButton( child: Row( @@ -95,11 +94,8 @@ class _RecordingDialogState extends State { ), onPressed: () async { await _recorderSubscription?.cancel(); - final result = await flutterSound.stopRecorder(); - if (widget.onFinished != null) { - widget.onFinished(result); - } - Navigator.of(context).pop(); + await flutterSound.stopRecorder(); + Navigator.of(context).pop(flutterSound.savedUri); }, ), ], diff --git a/lib/views/chat.dart b/lib/views/chat.dart index a77049ea..ab89acca 100644 --- a/lib/views/chat.dart +++ b/lib/views/chat.dart @@ -266,14 +266,12 @@ class _ChatState extends State<_Chat> { } void voiceMessageAction(BuildContext context) async { - String result; - await showDialog( - context: context, - builder: (context) => RecordingDialog( - onFinished: (r) => result = r, - )); - if (result == null) return; - final audioFile = File(result); + final filePath = await showDialog( + context: context, + builder: (context) => RecordingDialog(), + ); + if (filePath == null) return; + final audioFile = File(filePath); // as we already explicitly say send in the recording dialog, // we do not need the send file dialog anymore. We can just send this straight away. await SimpleDialogs(context).tryRequestWithLoadingDialog( diff --git a/pubspec.lock b/pubspec.lock index 63d350fb..39acbcf4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -404,7 +404,28 @@ packages: name: flutter_sound url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "6.4.2+1" + flutter_sound_platform_interface: + dependency: transitive + description: + name: flutter_sound_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "6.4.2+1" + flutter_sound_web: + dependency: transitive + description: + name: flutter_sound_web + url: "https://pub.dartlang.org" + source: hosted + version: "6.4.2+1" + flutter_spinkit: + dependency: transitive + description: + name: flutter_spinkit + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.2+1" flutter_test: dependency: "direct dev" description: flutter @@ -534,6 +555,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.3+6" + logger: + dependency: transitive + description: + name: logger + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.0+2" logging: dependency: transitive description: @@ -606,6 +634,13 @@ packages: url: "https://gitlab.com/famedly/libraries/native_imaging.git" source: git version: "0.0.1" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4" node_interop: dependency: transitive description: @@ -781,6 +816,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.13" + provider: + dependency: transitive + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "4.3.2+2" pub_semver: dependency: transitive description: @@ -802,6 +844,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + recase: + dependency: transitive + description: + name: recase + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" receive_sharing_intent: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 577c3873..e468a4bc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -45,7 +45,7 @@ dependencies: receive_sharing_intent: ^1.4.2 flutter_slidable: ^0.5.7 photo_view: ^0.10.2 - flutter_sound: 2.1.1 + flutter_sound: ^6.4.2+1 open_file: ^3.0.3 mime_type: ^0.3.2 flushbar: ^1.10.4