Skip to content

Commit dd2689b

Browse files
committed
Bug reporting and logs sharing improvements
1 parent e16f716 commit dd2689b

File tree

9 files changed

+302
-175
lines changed

9 files changed

+302
-175
lines changed

modules/react-native-status/ios/RCTStatus/RCTStatus.m

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ -(NSString *) prepareDirAndUpdateConfig:(NSString *)config
460460
#if DEBUG
461461
NSLog(@"SaveAccountAndLogin() method called");
462462
#endif
463+
[self getExportDbFilePath];
463464
NSString *keyUID = [self getKeyUID:multiaccountData];
464465
NSString *finalConfig = [self prepareDirAndUpdateConfig:config
465466
withKeyUID:keyUID];
@@ -477,13 +478,25 @@ -(NSString *) prepareDirAndUpdateConfig:(NSString *)config
477478
#if DEBUG
478479
NSLog(@"SaveAccountAndLoginWithKeycard() method called");
479480
#endif
481+
[self getExportDbFilePath];
480482
NSString *keyUID = [self getKeyUID:multiaccountData];
481483
NSString *finalConfig = [self prepareDirAndUpdateConfig:config
482484
withKeyUID:keyUID];
483485
NSString *result = StatusgoSaveAccountAndLoginWithKeycard(multiaccountData, password, settings, finalConfig, accountsData, chatKey);
484486
NSLog(@"%@", result);
485487
}
486488

489+
- (NSString *) getExportDbFilePath {
490+
NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"export.db"];
491+
NSFileManager *fileManager = [NSFileManager defaultManager];
492+
493+
if ([fileManager fileExistsAtPath:filePath]) {
494+
[fileManager removeItemAtPath:filePath error:nil];
495+
}
496+
497+
return filePath;
498+
}
499+
487500
- (NSURL *) getKeyStoreDir:(NSString *)keyUID {
488501
NSFileManager *fileManager = [NSFileManager defaultManager];
489502
NSURL *rootUrl =[[fileManager
@@ -523,6 +536,7 @@ - (void) migrateKeystore:(NSString *)accountData
523536
#if DEBUG
524537
NSLog(@"Login() method called");
525538
#endif
539+
[self getExportDbFilePath];
526540
[self migrateKeystore:accountData password:password];
527541
NSString *result = StatusgoLogin(accountData, password);
528542
NSLog(@"%@", result);
@@ -535,6 +549,7 @@ - (void) migrateKeystore:(NSString *)accountData
535549
#if DEBUG
536550
NSLog(@"LoginWithKeycard() method called");
537551
#endif
552+
[self getExportDbFilePath];
538553
[self migrateKeystore:accountData password:password];
539554

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

877+
NSString *filePath = [self getExportDbFilePath];
863878
StatusgoExportUnencryptedDatabase(accountData, password, filePath);
864879

865880
callback(@[filePath]);

src/status_im/subs.cljs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@
257257
(reg-root-key-sub :anon-metrics/data-visible? :anon-metrics/data-visible?)
258258
(reg-root-key-sub :anon-metrics/learn-more-visible? :anon-metrics/learn-more-visible?)
259259

260+
(reg-root-key-sub :bug-report/description-error :bug-report/description-error)
261+
260262
(re-frame/reg-sub
261263
:communities
262264
:<- [:raw-communities]
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
(ns status-im.ui.screens.bug-report
2+
(:require [quo.core :as quo]
3+
[quo.react-native :as react-native]
4+
[re-frame.core :as re-frame]
5+
[status-im.i18n.i18n :as i18n]
6+
[status-im.ui.components.topbar :as topbar]))
7+
8+
(defn bug-report []
9+
[react-native/view {:style {:flex 1}}
10+
[topbar/topbar
11+
{:title (i18n/label :t/bug-report)
12+
:modal? true}]
13+
[react-native/view {:style {:flex 1
14+
:padding-top 8
15+
:padding-horizontal 16}}
16+
[quo/text-input
17+
{:label (i18n/label :t/bug-report-description)
18+
:placeholder (i18n/label :t/bug-report-description-placeholder)
19+
:style {:margin-bottom 8}
20+
:multiline true
21+
:error @(re-frame/subscribe [:bug-report/description-error])
22+
:accessibility-label :bug-report-description
23+
:on-change-text #(re-frame/dispatch [:logging/report-details :description %])}]
24+
[quo/text-input
25+
{:label (i18n/label :t/bug-report-steps)
26+
:placeholder (i18n/label :t/bug-report-steps-placeholder)
27+
:style {:margin-bottom 16}
28+
:multiline true
29+
:accessibility-label :bug-report-steps
30+
:on-change-text #(re-frame/dispatch [:logging/report-details :steps %])}]
31+
[quo/button
32+
{:type :primary
33+
:accessibility-label :bug-report-submit
34+
:theme :accent
35+
:on-press #(re-frame/dispatch
36+
[:logging/submit-report])}
37+
(i18n/label :t/submit)]]])

src/status_im/ui/screens/help_center/views.cljs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
:title (i18n/label :t/submit-bug)
2525
:accessibility-label :submit-bug-button
2626
:on-press
27-
#(re-frame/dispatch [:logging.ui/send-logs-pressed])
27+
#(re-frame/dispatch [:open-modal :bug-report])
2828
:chevron true}
2929
{:size :small
3030
:title (i18n/label :t/request-feature)

0 commit comments

Comments
 (0)