Line data Source code
1 : import 'package:pal/src/services/client/in_app_user/in_app_user_client_service.dart'; 2 : 3 : 4 2 : void setInAppUserManagerService(InAppUserClientService inAppUserClientService){ 5 4 : InAppUserManager.instance._inAppUserClientService = inAppUserClientService; 6 : } 7 : 8 : 9 : class InAppUserManager { 10 : 11 6 : static InAppUserManager _instance = InAppUserManager._(); 12 : 13 : InAppUserClientService _inAppUserClientService; 14 : 15 2 : InAppUserManager._(); 16 : 17 : /// In edition mode, always return true 18 0 : Future<bool> connect(final String inAppUserId) async { 19 : try { 20 0 : if (this._inAppUserClientService == null) { // TODO change with config 21 : return true; 22 : } 23 0 : await this._inAppUserClientService.onConnect(inAppUserId); 24 : return true; 25 : } catch (e){ 26 : return false; 27 : } 28 : } 29 : 30 : /// In edition mode, always return true 31 0 : Future<bool> disconnect() async { 32 : try { 33 0 : if (this._inAppUserClientService == null) { // TODO change with config 34 : return true; 35 : } 36 0 : await this._inAppUserClientService.onDisconnect(); 37 : return true; 38 : } catch (e){ 39 : return false; 40 : } 41 : } 42 : 43 4 : static InAppUserManager get instance => _instance; 44 : }