[#12848] Add an option to submit error report to GH

This commit is contained in:
Roman Volosovskyi 2021-11-30 16:13:26 +02:00
parent c7e66fb1aa
commit 62162c0f2a
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
3 changed files with 43 additions and 3 deletions

View File

@ -35,6 +35,15 @@
{:type :primary {:type :primary
:accessibility-label :bug-report-submit :accessibility-label :bug-report-submit
:theme :accent :theme :accent
:on-press #(re-frame/dispatch :on-press #(re-frame/dispatch [:logging/submit-report])}
[:logging/submit-report])} (i18n/label :t/bug-report-submit-email)]
(i18n/label :t/submit)]]])) [react-native/view
{:style {:margin-vertical 16
:align-items :center}}
[quo/text (i18n/label :t/or)]]
[quo/button
{:type :primary
:accessibility-label :bug-report-submit-gh-issue
:theme :accent
:on-press #(re-frame/dispatch [:logging/submit-gh-issue])}
(i18n/label :t/bug-report-submit-gh-issue)]]]))

View File

@ -1,6 +1,7 @@
(ns status-im.utils.logging.core (ns status-im.utils.logging.core
(:require ["react-native-mail" :default react-native-mail] (:require ["react-native-mail" :default react-native-mail]
[clojure.string :as string] [clojure.string :as string]
[goog.string :as gstring]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[status-im.bottom-sheet.core :as bottom-sheet] [status-im.bottom-sheet.core :as bottom-sheet]
[status-im.i18n.i18n :as i18n] [status-im.i18n.i18n :as i18n]
@ -227,3 +228,31 @@
cofx cofx
(bottom-sheet/hide-bottom-sheet) (bottom-sheet/hide-bottom-sheet)
(send-logs :email)))) (send-logs :email))))
(re-frame/reg-fx
::open-url
(fn [url]
(.openURL ^js react/linking url)))
(def gh-issue-url "https://github.com/status-im/status-react/issues/new?labels=bug&title=%s&body=%s")
(fx/defn submit-issue
[{:keys [db]}]
(let [{:keys [steps description]}
(get db :bug-report/details)
title (or description (i18n/label :t/bug-report-description-placeholder))
body (str title
"\n\n"
(or steps (i18n/label :t/bug-report-steps-placeholder)))
url (gstring/format gh-issue-url (js/escape title) (js/escape body))]
{::open-url url}))
(fx/defn submit-gh-issue
{:events [:logging/submit-gh-issue]}
[{:keys [db] :as cofx} details steps]
(fx/merge
cofx
{:db (dissoc db :bug-report/details)}
(bottom-sheet/hide-bottom-sheet)
(submit-issue)))

View File

@ -114,6 +114,8 @@
"bug-report-description-placeholder": "Required, can't be empty", "bug-report-description-placeholder": "Required, can't be empty",
"bug-report-steps": "Steps to reproduce", "bug-report-steps": "Steps to reproduce",
"bug-report-steps-placeholder": "- open app\n- do something\n- and then somethig else...", "bug-report-steps-placeholder": "- open app\n- do something\n- and then somethig else...",
"bug-report-submit-email": "Submit by email with logs archive",
"bug-report-submit-gh-issue": "Submit a GitHub issue without logs",
"bug-report-too-short-description": "Description is too short", "bug-report-too-short-description": "Description is too short",
"camera-access-error": "To grant the required camera permission, please go to your system settings and make sure that Status > Camera is selected.", "camera-access-error": "To grant the required camera permission, please go to your system settings and make sure that Status > Camera is selected.",
"can-not-add-yourself": "That's you, to start a chat choose someone else", "can-not-add-yourself": "That's you, to start a chat choose someone else",