Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug reporting and logs sharing improvements #12773

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion modules/react-native-status/ios/RCTStatus/RCTStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ -(NSString *) prepareDirAndUpdateConfig:(NSString *)config
#if DEBUG
NSLog(@"SaveAccountAndLogin() method called");
#endif
[self getExportDbFilePath];
NSString *keyUID = [self getKeyUID:multiaccountData];
NSString *finalConfig = [self prepareDirAndUpdateConfig:config
withKeyUID:keyUID];
Expand All @@ -477,13 +478,25 @@ -(NSString *) prepareDirAndUpdateConfig:(NSString *)config
#if DEBUG
NSLog(@"SaveAccountAndLoginWithKeycard() method called");
#endif
[self getExportDbFilePath];
NSString *keyUID = [self getKeyUID:multiaccountData];
NSString *finalConfig = [self prepareDirAndUpdateConfig:config
withKeyUID:keyUID];
NSString *result = StatusgoSaveAccountAndLoginWithKeycard(multiaccountData, password, settings, finalConfig, accountsData, chatKey);
NSLog(@"%@", result);
}

- (NSString *) getExportDbFilePath {
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"export.db"];
NSFileManager *fileManager = [NSFileManager defaultManager];

if ([fileManager fileExistsAtPath:filePath]) {
[fileManager removeItemAtPath:filePath error:nil];
}

return filePath;
}

- (NSURL *) getKeyStoreDir:(NSString *)keyUID {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *rootUrl =[[fileManager
Expand Down Expand Up @@ -523,6 +536,7 @@ - (void) migrateKeystore:(NSString *)accountData
#if DEBUG
NSLog(@"Login() method called");
#endif
[self getExportDbFilePath];
[self migrateKeystore:accountData password:password];
NSString *result = StatusgoLogin(accountData, password);
NSLog(@"%@", result);
Expand All @@ -535,6 +549,7 @@ - (void) migrateKeystore:(NSString *)accountData
#if DEBUG
NSLog(@"LoginWithKeycard() method called");
#endif
[self getExportDbFilePath];
[self migrateKeystore:accountData password:password];

NSString *result = StatusgoLoginWithKeycard(accountData, password, chatKey);
Expand Down Expand Up @@ -858,8 +873,8 @@ - (void) migrateKeystore:(NSString *)accountData
#if DEBUG
NSLog(@"exportUnencryptedDatabase() method called");
#endif
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"export.db"];

NSString *filePath = [self getExportDbFilePath];
StatusgoExportUnencryptedDatabase(accountData, password, filePath);

callback(@[filePath]);
Expand Down
3 changes: 3 additions & 0 deletions src/status_im/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@
(reg-root-key-sub :anon-metrics/data-visible? :anon-metrics/data-visible?)
(reg-root-key-sub :anon-metrics/learn-more-visible? :anon-metrics/learn-more-visible?)

(reg-root-key-sub :bug-report/description-error :bug-report/description-error)
(reg-root-key-sub :bug-report/details :bug-report/details)

(re-frame/reg-sub
:communities
:<- [:raw-communities]
Expand Down
40 changes: 40 additions & 0 deletions src/status_im/ui/screens/bug_report.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(ns status-im.ui.screens.bug-report
(:require [quo.core :as quo]
[quo.react-native :as react-native]
[re-frame.core :as re-frame]
[status-im.i18n.i18n :as i18n]
[status-im.ui.components.topbar :as topbar]))

(defn bug-report []
(let [{:keys [description steps]} @(re-frame/subscribe [:bug-report/details])]
[react-native/view {:style {:flex 1}}
[topbar/topbar
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to use native topbar in this case

{:title (i18n/label :t/bug-report)
:modal? true}]
[react-native/view {:style {:flex 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is something new, usually we use react/view or rn/view

:padding-top 8
:padding-horizontal 16}}
[quo/text-input
{:label (i18n/label :t/bug-report-description)
:default-value description
:placeholder (i18n/label :t/bug-report-description-placeholder)
:style {:margin-bottom 8}
:multiline true
:error @(re-frame/subscribe [:bug-report/description-error])
:accessibility-label :bug-report-description
:on-change-text #(re-frame/dispatch [:logging/report-details :description %])}]
[quo/text-input
{:label (i18n/label :t/bug-report-steps)
:default-value steps
:placeholder (i18n/label :t/bug-report-steps-placeholder)
:style {:margin-bottom 16}
:multiline true
:accessibility-label :bug-report-steps
:on-change-text #(re-frame/dispatch [:logging/report-details :steps %])}]
[quo/button
{:type :primary
:accessibility-label :bug-report-submit
:theme :accent
:on-press #(re-frame/dispatch
[:logging/submit-report])}
(i18n/label :t/submit)]]]))
2 changes: 1 addition & 1 deletion src/status_im/ui/screens/help_center/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
:title (i18n/label :t/submit-bug)
:accessibility-label :submit-bug-button
:on-press
#(re-frame/dispatch [:logging.ui/send-logs-pressed])
#(re-frame/dispatch [:open-modal :bug-report])
:chevron true}
{:size :small
:title (i18n/label :t/request-feature)
Expand Down
Loading