-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- disabling connection check until host is set fixes #12 - introducing more strict checking on host means less errors are only discovered during connection check - allow removal of optional config values (username, password, port) by just emptying out the text field - show if password is set or not - use formatted string resources instead of formatting them manually
- Loading branch information
ostrya
committed
Nov 19, 2019
1 parent
8f5f7d5
commit 880c832
Showing
12 changed files
with
99 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 13 additions & 2 deletions
15
app/src/main/java/org/ostrya/presencepublisher/ui/preference/HostPreference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
package org.ostrya.presencepublisher.ui.preference; | ||
|
||
import android.content.Context; | ||
import org.eclipse.paho.client.mqttv3.MqttConnectOptions; | ||
import org.ostrya.presencepublisher.R; | ||
import org.ostrya.presencepublisher.ui.util.RegexValidator; | ||
|
||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
public class HostPreference extends AbstractTextPreference { | ||
public static final String HOST = "host"; | ||
|
||
public HostPreference(Context context) { | ||
super(context, HOST, new RegexValidator("[^:/]+"), R.string.host_title, R.string.host_summary); | ||
super(context, HOST, value -> { | ||
try { | ||
String testUri = "tcp://" + value; | ||
MqttConnectOptions.validateURI(testUri); | ||
return new URI(testUri).getHost() != null; | ||
} catch (IllegalArgumentException | URISyntaxException e) { | ||
return false; | ||
} | ||
}, R.string.host_title, R.string.host_summary); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/src/main/java/org/ostrya/presencepublisher/ui/util/PasswordSummaryProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.ostrya.presencepublisher.ui.util; | ||
|
||
import androidx.preference.Preference; | ||
import org.ostrya.presencepublisher.R; | ||
import org.ostrya.presencepublisher.ui.preference.PasswordPreference; | ||
|
||
public class PasswordSummaryProvider implements Preference.SummaryProvider<PasswordPreference> { | ||
private final int summaryId; | ||
|
||
public PasswordSummaryProvider(int summaryId) { | ||
this.summaryId = summaryId; | ||
} | ||
|
||
@Override | ||
public CharSequence provideSummary(PasswordPreference preference) { | ||
return preference.getContext().getString(summaryId, getValue(preference)); | ||
} | ||
|
||
private String getValue(PasswordPreference preference) { | ||
if (preference.getText() != null) { | ||
return preference.getContext().getString(R.string.password_placeholder); | ||
} else { | ||
return preference.getContext().getString(R.string.value_undefined); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,3 @@ | ||
v1.6.4 | ||
• Next attempt to fix F-Droid build. | ||
|
||
v1.6.3: | ||
• More minor build script changes to fix F-Droid build. | ||
|
||
v1.6.2: | ||
• Minor build script changes. | ||
|
||
v1.6.1: | ||
• Minor bugfix related to handling of VPN connections. | ||
|
||
v1.6.0: | ||
• Added option to send offline messages while connected to mobile network. | ||
• Added option to send battery level to a separate topic. | ||
• On Android 6+, encrypt login password. | ||
• Migrate from foreground service with scheduled thread pool to Android alarm manager and request disabling battery optimization. This should make sending messages more reliable during standby. | ||
v1.6.5 | ||
• Re-enable schedule periods down to 1 minute. | ||
• Small UX improvements. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters