Skip to content

Commit

Permalink
fix(llc): fixed foreground service being recreated when declining the…
Browse files Browse the repository at this point in the history
… call (#764)

* fixed foreground service recreation when declining the call

* changelog
  • Loading branch information
Brazol authored Sep 18, 2024
1 parent 20a9aa2 commit ba031c0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/stream_video/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 0.5.4

🐞 Fixed
* Fixed an issue where active call foreground service was recreated after being stopped when ringing call was declined and in-app incoming screen was displayed.

🚧 Breaking changes
* The regular push notification handling has been removed from iOS, providing more control over the implementation. VoIP push notifications will continue to be handled as before. For more details, refer to the documentation.

Expand Down
3 changes: 3 additions & 0 deletions packages/stream_video_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## 0.5.4

🐞 Fixed
* Fixed an issue where active call foreground service was recreated after being stopped when ringing call was declined and in-app incoming screen was displayed.

🚧 Breaking changes
* The regular push notification handling has been removed from iOS, providing more control over the implementation. VoIP push notifications will continue to be handled as before. For more details, refer to the documentation.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class ServiceManagerImpl(
}

/**
* Start the foreground service.
* Stop the foreground service.
*/
override fun stop(type: ServiceType): Boolean {
logger.d { "[stop] type: $type" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,12 @@ class StreamBackgroundService {
NotificationOptionsBuilder optionsBuilder,
) {
return call.state.listen((value) async {
_logger.v(() => '[listenState] call service update, state: $value');

if (value.status is CallStatusDisconnected) {
return;
}

try {
final result = await StreamVideoFlutterBackground.updateService(
NotificationPayload(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ mixin StreamVideoFlutterBackground {
if (!isAndroid) {
return false;
}

return StreamVideoFlutterPlatform.instance.updateBackgroundService(
payload: options,
type: type,
Expand Down

0 comments on commit ba031c0

Please sign in to comment.