Send logs on shaking device

This commit is contained in:
Roman Volosovskyi 2019-05-07 09:37:43 +03:00
parent ee127722ce
commit b0be9ee976
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
14 changed files with 115 additions and 17 deletions

View File

@ -217,7 +217,7 @@ android {
initWith release
applicationIdSuffix ".pr"
versionNameSuffix ".pr"
debuggable true
debuggable false
matchingFallbacks = ["release"]
// necessary to make react-native-config's code generation work
resValue "string", "build_config_package", "im.status.ethereum"
@ -276,6 +276,7 @@ dependencies {
implementation project(':react-native-webview')
implementation project(':react-native-config')
implementation project(':react-native-firebase')
implementation project(':react-native-shake')
implementation project(':RNMail')
compile ('com.google.android.gms:play-services-base:16.0.1') {
force = true

View File

@ -36,6 +36,7 @@ import io.invertase.firebase.notifications.RNFirebaseNotificationsPackage;
import io.realm.react.RealmReactPackage;
import me.alwx.HttpServer.HttpServerReactPackage;
import com.chirag.RNMail.*;
import com.clipsub.RNShake.RNShakeEventPackage;
public class MainApplication extends MultiDexApplication implements ReactApplication {
@ -72,7 +73,8 @@ public class MainApplication extends MultiDexApplication implements ReactApplica
new WebViewBridgePackage(BuildConfig.DEBUG_WEBVIEW == "1", callRPC),
new RNCWebViewPackage(),
new ReactNativeConfigPackage(),
new KeychainPackage());
new KeychainPackage(),
new RNShakeEventPackage());
}
@Override

View File

@ -44,3 +44,5 @@ include ':react-native-android'
project(':react-native-android').projectDir = new File(rootProject.projectDir, '../node_modules/react-native/ReactAndroid')
include ':RNMail', ':app'
project(':RNMail').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mail/android')
include ':react-native-shake'
project(':react-native-shake').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-shake/android')

View File

@ -44,7 +44,8 @@
"js-sha3"
"react-navigation"
"hi-base32"
"react-native-mail"]
"react-native-mail"
"react-native-shake"]
;; Desktop modules
:desktop-modules ["realm"

View File

@ -33,6 +33,7 @@
42B30EAD0EED4C72BB96D1AB /* Inter-ExtraBold.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6B145D55D500476BB45C2232 /* Inter-ExtraBold.otf */; };
475D202F20B7450D00879A77 /* libRNFirebase.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 475D1FC020B7413500879A77 /* libRNFirebase.a */; };
4C16DE0C1F89508700AA10DB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */; };
4C5F69C322815E6A00D26222 /* libRNShakeEvent.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C5F69BE22815E4F00D26222 /* libRNShakeEvent.a */; };
4C9FBC56227C85640024181F /* libRNMail.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C9FBC50227C85250024181F /* libRNMail.a */; };
54BD2CE922134B6291FE1BFD /* Inter-Light-BETA.otf in Resources */ = {isa = PBXBuildFile; fileRef = 6864A92FD6844B928C52F5C1 /* Inter-Light-BETA.otf */; };
57C854A7993C47A3B1AECD32 /* Inter-MediumItalic.otf in Resources */ = {isa = PBXBuildFile; fileRef = C6B1215047604CD59A4C74D6 /* Inter-MediumItalic.otf */; };
@ -188,6 +189,13 @@
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNFirebase;
};
4C5F69BD22815E4F00D26222 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4C5F698522815E4E00D26222 /* RNShakeEvent.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 134814201AA4EA6300B7C361;
remoteInfo = RNShakeEvent;
};
4C9FBC4F227C85250024181F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 4C9FBC19227C85250024181F /* RNMail.xcodeproj */;
@ -556,6 +564,7 @@
475D1FCD20B7415300879A77 /* libFirebaseCore.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFirebaseCore.a; sourceTree = BUILT_PRODUCTS_DIR; };
475D1FCE20B7415300879A77 /* libFirebaseMessaging.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libFirebaseMessaging.a; sourceTree = BUILT_PRODUCTS_DIR; };
4C16DE0B1F89508700AA10DB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
4C5F698522815E4E00D26222 /* RNShakeEvent.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNShakeEvent.xcodeproj; path = "../node_modules/react-native-shake/ios/RNShakeEvent.xcodeproj"; sourceTree = "<group>"; };
4C9FBC19227C85250024181F /* RNMail.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RNMail.xcodeproj; path = "../node_modules/react-native-mail/RNMail.xcodeproj"; sourceTree = "<group>"; };
4E586E1B0E544F64AA9F5BD1 /* libz.tbd */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
5535217F57E44D77AA9CF083 /* libRCTOrientation.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTOrientation.a; sourceTree = "<group>"; };
@ -629,6 +638,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4C5F69C322815E6A00D26222 /* libRNShakeEvent.a in Frameworks */,
ABC194E5221009A800EB06E6 /* libRNLanguages.a in Frameworks */,
475D202F20B7450D00879A77 /* libRNFirebase.a in Frameworks */,
4C9FBC56227C85640024181F /* libRNMail.a in Frameworks */,
@ -891,6 +901,14 @@
name = Products;
sourceTree = "<group>";
};
4C5F698622815E4E00D26222 /* Products */ = {
isa = PBXGroup;
children = (
4C5F69BE22815E4F00D26222 /* libRNShakeEvent.a */,
);
name = Products;
sourceTree = "<group>";
};
4C9FBC1A227C85250024181F /* Products */ = {
isa = PBXGroup;
children = (
@ -922,6 +940,7 @@
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
4C5F698522815E4E00D26222 /* RNShakeEvent.xcodeproj */,
4C9FBC19227C85250024181F /* RNMail.xcodeproj */,
ABC194DC2210099B00EB06E6 /* RNLanguages.xcodeproj */,
B461988B2210C98F00603CF2 /* RNCWebView.xcodeproj */,
@ -1324,6 +1343,10 @@
ProductGroup = 475D1EEE20B73EE000879A77 /* Products */;
ProjectRef = AF409BB755B94FB1BBA01927 /* RNSecureRandom.xcodeproj */;
},
{
ProductGroup = 4C5F698622815E4E00D26222 /* Products */;
ProjectRef = 4C5F698522815E4E00D26222 /* RNShakeEvent.xcodeproj */;
},
{
ProductGroup = 92925B361F571DE600203EEB /* Products */;
ProjectRef = 1E74DC52A1E449A2BA858B14 /* RNSVG.xcodeproj */;
@ -1451,6 +1474,13 @@
remoteRef = 475D1FBF20B7413500879A77 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
4C5F69BE22815E4F00D26222 /* libRNShakeEvent.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNShakeEvent.a;
remoteRef = 4C5F69BD22815E4F00D26222 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
4C9FBC50227C85250024181F /* libRNMail.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;

View File

@ -54,6 +54,7 @@
"react-native-randombytes": "3.5.0",
"react-native-safe-area-view": "0.9.0",
"react-native-securerandom": "git+https://github.com/status-im/react-native-securerandom.git#0.1.1-2",
"react-native-shake": "^3.3.1",
"react-native-splash-screen": "3.1.1",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#v2.5.4",
"react-native-svg": "^9.2.4",

View File

@ -3526,7 +3526,7 @@ invariant@2.2.0:
dependencies:
loose-envify "^1.0.0"
invariant@^2.2.2, invariant@^2.2.4:
invariant@^2.2.2, invariant@^2.2.4, invariant@^2.2.x:
version "2.2.4"
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==
@ -5581,6 +5581,13 @@ react-native-scrollable-mixin@^1.0.1:
dependencies:
base64-js "*"
react-native-shake@^3.3.1:
version "3.3.1"
resolved "https://registry.yarnpkg.com/react-native-shake/-/react-native-shake-3.3.1.tgz#e168827015db0cfb316f2bd428afe95f225fda6a"
integrity sha512-Z5W/tC3rsOcQmAOxe/uHsGNrXyZx3xwd1bFaRw0pbO0lhG4Z1g2MOcrO/Pa+ZA59ap/1tmwVP6/+IPtt6DPT1w==
dependencies:
invariant "^2.2.x"
react-native-splash-screen@3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/react-native-splash-screen/-/react-native-splash-screen-3.1.1.tgz#1a4e46c9fdce53ff52af2a2cb4181788c4e30b30"

View File

@ -33,4 +33,5 @@
(def snoopy-buffer #js {})
(def background-timer #js {:setTimeout (fn [cb ms] (js/setTimeout cb ms))})
(def react-navigation (js/require "react-navigation"))
(def react-native-shake #js {})
(def react-native-mail #js {:mail (fn [])})

View File

@ -28,6 +28,7 @@
(def snoopy-buffer (js/require "rn-snoopy/stream/buffer"))
(def background-timer (.-default (js/require "react-native-background-timer")))
(def react-navigation (js/require "react-navigation"))
(def react-native-shake (js/require "react-native-shake"))
(def react-native-mail (.-default (js/require "react-native-mail")))
(def desktop-linking #js {:addEventListener (fn [])})
(def desktop-menu #js {:addEventListener (fn [])})

View File

@ -21,6 +21,9 @@
(defn on-languages-change [event]
(set! (.-locale rn-dependencies/i18n) (.-language event)))
(defn on-shake []
(dispatch [:shake-event]))
(defn app-root [props]
(let [keyboard-height (subscribe [:keyboard-height])]
(reagent/create-class
@ -42,7 +45,10 @@
(dispatch [:set :keyboard-height 0]))))
(.hide react/splash-screen)
(.addEventListener react/app-state "change" app-state-change-handler)
(.addEventListener rn-dependencies/react-native-languages "change" on-languages-change))
(.addEventListener rn-dependencies/react-native-languages "change" on-languages-change)
(.addEventListener rn-dependencies/react-native-shake
"ShakeEvent"
on-shake))
:component-did-mount
(fn [this]
(dispatch [:set-initial-props (reagent/props this)]))
@ -50,7 +56,10 @@
(fn []
(.stop react/http-bridge)
(.removeEventListener react/app-state "change" app-state-change-handler)
(.removeEventListener rn-dependencies/react-native-languages "change" on-languages-change))
(.removeEventListener rn-dependencies/react-native-languages "change" on-languages-change)
(.removeEventListener rn-dependencies/react-native-shake
"ShakeEvent"
on-shake))
:display-name "root"
:reagent-render views/main})))

View File

@ -2237,3 +2237,8 @@
(fx/merge cofx
{:db (assoc-in db [:wallet :send-transaction] {})}
(navigation/navigate-back))))
(handlers/register-handler-fx
:shake-event
(fn [cofx _]
(logging/show-logs-dialog cofx)))

View File

@ -19,6 +19,9 @@
(defn on-languages-change [event]
(set! (.-locale rn-dependencies/i18n) (.-language event)))
(defn on-shake []
(dispatch [:shake-event]))
(defn app-root [props]
(let [keyboard-height (subscribe [:keyboard-height])]
(reagent/create-class
@ -37,7 +40,10 @@
(dispatch [:set :keyboard-height 0])))
(.hide react/splash-screen)
(.addEventListener react/app-state "change" app-state-change-handler)
(.addEventListener rn-dependencies/react-native-languages "change" on-languages-change))
(.addEventListener rn-dependencies/react-native-languages "change" on-languages-change)
(.addEventListener rn-dependencies/react-native-shake
"ShakeEvent"
on-shake))
:component-did-mount
(fn [this]
(dispatch [:set-initial-props (reagent/props this)]))
@ -45,7 +51,10 @@
(fn []
(.stop react/http-bridge)
(.removeEventListener react/app-state "change" app-state-change-handler)
(.removeEventListener rn-dependencies/react-native-languages "change" on-languages-change))
(.removeEventListener rn-dependencies/react-native-languages "change" on-languages-change)
(.removeEventListener rn-dependencies/react-native-shake
"ShakeEvent"
on-shake))
:display-name "root"
:reagent-render views/main})))

View File

@ -6,7 +6,8 @@
[status-im.utils.handlers :as handlers]
[status-im.utils.email :as mail]
[taoensso.timbre :as log]
[status-im.utils.config :as config]))
[status-im.utils.config :as config]
[status-im.i18n :as i18n]))
(def report-email "error-reports@status.im")
(def max-log-entries 1000)
@ -63,14 +64,41 @@
:node/status]))]
{:logs/archive-logs [db-json ::send-email]}))
(fx/defn show-logs-dialog
[{:keys [db]}]
(when-not (:logging/dialog-shown? db)
{:db
(assoc db :logging/dialog-shown? true)
:utils/show-confirmation
{:title (i18n/label :t/send-logs)
:content (i18n/label :t/send-logs-to
{:email report-email})
:confirm-button-text (i18n/label :t/send-logs)
:on-accept #(re-frame/dispatch
[:logging.ui/send-logs-pressed])
:on-cancel #(re-frame/dispatch
[:logging/dialog-canceled])}}))
(fx/defn dialog-closed
[{:keys [db]}]
{:db (dissoc db :logging/dialog-shown?)})
(handlers/register-handler-fx
::send-email
(fn [cofx [_ archive-path]]
(mail/send-email cofx
(fx/merge
cofx
(dialog-closed)
(mail/send-email
{:subject "Error report"
:recipients [report-email]
:body "logs attached"
:attachment {:path archive-path
:type "zip"
:name "status_logs.zip"}}
(fn []))))
(fn [])))))
(handlers/register-handler-fx
:logging/dialog-canceled
(fn [cofx]
(dialog-closed cofx)))

View File

@ -425,6 +425,7 @@
"status-not-sent-tap": "Not confirmed. Tap for options",
"status-not-sent-click": "Not confirmed. Click for options",
"send-logs": "Send logs",
"send-logs-to": "Send logs to {{email}}",
"edit-network-config": "Edit network config",
"clear-history-confirmation": "Clear history?",
"currency-display-name-gyd": "Guyana Dollar",