/// <summary> /// Send pup the given key. /// </summary> /// <returns>The pup key.</returns> /// <param name="keycode">Keycode.</param> public async Task <bool> SendPupKey(PopperCommand command) { if (IsDebugMode) { Logger.Debug($"Sent Pupper keycode {command}"); return(true); } // TODO Move all this into a handler ... SendKeyInputRequest request = new SendKeyInputRequest(); request.command = command; var response = await _api.MakeRequest <SendKeyInputRequest, string>(request).ConfigureAwait(false); if (response?.Success == true) { _analytics.TrackPupCommand(command); return(true); } else { //TODO Error handling??? Logger.Error($"Error sending pup key {command}, responded with {response?.Code} and {response?.Messsage}"); _analytics.TrackPupCommand(command, false); return(false); } }
public void TrackPupCommand(PopperCommand key, bool success = true) { TrackEvent(success ? PupKeySuccessEvent : PupKeyFailedEvent, new Dictionary <string, string>() { { PupKeyProperty, key.ToString() } }); }