Skip to content

Commit

Permalink
Replace __types__ in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
robertraaijmakers committed Feb 7, 2025
1 parent 0c33e96 commit ba96102
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ module.exports = class TrashCollectionReminder extends Homey.App {
outputText = alternativeTextLabel
.replace('__time__', timeReplacement)
.replace('__type__', multiTypeString)
.replace('__types__', multiTypeString)
.replace('__types__', multiTypeString) // Added replacement for __types__ backwards compatibility
.replace('__plural__', this.homey.__('tokens.output.replacementplural'));
} else {
let textLabel = labelSettings?.['NONE']?.trashLong || this.homey.__('tokens.output.type.NONE');
Expand All @@ -419,7 +419,7 @@ module.exports = class TrashCollectionReminder extends Homey.App {
outputText = alternativeTextLabel
.replace('__time__', timeReplacement)
.replace('__type__', textLabel)
.replace('__types__', textLabel)
.replace('__types__', textLabel) // Added replacement for __types__ backwards compatibility
.replace('__plural__', this.homey.__('tokens.output.replacementsingle'));
}

Expand Down
3 changes: 2 additions & 1 deletion settings/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ class SettingScript {
async handleGetLabelSettings(err: string, labelSettings: LabelSettings) {
console.log(labelSettings);

// Replacement of __types__ with __type__ to be backwards compatible and migrate everybody to the __type__ replacement
this.setInputValue('labelTimeIndicator', labelSettings?.timeindicator || 0);
this.setInputValue('labelGeneric', labelSettings?.generic || this.homey.__('tokens.output.trashtypeycollectedonx'));
this.setInputValue('labelGeneric', labelSettings?.generic?.replace('__types__', '__type__') || this.homey.__('tokens.output.trashtypeycollectedonx'));
this.setPlaceholderValue('labelGeneric', this.homey.__('tokens.output.trashtypeycollectedonx'));

// Loop over types
Expand Down

0 comments on commit ba96102

Please sign in to comment.