Skip to content

Commit

Permalink
Added connecting indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
edwinvdpol committed Sep 18, 2024
1 parent b8918ad commit 6bc6435
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Device.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Device extends Homey.Device {

// Device initialized
async onInit() {
// Connecting to API
await this.setUnavailable(this.homey.__('authentication.connecting'));

// Migrate settings to store
await this.migrate();

Expand Down Expand Up @@ -82,6 +85,8 @@ class Device extends Homey.Device {
result = await client.getSyncData();

await this.handleSyncData(result);

this.setAvailable().catch(this.error);
} catch (err) {
const msg = this.homey.__(err.message);

Expand Down Expand Up @@ -140,8 +145,6 @@ class Device extends Homey.Device {
}

this.setCapabilityValue('remaining_files', Object.keys(data.Files).length).catch(this.error);

this.setAvailable().catch(this.error);
}

/*
Expand Down
3 changes: 3 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"authentication": {
"connecting": "Connecting..."
},
"error": {
"400": "Request to server is incorrect",
"401": "Login details are incorrect",
Expand Down
3 changes: 3 additions & 0 deletions locales/nl.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"authentication": {
"connecting": "Bezig met verbinden..."
},
"error": {
"400": "Verzoek naar server is onjuist",
"401": "Inloggegevens zijn onjuist",
Expand Down

0 comments on commit 6bc6435

Please sign in to comment.