Skip to content

Commit

Permalink
Keep SL enabled even if copy operation fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
jph-sendlater committed Mar 23, 2021
1 parent 85f0915 commit 1c6c662
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions experiments/sl3u.js
Original file line number Diff line number Diff line change
Expand Up @@ -1295,19 +1295,22 @@ var SL3U = class extends ExtensionCommon.ExtensionAPI {
status
);

const localStorage = context.apiCan.findAPIPath("storage.local");
localStorage.callMethodInParentProcess(
"get", [{ "preferences": {} }]
).then(({ preferences }) => {
preferences.checkEvery = 0;
localStorage.callMethodInParentProcess(
"set", { preferences }
);
}).catch((err) =>
SendLaterFunctions.error(`Unable to disable extension`,err)
);
//// Maybe disable Send Later if copy operation failed?
// const localStorage = context.apiCan.findAPIPath("storage.local");
// localStorage.callMethodInParentProcess(
// "get", [{ "preferences": {} }]
// ).then(({ preferences }) => {
// preferences.checkEvery = 0;
// localStorage.callMethodInParentProcess(
// "set", { preferences }
// );
// }).catch((err) =>
// SendLaterFunctions.error(`Unable to disable extension`,err)
// );

const hexStatus = `0x${status.toString(16)}`;
const CopyUnsentError =
SendLaterFunctions.getMessage(context, "CopyUnsentError", [status]);
SendLaterFunctions.getMessage(context, "CopyUnsentError", [hexStatus]);
Services.prompt.alert(null, null, CopyUnsentError);
}
},
Expand Down Expand Up @@ -1349,7 +1352,7 @@ var SL3U = class extends ExtensionCommon.ExtensionAPI {
if (Components.isSuccessCode(status)) {
SendLaterFunctions.debug("SL3U.saveMessage: Saved updated message");
} else {
SendLaterFunctions.error("SL3U.saveMessage:",status);
SendLaterFunctions.error("SL3U.saveMessage:", `0x${status.toString(16)}`);
}
},
SetMessageKey: function(key) {
Expand Down

0 comments on commit 1c6c662

Please sign in to comment.