osu-framework icon indicating copy to clipboard operation
osu-framework copied to clipboard

Take focus from game during calls on iOS

Open frenzibyte opened this issue 1 year ago • 5 comments

  • Closes ppy/osu#4565
  • Split from https://github.com/ppy/osu-framework/pull/6449

Again, this is not normal behaviour of any iOS app, as incoming calls have recently been acting more like a glorified notification than a full-screen overlay. However, as a rhythm game, exclusive access to the audio is required for the game to function appropriately, therefore we have to observe for incoming calls and cut focus from the game in order to be aware that it should not remain operating (i.e. send to pause screen).

Note that this change is made primarily because users would otherwise lose their scores when they get a call, as the beatmap freezes and osu! triggers the "you have an issue with your audio device, score will not be submitted" notification.

The framework may not be exclusively for rhythm games, but I think it's simple to have this anyway until we get a report about it from other framework consumers.

frenzibyte avatar Dec 17 '24 07:12 frenzibyte

To clarify, this is avoiding the game becoming unusable when a phone call arrives? Because your description sounds like this is an optional change, and not having it would just mean that the phone call notification shows on top of the game.

Maybe you could show a video of what happens with/without this to clarify.

peppy avatar Dec 17 '24 09:12 peppy

I briefly mentioned it in https://github.com/ppy/osu-framework/pull/6449#issue-2727329289 but forgot to mention here. This change is mandatory for osu!, otherwise when someone receives a call the beatmap freezes and osu! thinks the audio system is at fault and excludes the score from submission. The change fixes the issue by killing focus and taking gameplay to pause screen immediately.

frenzibyte avatar Dec 17 '24 09:12 frenzibyte

@frenzibyte I found the handling of sdl events locally in IOSWindow pretty ugly, so I've refactored a bit to avoid this. It's still not pretty, but it's the best I can come up with. cc @Susko3 for a quick check.

peppy avatar Feb 14 '25 10:02 peppy

Requesting a second set of eyes on this (low priority) @ppy/team-client.

peppy avatar Feb 14 '25 10:02 peppy

Everything else seems fine to me.

Susko3 avatar Feb 14 '25 20:02 Susko3