Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add player stream #182

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Add player stream #182

wants to merge 4 commits into from

Conversation

theLee3
Copy link
Collaborator

@theLee3 theLee3 commented Feb 19, 2025

This update adds the getter Stream<PlayerData?> player to GameAuth, making it far easier to update the UI on auth changes.

Issues related to signIn are also resolved, in particular, the hanging of signIn on iOS due to setting the authenticationHandler on every signIn call. Per the docs, this should be set one time. Afterwards an error is thrown so the dev can direct the user to sign in via Game Center in the device settings.

On Android, if Play Services is missing or outdated on the device, signIn will no longer hang until the user taps the notification from Play Services. Many users did not notice this notification and perceived the app as frozen. Now the plugin will throw an error from the signIn method and, if possible, present a native dialog allowing the user to easily install or update Play Services on the device.

PlayerData now includes all player related data for easy synchronous access from the stream.

Some code has been refactored to utilize the data from stream to prevent redundant platform channel communications to optimize performance. All changes are fully backwards compatible.

Docs & changelog are updated accordingly, and version number is bumped to 4.1.0.

Consolidate `PlayerData` class to avoid redundancies.
Fix auth issues for subsequent `SignIn` calls.
Fix false positives for `isSignedIn`.
Remove redundant channel methods for info accessible via `PlayerData` class & player stream.
@PacifistaBot
Copy link
Collaborator

PacifistaBot commented Feb 19, 2025

Fails
🚫 This pull request adds too many lines of code. It adds 20749 lines, but the maximum allowed is 1000 lines.
🚫 Flutter analyzer failed. Please fix the issues reported by the analyzer. Error: Command failed: flutter analyze 1 issue found. (ran in 7.4s)

Generated by 🚫 dangerJS against b9b63f8

@theLee3
Copy link
Collaborator Author

theLee3 commented Feb 19, 2025

Closes #158 and #181

@theLee3
Copy link
Collaborator Author

theLee3 commented Feb 20, 2025

Also working on an updated written tutorial to link to. I will push to this PR tonight or tomorrow.

@theLee3
Copy link
Collaborator Author

theLee3 commented Feb 20, 2025

@Abedalkareem This PR still does not set the GameKit auth handler until signIn is called. The docs suggest setting it asap which will display consistent behavior with Android's auto sign-in implementation.

The difference being that on iOS, signIn would no longer serve a purpose, and the dev should instead direct the user to Game Center in device settings (or should that be signIn's behavior?).

This would adhere to Apple's guidelines, but would eliminate the ability for devs to defer sign-in to a later point in the app lifecycle (a possibility that no longer exists on Android either).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants