public async Task <Domain.Models.ResponseModels.RegisterModel> GetDeviceStatusAsync() { //SetDefaultSettings(); //Settings.SetSerialNumber(CrossDevice.Hardware.DeviceId); //Settings.SetDomainName("accessefm"); //Settings.SetApplicationId("2"); //Settings.SetVersion(CrossDevice.App.Version); //Acs.Domain.Models.RequestModels.RegisterModel deviceInfo = new Acs.Domain.Models.RequestModels.RegisterModel(); //deviceInfo.SerialNumber = Settings.GetSerialNumber(); //deviceInfo.AuthToken = Settings.GetAuthorizationToken(); //deviceInfo.DeviceName = CrossDevice.Hardware.DeviceId; //deviceInfo.OS = CrossDevice.Hardware.OperatingSystem; //deviceInfo.Version = CrossDevice.Hardware.OperatingSystemVersion; //deviceInfo.Manufacturer = CrossDevice.Hardware.Manufacturer; //deviceInfo.Model = CrossDevice.Hardware.Model; // Domain.Models.ResponseModels.RegisterModel sd = await _authService.VerifyStatus(deviceInfo); Acs.Domain.Models.RequestModels.RegisterModel deviceInfo = GetDeviceDetails(); Domain.Models.ResponseModels.RegisterModel sd = await _registerService.GetDeviceStatusAsync(deviceInfo); Settings.SetAuthorizationToken(sd.AuthToken); //DependencyService.Get<IUserPreferences>().SetString("SetAuthorizationToken", sd.AuthToken); return(sd); }
public async Task <Domain.Models.ResponseModels.RegisterModel> RegisterDeviceAsync() { Acs.Domain.Models.RequestModels.RegisterModel deviceInfo = GetDeviceDetails(); //Settings.SetSerialNumber(CrossDevice.Hardware.DeviceId); //Settings.SetDomainName("accessefm"); //Settings.SetApplicationId("Acs.ESig.Mobile"); //Settings.SetVersion(CrossDevice.App.Version); //Acs.Domain.Models.RequestModels.RegisterModel deviceInfo = new Acs.Domain.Models.RequestModels.RegisterModel(); //deviceInfo.SerialNumber = Settings.GetSerialNumber(); //deviceInfo.AuthToken = Settings.GetAuthorizationToken(); //deviceInfo.DeviceName = CrossDevice.Hardware.DeviceId; //deviceInfo.OS = CrossDevice.Hardware.OperatingSystem; //deviceInfo.Version = CrossDevice.Hardware.OperatingSystemVersion; //deviceInfo.Manufacturer = CrossDevice.Hardware.Manufacturer; //deviceInfo.Model = CrossDevice.Hardware.Model; // Register device and set AuthToken Domain.Models.ResponseModels.RegisterModel registerModel = await _registerService.RegisterDeviceAsync(deviceInfo); Settings.SetAuthorizationToken(registerModel.AuthToken); // TODO: Remove hard-coded strings. DependencyService.Get <IUserPreferences>().SetString("SetAuthorizationToken", registerModel.AuthToken); return(registerModel); }
// TODO: Move to register vm public async Task <Domain.Models.ResponseModels.RegisterModel> Register() { Settings.SetSerialNumber(CrossDevice.Hardware.DeviceId); Settings.SetDomainName("accessefm"); Settings.SetApplicationId("2"); Settings.SetVersion(CrossDevice.App.Version); // string s= _userPreferencesService.GetString("IsSettingsSave"); //DependencyService.Get<IUserPreferences>().SetString("SetSerialNumber", CrossDevice.Hardware.DeviceId); //DependencyService.Get<IUserPreferences>().SetString("SetDomainName", "accessefm"); //DependencyService.Get<IUserPreferences>().SetString("SetApplicationId", "2"); //DependencyService.Get<IUserPreferences>().SetString("SetVersion", CrossDevice.App.Version); Acs.Domain.Models.RequestModels.RegisterModel deviceInfo = new Acs.Domain.Models.RequestModels.RegisterModel(); deviceInfo.SerialNumber = Settings.GetSerialNumber(); deviceInfo.AuthToken = Settings.GetAuthorizationToken(); deviceInfo.DeviceName = CrossDevice.Hardware.DeviceId; deviceInfo.OS = CrossDevice.Hardware.OperatingSystem; deviceInfo.Version = CrossDevice.Hardware.OperatingSystemVersion; deviceInfo.Manufacturer = CrossDevice.Hardware.Manufacturer; deviceInfo.Model = CrossDevice.Hardware.Model; // Domain.Models.ResponseModels.RegisterModel sd = await _authService.RegisterDeviceAsync(deviceInfo); Domain.Models.ResponseModels.RegisterModel sd = await _registerService.RegisterDeviceAsync(deviceInfo); Settings.SetAuthorizationToken(sd.AuthToken); DependencyService.Get <IUserPreferences>().SetString("SetAuthorizationToken", sd.AuthToken); return(sd); }
protected async override void OnAppearing() { base.OnAppearing(); Domain.Models.ResponseModels.RegisterModel registrationInfo = await ViewModel.GetDeviceStatusAsync(); // TODO: move Status to enum as in specification if (registrationInfo.Status == "0") { Domain.Models.ResponseModels.RegisterModel regMod = await ViewModel.Register(); // TODO: add if DEBUG before going to prod if (regMod.Success) { var answer = await DisplayAlert("Device Registration", "This device is not approved for use with the eSignature app. Would you like to request this device be approved for use with the eSignature app?", "Yes", "No"); // Request hasn't been sent nor processed -- debug will approve if (answer) { // TODO: Remove automatic approval of device. await ViewModel.ChangeDeviceStatus(); await DisplayAlert("Device Registration", "A request has been sent to register this decive for use with the eSignature app. The approval process can take between 1 - 3 business days. Please check back tomorrow", "OK"); } else { } } } // Registration request received, but not processed yet. else if (registrationInfo.Status == "1") { await DisplayAlert("Device Registration", "A request to approve this device for use with the eSignature app has been sent, but approval hasn't been granted yet. Please check back tomorrow.\" This device is pending approval request has been sent to have this device approved for use with the eSignature app. The approval process can take between 1 - 3 business days. Please check back tomorrow", "OK"); } // Success - Device has been approved and can run this application else if (registrationInfo.Status == "2") { Settings.SetAuthorizationToken(registrationInfo.AuthToken); } // Device not allowed to run this application else if (registrationInfo.Status == "3") { await DisplayAlert("Device Registration", "This mobile application is not allowed to run on this device. Please contact support if you need help. The app will close now", "OK"); } // Request was declined else if (registrationInfo.Status == "4") { await DisplayAlert("Device Registration", "The request to register this device was declined by a system admin and blocked from connecting to Passport", "OK"); } }