Commit a65c312f authored by Daniel Wolf's avatar Daniel Wolf

Some Q&D fixes

parent 156ff344
......@@ -785,7 +785,7 @@ public class MainActivity extends NavigationDrawerActivity implements RuleImport
_text = _text.replace("[x]", unreachable.size() + reachable.size() + "");
_text = _text.replace("[y]", unreachable.size() + "");
boolean customPorts = PreferencesAccessor.areCustomPortsEnabled(MainActivity.this);
for(IPPortPair p: unreachable)builder.append("- ").append(p.formatForTextfield(customPorts)).append("\n");
for(IPPortPair p: unreachable)if(p != null) builder.append("- ").append(p.formatForTextfield(customPorts)).append("\n");
_text = _text.replace("[servers]", builder.toString());
final String text = _text;
MainActivity.this.runOnUiThread(new Runnable() {
......
......@@ -79,10 +79,10 @@ public class CurrentNetworksFragment extends Fragment {
final DNSProperties properties = dnsProperties.get(index);
boolean port = PreferencesAccessor.areCustomPortsEnabled(requireContext());
for(IPPortPair ipPortPair: properties.ipv4Servers){
serverText.append(ipPortPair.toString(port)).append("\n");
if(ipPortPair != null) serverText.append(ipPortPair.toString(port)).append("\n");
}
for(IPPortPair ipPortPair: properties.ipv6Servers){
serverText.append(ipPortPair.toString(port)).append("\n");
if(ipPortPair != null) serverText.append(ipPortPair.toString(port)).append("\n");
}
String text = getString(R.string.text_dns_configuration).replace("[name]", properties.networkName);
text = text.replace("[servers]", serverText);
......
......@@ -107,7 +107,7 @@ public class DNSVpnService extends VpnService {
if(!serviceRunning)return;
LogFactory.writeMessage(this, new String[]{LOG_TAG, "[NOTIFICATION]"}, "Updating notification");
initNotification();
if(!preferences.getBoolean( "setting_show_notification",true)){
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O && !preferences.getBoolean( "setting_show_notification",true)){
LogFactory.writeMessage(this, new String[]{LOG_TAG, "[NOTIFICATION]"}, "Notification is disabled");
stopForeground(true);
return;
......@@ -232,6 +232,7 @@ public class DNSVpnService extends VpnService {
public int onStartCommand(Intent intent, int flags, int startId) {
//intent = intent == null ? intent : restoreSettings(intent);
LogFactory.writeMessage(this, new String[]{LOG_TAG, "[ONSTARTCOMMAND]"}, "Got StartCommand", intent);
if(notificationBuilder != null) startForeground(NOTIFICATION_ID, notificationBuilder.build());
if(Utils.isServiceRunning(this, RuleImportService.class)){
LogFactory.writeMessage(this, new String[]{LOG_TAG, "[ONSTARTCOMMAND]"}, "Not starting the service because rules are currently being imported");
stopSelf();
......@@ -265,7 +266,7 @@ public class DNSVpnService extends VpnService {
}
Util.updateTiles(this);
}else LogFactory.writeMessage(this, new String[]{LOG_TAG, "[ONSTARTCOMMAND]", LogFactory.Tag.ERROR.toString()}, "Intent given is null. This isn't normal behavior");
if(upstreamServers != null && upstreamServers.size() != 0)updateNotification();
if(upstreamServers != null && upstreamServers.size() != 0) updateNotification();
return START_REDELIVER_INTENT;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment