-
Notifications
You must be signed in to change notification settings - Fork 279
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
add support for backend to fix #1633 #595
Conversation
I have updated this request with a new commit fixing the typo that prevented the new Preference "autoUpdate" from initializing properly. If there are any code or styling changes I have missed, please let me know and I will change them as soon as possible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works well! Add an entry for getAutoUpdate
to the README and this should be good to go.
The README has been updated with getAutoUpdate. |
@gideonthomas is this ready to merge? |
@timmoy doesn't look like it's remembering the setting when you refresh the page. I'm gonna try to find the cause of that because I don't see an issue in your code. |
@timmoy, I made a pull request against your branch with the changes that need to be made to make this patch work fully: timmoy#1. Feel free to merge it in or make the changes yourself. Here's an explanation of the changes:
Once you have made the above changes, there are also two other small changes needed: you are missing a closing ` in your README docs and https://github.com/mozilla/brackets/pull/595/files#r102832444. Once you make those changes, I think we're good to merge this in. |
Requested changes have been made and errors are no longer occurring for registering the internal command related to auto update. Note that I kept this line since it is used in the code we want to keep here. Minor text changes have been made to fix the closing ` in the README, as well as spacing in StateManager for consistency purposes. |
@@ -105,6 +106,11 @@ define(function (require, exports, module) { | |||
function start(){ | |||
window.addEventListener("message", _listener); | |||
|
|||
var autoUpdate = BrambleStartupState.ui("autoUpdate"); | |||
if(typeof autoUpdate === "boolean") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a possibility that this is not a boolean? What are the values that it can take?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
literally anything I believe. BrambleStartupState is just a simple map currently that doesn't do any type checking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that mean we should type check, or do we need to coerce with a !!
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably just type check? I think for all the other properties, we don't do any coercion so maybe keep it like that for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it feels odd to have to type check a value that we supposedly control. Would we at least be able to enforce that whetever it's set it is a boolean? Then we don't have to bother with the check here, and we can let the handler function do whatever it needs to do when it gets "not a bool" passed into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually don't really control that, it sets it to whatever the hosting app sends us. But, I agree that we should probably enforce type checks as soon as the values are being set. We'll have to add that logic to BrambleStartupState
which currently is pretty generic to store any kind of value. Filed #615 to fix that.
@timmoy would you be able to rebase your code onto master? I see some extra commits in here. |
@gideonthomas So, in my local brackets repo I did:
This seems to have resulted in adding empty commits with original commit names and made even more extra commits. |
locales/zh-CN/editor.properties
Outdated
@@ -125,7 +125,7 @@ CMD_TOGGLE_QUICK_DOCS=快速文档 | |||
|
|||
# Drag and Drop | |||
|
|||
DND_MAX_FILE_SIZE_EXCEEDED=文件超过支持的最大大小: 3MB | |||
DND_MAX_FILE_SIZE_EXCEEDED=文件超过支持的最大大小:3MB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like you accidentally changed this file. Can you revert it so it doesn't show up as part of this commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: if you find that there are files that got accidentally changed in your commit, and you need to fix them to be what they were on master
:
git checkout master locales/zh-CN/editor.properties
git commit --amend --no-edit
@timmoy when you If so, when you are on your branch and use If not, the easiest solution is to bypass git entirely: copy the files you intentionally touched as part of this issue's work to a temp dir, do a |
@Pomax for some reason the top commit was showing correctly (c63d...), but when I tried to rebase it, only my commits were shown. Not entirely sure how the other commits got mixed up in here, but might have been when I updated thimble and did a rebase of this branch onto master? Anyways, I did end up using the second solution and it seems to have worked. The commits are all cleaned up and the fix is still working. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work @timmoy! Thanks for sticking this one out.
@@ -105,6 +106,11 @@ define(function (require, exports, module) { | |||
function start(){ | |||
window.addEventListener("message", _listener); | |||
|
|||
var autoUpdate = BrambleStartupState.ui("autoUpdate"); | |||
if(typeof autoUpdate === "boolean") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We actually don't really control that, it sets it to whatever the hosting app sends us. But, I agree that we should probably enforce type checks as soon as the values are being set. We'll have to add that logic to BrambleStartupState
which currently is pretty generic to store any kind of value. Filed #615 to fix that.
@gideonthomas I'm glad to have participated in resolving this bug, it was a great learning experience of both how the code works between the two repos, expectations and the flow of work in the community! :) |
This is a work in progress for adobe#1633 for the bramble side of the fix.
The fix will create a preference for the auto update setting so that if a user refreshes their browser, the setting will persist.