fixed Download latest button for Mac

Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
Andrey Shovkoplyas 2018-11-25 12:08:25 +01:00
parent f283efaebb
commit 89f66eab0e
No known key found for this signature in database
GPG Key ID: EAAB7C8622D860A4
3 changed files with 8 additions and 10 deletions

View File

@ -22,7 +22,7 @@
(= tab-name :profile)) (= tab-name :profile))
{:http-get {:http-get
{:url {:url
"https://raw.githubusercontent.com/status-im/status-im.github.io/develop/env.sh" "https://status-im.ams3.digitaloceanspaces.com/latest.json"
:success-event-creator :success-event-creator
(fn [o] (fn [o]
[:fetch-desktop-version-success o])}})) [:fetch-desktop-version-success o])}}))

View File

@ -35,7 +35,8 @@
[status-im.utils.fx :as fx] [status-im.utils.fx :as fx]
[status-im.utils.platform :as platform] [status-im.utils.platform :as platform]
[taoensso.timbre :as log] [taoensso.timbre :as log]
[clojure.string :as str])) [clojure.string :as str]
[status-im.utils.types :as types]))
(defn- http-get [{:keys [url response-validator success-event-creator failure-event-creator timeout-ms]}] (defn- http-get [{:keys [url response-validator success-event-creator failure-event-creator timeout-ms]}]
(let [on-success #(re-frame/dispatch (success-event-creator %)) (let [on-success #(re-frame/dispatch (success-event-creator %))
@ -163,11 +164,7 @@
:fetch-desktop-version-success :fetch-desktop-version-success
(fn [{:keys [db]} [_ result]] (fn [{:keys [db]} [_ result]]
(when (and result (not (str/blank? result)) (or platform/isMacOs? platform/isNix?)) (when (and result (not (str/blank? result)) (or platform/isMacOs? platform/isNix?))
(let [lines (str/split-lines result) (when-let [url (get (types/json->clj result) (if platform/isMacOs? :MAC :APP))]
var (if platform/isMacOs? "DMG_URL=\"" "NIX_URL=\"") (let [dt (- (count url) (if platform/isMacOs? 12 17))
param (first (filter #(not= -1 (.indexOf % var)) lines))]
(when param
(let [url (subs param (+ 9 (.indexOf param var)) (- (count param) 1))
dt (- (count url) (if platform/isMacOs? 12 17))
commit (subs url (- dt 6) dt)] commit (subs url (- dt 6) dt)]
{:db (assoc-in db [:desktop/desktop :nightly-version] {:url url :commit commit})})))))) {:db (assoc-in db [:desktop/desktop :nightly-version] {:url url :commit commit})})))))

View File

@ -23,6 +23,7 @@
(def isMacOs? (when platform (.-isMacOs platform))) (def isMacOs? (when platform (.-isMacOs platform)))
(def isNix? (when platform (or (.-isLinux platform) (.-isUnix platform)))) (def isNix? (when platform (or (.-isLinux platform) (.-isUnix platform))))
(def isWin? (when platform (.-isWin platform)))
(def platform-specific (def platform-specific
(cond (cond