Add the getFeedURL API for macOS and Windows
This commit is contained in:
parent
ba887dbde7
commit
51687e1bc9
6 changed files with 22 additions and 0 deletions
|
@ -79,6 +79,10 @@ void AutoUpdater::OnWindowAllClosed() {
|
||||||
QuitAndInstall();
|
QuitAndInstall();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AutoUpdater::GetFeedURL() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
void AutoUpdater::SetFeedURL(const std::string& url, mate::Arguments* args) {
|
void AutoUpdater::SetFeedURL(const std::string& url, mate::Arguments* args) {
|
||||||
auto_updater::AutoUpdater::HeaderMap headers;
|
auto_updater::AutoUpdater::HeaderMap headers;
|
||||||
args->GetNext(&headers);
|
args->GetNext(&headers);
|
||||||
|
@ -109,6 +113,7 @@ void AutoUpdater::BuildPrototype(
|
||||||
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
|
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
|
||||||
mate::ObjectTemplateBuilder(isolate, prototype)
|
mate::ObjectTemplateBuilder(isolate, prototype)
|
||||||
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
|
.SetMethod("checkForUpdates", &auto_updater::AutoUpdater::CheckForUpdates)
|
||||||
|
.SetMethod("getFeedURL", &auto_updater::AutoUpdater::GetFeedURL)
|
||||||
.SetMethod("setFeedURL", &AutoUpdater::SetFeedURL)
|
.SetMethod("setFeedURL", &AutoUpdater::SetFeedURL)
|
||||||
.SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
|
.SetMethod("quitAndInstall", &AutoUpdater::QuitAndInstall);
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ class AutoUpdater : public mate::EventEmitter<AutoUpdater>,
|
||||||
void OnWindowAllClosed() override;
|
void OnWindowAllClosed() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string GetFeedURL();
|
||||||
void SetFeedURL(const std::string& url, mate::Arguments* args);
|
void SetFeedURL(const std::string& url, mate::Arguments* args);
|
||||||
void QuitAndInstall();
|
void QuitAndInstall();
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,10 @@ void AutoUpdater::SetDelegate(Delegate* delegate) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(OS_MACOSX) || defined(MAS_BUILD)
|
#if !defined(OS_MACOSX) || defined(MAS_BUILD)
|
||||||
|
std::string AutoUpdater::GetFeedURL() {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
void AutoUpdater::SetFeedURL(const std::string& url,
|
void AutoUpdater::SetFeedURL(const std::string& url,
|
||||||
const HeaderMap& requestHeaders) {
|
const HeaderMap& requestHeaders) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ class AutoUpdater {
|
||||||
static Delegate* GetDelegate();
|
static Delegate* GetDelegate();
|
||||||
static void SetDelegate(Delegate* delegate);
|
static void SetDelegate(Delegate* delegate);
|
||||||
|
|
||||||
|
static std::string GetFeedURL();
|
||||||
static void SetFeedURL(const std::string& url,
|
static void SetFeedURL(const std::string& url,
|
||||||
const HeaderMap& requestHeaders);
|
const HeaderMap& requestHeaders);
|
||||||
static void CheckForUpdates();
|
static void CheckForUpdates();
|
||||||
|
|
|
@ -25,9 +25,14 @@ SQRLUpdater* g_updater = nil;
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool g_update_available = false;
|
bool g_update_available = false;
|
||||||
|
std::string update_url_ = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AutoUpdater::GetFeedURL() {
|
||||||
|
return update_url_;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void AutoUpdater::SetFeedURL(const std::string& feed,
|
void AutoUpdater::SetFeedURL(const std::string& feed,
|
||||||
const HeaderMap& requestHeaders) {
|
const HeaderMap& requestHeaders) {
|
||||||
|
@ -35,6 +40,8 @@ void AutoUpdater::SetFeedURL(const std::string& feed,
|
||||||
if (!delegate)
|
if (!delegate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
update_url_ = feed;
|
||||||
|
|
||||||
NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)];
|
NSURL* url = [NSURL URLWithString:base::SysUTF8ToNSString(feed)];
|
||||||
NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url];
|
NSMutableURLRequest* urlRequest = [NSMutableURLRequest requestWithURL:url];
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,10 @@ AutoUpdater.prototype.quitAndInstall = function () {
|
||||||
return app.quit()
|
return app.quit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoUpdater.prototype.GetFeedURL = function () {
|
||||||
|
return this.updateURL;
|
||||||
|
}
|
||||||
|
|
||||||
AutoUpdater.prototype.setFeedURL = function (updateURL, headers) {
|
AutoUpdater.prototype.setFeedURL = function (updateURL, headers) {
|
||||||
this.updateURL = updateURL
|
this.updateURL = updateURL
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue