IUserService
public protocol IUserService
The UserService library manages the user data for an application.
The UserService library is responsible for managing a user’s data stored in the remote v5 Game Service. The library wraps all network requests required to set and fetch a user’s bankroll items and bulk storage values. The service will also optionally initialize a new user’s values to defaults specified in the manifest. The service can also be setup to fetch data for other users.
The service requires the game setup a ‘userService’ data node in the manifest.
-
Preinitialize the User Service. When using hive
preInitialize()will be executed on all hive nodes, before proceding to the initialization phase.Declaration
Swift
func preInitialize() -> Void -
Initialize the User Service. This will initialize internal User Service dependencies like the profile manager and the data model. It will also fetch all data associated with the ‘onLoad’ fetch configuration key in the manifest. All external dependencies will use the default singleton instances.
Declaration
Swift
func initialize() -> Promise<Response>Return Value
A
Promise<Response>, response will be empty on success. -
Initialize service with custom service dependency implementations.
See
initialize()Custom service implementaitions can be provided which will be used instead of the defaults.
Declaration
Swift
func initialize(manifest: Manifest, darkMatter: IDarkMatter, profileManager: IUserServiceProfileManager, networkManager: INetworkManager, gameService: IGameService) -> Promise<Response>Parameters
manifestThe
Manifestobject the UserService library will use.darkMatterThe
IDarkMatterobject the UserService library will use.profileManagerThe
IUserServiceProfileManagerobject the UserService library will use.networkManagerThe
INetworkManagerobject the UserService library will use.gameServiceThe
IGameServiceobject the UserService library will use.Return Value
A
Promise<Response>, response will be empty on success. -
Fetches all data for the current local user, this will automatically get called as part of the initialization of the User Service.
Declaration
Swift
func initializeLocalUser(resetToDefaults: Bool) -> Promise<Response>Parameters
resetToDefaultsFlag that will resets the local user to defaults defined in the manifest.
Return Value
A
Promise<Response>, response will be empty on success. -
Get the current user token required to set data in the v5 service.
Declaration
Swift
var userToken: String -
An external flag set when initializing the service that tracks if the local user is new and thus needs their data initialized.
Declaration
Swift
var newUser: Bool
IUserService Protocol Reference