diff --git a/app/build.gradle b/app/build.gradle index c1f76556..25948b3b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -36,8 +36,8 @@ android { applicationId "com.github.catfriend1.syncthingandroid" minSdkVersion 16 targetSdkVersion 26 - versionCode 4171 - versionName "0.14.51.8" + versionCode 4172 + versionName "0.14.51.9" testApplicationId 'com.github.catfriend1.syncthingandroid.test' testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' playAccountConfig = playAccountConfigs.defaultAccountConfig diff --git a/app/src/main/java/com/nutomic/syncthingandroid/activities/TipsAndTricksActivity.java b/app/src/main/java/com/nutomic/syncthingandroid/activities/TipsAndTricksActivity.java index eff9d4af..3c3573ef 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/activities/TipsAndTricksActivity.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/activities/TipsAndTricksActivity.java @@ -1,9 +1,13 @@ package com.nutomic.syncthingandroid.activities; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.wifi.WifiManager; import android.os.Build; import android.os.Bundle; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; +import android.text.format.Formatter; import android.util.Log; import android.view.View; @@ -55,6 +59,16 @@ public class TipsAndTricksActivity extends SyncthingActivity { mTipListAdapter.add(getString(R.string.tip_sync_on_local_network_title), getString(R.string.tip_sync_on_local_network_text)); mTipListAdapter.add(getString(R.string.tip_custom_sync_conditions_title), getString(R.string.tip_custom_sync_conditions_text)); + // Tips referring to Huawei devices. + if ("huawei".equalsIgnoreCase(Build.MANUFACTURER)) { + String ipAddress = getString(R.string.tip_phone_ip_address_syntax); + if (isWifiOrEthernetConnection()) { + WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(WIFI_SERVICE); + ipAddress = Formatter.formatIpAddress(wifiManager.getConnectionInfo().getIpAddress()); + } + mTipListAdapter.add(getString(R.string.tip_huawei_device_disconnected_title), getString(R.string.tip_huawei_device_disconnected_text, ipAddress)); + } + // Set onClick listener and add adapter to recycler view. mTipListAdapter.setOnClickListener( new ItemClickListener() { @@ -72,4 +86,25 @@ public class TipsAndTricksActivity extends SyncthingActivity { mRecyclerView.setAdapter(mTipListAdapter); } + private boolean isWifiOrEthernetConnection() { + ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); + NetworkInfo ni = cm.getActiveNetworkInfo(); + if (ni == null) { + // In flight mode. + return false; + } + if (!ni.isConnected()) { + // No network connection. + return false; + } + switch (ni.getType()) { + case ConnectivityManager.TYPE_WIFI: + case ConnectivityManager.TYPE_WIMAX: + case ConnectivityManager.TYPE_ETHERNET: + return true; + default: + return false; + } + } + } diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 63beb568..4fddc093 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -299,6 +299,10 @@ Bitte melden Sie auftretende Probleme via GitHub. Sync-Bedingungen pro Ordner/Gerät festlegen Diese Funktion wird in zukünftigen Releases weiter verbessert. Für den Moment wollten wir das App-Verhalten nicht \"umstürzen\", um bestehende Konfigurationen nicht zu \"brechen\". Deshalb können die \"individuellen Sync-Bedingungen\" für einen bestimmten Netzwerktyp erst festgelegt werden, wenn dieser Netzwerktyp vorher in den globalen Laufkonditionen aktiviert wurde. + Huawei: Workaround für \"Gerät getrennt\" + Falls der Computer das Huawei-Gerät permanent als \"getrennt\" meldet, öffne die Syncthing-Oberfläche auf dem Computer. Gehe zu \"Externe Geräte\", klappe den Eintrag des Mobilgeräts aus, klicke \"Bearbeiten\", wechsle zu \"Erweitert\". Trage die IP-Adresse deines Mobilgeräts in \"Adressen\" wie folgt ein:\ntcp4://%1$s, dynamic\nFunktioniert sicher auf: Huawei P10 + TELEFON_IP_ADRESSE + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 94f97c69..896d9773 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -299,6 +299,10 @@ Please report any problems you encounter via Github. Use per folder/device custom sync conditions This feature will still be improved in future releases. For now, we didn\'t want to break existing configs and app behaviour. That\'s why custom sync conditions for a certain network type can only be set if you enable syncing on the network in the global run conditions first. + Huawei \'device disconnected\' workaround + If your desktop constantly reports your Huawei device as disconnected, open Syncthing UI of your desktop. Go to \'remote devices\', expand the phone\'s entry, click \'Edit\', switch to \'Advanced\'. Put your phone IP address into \'Addresses\' like this:\ntcp4://%1$s, dynamic\nConfirmed working for: Huawei P10 + PHONE_IP_ADDRESS +