AsyncTask: TLS now supports storing multiple values (now requires a key/value pair)

This commit is contained in:
Dylan K. Taylor
2019-04-18 18:58:31 +01:00
parent a4c7ec077b
commit 752e398970
9 changed files with 43 additions and 23 deletions

View File

@ -30,6 +30,7 @@ use function is_array;
use function json_decode;
class UpdateCheckTask extends AsyncTask{
private const TLS_KEY_UPDATER = "updater";
/** @var string */
private $endpoint;
@ -39,7 +40,7 @@ class UpdateCheckTask extends AsyncTask{
private $error = "Unknown error";
public function __construct(AutoUpdater $updater, string $endpoint, string $channel){
$this->storeLocal($updater);
$this->storeLocal(self::TLS_KEY_UPDATER, $updater);
$this->endpoint = $endpoint;
$this->channel = $channel;
}
@ -74,7 +75,7 @@ class UpdateCheckTask extends AsyncTask{
public function onCompletion() : void{
/** @var AutoUpdater $updater */
$updater = $this->fetchLocal();
$updater = $this->fetchLocal(self::TLS_KEY_UPDATER);
if($this->hasResult()){
$updater->checkUpdateCallback($this->getResult());
}else{