From 64d551579ce3a684b3806b4957295872e0c667fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?And=C5=BEej=20Maciusovi=C4=8D?= Date: Tue, 5 Nov 2019 13:41:15 +0200 Subject: [PATCH] Update node and tequilapi (#173) Update node to newest 0.13.2 version and tequilapi with new connectionLocation() method to fetch location from current active connection. --- android/app/build.gradle | 2 +- android/build.gradle | 3 +++ package.json | 4 +++- src/app/adapters/connection/connection-adapter.ts | 2 +- .../adapters/connection/tequilapi-connection-adapter.ts | 4 ++-- src/app/domain/connection.ts | 2 +- tests/unit/mocks/mock-connection-adapter.ts | 2 +- yarn.lock | 8 ++++---- 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1cfecedc7..2f98e30f9 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -185,7 +185,7 @@ dependencies { implementation 'com.google.firebase:firebase-core:16.0.1' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation 'network.mysterium:mobile-node:0.10.1' + implementation 'network.mysterium:mobile-node:0.13.2' // implementation files('libs/Mysterium.aar') } diff --git a/android/build.gradle b/android/build.gradle index cac0b4cb4..04ee89573 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -29,6 +29,9 @@ buildscript { allprojects { repositories { mavenLocal() + maven { + url 'https://dl.bintray.com/mysteriumnetwork/maven' + } maven { url 'https://maven.fabric.io/public' } maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm diff --git a/package.json b/package.json index 10ab52378..f206d9c97 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js", "scripts": { "android": "react-native run-android", + "log-android": "react-native log-android", "ios": "react-native run-ios", + "start": "react-native start", "test:unit": "jest", "lint": "tsc --noEmit --skipLibCheck && tslint -p . 'src/**/*.{ts,tsx}' 'tests/**/*.{ts,tsx}'", "ci": "yarn lint && yarn test:unit && util_scripts/check-headers.sh", @@ -45,7 +47,7 @@ "mobx": "^4.3.1", "mobx-react": "^5.1.0", "mobx-utils": "^5.0.2", - "mysterium-tequilapi": "^0.8.4", + "mysterium-tequilapi": "^0.9.0", "mysterium-vpn-js": "^0.0.2", "native-base": "^2.8.1", "react": "^16.4.1", diff --git a/src/app/adapters/connection/connection-adapter.ts b/src/app/adapters/connection/connection-adapter.ts index fea62a06c..11c65a025 100644 --- a/src/app/adapters/connection/connection-adapter.ts +++ b/src/app/adapters/connection/connection-adapter.ts @@ -27,7 +27,7 @@ interface ConnectionAdapter { fetchStatus (): Promise fetchStatistics (): Promise fetchOriginalLocation (): Promise - fetchLocation (): Promise + fetchConnectionLocation (): Promise } class ConnectionCanceled extends Error { diff --git a/src/app/adapters/connection/tequilapi-connection-adapter.ts b/src/app/adapters/connection/tequilapi-connection-adapter.ts index ea0f4e7f1..6861a11a8 100644 --- a/src/app/adapters/connection/tequilapi-connection-adapter.ts +++ b/src/app/adapters/connection/tequilapi-connection-adapter.ts @@ -56,8 +56,8 @@ class TequilapiConnectionAdapter implements ConnectionAdapter { return this.tequilapiClient.connectionStatistics() } - public async fetchLocation (): Promise { - const dto = await this.tequilapiClient.location() + public async fetchConnectionLocation (): Promise { + const dto = await this.tequilapiClient.connectionLocation() return { ip: dto.ip, countryCode: dto.country } } diff --git a/src/app/domain/connection.ts b/src/app/domain/connection.ts index fcc33d699..c37d850d9 100644 --- a/src/app/domain/connection.ts +++ b/src/app/domain/connection.ts @@ -129,7 +129,7 @@ class Connection { } private buildLocationFetcher (): LocationFetcher { - const fetchLocation = this.connectionAdapter.fetchLocation.bind(this.connectionAdapter) + const fetchLocation = this.connectionAdapter.fetchConnectionLocation.bind(this.connectionAdapter) return new LocationFetcher(fetchLocation, this, location => { this.updateLocation(location) }) diff --git a/tests/unit/mocks/mock-connection-adapter.ts b/tests/unit/mocks/mock-connection-adapter.ts index bca4a543e..75d56f2f1 100644 --- a/tests/unit/mocks/mock-connection-adapter.ts +++ b/tests/unit/mocks/mock-connection-adapter.ts @@ -62,7 +62,7 @@ export class MockConnectionAdapter implements ConnectionAdapter { } } - public async fetchLocation (): Promise { + public async fetchConnectionLocation (): Promise { return { ip: '100.101.102.103', countryCode: 'lt' } } diff --git a/yarn.lock b/yarn.lock index 982bc0483..90a5be8e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5547,10 +5547,10 @@ mv@^2.1.1, mv@~2: ncp "~2.0.0" rimraf "~2.4.0" -mysterium-tequilapi@^0.8.4: - version "0.8.4" - resolved "https://registry.yarnpkg.com/mysterium-tequilapi/-/mysterium-tequilapi-0.8.4.tgz#9bd819fb7f8eae5faf4af6891e307dfb37cb3a39" - integrity sha512-f1jzHDEKalIhCRBysOXsHqEl3NYmbDCHoFYkS8gRXT5h9KuYLMZqxN84tXs5fEvRLI9qhYclOJ0ldhCQlrr6XQ== +mysterium-tequilapi@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/mysterium-tequilapi/-/mysterium-tequilapi-0.9.0.tgz#779b726e40773a459b52b2ee414ccf3dd472b39d" + integrity sha512-4NdMBE64M/oHoSgqiDE7mgj/q0p2prnC1uj0TWFGLhhRmdN7EaBjxiTFZ1DsAsvhwEjihbu+Xs4C0CY5/TzJiw== dependencies: "@babel/runtime" "^7.1.5" axios "^0.18.0"