MrStahlfelge/gdx-gamesvcs

Rename core interface methods to clarify their purposes

MrStahlfelge opened this issue · 0 comments

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