Showing device's IP (#807)

This commit is contained in:
alwx 2017-03-02 17:35:22 +03:00 committed by Roman Volosovskyi
parent eb15c0a4eb
commit 43667ea6ac
9 changed files with 69 additions and 4 deletions

View File

@ -39,7 +39,8 @@
"react-native-autolink",
"instabug-reactnative",
"nfc-react-native",
"react-native-http-bridge"
"react-native-http-bridge",
"react-native-network-info"
],
"imageDirs": [
"images"

View File

@ -158,6 +158,7 @@ android {
}
dependencies {
compile project(':react-native-network-info')
compile project(':react-native-http-bridge')
compile project(':nfc-react-native')
compile project(':instabug-reactnative')

View File

@ -3,6 +3,7 @@ package im.status.ethereum;
import android.app.Application;
import com.facebook.react.ReactApplication;
import com.pusherman.networkinfo.RNNetworkInfoPackage;
import me.alwx.HttpServer.HttpServerReactPackage;
import es.tiarg.nfcreactnative.NfcReactNativePackage;
import com.instabug.reactlibrary.RNInstabugReactnativePackage;
@ -43,6 +44,7 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new RNNetworkInfoPackage(),
new HttpServerReactPackage(),
new NfcReactNativePackage(),
new RNInstabugReactnativePackage("b239f82a9cb00464e4c72cc703e6821e",MainApplication.this,"shake"),

View File

@ -1,6 +1,8 @@
rootProject.name = 'StatusIm'
include ':app'
include ':react-native-network-info'
project(':react-native-network-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-network-info/android')
include ':react-native-http-bridge'
project(':react-native-http-bridge').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-http-bridge/android')
include ':nfc-react-native'

View File

@ -66,6 +66,7 @@
CE4E31B31D8695250033ED64 /* Statusgo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE4E31B21D8695250033ED64 /* Statusgo.framework */; };
D28AEFB4C39548EB80416889 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 52E205D210BC48B7A553BB62 /* Entypo.ttf */; };
E0AD9E8F495A4907B65104BF /* libRCTImageResizer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BEE3436791D42248F853999 /* libRCTImageResizer.a */; };
EC8998BFE2C04023A860C065 /* libRNNetworkInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 74B7BDFF464F43D3BA8EA040 /* libRNNetworkInfo.a */; };
EF2B5857B4A34E0C9707FB3F /* Octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B3B19223008342D096AA356E /* Octicons.ttf */; };
FD4F213C3873473CB703B1D2 /* libRNFS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 674B3D9595A047AB8D518F4E /* libRNFS.a */; };
/* End PBXBuildFile section */
@ -344,6 +345,13 @@
remoteGlobalIDString = 2D2A28201D9B03D100D4039D;
remoteInfo = "RCTAnimation-tvOS";
};
B2D090C71E6839D7005BD157 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F93B6663A59F4B26BD4DA525 /* RNNetworkInfo.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 045BEB3C1B52EA6A0013C1B9;
remoteInfo = RNNetworkInfo;
};
B2DEA0B01E49E32000FA28D6 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = B2DEA0A41E49E32000FA28D6 /* RCTHttpServer.xcodeproj */;
@ -426,6 +434,7 @@
5535217F57E44D77AA9CF083 /* libRCTOrientation.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTOrientation.a; sourceTree = "<group>"; };
5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RCTImageResizer.xcodeproj; path = "../node_modules/react-native-image-resizer/ios/RCTImageResizer.xcodeproj"; sourceTree = "<group>"; };
674B3D9595A047AB8D518F4E /* libRNFS.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNFS.a; sourceTree = "<group>"; };
74B7BDFF464F43D3BA8EA040 /* libRNNetworkInfo.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNNetworkInfo.a; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
78C55F15EB4D4DAF9202A662 /* libRNRandomBytes.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRNRandomBytes.a; sourceTree = "<group>"; };
7B5870D9ED504F32B6A09C35 /* FontAwesome.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome.ttf"; sourceTree = "<group>"; };
@ -458,6 +467,7 @@
DF1CD4C3D1254774ACCAE4E8 /* libBVLinearGradient.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libBVLinearGradient.a; sourceTree = "<group>"; };
F090E261B9854867A728CE4F /* RealmReact.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RealmReact.xcodeproj; path = "../node_modules/realm/react-native/ios/RealmReact.xcodeproj"; sourceTree = "<group>"; };
F3548417D8DA4362B6796A54 /* RNInstabug.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNInstabug.xcodeproj; path = "../node_modules/instabug-reactnative/ios/RNInstabug.xcodeproj"; sourceTree = "<group>"; };
F93B6663A59F4B26BD4DA525 /* RNNetworkInfo.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = RNNetworkInfo.xcodeproj; path = "../node_modules/react-native-network-info/ios/RNNetworkInfo.xcodeproj"; sourceTree = "<group>"; };
FC1CBCFE6C906043D6CCEEE1 /* libPods-StatusImTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-StatusImTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@ -512,6 +522,7 @@
E0AD9E8F495A4907B65104BF /* libRCTImageResizer.a in Frameworks */,
5F8585D411844E5981B94F40 /* libRNInstabug.a in Frameworks */,
8E55E6877F950B81C8D711C5 /* libPods-StatusIm.a in Frameworks */,
EC8998BFE2C04023A860C065 /* libRNNetworkInfo.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -807,6 +818,7 @@
439B6B4B407A4E2AACAFE5BE /* RCTStatus.xcodeproj */,
5E5A7625B76441D984EA8C0D /* RCTImageResizer.xcodeproj */,
F3548417D8DA4362B6796A54 /* RNInstabug.xcodeproj */,
F93B6663A59F4B26BD4DA525 /* RNNetworkInfo.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
@ -911,6 +923,14 @@
name = Products;
sourceTree = "<group>";
};
B2D090A31E6839D7005BD157 /* Products */ = {
isa = PBXGroup;
children = (
B2D090C81E6839D7005BD157 /* libRNNetworkInfo.a */,
);
name = Products;
sourceTree = "<group>";
};
B2DEA0A51E49E32000FA28D6 /* Products */ = {
isa = PBXGroup;
children = (
@ -1106,6 +1126,10 @@
ProductGroup = 9E3F1BE31DDAE781005E4779 /* Products */;
ProjectRef = F3548417D8DA4362B6796A54 /* RNInstabug.xcodeproj */;
},
{
ProductGroup = B2D090A31E6839D7005BD157 /* Products */;
ProjectRef = F93B6663A59F4B26BD4DA525 /* RNNetworkInfo.xcodeproj */;
},
{
ProductGroup = 20B7D0F01D3F74CC00B70F14 /* Products */;
ProjectRef = 45FB5F523DE04BDE9877869C /* RNRandomBytes.xcodeproj */;
@ -1406,6 +1430,13 @@
remoteRef = B2A5F4391DEC36B200174F4D /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B2D090C81E6839D7005BD157 /* libRNNetworkInfo.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libRNNetworkInfo.a;
remoteRef = B2D090C71E6839D7005BD157 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
B2DEA0B11E49E32000FA28D6 /* libRCTHttpServer.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1639,6 +1670,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StatusIm.app/StatusIm";
@ -1676,6 +1708,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/StatusIm.app/StatusIm";
@ -1716,6 +1749,7 @@
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/react-native-network-info/ios",
);
INFOPLIST_FILE = StatusIm/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@ -1765,6 +1799,7 @@
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/react-native-network-info/ios",
);
INFOPLIST_FILE = StatusIm/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
@ -1836,6 +1871,7 @@
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/react-native-network-info/ios",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
@ -1894,6 +1930,7 @@
"$(SRCROOT)/../node_modules/react-native-image-resizer/ios/RCTImageResizer",
"$(SRCROOT)/../node_modules/instabug-reactnative/ios/RNInstabug",
"$(SRCROOT)/../node_modules/react-native-splash-screen/ios",
"$(SRCROOT)/../node_modules/react-native-network-info/ios",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;

View File

@ -63,6 +63,7 @@
"react-native-invertible-scroll-view": "^1.0.0",
"react-native-level-fs": "^2.0.1",
"react-native-linear-gradient": "1.5.7",
"react-native-network-info": "github:alwx/react-native-network-info",
"react-native-orientation": "github:youennPennarun/react-native-orientation",
"react-native-qrcode": "^0.2.2",
"react-native-randombytes": "^2.1.0",

View File

@ -3,9 +3,11 @@
[status-im.utils.handlers :refer [register-handler] :as u]
[status-im.constants :refer [console-chat-id
text-content-type]]
[status-im.components.network-info :refer [get-ip]]
[status-im.data-store.messages :as messages]
[taoensso.timbre :as log]
[status-im.utils.random :as random]))
[status-im.i18n :refer [label]]
[status-im.utils.random :as random]
[taoensso.timbre :as log]))
(def console-commands
{:password
@ -29,7 +31,17 @@
(let [debug-on? (= (params "mode") "On")]
(dispatch [:account-update {:debug? debug-on?}])
(if debug-on?
(dispatch [:debug-server-start])
(do
(dispatch [:debug-server-start])
(get-ip (fn [ip]
(dispatch [:received-message
{:message-id (random/id)
:content (label :t/debug-enabled {:ip ip})
:content-type text-content-type
:outgoing false
:chat-id console-chat-id
:from console-chat-id
:to "me"}]))))
(dispatch [:debug-server-stop]))))})
(def commands-names (set (keys console-commands)))

View File

@ -0,0 +1,8 @@
(ns status-im.components.network-info
(:require [taoensso.timbre :as log]))
(def network-info-class (js/require "react-native-network-info"))
(defn get-ip [callback]
(.getIPAddress network-info-class
callback))

View File

@ -109,6 +109,7 @@
:intro-status "Chat with me to setup your account and change your settings!"
:intro-message1 "Welcome to Status\nTap this message to set your password & get started!"
:account-generation-message "Gimmie a sec, I gotta do some crazy math to generate your account!"
:debug-enabled "Debug server has been launched! Your IP address is {{ip}}. You can now add your DApp by running *status-dev-cli add-dapp --ip {{ip}}* from your computer"
;phone types
:phone-e164 "International 1"