diff --git a/ios/Gemfile.lock b/ios/Gemfile.lock index aaaffc7b4..c2a9c1b96 100644 --- a/ios/Gemfile.lock +++ b/ios/Gemfile.lock @@ -156,8 +156,8 @@ GEM trailblazer-option (>= 0.1.1, < 0.2.0) uber (< 0.2.0) retriable (3.1.2) - rexml (3.2.8) - strscan (>= 3.0.9) + rexml (3.3.3) + strscan rouge (2.0.7) ruby2_keywords (0.0.4) rubyzip (2.3.0) diff --git a/ios/Podfile b/ios/Podfile index fac4d8176..1f9db6f6e 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '13.0' +platform :ios, '12.1' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 98f0adda2..d5da0966b 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -475,7 +475,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -568,7 +568,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -617,7 +617,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.1; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/lib/pages/chat/events/audio_player.dart b/lib/pages/chat/events/audio_player.dart index 8ab4d067a..f0ec64bab 100644 --- a/lib/pages/chat/events/audio_player.dart +++ b/lib/pages/chat/events/audio_player.dart @@ -9,6 +9,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:just_audio/just_audio.dart'; import 'package:matrix/matrix.dart'; +import 'package:opus_caf_converter_dart/opus_caf_converter_dart.dart'; import 'package:path_provider/path_provider.dart'; import '../../../utils/matrix_sdk_extensions/event_extension.dart'; @@ -95,7 +96,18 @@ class AudioPlayerState extends State { // Pangea# ); file = File('${tempDir.path}/${fileName}_${matrixFile.name}'); + await file.writeAsBytes(matrixFile.bytes); + + if (Platform.isIOS && + matrixFile.mimeType.toLowerCase() == 'audio/ogg') { + Logs().v('Convert ogg audio file for iOS...'); + final convertedFile = File('${file.path}.caf'); + if (await convertedFile.exists() == false) { + OpusCaf().convertOpusToCaf(file.path, convertedFile.path); + } + file = convertedFile; + } } setState(() { diff --git a/lib/pages/chat/recording_dialog.dart b/lib/pages/chat/recording_dialog.dart index 1540b3405..5b4e51252 100644 --- a/lib/pages/chat/recording_dialog.dart +++ b/lib/pages/chat/recording_dialog.dart @@ -16,7 +16,6 @@ import 'package:wakelock_plus/wakelock_plus.dart'; import 'events/audio_player.dart'; class RecordingDialog extends StatefulWidget { - static const String recordingFileType = 'wav'; const RecordingDialog({ super.key, }); @@ -44,12 +43,15 @@ class RecordingDialogState extends State { try { // #Pangea // enable recording on web + // final useOpus = + // await _audioRecorder.isEncoderSupported(AudioEncoder.opus); // final tempDir = await getTemporaryDirectory(); // final path = _recordedPath = - // '${tempDir.path}/recording${DateTime.now().microsecondsSinceEpoch}.${RecordingDialog.recordingFileType}'; - final tempDirPath = kIsWeb ? "." : (await getTemporaryDirectory()).path; - _recordedPath = - '$tempDirPath/recording${DateTime.now().microsecondsSinceEpoch}.${RecordingDialog.recordingFileType}'; + // '${tempDir.path}/recording${DateTime.now().microsecondsSinceEpoch}.${useOpus ? 'ogg' : 'm4a'}'; + final tempDir = kIsWeb ? "." : (await getTemporaryDirectory()).path; + + final path = _recordedPath = + '$tempDir/recording${DateTime.now().microsecondsSinceEpoch}.wav'; // Pangea# final result = await _audioRecorder.hasPermission(); @@ -59,7 +61,7 @@ class RecordingDialogState extends State { } await WakelockPlus.enable(); // #Pangea - final bool isNotError = await showUpdateVersionDialog( + final isNotError = await showUpdateVersionDialog( future: () => // Pangea# _audioRecorder.start( diff --git a/lib/utils/show_update_snackbar.dart b/lib/utils/show_update_snackbar.dart index d9161dd01..3f8b80ff4 100644 --- a/lib/utils/show_update_snackbar.dart +++ b/lib/utils/show_update_snackbar.dart @@ -10,39 +10,40 @@ abstract class UpdateNotifier { final scaffoldMessenger = ScaffoldMessenger.of(context); final currentVersion = await PlatformInfos.getVersion(); final store = await SharedPreferences.getInstance(); - // final storedVersion = store.getString(versionStoreKey); - const storedVersion = "0.0.0"; + final storedVersion = store.getString(versionStoreKey); if (currentVersion != storedVersion) { - ScaffoldFeatureController? controller; - controller = scaffoldMessenger.showSnackBar( - SnackBar( - duration: const Duration(seconds: 30), - content: Row( - children: [ - IconButton( - icon: Icon( - Icons.close_outlined, - size: 20, - color: Theme.of(context).colorScheme.onPrimary, + if (storedVersion != null) { + ScaffoldFeatureController? controller; + controller = scaffoldMessenger.showSnackBar( + SnackBar( + duration: const Duration(seconds: 30), + content: Row( + children: [ + IconButton( + icon: Icon( + Icons.close_outlined, + size: 20, + color: Theme.of(context).colorScheme.onPrimary, + ), + onPressed: () => controller?.close(), ), - onPressed: () => controller?.close(), - ), - Expanded( - child: Text( - L10n.of(context)!.updateInstalled(currentVersion), + Expanded( + child: Text( + L10n.of(context)!.updateInstalled(currentVersion), + ), ), - ), - ], + ], + ), + // #Pangea + // action: SnackBarAction( + // label: L10n.of(context)!.changelog, + // onPressed: () => launchUrlString(AppConfig.changelogUrl), + // ), + // Pangea# ), - // #Pangea - // action: SnackBarAction( - // label: L10n.of(context)!.changelog, - // onPressed: () => launchUrlString(AppConfig.changelogUrl), - // ), - // Pangea# - ), - ); + ); + } await store.setString(versionStoreKey, currentVersion); } } diff --git a/licenses.yaml b/licenses.yaml index 7b2f79bbf..ebab43440 100644 --- a/licenses.yaml +++ b/licenses.yaml @@ -12,6 +12,7 @@ permittedLicenses: - BSD-2-Clause - BSD-3-Clause - EUPL-1.2 + - LGPL-3.0 - MIT - MPL-2.0 - Zlib diff --git a/pubspec.lock b/pubspec.lock index 0f7a9ba52..15c911cc1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1510,6 +1510,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.3.2" + opus_caf_converter_dart: + dependency: "direct main" + description: + name: opus_caf_converter_dart + sha256: e08156066916f790a54df305e103d6dec4d853ec23147e6a02eda3c06f67ba1a + url: "https://pub.dev" + source: hosted + version: "1.0.1" package_config: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index ebdad03f3..8d5844aa1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -78,6 +78,7 @@ dependencies: # matrix: ^0.31.0 # Pangea# native_imaging: ^0.1.1 + opus_caf_converter_dart: ^1.0.1 package_info_plus: ^6.0.0 pasteboard: ^0.2.0 path: ^1.9.0