From 89f66eab0ebca4fde5cb27254ed28a2fa9dc3407 Mon Sep 17 00:00:00 2001 From: Andrey Shovkoplyas Date: Sun, 25 Nov 2018 12:08:25 +0100 Subject: [PATCH] fixed Download latest button for Mac Signed-off-by: Andrey Shovkoplyas --- src/status_im/ui/components/desktop/events.cljs | 2 +- src/status_im/ui/screens/events.cljs | 15 ++++++--------- src/status_im/utils/platform.cljs | 1 + 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/status_im/ui/components/desktop/events.cljs b/src/status_im/ui/components/desktop/events.cljs index 69b2725451..00e0ea4005 100644 --- a/src/status_im/ui/components/desktop/events.cljs +++ b/src/status_im/ui/components/desktop/events.cljs @@ -22,7 +22,7 @@ (= tab-name :profile)) {:http-get {: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 (fn [o] [:fetch-desktop-version-success o])}})) diff --git a/src/status_im/ui/screens/events.cljs b/src/status_im/ui/screens/events.cljs index 4f0f8c7ec4..861b043a75 100644 --- a/src/status_im/ui/screens/events.cljs +++ b/src/status_im/ui/screens/events.cljs @@ -35,7 +35,8 @@ [status-im.utils.fx :as fx] [status-im.utils.platform :as platform] [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]}] (let [on-success #(re-frame/dispatch (success-event-creator %)) @@ -163,11 +164,7 @@ :fetch-desktop-version-success (fn [{:keys [db]} [_ result]] (when (and result (not (str/blank? result)) (or platform/isMacOs? platform/isNix?)) - (let [lines (str/split-lines result) - var (if platform/isMacOs? "DMG_URL=\"" "NIX_URL=\"") - 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)] - {:db (assoc-in db [:desktop/desktop :nightly-version] {:url url :commit commit})})))))) + (when-let [url (get (types/json->clj result) (if platform/isMacOs? :MAC :APP))] + (let [dt (- (count url) (if platform/isMacOs? 12 17)) + commit (subs url (- dt 6) dt)] + {:db (assoc-in db [:desktop/desktop :nightly-version] {:url url :commit commit})}))))) diff --git a/src/status_im/utils/platform.cljs b/src/status_im/utils/platform.cljs index 08fad41b7a..6adf063cd2 100644 --- a/src/status_im/utils/platform.cljs +++ b/src/status_im/utils/platform.cljs @@ -23,6 +23,7 @@ (def isMacOs? (when platform (.-isMacOs platform))) (def isNix? (when platform (or (.-isLinux platform) (.-isUnix platform)))) +(def isWin? (when platform (.-isWin platform))) (def platform-specific (cond