mirror of https://github.com/NekoX-Dev/NekoX.git
Improve launch speed
This commit is contained in:
parent
83278a4d76
commit
f31999e653
|
@ -51,7 +51,7 @@ public class GcmImpl implements ExternalGcm.Interface {
|
|||
|
||||
@Override
|
||||
public void initPlayServices() {
|
||||
UIUtil.runOnIoDispatcher(() -> {
|
||||
Utilities.stageQueue.postRunnable(() -> {
|
||||
if (hasPlayServices = checkPlayServices()) {
|
||||
final String currentPushString = SharedConfig.pushString;
|
||||
if (!TextUtils.isEmpty(currentPushString)) {
|
||||
|
|
|
@ -216,7 +216,7 @@ public class ApplicationLoader extends Application {
|
|||
}
|
||||
applicationInited = true;
|
||||
|
||||
UIUtil.runOnIoDispatcher(() -> {
|
||||
Utilities.stageQueue.postRunnable(() -> {
|
||||
|
||||
try {
|
||||
LocaleController.getInstance(); //TODO improve
|
||||
|
@ -295,7 +295,7 @@ public class ApplicationLoader extends Application {
|
|||
}
|
||||
};
|
||||
if (finalA == UserConfig.selectedAccount) initRunnable.run();
|
||||
else UIUtil.runOnIoDispatcher(initRunnable);
|
||||
else Utilities.stageQueue.postRunnable(initRunnable);
|
||||
}
|
||||
|
||||
ExternalGcm.initPlayServices();
|
||||
|
@ -311,7 +311,7 @@ public class ApplicationLoader extends Application {
|
|||
DownloadController.getInstance(finalA);
|
||||
};
|
||||
if (finalA == UserConfig.selectedAccount) initRunnable.run();
|
||||
else UIUtil.runOnIoDispatcher(initRunnable);
|
||||
else Utilities.stageQueue.postRunnable(initRunnable);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ public class ApplicationLoader extends Application {
|
|||
}
|
||||
|
||||
public static void startPushService() {
|
||||
UIUtil.runOnIoDispatcher(ApplicationLoader::startPushServiceInternal);
|
||||
Utilities.stageQueue.postRunnable(ApplicationLoader::startPushServiceInternal);
|
||||
}
|
||||
|
||||
private static void startPushServiceInternal() {
|
||||
|
|
|
@ -254,8 +254,6 @@ public class LocaleController {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (localInstance.formatterDay == null || localInstance.chatFullDate == null)
|
||||
localInstance.recreateFormatters();
|
||||
return localInstance;
|
||||
}
|
||||
|
||||
|
|
|
@ -362,27 +362,31 @@ public class ConnectionsManager extends BaseController {
|
|||
|
||||
public void init(int version, int layer, int apiId, String deviceModel, String systemVersion, String appVersion, String langCode, String systemLangCode, String configPath, String logPath, String regId, String cFingerprint, int timezoneOffset, int userId, boolean enablePushConnection) {
|
||||
|
||||
SharedConfig.loadProxyList();
|
||||
Utilities.stageQueue.postRunnable(() -> {
|
||||
|
||||
if (SharedConfig.proxyEnabled && SharedConfig.currentProxy != null) {
|
||||
if (SharedConfig.currentProxy instanceof SharedConfig.ExternalSocks5Proxy) {
|
||||
((SharedConfig.ExternalSocks5Proxy) SharedConfig.currentProxy).start();
|
||||
SharedConfig.loadProxyList();
|
||||
|
||||
if (SharedConfig.proxyEnabled && SharedConfig.currentProxy != null) {
|
||||
if (SharedConfig.currentProxy instanceof SharedConfig.ExternalSocks5Proxy) {
|
||||
((SharedConfig.ExternalSocks5Proxy) SharedConfig.currentProxy).start();
|
||||
}
|
||||
native_setProxySettings(currentAccount, SharedConfig.currentProxy.address, SharedConfig.currentProxy.port, SharedConfig.currentProxy.username, SharedConfig.currentProxy.password, SharedConfig.currentProxy.secret);
|
||||
}
|
||||
native_setProxySettings(currentAccount, SharedConfig.currentProxy.address, SharedConfig.currentProxy.port, SharedConfig.currentProxy.username, SharedConfig.currentProxy.password, SharedConfig.currentProxy.secret);
|
||||
}
|
||||
|
||||
String installer = "";
|
||||
try {
|
||||
installer = ApplicationLoader.applicationContext.getPackageManager().getInstallerPackageName(ApplicationLoader.applicationContext.getPackageName());
|
||||
} catch (Throwable ignore) {
|
||||
String installer = "";
|
||||
try {
|
||||
installer = ApplicationLoader.applicationContext.getPackageManager().getInstallerPackageName(ApplicationLoader.applicationContext.getPackageName());
|
||||
} catch (Throwable ignore) {
|
||||
|
||||
}
|
||||
if (installer == null) {
|
||||
installer = "";
|
||||
}
|
||||
}
|
||||
if (installer == null) {
|
||||
installer = "";
|
||||
}
|
||||
|
||||
native_init(currentAccount, version, layer, apiId, deviceModel, systemVersion, appVersion, langCode, systemLangCode, configPath, logPath, regId, cFingerprint, installer, timezoneOffset, userId, enablePushConnection, ApplicationLoader.isNetworkOnline(), ApplicationLoader.getCurrentNetworkType());
|
||||
checkConnection();
|
||||
native_init(currentAccount, version, layer, apiId, deviceModel, systemVersion, appVersion, langCode, systemLangCode, configPath, logPath, regId, cFingerprint, installer, timezoneOffset, userId, enablePushConnection, ApplicationLoader.isNetworkOnline(), ApplicationLoader.getCurrentNetworkType());
|
||||
checkConnection();
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue