diff --git a/android/app/build.gradle b/android/app/build.gradle index caaad4fa6c4..6a9b83ed1df 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -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" diff --git a/android/app/src/main/java/com/zulipmobile/MainApplication.java b/android/app/src/main/java/com/zulipmobile/MainApplication.java index 301a9e58584..db4c9635cf3 100644 --- a/android/app/src/main/java/com/zulipmobile/MainApplication.java +++ b/android/app/src/main/java/com/zulipmobile/MainApplication.java @@ -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; @@ -23,7 +24,8 @@ protected boolean getUseDeveloperSupport() { @Override protected List getPackages() { return Arrays.asList( - new MainReactPackage() + new MainReactPackage(), + new RNDeviceInfo() ); } }; diff --git a/android/settings.gradle b/android/settings.gradle index a1047586559..6fe93299747 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -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' diff --git a/ios/ZulipMobile.xcodeproj/project.pbxproj b/ios/ZulipMobile.xcodeproj/project.pbxproj index 1448c9def58..8f1164552ea 100644 --- a/ios/ZulipMobile.xcodeproj/project.pbxproj +++ b/ios/ZulipMobile.xcodeproj/project.pbxproj @@ -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 */; }; @@ -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 */ @@ -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 = ""; }; 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 = ""; }; 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 = ""; }; + ACCD980949044096B1BAD249 /* RNDeviceInfo.xcodeproj */ = {isa = PBXFileReference; name = "RNDeviceInfo.xcodeproj"; path = "../node_modules/react-native-device-info/RNDeviceInfo.xcodeproj"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; }; + D5664A74FA8048439CBAB734 /* libRNDeviceInfo.a */ = {isa = PBXFileReference; name = "libRNDeviceInfo.a"; path = "libRNDeviceInfo.a"; sourceTree = ""; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -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; }; @@ -380,6 +383,7 @@ 00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */, 139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */, 6DA76D9085EA458BB979ED8D /* RNVectorIcons.xcodeproj */, + ACCD980949044096B1BAD249 /* RNDeviceInfo.xcodeproj */, ); name = Libraries; sourceTree = ""; @@ -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"; @@ -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"; @@ -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"; @@ -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"; @@ -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; @@ -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; diff --git a/package.json b/package.json index 8206656d826..882c1f63770 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", diff --git a/src/events/eventActions.js b/src/events/eventActions.js index 80a1513a3be..bc62e0d8e8c 100644 --- a/src/events/eventActions.js +++ b/src/events/eventActions.js @@ -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, diff --git a/src/main/MainScreen.js b/src/main/MainScreen.js index eae6ce40582..539d7380a18 100644 --- a/src/main/MainScreen.js +++ b/src/main/MainScreen.js @@ -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'; @@ -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 ( {}} > {messageList} diff --git a/yarn.lock b/yarn.lock index 5ae0056a470..b201e57f4b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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" @@ -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: @@ -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" @@ -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"