mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-09 19:18:46 +02:00
Put back the worker thread for account manager in android
This commit is contained in:
parent
e838a85a47
commit
db460e9856
5 changed files with 17 additions and 18 deletions
|
@ -236,7 +236,6 @@ public class HomeActivity extends AppCompatActivity implements NavigationView.On
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
QtActivity.forceQuit();
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,6 @@ public class QtActivity extends Activity {
|
||||||
private QtActivityLoader m_loader = new QtActivityLoader(this);
|
private QtActivityLoader m_loader = new QtActivityLoader(this);
|
||||||
|
|
||||||
public boolean isLoading;
|
public boolean isLoading;
|
||||||
private boolean forcedQuit;
|
|
||||||
|
|
||||||
public static QtActivity instance;
|
|
||||||
|
|
||||||
public QtActivity() {
|
public QtActivity() {
|
||||||
}
|
}
|
||||||
|
@ -240,7 +237,6 @@ public class QtActivity extends Activity {
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
onCreateHook(savedInstanceState);
|
onCreateHook(savedInstanceState);
|
||||||
instance = this;
|
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -366,7 +362,6 @@ public class QtActivity extends Activity {
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
QtApplication.invokeDelegate();
|
QtApplication.invokeDelegate();
|
||||||
instance = null;
|
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -643,24 +638,13 @@ public class QtActivity extends Activity {
|
||||||
protected void onStart() {
|
protected void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
QtApplication.invokeDelegate();
|
QtApplication.invokeDelegate();
|
||||||
if (forcedQuit) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
if (forcedQuit) {
|
QtApplication.invokeDelegate();
|
||||||
QtApplication.invokeDelegate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void forceQuit() {
|
|
||||||
if (instance != null) {
|
|
||||||
instance.forcedQuit = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
|
@ -10,11 +10,19 @@
|
||||||
//
|
//
|
||||||
#include "AndroidHelper.h"
|
#include "AndroidHelper.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <AccountManager.h>
|
||||||
|
|
||||||
AndroidHelper::AndroidHelper() {
|
AndroidHelper::AndroidHelper() {
|
||||||
|
workerThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidHelper::~AndroidHelper() {
|
AndroidHelper::~AndroidHelper() {
|
||||||
|
workerThread.quit();
|
||||||
|
workerThread.wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AndroidHelper::init() {
|
||||||
|
DependencyManager::get<AccountManager>()->moveToThread(&workerThread);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidHelper::requestActivity(const QString &activityName) {
|
void AndroidHelper::requestActivity(const QString &activityName) {
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#define hifi_Android_Helper_h
|
#define hifi_Android_Helper_h
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
class AndroidHelper : public QObject {
|
class AndroidHelper : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -21,6 +22,7 @@ public:
|
||||||
static AndroidHelper instance;
|
static AndroidHelper instance;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
void init();
|
||||||
void requestActivity(const QString &activityName);
|
void requestActivity(const QString &activityName);
|
||||||
void notifyLoadComplete();
|
void notifyLoadComplete();
|
||||||
void goBackFromAndroidActivity();
|
void goBackFromAndroidActivity();
|
||||||
|
@ -35,6 +37,7 @@ signals:
|
||||||
private:
|
private:
|
||||||
AndroidHelper();
|
AndroidHelper();
|
||||||
~AndroidHelper();
|
~AndroidHelper();
|
||||||
|
QThread workerThread;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -850,7 +850,11 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
|
||||||
DependencyManager::set<Cursor::Manager>();
|
DependencyManager::set<Cursor::Manager>();
|
||||||
DependencyManager::set<VirtualPad::Manager>();
|
DependencyManager::set<VirtualPad::Manager>();
|
||||||
DependencyManager::set<DesktopPreviewProvider>();
|
DependencyManager::set<DesktopPreviewProvider>();
|
||||||
|
#if defined(Q_OS_ANDROID)
|
||||||
|
DependencyManager::set<AccountManager>(); // use the default user agent getter
|
||||||
|
#else
|
||||||
DependencyManager::set<AccountManager>(std::bind(&Application::getUserAgent, qApp));
|
DependencyManager::set<AccountManager>(std::bind(&Application::getUserAgent, qApp));
|
||||||
|
#endif
|
||||||
DependencyManager::set<StatTracker>();
|
DependencyManager::set<StatTracker>();
|
||||||
DependencyManager::set<ScriptEngines>(ScriptEngine::CLIENT_SCRIPT);
|
DependencyManager::set<ScriptEngines>(ScriptEngine::CLIENT_SCRIPT);
|
||||||
DependencyManager::set<ScriptInitializerMixin, NativeScriptInitializers>();
|
DependencyManager::set<ScriptInitializerMixin, NativeScriptInitializers>();
|
||||||
|
@ -2246,6 +2250,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
|
qCDebug(interfaceapp) << "Metaverse session ID is" << uuidStringWithoutCurlyBraces(accountManager->getSessionID());
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
|
AndroidHelper::instance().init();
|
||||||
AndroidHelper::instance().notifyLoadComplete();
|
AndroidHelper::instance().notifyLoadComplete();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue