Potentially fix play button

This commit is contained in:
Michael Speed 2024-02-05 19:31:24 +01:00
parent e2595a5b2d
commit a3ac939f82
6 changed files with 55 additions and 53 deletions

View File

@ -515,3 +515,4 @@ class MeditoAudioServiceCallbackApi(private val binaryMessenger: BinaryMessenger
}
}
}

View File

@ -45,6 +45,11 @@ class AudioPlayerService : MediaSessionService(), Player.Listener, MeditoAudioSe
override fun onCreate() {
super.onCreate()
FlutterEngineCache.getInstance().get(MainActivity.ENGINE_ID)?.let { engine ->
MeditoAudioServiceApi.setUp(engine.dartExecutor.binaryMessenger, this)
meditoAudioApi = MeditoAudioServiceCallbackApi(engine.dartExecutor.binaryMessenger)
}
primaryPlayer = ExoPlayer.Builder(this)
.setAudioAttributes(AudioAttributes.DEFAULT, false)
.setHandleAudioBecomingNoisy(true)
@ -63,11 +68,6 @@ class AudioPlayerService : MediaSessionService(), Player.Listener, MeditoAudioSe
.setCallback(this)
.build()
FlutterEngineCache.getInstance().get(MainActivity.ENGINE_ID)?.let { engine ->
MeditoAudioServiceApi.setUp(engine.dartExecutor.binaryMessenger, this)
meditoAudioApi = MeditoAudioServiceCallbackApi(engine.dartExecutor.binaryMessenger)
}
}
override fun onDestroy() {

View File

@ -4,7 +4,6 @@ import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
@ -14,11 +13,14 @@ import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity : FlutterActivity() {
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
GeneratedPluginRegistrant.registerWith(flutterEngine)
FlutterEngineCache
.getInstance()
.put(ENGINE_ID, flutterEngine);
super.configureFlutterEngine(flutterEngine)
GeneratedPluginRegistrant.registerWith(flutterEngine)
val intent = Intent(this, AudioPlayerService::class.java)
startService(intent)
}
override fun onCreate(savedInstanceState: Bundle?) {
@ -26,8 +28,6 @@ class MainActivity : FlutterActivity() {
createNotificationChannel()
val intent = Intent(this, AudioPlayerService::class.java)
startService(intent)
}
companion object {
@ -37,11 +37,13 @@ class MainActivity : FlutterActivity() {
private fun createNotificationChannel() {
val channelName = "Meditation audio"
val importance = NotificationManager.IMPORTANCE_DEFAULT
val channel = NotificationChannel(AudioPlayerService.CHANNEL_ID, channelName, importance).apply {
description = "Notification for media control of meditation audio"
}
val channel =
NotificationChannel(AudioPlayerService.CHANNEL_ID, channelName, importance).apply {
description = "Notification for media control of meditation audio"
}
val notificationManager: NotificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationManager: NotificationManager =
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.createNotificationChannel(channel)
}
}

View File

@ -1 +1 @@
/Users/mike/.pub-cache/hosted/pub.dev/sentry_flutter-7.13.2/
/Users/mike/.pub-cache/hosted/pub.dev/sentry_flutter-7.16.0/

View File

@ -546,10 +546,10 @@ packages:
dependency: "direct main"
description:
name: flutter_local_notifications
sha256: "501ed9d54f1c8c0535b7991bade36f9e7e3b45a2346401f03775c1ec7a3c06ae"
sha256: "401643a6ea9d8451365f2ec11145335bf130560cfde367bdf8f0be6d60f89479"
url: "https://pub.dev"
source: hosted
version: "15.1.2"
version: "15.1.3"
flutter_local_notifications_linux:
dependency: transitive
description:
@ -578,10 +578,10 @@ packages:
dependency: "direct main"
description:
name: flutter_riverpod
sha256: da9591d1f8d5881628ccd5c25c40e74fc3eef50ba45e40c3905a06e1712412d5
sha256: "4bce556b7ecbfea26109638d5237684538d4abc509d253e6c5c4c5733b360098"
url: "https://pub.dev"
source: hosted
version: "2.4.9"
version: "2.4.10"
flutter_svg:
dependency: "direct main"
description:
@ -940,42 +940,50 @@ packages:
dependency: "direct main"
description:
name: permission_handler
sha256: bc56bfe9d3f44c3c612d8d393bd9b174eb796d706759f9b495ac254e4294baa5
sha256: "45ff3fbcb99040fde55c528d5e3e6ca29171298a85436274d49c6201002087d6"
url: "https://pub.dev"
source: hosted
version: "10.4.5"
version: "11.2.0"
permission_handler_android:
dependency: transitive
description:
name: permission_handler_android
sha256: "59c6322171c29df93a22d150ad95f3aa19ed86542eaec409ab2691b8f35f9a47"
sha256: "758284a0976772f9c744d6384fc5dc4834aa61e3f7aa40492927f244767374eb"
url: "https://pub.dev"
source: hosted
version: "10.3.6"
version: "12.0.3"
permission_handler_apple:
dependency: transitive
description:
name: permission_handler_apple
sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5"
sha256: c6bf440f80acd2a873d3d91a699e4cc770f86e7e6b576dda98759e8b92b39830
url: "https://pub.dev"
source: hosted
version: "9.1.4"
version: "9.3.0"
permission_handler_html:
dependency: transitive
description:
name: permission_handler_html
sha256: "54bf176b90f6eddd4ece307e2c06cf977fb3973719c35a93b85cc7093eb6070d"
url: "https://pub.dev"
source: hosted
version: "0.1.1"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4"
sha256: "5c43148f2bfb6d14c5a8162c0a712afe891f2d847f35fcff29c406b37da43c3c"
url: "https://pub.dev"
source: hosted
version: "3.12.0"
version: "4.1.0"
permission_handler_windows:
dependency: transitive
description:
name: permission_handler_windows
sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
url: "https://pub.dev"
source: hosted
version: "0.1.3"
version: "0.2.1"
petitparser:
dependency: transitive
description:
@ -992,14 +1000,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "16.0.5"
pin_code_fields:
dependency: "direct main"
description:
name: pin_code_fields
sha256: c8652519d14688f3fe2a8288d86910a46aa0b9046d728f292d3bf6067c31b4c7
url: "https://pub.dev"
source: hosted
version: "7.4.0"
platform:
dependency: transitive
description:
@ -1076,10 +1076,10 @@ packages:
dependency: transitive
description:
name: riverpod
sha256: "942999ee48b899f8a46a860f1e13cee36f2f77609eb54c5b7a669bb20d550b11"
sha256: "548e2192eb7aeb826eb89387f814edb76594f3363e2c0bb99dd733d795ba3589"
url: "https://pub.dev"
source: hosted
version: "2.4.9"
version: "2.5.0"
riverpod_analyzer_utils:
dependency: transitive
description:
@ -1092,10 +1092,10 @@ packages:
dependency: "direct main"
description:
name: riverpod_annotation
sha256: b70e95fbd5ca7ce42f5148092022971bb2e9843b6ab71e97d479e8ab52e98979
sha256: "77e5d51afa4fa3e67903fb8746f33d368728d7051a0b6c292bcee60aeba46d95"
url: "https://pub.dev"
source: hosted
version: "2.3.3"
version: "2.3.4"
riverpod_generator:
dependency: "direct dev"
description:
@ -1116,18 +1116,18 @@ packages:
dependency: transitive
description:
name: sentry
sha256: e7ded42974bac5f69e4ca4ddc57d30499dd79381838f24b7e8fd9aa4139e7b79
sha256: a7946f4a90b0feb47214981d881b98149e05f6c576da9f2a2f33945bf561de25
url: "https://pub.dev"
source: hosted
version: "7.13.2"
version: "7.16.0"
sentry_flutter:
dependency: "direct main"
description:
name: sentry_flutter
sha256: d6f55ec7a1f681784165021f749007712a72ff57eadf91e963331b6ae326f089
sha256: "6db7fa1b076faf2f5dd77d8cc9ef206171f32a290cc638842d78e5d62b441a27"
url: "https://pub.dev"
source: hosted
version: "7.13.2"
version: "7.16.0"
share:
dependency: "direct main"
description:
@ -1583,4 +1583,4 @@ packages:
version: "3.1.2"
sdks:
dart: ">=3.2.0-194.0.dev <3.7.0-13.0"
flutter: ">=3.13.0"
flutter: ">=3.16.0"

View File

@ -20,12 +20,12 @@ dependencies:
flutter:
sdk: flutter
http: ^0.13.3
dio: ^5.0.2
dio: ^5.4.0
flutter_svg: ^1.1.6
path_provider: ^2.0.1
url_launcher: ^6.1.14
flutter_markdown: ^0.6.7
shared_preferences: ^2.0.5
shared_preferences: ^2.2.2
auto_size_text: ^3.0.0-nullsafety.0
rxdart: ^0.27.1
share: ^2.0.1
@ -35,11 +35,11 @@ dependencies:
connectivity: ^3.0.3
device_info_plus: ^9.0.2
equatable: ^2.0.0
sentry_flutter: ^7.9.0
sentry_flutter: ^7.16.0
back_button_interceptor: ^6.0.2
go_router: ^6.5.5
flutter_riverpod: ^2.4.4
riverpod_annotation: ^2.2.1
flutter_riverpod: ^2.4.10
riverpod_annotation: ^2.3.4
freezed: ^2.3.2
freezed_annotation: ^2.2.0
json_annotation: ^4.8.1
@ -48,14 +48,13 @@ dependencies:
flutter_downloader: ^1.10.2
cached_network_image: ^3.2.3
email_validator: '^2.1.16'
pin_code_fields: ^7.4.0
share_plus: ^7.0.2
firebase_messaging: ^13.1.0
firebase_core: ^1.24.0
flutter_local_notifications: ^15.0.0
marquee: ^2.2.3
image: ^4.0.17
permission_handler: ^10.4.5
permission_handler: ^11.2.0
app_settings: ^5.1.1
reorderables: ^0.6.0
google_api_availability: ^5.0.0