mvan231 / Scriptable

MIT License
120 stars 40 forks source link

Suggestion: Display previous months on calendar view (Upcoming Calendar Indicator) #14

Closed Andrew6rant closed 3 years ago

Andrew6rant commented 3 years ago

Here is a quick mock-up I made in photoshop to demonstrate: before after

mvan231 commented 3 years ago

Something like this? I found that with transparency on it won't render the widget. Probably on the edge of the memory limit 1EF65B33-2ABD-49F3-98D7-CFDF6EF704A0

Andrew6rant commented 3 years ago

That looks great! If it would be at all possible, could you make it so event dots outside of the current calendar month are gray like the numbers?

If you are not willing to have an update to master that hits the memory limit, could you just share the code so I can use and maintain it on my own branch? I have a jailbroken iPhone so I can manually adjust the Jetsam memory allocated to Scriptable.

Thanks a ton!

mvan231 commented 3 years ago

That's wild that you can adjust the amount of memory available for it.

Out of curiosity, what is the benefit of having the dots there, if they are gray?

Andrew6rant commented 3 years ago

Thinking about it more, it doesnt really make sense for them to be gray - I kind of just wanted something to emphasize the current month and stay consistent with how the other months are colored.

Maybe turning down the alpha transparency value for them instead?

It's not really a big thing at all, looks great as is right now anyways.

mvan231 commented 3 years ago

Excellent! Can you test this 1.9beta for me?

Andrew6rant commented 3 years ago

Works great! Tossed ya a coffee on PayPal

mvan231 commented 3 years ago

Thanks so much! Glad you like it so far. I think some further tweaks might be needed and you might want to also make some additional changes as well if you want transparency with it

Andrew6rant commented 3 years ago

Unfortunately, while the widget does render without transparency enabled, it is still close enough to the memory limit that I am getting constant Jetsam crashes from ScriptableWidgetExtension (dk.simonbs.Scriptable.ScriptableWidget). Jetsam crashes are not detectable on non-jailbroken devices, but the processes are still killed and restarted the same. I've gotten well over 100 crashes yesterday, and I believe it has had a noticeable impact on my battery life.

Increasing the hard memory limit from 30mb to 32mb has solved this on my end, but this solution isn't possible for users on non-jailbroken devices. I suggest not pushing Beta 1.9 to release unless you can somehow manage to get the memory footprint down.

mvan231 commented 3 years ago

Thanks so much! I'll look into optimizing it further if I can. I've been meaning to try and optimize the memory usage further anyway. I'll hold off 1.9 for now. It would be a shame to have this feature enabled on someone's device and have it end up crashing that much

On Fri, May 21, 2021 at 3:59 PM Andrew6rant @.***> wrote:

Unfortunately, while the widget does render without transparency enabled, it is close enough to the memory limit that I am getting constant Jetsam crashes from ScriptableWidgetExtension (dk.simonbs.Scriptable.ScriptableWidget). Jetsam crashes are not detectable on non-jailbroken devices, but the processes are still killed and restarted the same. I've gotten well over 100 crashes yesterday, and I believe it has had a noticeable impact on my battery life.

Increasing the hard memory limit from 30mb to 32mb has solved this on my end, but this solution isn't possible for users on non-jailbroken devices. I suggest not pushing Beta 1.9 to release unless you can somehow manage to get the memory footprint down.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mvan231/Scriptable/issues/14#issuecomment-846221390, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMENLER7Z4FXBFDXJCECU7LTO23SRANCNFSM44KW3KZQ .

mvan231 commented 3 years ago

Actually, I have a question, are you able to see how much memory a widget would use even if it ends early? I'm thinking we could force it to error early so we could try and piece together how much memory each section of the script is using so it could be a more targeted approach. Just an idea I had while looking at the code

Andrew6rant commented 3 years ago

Unfortunately, I'm not able to get much data off of the crash reports. Here are two of them from yesterday:

Date: 5/21/21, 3:28 PM
Process: ScriptableWidgetExtension
Bundle id: dk.simonbs.Scriptable.ScriptableWidget
Device: iPhone X, iOS 14.3

Reason: The process was terminated for exceeding jetsam memory limits
Uptime: 1s
Virtual memory size: 0x6169bb0000 bytes
Resident memory size: 0x447c000 bytes
CPU usage: 28%
Thread count: 9

Binary Images:
0x19e36f000 - 0x19e609fff Foundation arm64  <DB4D183E-0DD9-3CE4-990C-44D1C3982206> /System/Library/Frameworks/Foundation.framework/Foundation
0x1c4936000 - 0x1c4961fff AttributeGraph arm64  <74B9E18C-9822-3092-9D14-B73809CAA1B2> /System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph
0x1b15d6000 - 0x1b162ffff libc++.1.dylib arm64  <61A274A0-FAFF-3F58-B6B5-A38B20C7AE6E> /usr/lib/libc++.1.dylib
0x19ce34000 - 0x19ce6afff libdyld.dylib arm64  <FC5D448B-5EE3-3786-86E7-CCE6C21A212B> /usr/lib/system/libdyld.dylib
0x1e5897000 - 0x1e58c9fff libxpc.dylib arm64  <141B14C6-D162-3FE6-8F72-DA88EF6411DA> /usr/lib/system/libxpc.dylib
0x1e5878000 - 0x1e5888fff libsystem_pthread.dylib arm64  <D5035724-3CF4-33BE-B3C1-4F5502A9130F> /usr/lib/system/libsystem_pthread.dylib
0x1a32bc000 - 0x1a3348fff WidgetKit arm64  <ABDC6F6D-274A-3251-B13C-3A965B605EF6> /System/Library/Frameworks/WidgetKit.framework/WidgetKit
0x1c9015000 - 0x1c9045fff libsystem_kernel.dylib arm64  <70F0BF28-5A58-32C7-B85E-ED47A2216291> /usr/lib/system/libsystem_kernel.dylib
0x1a3349000 - 0x1a3eaafff SwiftUI arm64  <D4EEA371-EDDE-3F1B-9ED0-0AEBAE1692C4> /System/Library/Frameworks/SwiftUI.framework/SwiftUI
0x1a14aa000 - 0x1a14c3fff ExtensionKit arm64  <1232B11D-27CE-3866-90E4-452F45A412D0> /System/Library/PrivateFrameworks/ExtensionKit.framework/ExtensionKit
0x19d0c3000 - 0x19d46cfff CoreFoundation arm64  <6FD5304A-9759-3E22-A863-456EAB55F4CC> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1cb9d5000 - 0x1cba03fff PlugInKit arm64  <F413AAFD-A199-34E9-8D3C-C913B81D5A03> /System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit
0x19cdb5000 - 0x19ce33fff libdispatch.dylib arm64  <04B54A98-8EAD-371E-8C12-AD116CB118E2> /usr/lib/system/libdispatch.dylib
0x1a5f1e000 - 0x1a6fcffff JavaScriptCore arm64  <992C88F1-5507-357D-ABCC-2CF1BB04E37F> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore

{"ProcessBundleID":"dk.simonbs.Scriptable.ScriptableWidget","NSExceptionReason":"The process was terminated for exceeding jetsam memory limits","ProcessName":"ScriptableWidgetExtension"}
Date: 5/21/21, 3:36 PM
Process: ScriptableWidgetExtension
Bundle id: dk.simonbs.Scriptable.ScriptableWidget
Device: iPhone X, iOS 14.3

Reason: The process was terminated for exceeding jetsam memory limits
Uptime: 2s
Virtual memory size: 0x6169e54000 bytes
Resident memory size: 0x46dc000 bytes
CPU usage: 9%
Thread count: 12

Binary Images:
0x1a45c3000 - 0x1a485dfff Foundation arm64  <DB4D183E-0DD9-3CE4-990C-44D1C3982206> /System/Library/Frameworks/Foundation.framework/Foundation
0x1cab8a000 - 0x1cabb5fff AttributeGraph arm64  <74B9E18C-9822-3092-9D14-B73809CAA1B2> /System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph
0x1b782a000 - 0x1b7883fff libc++.1.dylib arm64  <61A274A0-FAFF-3F58-B6B5-A38B20C7AE6E> /usr/lib/libc++.1.dylib
0x1a3088000 - 0x1a30befff libdyld.dylib arm64  <FC5D448B-5EE3-3786-86E7-CCE6C21A212B> /usr/lib/system/libdyld.dylib
0x1ebaeb000 - 0x1ebb1dfff libxpc.dylib arm64  <141B14C6-D162-3FE6-8F72-DA88EF6411DA> /usr/lib/system/libxpc.dylib
0x1ebacc000 - 0x1ebadcfff libsystem_pthread.dylib arm64  <D5035724-3CF4-33BE-B3C1-4F5502A9130F> /usr/lib/system/libsystem_pthread.dylib
0x1a9510000 - 0x1a959cfff WidgetKit arm64  <ABDC6F6D-274A-3251-B13C-3A965B605EF6> /System/Library/Frameworks/WidgetKit.framework/WidgetKit
0x1cf269000 - 0x1cf299fff libsystem_kernel.dylib arm64  <70F0BF28-5A58-32C7-B85E-ED47A2216291> /usr/lib/system/libsystem_kernel.dylib
0x1a959d000 - 0x1aa0fefff SwiftUI arm64  <D4EEA371-EDDE-3F1B-9ED0-0AEBAE1692C4> /System/Library/Frameworks/SwiftUI.framework/SwiftUI
0x1a76fe000 - 0x1a7717fff ExtensionKit arm64  <1232B11D-27CE-3866-90E4-452F45A412D0> /System/Library/PrivateFrameworks/ExtensionKit.framework/ExtensionKit
0x1a3317000 - 0x1a36c0fff CoreFoundation arm64  <6FD5304A-9759-3E22-A863-456EAB55F4CC> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1d1c29000 - 0x1d1c57fff PlugInKit arm64  <F413AAFD-A199-34E9-8D3C-C913B81D5A03> /System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit
0x1a3009000 - 0x1a3087fff libdispatch.dylib arm64  <04B54A98-8EAD-371E-8C12-AD116CB118E2> /usr/lib/system/libdispatch.dylib
0x1ac172000 - 0x1ad223fff JavaScriptCore arm64  <992C88F1-5507-357D-ABCC-2CF1BB04E37F> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore

{"ProcessBundleID":"dk.simonbs.Scriptable.ScriptableWidget","NSExceptionReason":"The process was terminated for exceeding jetsam memory limits","ProcessName":"ScriptableWidgetExtension"}

I can send you almost 200 more if you need and can find a use for them.

mvan231 commented 3 years ago

No worries. I'm going to dig into a better way to manage some of the large data being processed to see if that helps. Will keep you informed

On Sat, May 22, 2021 at 8:22 PM Andrew6rant @.***> wrote:

Unfortunately, I'm not able to get much data off of the crash reports. Here are two of them from yesterday:

Date: 5/21/21, 3:28 PM Process: ScriptableWidgetExtension Bundle id: dk.simonbs.Scriptable.ScriptableWidget Device: iPhone X, iOS 14.3

Reason: The process was terminated for exceeding jetsam memory limits Uptime: 1s Virtual memory size: 0x6169bb0000 bytes Resident memory size: 0x447c000 bytes CPU usage: 28% Thread count: 9

Binary Images: 0x19e36f000 - 0x19e609fff Foundation arm64 /System/Library/Frameworks/Foundation.framework/Foundation 0x1c4936000 - 0x1c4961fff AttributeGraph arm64 <74B9E18C-9822-3092-9D14-B73809CAA1B2> /System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph 0x1b15d6000 - 0x1b162ffff libc++.1.dylib arm64 <61A274A0-FAFF-3F58-B6B5-A38B20C7AE6E> /usr/lib/libc++.1.dylib 0x19ce34000 - 0x19ce6afff libdyld.dylib arm64 /usr/lib/system/libdyld.dylib 0x1e5897000 - 0x1e58c9fff libxpc.dylib arm64 <141B14C6-D162-3FE6-8F72-DA88EF6411DA> /usr/lib/system/libxpc.dylib 0x1e5878000 - 0x1e5888fff libsystem_pthread.dylib arm64 /usr/lib/system/libsystem_pthread.dylib 0x1a32bc000 - 0x1a3348fff WidgetKit arm64 /System/Library/Frameworks/WidgetKit.framework/WidgetKit 0x1c9015000 - 0x1c9045fff libsystem_kernel.dylib arm64 <70F0BF28-5A58-32C7-B85E-ED47A2216291> /usr/lib/system/libsystem_kernel.dylib 0x1a3349000 - 0x1a3eaafff SwiftUI arm64 /System/Library/Frameworks/SwiftUI.framework/SwiftUI 0x1a14aa000 - 0x1a14c3fff ExtensionKit arm64 <1232B11D-27CE-3866-90E4-452F45A412D0> /System/Library/PrivateFrameworks/ExtensionKit.framework/ExtensionKit 0x19d0c3000 - 0x19d46cfff CoreFoundation arm64 <6FD5304A-9759-3E22-A863-456EAB55F4CC> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 0x1cb9d5000 - 0x1cba03fff PlugInKit arm64 /System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit 0x19cdb5000 - 0x19ce33fff libdispatch.dylib arm64 <04B54A98-8EAD-371E-8C12-AD116CB118E2> /usr/lib/system/libdispatch.dylib 0x1a5f1e000 - 0x1a6fcffff JavaScriptCore arm64 <992C88F1-5507-357D-ABCC-2CF1BB04E37F> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore

{"ProcessBundleID":"dk.simonbs.Scriptable.ScriptableWidget","NSExceptionReason":"The process was terminated for exceeding jetsam memory limits","ProcessName":"ScriptableWidgetExtension"}

Date: 5/21/21, 3:36 PM Process: ScriptableWidgetExtension Bundle id: dk.simonbs.Scriptable.ScriptableWidget Device: iPhone X, iOS 14.3

Reason: The process was terminated for exceeding jetsam memory limits Uptime: 2s Virtual memory size: 0x6169e54000 bytes Resident memory size: 0x46dc000 bytes CPU usage: 9% Thread count: 12

Binary Images: 0x1a45c3000 - 0x1a485dfff Foundation arm64 /System/Library/Frameworks/Foundation.framework/Foundation 0x1cab8a000 - 0x1cabb5fff AttributeGraph arm64 <74B9E18C-9822-3092-9D14-B73809CAA1B2> /System/Library/PrivateFrameworks/AttributeGraph.framework/AttributeGraph 0x1b782a000 - 0x1b7883fff libc++.1.dylib arm64 <61A274A0-FAFF-3F58-B6B5-A38B20C7AE6E> /usr/lib/libc++.1.dylib 0x1a3088000 - 0x1a30befff libdyld.dylib arm64 /usr/lib/system/libdyld.dylib 0x1ebaeb000 - 0x1ebb1dfff libxpc.dylib arm64 <141B14C6-D162-3FE6-8F72-DA88EF6411DA> /usr/lib/system/libxpc.dylib 0x1ebacc000 - 0x1ebadcfff libsystem_pthread.dylib arm64 /usr/lib/system/libsystem_pthread.dylib 0x1a9510000 - 0x1a959cfff WidgetKit arm64 /System/Library/Frameworks/WidgetKit.framework/WidgetKit 0x1cf269000 - 0x1cf299fff libsystem_kernel.dylib arm64 <70F0BF28-5A58-32C7-B85E-ED47A2216291> /usr/lib/system/libsystem_kernel.dylib 0x1a959d000 - 0x1aa0fefff SwiftUI arm64 /System/Library/Frameworks/SwiftUI.framework/SwiftUI 0x1a76fe000 - 0x1a7717fff ExtensionKit arm64 <1232B11D-27CE-3866-90E4-452F45A412D0> /System/Library/PrivateFrameworks/ExtensionKit.framework/ExtensionKit 0x1a3317000 - 0x1a36c0fff CoreFoundation arm64 <6FD5304A-9759-3E22-A863-456EAB55F4CC> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation 0x1d1c29000 - 0x1d1c57fff PlugInKit arm64 /System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit 0x1a3009000 - 0x1a3087fff libdispatch.dylib arm64 <04B54A98-8EAD-371E-8C12-AD116CB118E2> /usr/lib/system/libdispatch.dylib 0x1ac172000 - 0x1ad223fff JavaScriptCore arm64 <992C88F1-5507-357D-ABCC-2CF1BB04E37F> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore

{"ProcessBundleID":"dk.simonbs.Scriptable.ScriptableWidget","NSExceptionReason":"The process was terminated for exceeding jetsam memory limits","ProcessName":"ScriptableWidgetExtension"}

I can send you almost 200 more if you need and can find a use for them.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mvan231/Scriptable/issues/14#issuecomment-846486216, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMENLEUOZ4D5CJDJXDMIVADTPBKELANCNFSM44KW3KZQ .

mvan231 commented 3 years ago

Can you give this new version a try?

Andrew6rant commented 3 years ago

Works without any Jetsam crashes at stock iOS memory limits!

mvan231 commented 3 years ago

This is wonderful news! I noticed that even with transparency setting allowed to run, it loads quite quickly now. I guess reducing the amount of data that the script has to process really helped a lot and optimizing the methods of filtering the data too. I should be able to push out 1.9 soon

mvan231 commented 3 years ago

1.9 will be releasing today, sorry for the delay in getting this out