diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-05-05 16:38:58 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2020-05-05 16:38:58 -0300 |
| commit | eacc22bdf2799714f70f42b54f6430ed761cda70 (patch) | |
| tree | ed2d8d988a39ad79fa870caee75b149206c75c54 | |
| parent | 4d6a48aa603632a3e031cc9cebe0af004a4a7704 (diff) | |
| parent | 851e3d2f839549570b25559876a576214ec0a771 (diff) | |
| download | mullvadvpn-eacc22bdf2799714f70f42b54f6430ed761cda70.tar.xz mullvadvpn-eacc22bdf2799714f70f42b54f6430ed761cda70.zip | |
Merge branch 'fix-app-version-info'
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | android/src/main/kotlin/net/mullvad/mullvadvpn/model/AppVersionInfo.kt | 4 | ||||
| -rw-r--r-- | mullvad-rpc/src/lib.rs | 32 |
3 files changed, 29 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b827c50523..b9d5ea3c69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Line wrap the file at 100 chars. Th isn't running. It would previously just open the app UI and stay in the disconnected state. - Fix crash when requesting to connect from notification or quick-settings tile. - Fix relay list sort order +- Fix version update notifications not appearing. ## [2020.4-beta3] - 2020-04-29 diff --git a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/AppVersionInfo.kt b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/AppVersionInfo.kt index 2fe8b9d3ed..a28c06a505 100644 --- a/android/src/main/kotlin/net/mullvad/mullvadvpn/model/AppVersionInfo.kt +++ b/android/src/main/kotlin/net/mullvad/mullvadvpn/model/AppVersionInfo.kt @@ -2,7 +2,7 @@ package net.mullvad.mullvadvpn.model data class AppVersionInfo( val supported: Boolean, + val latest: String, val latestStable: String, - val latestBeta: String, - val latest: String + val latestBeta: String ) diff --git a/mullvad-rpc/src/lib.rs b/mullvad-rpc/src/lib.rs index 949f8c76f8..de29ccd8e5 100644 --- a/mullvad-rpc/src/lib.rs +++ b/mullvad-rpc/src/lib.rs @@ -5,7 +5,7 @@ use futures01::future::Future as Future01; use hyper::Method; use mullvad_types::{ account::{AccountToken, VoucherSubmission}, - version, + version::{AppVersion, AppVersionInfo}, }; use std::{ collections::BTreeMap, @@ -278,6 +278,14 @@ pub struct AppVersionProxy { handle: rest::MullvadRestHandle, } +#[derive(serde::Deserialize)] +struct AppVersionResponse { + supported: bool, + latest: AppVersion, + latest_stable: Option<AppVersion>, + latest_beta: AppVersion, +} + impl AppVersionProxy { pub fn new(handle: rest::MullvadRestHandle) -> Self { Self { handle } @@ -285,9 +293,9 @@ impl AppVersionProxy { pub fn version_check( &self, - version: version::AppVersion, + version: AppVersion, platform: &str, - ) -> impl Future01<Item = mullvad_types::version::AppVersionInfo, Error = rest::Error> { + ) -> impl Future01<Item = AppVersionInfo, Error = rest::Error> { let service = self.handle.service.clone(); let request = rest::send_request( @@ -298,9 +306,21 @@ impl AppVersionProxy { None, StatusCode::OK, ); - self.handle - .service - .compat_spawn(async move { rest::deserialize_body(request.await?).await }) + + let future = async move { + let response: AppVersionResponse = rest::deserialize_body(request.await?).await?; + + let version_info = AppVersionInfo { + supported: response.supported, + latest: response.latest, + latest_stable: response.latest_stable.unwrap_or_else(|| "".to_owned()), + latest_beta: response.latest_beta, + }; + + Ok(version_info) + }; + + self.handle.service.compat_spawn(future) } } |
