Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error adding photo + older settings being ignored #99

Closed
d3vcoder opened this issue Dec 17, 2020 · 17 comments
Closed

Error adding photo + older settings being ignored #99

d3vcoder opened this issue Dec 17, 2020 · 17 comments
Labels
Fixed The issue appears to be fixed.

Comments

@d3vcoder
Copy link

I get this error when trying to add a new background photo. No error when adding a solid or gradient background
77DE9139-6862-463A-BA89-70D005C4BD63

@mzeryck mzeryck added the Bug Something is not working as expected. label Dec 17, 2020
@mzeryck
Copy link
Owner

mzeryck commented Dec 17, 2020

@d3vcoder What a weird error! Is iCloud turned on for Scriptable? (Settings app > your name > iCloud > scroll to the Scriptable item)

@d3vcoder
Copy link
Author

Yes iCloud is turned on.

@icsAT
Copy link
Contributor

icsAT commented Dec 17, 2020

@d3vcoder I just discoverd the same thing at my sons mobile after performing an code update. @mzeryck already pointed into the right direction, but you not only have to activate iCloud for scriptable, but you have also to turn on iCloud Drive. But be carefull if you turn on iCloud Drive all your Script's seems to be gone, because Scriptable wants to read them from iCloud Drive now. I did not figure out how to get the the locale ones shown in scriptable with iCloud Drive on. You need to set them up new. What I did was to share them by Scriptable to the notes app and get them back after turning on iCloud drive.

@d3vcoder
Copy link
Author

@icsAT thabks for the tip. Unfortunately my phone completely glitches out when I try to turn on iCloud Drive so I can’t test this. Another issue that just cropped up is the code no longer recognizes any changes to text size and will ignore any changes made

@icsAT icsAT mentioned this issue Dec 19, 2020
@icsAT
Copy link
Contributor

icsAT commented Dec 19, 2020

@d3vcoder I just added a pull request for the picture problem. Max needs to have a look at it and merge it, then I think it will work again. Actually it was not an adding, but a reading problem. Your second problem is not related to this. It might more be related to Issue #100.

mzeryck pushed a commit that referenced this issue Dec 21, 2020
* Fixed issue #99
Fixes Issue #99 Error adding photo. The problem was not the adding, but the function "downloadFileFromiCloud" when iCloud was turned on, but iCloud Drive was turned off. I added a check, if the file ist stored in iCloud.
@mzeryck
Copy link
Owner

mzeryck commented Dec 21, 2020

@d3vcoder Thanks for bringing this up, and thanks @icsAT for your solution. In my own testing, the code worked fine with iCloud turned on or off - but since I use iCloud Drive, I didn't even think about this potential situation.

Regardless, it appears the solution should work - if you Update Code, please let me know if that is correct! And, sorry for the few days away from this project.

@mzeryck mzeryck added Fixed The issue appears to be fixed. and removed Bug Something is not working as expected. labels Dec 21, 2020
@d3vcoder
Copy link
Author

You guys are awesome. Thanks for the fix!

Still however having the issue with text size not displaying properly. The strange thing is it will change if I modify the defaultText font size, but changing any individual items size wont have any effect.

@icsAT
Copy link
Contributor

icsAT commented Dec 21, 2020

@d3vcoder none of the other textsizes are working? Could you name at least one item, where the textsize is not working correctly? Also it would be interesting, if you discover this only if the script runs in the widget or also if you start it from the app.

@d3vcoder
Copy link
Author

@icsAT See attached screenshot. Changing the defaultText will change the size of everything. Changing any individual item from that list won’t do anything.
Uploading 3253FE77-A6F7-4435-8049-E1F46090BB8A.png…

@icsAT
Copy link
Contributor

icsAT commented Dec 23, 2020

@d3vcoder I can't see your screenshot.
I tried a lot, even turning on and off icloud drive, but was not able to reproduce this situation. I thought there might be an issue with reading the preference file in your setup, but found none so far. Very strange to me is, that you say

changing defaultText will change everything

That means writing and reading to preference file seems to work, else it would stay on the provided defaults.

Is the script keeping your changes in the settings or are they gone if you call the the settings the next time?
Also, could you give me the name of your script, as shown in Scriptable?

@d3vcoder
Copy link
Author

@icsAT ill try again. It keeps the settings, it just doesn’t do anything with them. My script name is Weather cal.

2819ACC9-CFFC-4B68-9763-5C1F51478206

@icsAT
Copy link
Contributor

icsAT commented Dec 23, 2020

@d3vcoder thanks for your information. Could you please run this script https://pastebin.com/czjFJnEW from Scriptable and post a screenshot of the output.

@d3vcoder
Copy link
Author

@icsAT Here you go.

705E63BE-8A86-4734-BBF7-E14D50C89910

@icsAT
Copy link
Contributor

icsAT commented Dec 23, 2020

@d3vcoder that helps I think. The Testscript did not found the preference file. So, maybe also the Weather Cal Script is not finding it for reading the preferences. But and this is not clear to me at the moment, it must be somewhere if it stores and shows your changes. Maybe @mzeryck has an idea on this.

@mzeryck
Copy link
Owner

mzeryck commented Dec 23, 2020

@d3vcoder This is an older version of Weather Cal (the settings are now in a UITableView rather than the script). However, the code does attempt to check for older versions. Can you please go into the Weather Cal code script, and find this section:

// Determine if we're using the old or new setup.
if (typeof layout == "object") {
  this.settings = layout

} else {
  this.settings = this.getSettings()
  this.settings.layout = layout
}

And then add a single line of code after it:
console.log(this.settings)

Can you let me know what it shows? It should display a readout of all the settings from the main script file.

@mzeryck mzeryck added Bug Something is not working as expected. and removed Fixed The issue appears to be fixed. labels Dec 23, 2020
@mzeryck mzeryck changed the title Error adding photo Error adding photo + older settings being ignored Dec 23, 2020
@d3vcoder
Copy link
Author

I’ll paste below the output of the log.

2020-12-23 16:26:02: {"widget":{"locale":"","units":"imperial","preview":"large","padding":5,"tintIcons":false},"layout":"\n \n row\n column(200)\n greeting\n date \n sunset\n battery\n \n column\n center\n current \n future\n \n \n space()\n \n row\n \n column\n left\n events\n \n column\n reminders\n ","localization":{"nightGreeting":"Good night.","morningGreeting":"Good morning.","afternoonGreeting":"Good afternoon.","eveningGreeting":"Good evening.","nextHourLabel":"Next hour","tomorrowLabel":"Tomorrow","noEventMessage":"No more events","durationMinute":"m","durationHour":"h","covid":"{cases} cases, {deaths} deaths, {recovered} recoveries"},"date":{"dynamicDateSize":false,"staticDateSize":"large","smallDateFormat":"EEEE, MMMM d","largeDateLineOne":"d","largeDateLineTwo":"EEEE"},"events":{"numberOfEvents":3,"minutesAfter":5,"showAllDay":true,"showTomorrow":20,"showEventLength":"duration","selectCalendars":[],"showCalendarColor":"rectangle left","noEventBehavior":"message"},"reminders":{"numberOfReminders":3,"useRelativeDueDate":false,"showWithoutDueDate":false,"showOverdue":true,"todayOnly":true,"selectLists":[],"showListColor":"rectangle left"},"sunrise":{"showWithin":0,"separateElements":false},"weather":{"showLocation":false,"horizontalCondition":true,"showCondition":false,"showHighLow":true,"showRain":true,"tomorrowShownAtHour":20,"showDays":4,"showDaysFormat":"E","showToday":false},"covid":{"country":"USA","url":"https://covid19.who.int"},"font":{"defaultText":{"size":14,"color":"ffffff","font":"regular"},"smallDate":{"size":17,"color":"","font":"semibold"},"largeDate1":{"size":50,"color":"","font":"light"},"largeDate2":{"size":20,"color":"","font":"light"},"greeting":{"size":20,"color":"","font":"light"},"eventLabel":{"size":14,"color":"","font":"semibold"},"eventTitle":{"size":14,"color":"","font":"semibold"},"eventTime":{"size":14,"color":"ffffffcc","font":""},"noEvents":{"size":15,"color":"","font":"semibold"},"largeTemp":{"size":30,"color":"","font":"light"},"smallTemp":{"size":14,"color":"","font":""},"tinyTemp":{"size":12,"color":"","font":""},"customText":{"size":14,"color":"","font":""},"battery":{"size":14,"color":"","font":"medium"},"sunrise":{"size":14,"color":"","font":"medium"},"covid":{"size":14,"color":"","font":"medium"}}}

mzeryck added a commit that referenced this issue Dec 24, 2020
Although in the preferences window textSize is a string, it's passed as an integer value with the old settings format, meaning .length returns undefined.
@mzeryck mzeryck added Fixed The issue appears to be fixed. and removed Bug Something is not working as expected. labels Dec 24, 2020
@mzeryck
Copy link
Owner

mzeryck commented Dec 24, 2020

@d3vcoder Ah, found the bug! It's fixed in the most recent version, if you delete and re-download the Weather Cal code script.

@mzeryck mzeryck closed this as completed Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed The issue appears to be fixed.
Projects
None yet
Development

No branches or pull requests

3 participants