Skip to content

Commit

Permalink
Add react-native-device-info
Browse files Browse the repository at this point in the history
  • Loading branch information
borisyankov committed Dec 19, 2016
1 parent 4c7be97 commit f5b3271
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 20 deletions.
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ android {
}

dependencies {
compile project(':react-native-device-info')
compile project(':react-native-vector-icons')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.learnium.RNDeviceInfo.RNDeviceInfo;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
Expand All @@ -23,7 +24,8 @@ protected boolean getUseDeveloperSupport() {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage()
new MainReactPackage(),
new RNDeviceInfo()
);
}
};
Expand Down
2 changes: 2 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = 'ZulipMobile'
include ':react-native-device-info'
project(':react-native-device-info').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-device-info/android')

include ':app'
include ':react-native-vector-icons'
Expand Down
12 changes: 11 additions & 1 deletion ios/ZulipMobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
Expand Down Expand Up @@ -36,6 +35,7 @@
A155C0061DD8E7A800A8B695 /* libRCTCameraRoll.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A155BFEC1DD8E54100A8B695 /* libRCTCameraRoll.a */; };
C2FB87564E22416A9EDEABD3 /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = AEF58326BC25479294083E9C /* EvilIcons.ttf */; };
C478B42A63D649EFA2CFD12D /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 9E53FD60A6D0409A8E58DCB5 /* SimpleLineIcons.ttf */; };
D6D40984ED07473499B3F0C9 /* libRNDeviceInfo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D5664A74FA8048439CBAB734 /* libRNDeviceInfo.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -219,6 +219,8 @@
AEF58326BC25479294083E9C /* EvilIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = EvilIcons.ttf; path = "../node_modules/react-native-vector-icons/Fonts/EvilIcons.ttf"; sourceTree = "<group>"; };
C9B0BDEA40534DFA9BDC4C75 /* 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>"; };
F56CBB1B9A6449F895C858C6 /* Entypo.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Entypo.ttf; path = "../node_modules/react-native-vector-icons/Fonts/Entypo.ttf"; sourceTree = "<group>"; };
ACCD980949044096B1BAD249 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; name = "RNDeviceInfo.xcodeproj"; path = "../node_modules/react-native-device-info/RNDeviceInfo.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
D5664A74FA8048439CBAB734 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo.a"; path = "libRNDeviceInfo.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -246,6 +248,7 @@
00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */,
139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */,
05C34EA2C79448BB9767887A /* libRNVectorIcons.a in Frameworks */,
D6D40984ED07473499B3F0C9 /* libRNDeviceInfo.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -380,6 +383,7 @@
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */,
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */,
6DA76D9085EA458BB979ED8D /* RNVectorIcons.xcodeproj */,
ACCD980949044096B1BAD249 /* RNDeviceInfo.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
Expand Down Expand Up @@ -808,6 +812,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZulipMobile.app/ZulipMobile";
Expand All @@ -825,6 +830,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZulipMobile.app/ZulipMobile";
Expand All @@ -841,6 +847,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
INFOPLIST_FILE = ZulipMobile/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand All @@ -862,6 +869,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
INFOPLIST_FILE = ZulipMobile/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down Expand Up @@ -913,6 +921,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = YES;
Expand Down Expand Up @@ -954,6 +963,7 @@
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$(SRCROOT)/../node_modules/react-native/React/**",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-device-info/RNDeviceInfo",
);
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
MTL_ENABLE_DEBUG_INFO = NO;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
"react": "^15.4.1",
"react-addons-shallow-compare": "^15.4.1",
"react-native": "^0.39.2",
"react-native-device-info": "^0.9.7",
"react-native-drawer": "^2.3.0",
"react-native-scrollable-tab-view": "^0.7.0",
"react-native-vector-icons": "^3.0.0",
"react-redux": "^4.4.6",
"react-redux": "^5.0.1",
"redux": "^3.6.0",
"redux-action-buffer": "^1.0.1",
"redux-logger": "^2.7.4",
Expand All @@ -46,7 +47,7 @@
"babel-eslint": "^7.1.1",
"babel-jest": "^17.0.2",
"babel-preset-react-native": "^1.9.0",
"eslint": "^3.12.1",
"eslint": "^3.12.2",
"eslint-config-airbnb": "^13.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "~2.2.3",
Expand Down
3 changes: 3 additions & 0 deletions src/events/eventActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import {
} from '../constants';

const processEvent = (dispatch, event, getState) => {
if (!getState().account) {
console.log('WTF WTF WTF', getState());
}
const isInNarrow = isMessageInNarrow(
event.message,
getState().chat.narrow,
Expand Down
7 changes: 6 additions & 1 deletion src/main/MainScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
} from 'react-native';
import Drawer from 'react-native-drawer';

import DeviceInfo from 'react-native-device-info';

import Chat from '../chat/Chat';
import MainNavBar from '../nav/MainNavBar';
import StreamSidebar from '../nav/StreamSidebar';
Expand All @@ -13,7 +15,10 @@ export default class MainScreen extends React.Component {

render() {
const { streamlistOpened, doNarrow } = this.props;

console.log('getModel', DeviceInfo.getModel());
console.log('getSystemVersion', DeviceInfo.getSystemVersion());
console.log('getVersion', DeviceInfo.getVersion());
console.log('getUserAgent', DeviceInfo.getUserAgent());
return (
<Drawer
content={
Expand Down
1 change: 1 addition & 0 deletions src/message-list/MessageList.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default class MessageList extends React.PureComponent {
stickyHeaderIndices={headerIndices}
onStartReached={fetchOlder}
onEndReached={fetchNewer}
onScroll={e => {}}
>
{messageList}
</InfiniteScrollView>
Expand Down
45 changes: 30 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1268,9 +1268,9 @@ dateformat@^1.0.11:
get-stdin "^4.0.1"
meow "^3.3.0"

debug@^2.1.1, debug@^2.2.0, debug@2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.3.3.tgz#40c453e67e6e13c901ddec317af8986cda9eff8c"
debug@^2.1.1, debug@^2.2.0:
version "2.4.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.4.3.tgz#3fe67c5588e724d0f5d9e48c8f08ff69b4b20643"
dependencies:
ms "0.7.2"

Expand All @@ -1280,6 +1280,12 @@ debug@~2.2.0, debug@2.2.0:
dependencies:
ms "0.7.1"

debug@2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/debug/-/debug-2.3.3.tgz#40c453e67e6e13c901ddec317af8986cda9eff8c"
dependencies:
ms "0.7.2"

decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
Expand Down Expand Up @@ -1584,9 +1590,9 @@ eslint-plugin-spellcheck@0.0.8:
hunspell-spellchecker "^1.0.2"
lodash "^4.14.2"

eslint@^3.12.1:
version "3.12.1"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.12.1.tgz#507a609fe251dfefd58fda03e6dbd7e851c07581"
eslint@^3.12.2:
version "3.12.2"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-3.12.2.tgz#6be5a9aa29658252abd7f91e9132bab1f26f3c34"
dependencies:
babel-code-frame "^6.16.0"
chalk "^1.1.3"
Expand Down Expand Up @@ -2788,8 +2794,8 @@ jsprim@^1.2.2:
verror "1.3.6"

jsx-ast-utils@^1.0.0, jsx-ast-utils@^1.3.4:
version "1.3.4"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.3.4.tgz#0257ed1cc4b1e65b39d7d9940f9fb4f20f7ba0a9"
version "1.3.5"
resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-1.3.5.tgz#9ba6297198d9f754594d62e59496ffb923778dd4"
dependencies:
acorn-jsx "^3.0.1"
object-assign "^4.1.0"
Expand Down Expand Up @@ -2833,7 +2839,7 @@ load-json-file@^1.0.0:
pinkie-promise "^2.0.0"
strip-bom "^2.0.0"

lodash-es@^4.16.0, lodash-es@^4.2.1:
lodash-es@^4.16.0, lodash-es@^4.2.0, lodash-es@^4.2.1:
version "4.17.2"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.2.tgz#59011b585166e613eb9dd5fc256b2cd1a30f3712"

Expand Down Expand Up @@ -3592,6 +3598,10 @@ react-native-cli@^2.0.0:
prompt "^0.2.14"
semver "^5.0.3"

react-native-device-info@^0.9.7:
version "0.9.7"
resolved "https://registry.yarnpkg.com/react-native-device-info/-/react-native-device-info-0.9.7.tgz#e4b35d60bbf73472beb30de3d2b96de15a51b75d"

react-native-drawer@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/react-native-drawer/-/react-native-drawer-2.3.0.tgz#a0369ec80ff0b61c9f152dbdea91fe76c843113a"
Expand Down Expand Up @@ -3697,13 +3707,14 @@ react-proxy@^1.1.7:
lodash "^4.6.1"
react-deep-force-update "^1.0.0"

react-redux@^4.4.6:
version "4.4.6"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-4.4.6.tgz#4b9d32985307a11096a2dd61561980044fcc6209"
react-redux@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/react-redux/-/react-redux-5.0.1.tgz#84a41bd4cdd180452bb6922bc79ad25bd5abb7c4"
dependencies:
hoist-non-react-statics "^1.0.3"
invariant "^2.0.0"
lodash "^4.2.0"
lodash-es "^4.2.0"
loose-envify "^1.1.0"

react-test-renderer@^15.4.1:
Expand Down Expand Up @@ -3959,7 +3970,11 @@ resolve-from@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"

resolve@^1.1.6, resolve@1.1.7, resolve@1.1.x:
resolve@^1.1.6:
version "1.2.0"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.2.0.tgz#9589c3f2f6149d1417a40becc1663db6ec6bc26c"

resolve@1.1.7, resolve@1.1.x:
version "1.1.7"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b"

Expand Down Expand Up @@ -4401,8 +4416,8 @@ tween-functions@^1.0.1:
resolved "https://registry.yarnpkg.com/tween-functions/-/tween-functions-1.2.0.tgz#1ae3a50e7c60bb3def774eac707acbca73bbc3ff"

tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.4"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.4.tgz#8c9dbfb52795686f166cd2023794bcf103d13c2b"
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"

type-check@~0.3.2:
version "0.3.2"
Expand Down

0 comments on commit f5b3271

Please sign in to comment.