|
|
@ -33,11 +33,19 @@ import javax.inject.Singleton; |
|
|
|
|
|
|
|
|
|
|
|
@Singleton |
|
|
|
@Singleton |
|
|
|
public class SiteManager { |
|
|
|
public class SiteManager { |
|
|
|
|
|
|
|
private static boolean addSiteForLegacy = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Called from the DatabaseHelper when upgrading to the tables with a site id. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static void addSiteForLegacy() { |
|
|
|
|
|
|
|
addSiteForLegacy = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private SiteRepository siteRepository; |
|
|
|
private SiteRepository siteRepository; |
|
|
|
private SiteResolver resolver; |
|
|
|
private SiteResolver resolver; |
|
|
|
|
|
|
|
|
|
|
|
private boolean initialized = false; |
|
|
|
private boolean initialized = false; |
|
|
|
private boolean addSiteForLegacy = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Inject |
|
|
|
@Inject |
|
|
|
public SiteManager(SiteRepository siteRepository, |
|
|
|
public SiteManager(SiteRepository siteRepository, |
|
|
@ -78,19 +86,14 @@ public class SiteManager { |
|
|
|
callback.onSiteAdded(site); |
|
|
|
callback.onSiteAdded(site); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Called from the DatabaseHelper when upgrading to the tables with a site id. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public void addSiteForLegacy() { |
|
|
|
|
|
|
|
addSiteForLegacy = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void initialize() { |
|
|
|
public void initialize() { |
|
|
|
if (initialized) { |
|
|
|
if (initialized) { |
|
|
|
throw new IllegalStateException("Already initialized"); |
|
|
|
throw new IllegalStateException("Already initialized"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (addSiteForLegacy) { |
|
|
|
if (addSiteForLegacy) { |
|
|
|
|
|
|
|
addSiteForLegacy = false; |
|
|
|
|
|
|
|
|
|
|
|
Site site = new Chan4(); |
|
|
|
Site site = new Chan4(); |
|
|
|
|
|
|
|
|
|
|
|
SiteConfig config = new SiteConfig(); |
|
|
|
SiteConfig config = new SiteConfig(); |
|
|
|