mzeryck / Weather-Cal

This is a Scriptable widget that lets you display, position, and format multiple elements, including dates and events, weather information, battery level, and more. You can even create your own elements.
MIT License
808 stars 316 forks source link

URL for noRemindersBehavior #181

Open EnricoBara opened 2 years ago

EnricoBara commented 2 years ago

Like the noEventBehavior clickable label, I'd like to suggest to add the url on noRemindersBehavior label. Here's the part I modified, tested and working fine

// Display reminders on the widget.
  async reminders(column) {    
    if (!this.data.reminders) { await this.setupReminders() }
    const reminderSettings = this.settings.reminders

    const settingUrl = reminderSettings.url || ""

    if (this.data.reminders.length == 0) {
      if (reminderSettings.noRemindersBehavior == "message" && this.localization.noRemindersMessage.length) { return this.provideText(this.localization.noRemindersMessage, column, this.format.noReminders, true, settingUrl ? reminderSettings.url : "x-apple-reminderkit://REMCDReminder/") }
      if (this[reminderSettings.noRemindersBehavior]) { return await this[reminderSettings.noRemindersBehavior](column) }
    }

    const reminderStack = column.addStack()
    reminderStack.layoutVertically()
    reminderStack.setPadding(0, 0, 0, 0)

    reminderStack.url = (settingUrl.length > 0) ? settingUrl : "x-apple-reminderkit://REMCDReminder/"    

    const numberOfReminders = this.data.reminders.length
    const showListColor = reminderSettings.showListColor
    const colorShape = showListColor.includes("circle") ? "circle" : "rectangle"

    for (let i = 0; i < numberOfReminders; i++) {
      const reminder = this.data.reminders[i]

      const titleStack = this.align(reminderStack)
      titleStack.layoutHorizontally()