MrStahlfelge / gdx-gamesvcs

Easy integration of gameservices in your libGDX game: Google Play Games, Apple Game Center, Amazon GameCircle and more
Apache License 2.0
113 stars 20 forks source link

Rename core interface methods to clarify their purposes #15

Closed MrStahlfelge closed 7 years ago

MrStahlfelge commented 7 years ago

The core's interface main methods root on a connection/session model based on GPGS Android which was this libraries first implementation.

However, GPGS is special in the case that the service is only available when the GoogleApiClient is "connected", which is no technical connection to the service cloud backend but just an active user session on a users device. Therefore, the methods resuming, pausing and checking the user session are named connect(), disconnect(), isConnected() in v0.1 of the interface, following the names from GoogleApiClient.

Other services do not need a user session for certain functionalities like fetching leader board entries, but of course they need a technical connection to the service's servers. This technical connection is not opened with connect() and closed with disconnect() - it is just an user session that is opened or closed when calling this methods. It is up to the service API implementation how the technical connection is made and when it is opened and closed (in most cases, the REST API implementations do not hold a connection, but just open a connection for querying or submitting data).

The JavaDocs on the methods state this correctly, however, the names of the methods lead to confusion, so they should be renamed. Suggestions are:

IGameServiceClient: connect(true) to resumeSession() connect(false) to logIn() disconnect() to pauseSession() isConnected() to isSessionActive()

IGameServliceListener: gsConnected() to gsOnSessionActive() gsDisconnected() to gsOnSessionInactive() gsError() to gsShowErrorToUser()

NotConnectedExceptionto NoSessionException