diff options
author | Txema Martinez <mrtxema@gmail.com> | 2021-05-15 21:38:55 +0200 |
---|---|---|
committer | Txema Martinez <mrtxema@gmail.com> | 2021-05-15 21:38:55 +0200 |
commit | ba017fc001d2d0bf55a10ba42480dd9fa19f6125 (patch) | |
tree | c62491950e7517c68cd1873ab85ebabce44b68ff | |
parent | 3a6d412ffa3c92021ddefd98a5181b9fefc97817 (diff) | |
download | dsub-ba017fc001d2d0bf55a10ba42480dd9fa19f6125.tar.gz dsub-ba017fc001d2d0bf55a10ba42480dd9fa19f6125.tar.bz2 dsub-ba017fc001d2d0bf55a10ba42480dd9fa19f6125.zip |
Fix current SSID detection
3 files changed, 5 insertions, 5 deletions
diff --git a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java index eabc1a07..2416832d 100644 --- a/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java +++ b/app/src/main/java/github/daneren2005/dsub/activity/SubsonicActivity.java @@ -192,7 +192,7 @@ public class SubsonicActivity extends AppCompatActivity implements OnItemSelecte if(!expectedSSID.isEmpty()) { String currentSSID = Util.getSSID(this); - if(currentSSID == "<unknown ssid>" && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + if("<unknown ssid>".equals(currentSSID) && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, SubsonicActivity.PERMISSIONS_REQUEST_LOCATION); } } diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java index c5463f38..f76677d5 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/SettingsFragment.java @@ -528,7 +528,7 @@ public class SettingsFragment extends PreferenceCompatFragment implements Shared super.onAddEditTextToDialogView(dialogView, editText); ViewGroup root = (ViewGroup) ((ViewGroup) dialogView).getChildAt(0); - if(internalSSID == "<unknown ssid>" && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { + if("<unknown ssid>".equals(internalSSID) && ActivityCompat.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { ActivityCompat.requestPermissions(context, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, SubsonicActivity.PERMISSIONS_REQUEST_LOCATION); } diff --git a/app/src/main/java/github/daneren2005/dsub/util/Util.java b/app/src/main/java/github/daneren2005/dsub/util/Util.java index 872e9561..1aa17c35 100644 --- a/app/src/main/java/github/daneren2005/dsub/util/Util.java +++ b/app/src/main/java/github/daneren2005/dsub/util/Util.java @@ -354,9 +354,9 @@ public final class Util { String currentSSID = Util.getSSID(context); String[] ssidParts = SSID.split(","); - if ("".equals(SSID) || SSID.equals(currentSSID) || Arrays.asList(ssidParts).contains(currentSSID)) { - String internalUrl = prefs.getString(Constants.PREFERENCES_KEY_SERVER_INTERNAL_URL + instance, null); - if (internalUrl != null && !"".equals(internalUrl) && !"http://".equals(internalUrl)) { + if (SSID.equals(currentSSID) || Arrays.asList(ssidParts).contains(currentSSID)) { + String internalUrl = prefs.getString(Constants.PREFERENCES_KEY_SERVER_INTERNAL_URL + instance, ""); + if (!internalUrl.isEmpty() && !"http://".equals(internalUrl)) { serverUrl = internalUrl; } } |