stoically / temporary-containers

Firefox Add-on that lets you open automatically managed disposable containers
https://addons.mozilla.org/firefox/addon/temporary-containers/
MIT License
852 stars 60 forks source link

feat: automatic re-isolation after n seconds (#315) #429

Closed rkodey closed 4 years ago

rkodey commented 4 years ago

Add handler logic in isolation.ts Add a new function setIsolation, to consolidate some overlapping code Replace code in commands.ts with setIsolation function Update addIsolationInactiveBadge in browseraction.ts to accept an optional counter Closes #315

rkodey commented 4 years ago

Something that came to mind which might make this slightly more complicated - how should automatically re-enabling isolation behave in case of Firefox shutdown/restart? Like, if I set the delay to 60seconds and just happen to close Firefox while it ticks down, it'll stay disabled after Firefox starts again. Maybe it might make sense to store the re-enable target time in storage (not preferences) and check that while initialization as well?

New commit should resolve all conversations above, and addresses the question of an interrupted countdown if the browser is closed. Using the local storage was rather seamless, thanks to your storage class!

I think there's a good argument to move the isolation.active out of preferences. My thought is that it's not really a preference as it cannot be toggled from the Preferences / Options page. It's more of a pseudo-pref that's only in the popup. I think I can cleanly pull it out of prefs and into the new local storage I added to resume the auto-re-isolate. That might also resolve #433.

rkodey commented 4 years ago

New commit. NOTE: Somehow something changed on my setup, and a build error popped up in test/helper.ts. It feels like some library got updated, but even after fully rebuilding my local node_packages, I'm still getting it. I fixed the error to allow my local build to proceed - but I did not commit the change it since I'm not sure where the underlying change came from.

stoically commented 4 years ago

I fixed the error to allow my local build to proceed

What kind of error did you encounter?

rkodey commented 4 years ago

I fixed the error to allow my local build to proceed

What kind of error did you encounter?

You can disregard. Now that I'm caught up on the main branch, the head is compiling clean.

rkodey commented 4 years ago

Thanks for the merge!

I will work on refactoring the isolation active flag in a new PR related to #433