|
@@ -66,7 +66,7 @@
|
|
|
(when-let [token (db/get-github-token)]
|
|
(when-let [token (db/get-github-token)]
|
|
|
(pull repo-url token)
|
|
(pull repo-url token)
|
|
|
(js/setInterval #(pull repo-url token)
|
|
(js/setInterval #(pull repo-url token)
|
|
|
- (* 10 1000))))
|
|
|
|
|
|
|
+ (* 60 1000))))
|
|
|
|
|
|
|
|
(defn add-transaction
|
|
(defn add-transaction
|
|
|
[tx]
|
|
[tx]
|
|
@@ -107,7 +107,6 @@
|
|
|
(let [token (db/get-github-token)]
|
|
(let [token (db/get-github-token)]
|
|
|
(util/p-handle
|
|
(util/p-handle
|
|
|
(do
|
|
(do
|
|
|
- (prn "Debug: cloning " repo)
|
|
|
|
|
(db/set-repo-cloning repo true)
|
|
(db/set-repo-cloning repo true)
|
|
|
(git/clone repo token))
|
|
(git/clone repo token))
|
|
|
(fn []
|
|
(fn []
|
|
@@ -162,15 +161,20 @@
|
|
|
(notify-fn)
|
|
(notify-fn)
|
|
|
(js/setInterval notify-fn (* 1000 60)))))
|
|
(js/setInterval notify-fn (* 1000 60)))))
|
|
|
|
|
|
|
|
|
|
+(defn show-notification!
|
|
|
|
|
+ [text]
|
|
|
|
|
+ (swap! state/state assoc
|
|
|
|
|
+ :notification/show? true
|
|
|
|
|
+ :notification/text text)
|
|
|
|
|
+ (js/setTimeout #(swap! state/state assoc
|
|
|
|
|
+ :notification/show? false
|
|
|
|
|
+ :notification/text nil)
|
|
|
|
|
+ 3000))
|
|
|
|
|
+
|
|
|
(defn alter-file
|
|
(defn alter-file
|
|
|
[path commit-message content]
|
|
[path commit-message content]
|
|
|
(let [token (db/get-github-token)
|
|
(let [token (db/get-github-token)
|
|
|
repo-url (db/get-current-repo)]
|
|
repo-url (db/get-current-repo)]
|
|
|
- (prn {:repo-url repo-url
|
|
|
|
|
- :token token
|
|
|
|
|
- :path path
|
|
|
|
|
- :content content
|
|
|
|
|
- :commit-message commit-message})
|
|
|
|
|
(util/p-handle
|
|
(util/p-handle
|
|
|
(fs/write-file (git/get-repo-dir repo-url) path content)
|
|
(fs/write-file (git/get-repo-dir repo-url) path content)
|
|
|
(fn [_]
|
|
(fn [_]
|
|
@@ -180,8 +184,7 @@
|
|
|
token
|
|
token
|
|
|
(fn []
|
|
(fn []
|
|
|
(db/set-file-content! repo-url path content)
|
|
(db/set-file-content! repo-url path content)
|
|
|
- ;; (show-snackbar "File updated!")
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ (show-notification! "File updated!"))
|
|
|
(fn [error]
|
|
(fn [error]
|
|
|
(prn "Failed to update file, error: " error)))))))
|
|
(prn "Failed to update file, error: " error)))))))
|
|
|
|
|
|
|
@@ -228,8 +231,8 @@
|
|
|
headings (block/extract-headings headings)]
|
|
headings (block/extract-headings headings)]
|
|
|
(map (fn [heading]
|
|
(map (fn [heading]
|
|
|
(assoc heading
|
|
(assoc heading
|
|
|
- :repo [:repo/url repo-url]
|
|
|
|
|
- :file file))
|
|
|
|
|
|
|
+ :heading/repo [:repo/url repo-url]
|
|
|
|
|
+ :heading/file [:file/path file]))
|
|
|
headings)))
|
|
headings)))
|
|
|
|
|
|
|
|
(defn load-all-contents!
|
|
(defn load-all-contents!
|
|
@@ -241,7 +244,6 @@
|
|
|
(db/set-file-content! repo-url file content)))))
|
|
(db/set-file-content! repo-url file content)))))
|
|
|
(p/then
|
|
(p/then
|
|
|
(fn [_]
|
|
(fn [_]
|
|
|
- (prn "Files are loaded!")
|
|
|
|
|
(ok-handler))))))
|
|
(ok-handler))))))
|
|
|
|
|
|
|
|
(defn extract-all-headings
|
|
(defn extract-all-headings
|
|
@@ -261,7 +263,7 @@
|
|
|
(fn []
|
|
(fn []
|
|
|
(let [headings (extract-all-headings repo-url)]
|
|
(let [headings (extract-all-headings repo-url)]
|
|
|
(reset! headings-atom headings)
|
|
(reset! headings-atom headings)
|
|
|
- (db/reset-headings! headings)))))
|
|
|
|
|
|
|
+ (db/reset-headings! repo-url headings)))))
|
|
|
|
|
|
|
|
|
|
|
|
|
;; (defn sync
|
|
;; (defn sync
|
|
@@ -313,7 +315,6 @@
|
|
|
[]
|
|
[]
|
|
|
(db/restore!)
|
|
(db/restore!)
|
|
|
(when-let [first-repo (first (db/get-repos))]
|
|
(when-let [first-repo (first (db/get-repos))]
|
|
|
- (prn "first-repo: " first-repo)
|
|
|
|
|
(db/set-current-repo! first-repo))
|
|
(db/set-current-repo! first-repo))
|
|
|
(let [repos (db/get-repos)]
|
|
(let [repos (db/get-repos)]
|
|
|
(doseq [repo repos]
|
|
(doseq [repo repos]
|