mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-22 12:21:15 +00:00
Use public key instead of config to check for first start.
This lets SyncthingService.isFirstStart() return true for a longer time (previously, it would return false as soon as the config was copied).
This commit is contained in:
parent
fa749da4a6
commit
1c1b1e6aa6
1 changed files with 8 additions and 1 deletions
|
@ -67,6 +67,11 @@ public class SyncthingService extends Service {
|
|||
*/
|
||||
private static final String CONFIG_FILE = "config.xml";
|
||||
|
||||
/**
|
||||
* Name of the public key file in the data directory.
|
||||
*/
|
||||
private static final String PUBLIC_KEY_FILE = "cert.pem";
|
||||
|
||||
private RestApi mApi;
|
||||
|
||||
private final SyncthingServiceBinder mBinder = new SyncthingServiceBinder(this);
|
||||
|
@ -363,9 +368,11 @@ public class SyncthingService extends Service {
|
|||
|
||||
/**
|
||||
* Returns true if this service has not been started before (ie config.xml does not exist).
|
||||
*
|
||||
* This will return true until the public key file has been generated.
|
||||
*/
|
||||
public static boolean isFirstStart(Context context) {
|
||||
return !new File(context.getApplicationInfo().dataDir, CONFIG_FILE).exists();
|
||||
return !new File(context.getApplicationInfo().dataDir, PUBLIC_KEY_FILE).exists();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue