update supported NS & NSclient versions

This commit is contained in:
Milos Kozak 2017-06-12 09:30:04 +02:00
parent 148f4d43f9
commit b41a942d11
4 changed files with 29 additions and 14 deletions

View file

@ -4,6 +4,8 @@ package info.nightscout.androidaps;
* Created by mike on 07.06.2016. * Created by mike on 07.06.2016.
*/ */
public class Config { public class Config {
public static int SUPPORTEDNSVERSION = 1000; // 0.10.00
// MAIN FUCTIONALITY // MAIN FUCTIONALITY
public static final boolean APS = BuildConfig.APS; public static final boolean APS = BuildConfig.APS;
// PLUGINS // PLUGINS

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.Services;
import android.app.IntentService; import android.app.IntentService;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle; import android.os.Bundle;
import android.provider.Telephony; import android.provider.Telephony;
@ -237,12 +238,22 @@ public class DataService extends IntentService {
ConfigBuilderPlugin.nsClientVersionCode = bundles.getInt("nsclientversioncode"); // for ver 1.17 contains 117 ConfigBuilderPlugin.nsClientVersionCode = bundles.getInt("nsclientversioncode"); // for ver 1.17 contains 117
ConfigBuilderPlugin.nsClientVersionName = bundles.getString("nsclientversionname"); ConfigBuilderPlugin.nsClientVersionName = bundles.getString("nsclientversionname");
log.debug("Got versions: NSClient: " + ConfigBuilderPlugin.nsClientVersionName + " Nightscout: " + ConfigBuilderPlugin.nightscoutVersionName); log.debug("Got versions: NSClient: " + ConfigBuilderPlugin.nsClientVersionName + " Nightscout: " + ConfigBuilderPlugin.nightscoutVersionName);
if (ConfigBuilderPlugin.nsClientVersionCode < 121) { try {
if (ConfigBuilderPlugin.nsClientVersionCode < MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode) {
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.sResources.getString(R.string.unsupportedclientver), Notification.URGENT); Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.sResources.getString(R.string.unsupportedclientver), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification)); MainApp.bus().post(new EventNewNotification(notification));
} else { } else {
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NSCLIENT)); MainApp.bus().post(new EventDismissNotification(Notification.OLD_NSCLIENT));
} }
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
if (ConfigBuilderPlugin.nightscoutVersionCode < Config.SUPPORTEDNSVERSION) {
Notification notification = new Notification(Notification.OLD_NS, MainApp.sResources.getString(R.string.unsupportednsversion), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NS));
}
} else { } else {
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.sResources.getString(R.string.unsupportedclientver), Notification.URGENT); Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.sResources.getString(R.string.unsupportedclientver), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification)); MainApp.bus().post(new EventNewNotification(notification));

View file

@ -24,17 +24,18 @@ public class Notification {
public static final int FAILED_UDPATE_PROFILE = 6; public static final int FAILED_UDPATE_PROFILE = 6;
public static final int BASAL_VALUE_BELOW_MINIMUM = 7; public static final int BASAL_VALUE_BELOW_MINIMUM = 7;
public static final int OLD_NSCLIENT = 8; public static final int OLD_NSCLIENT = 8;
public static final int INVALID_PHONE_NUMBER = 9; public static final int OLD_NS = 9;
public static final int APPROACHING_DAILY_LIMIT = 10; public static final int INVALID_PHONE_NUMBER = 10;
public static final int NSCLIENT_NO_WRITE_PERMISSION = 11; public static final int APPROACHING_DAILY_LIMIT = 11;
public static final int MISSING_SMS_PERMISSION = 12; public static final int NSCLIENT_NO_WRITE_PERMISSION = 12;
public static final int ISF_MISSING = 13; public static final int MISSING_SMS_PERMISSION = 13;
public static final int IC_MISSING = 14; public static final int ISF_MISSING = 14;
public static final int BASAL_MISSING = 15; public static final int IC_MISSING = 15;
public static final int TARGET_MISSING = 16; public static final int BASAL_MISSING = 16;
public static final int NSANNOUNCEMENT = 17; public static final int TARGET_MISSING = 17;
public static final int NSALARM = 18; public static final int NSANNOUNCEMENT = 18;
public static final int NSURGENTALARM = 18; public static final int NSALARM = 19;
public static final int NSURGENTALARM = 20;
public int id; public int id;
public Date date; public Date date;

View file

@ -142,6 +142,7 @@
<string name="openloop_newsuggestion">New suggestion available</string> <string name="openloop_newsuggestion">New suggestion available</string>
<string name="unsupportedclientver">Unsupported version of NSClient</string> <string name="unsupportedclientver">Unsupported version of NSClient</string>
<string name="unsupportednsversion">Unsupported version of Nightscout</string>
<string name="nsclientnotinstalled">NSClient not installed. Record lost!</string> <string name="nsclientnotinstalled">NSClient not installed. Record lost!</string>
<string name="objectives_bgavailableinns">BG available in NS</string> <string name="objectives_bgavailableinns">BG available in NS</string>
<string name="objectives_pumpstatusavailableinns">Pump status available in NS</string> <string name="objectives_pumpstatusavailableinns">Pump status available in NS</string>