mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 07:04:44 +02:00
Remove the duplicated AccountManager used for android
This commit is contained in:
parent
1f4346d221
commit
e15fc787d3
4 changed files with 4 additions and 31 deletions
|
@ -228,7 +228,7 @@ Java_io_highfidelity_hifiinterface_fragment_LoginFragment_nativeLogin(JNIEnv *en
|
||||||
env->ReleaseStringUTFChars(username_, c_username);
|
env->ReleaseStringUTFChars(username_, c_username);
|
||||||
env->ReleaseStringUTFChars(password_, c_password);
|
env->ReleaseStringUTFChars(password_, c_password);
|
||||||
|
|
||||||
auto accountManager = AndroidHelper::instance().getAccountManager();
|
auto accountManager = DependencyManager::get<AccountManager>();
|
||||||
|
|
||||||
__loginCompletedListener = QAndroidJniObject(instance);
|
__loginCompletedListener = QAndroidJniObject(instance);
|
||||||
__usernameChangedListener = QAndroidJniObject(usernameChangedListener);
|
__usernameChangedListener = QAndroidJniObject(usernameChangedListener);
|
||||||
|
@ -270,18 +270,18 @@ Java_io_highfidelity_hifiinterface_SplashActivity_registerLoadCompleteListener(J
|
||||||
}
|
}
|
||||||
JNIEXPORT jboolean JNICALL
|
JNIEXPORT jboolean JNICALL
|
||||||
Java_io_highfidelity_hifiinterface_MainActivity_nativeIsLoggedIn(JNIEnv *env, jobject instance) {
|
Java_io_highfidelity_hifiinterface_MainActivity_nativeIsLoggedIn(JNIEnv *env, jobject instance) {
|
||||||
return AndroidHelper::instance().getAccountManager()->isLoggedIn();
|
return DependencyManager::get<AccountManager>()->isLoggedIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_io_highfidelity_hifiinterface_MainActivity_nativeLogout(JNIEnv *env, jobject instance) {
|
Java_io_highfidelity_hifiinterface_MainActivity_nativeLogout(JNIEnv *env, jobject instance) {
|
||||||
AndroidHelper::instance().getAccountManager()->logout();
|
DependencyManager::get<AccountManager>()->logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jstring JNICALL
|
JNIEXPORT jstring JNICALL
|
||||||
Java_io_highfidelity_hifiinterface_MainActivity_nativeGetDisplayName(JNIEnv *env,
|
Java_io_highfidelity_hifiinterface_MainActivity_nativeGetDisplayName(JNIEnv *env,
|
||||||
jobject instance) {
|
jobject instance) {
|
||||||
QString username = AndroidHelper::instance().getAccountManager()->getAccountInfo().getUsername();
|
QString username = DependencyManager::get<AccountManager>()->getAccountInfo().getUsername();
|
||||||
return env->NewStringUTF(username.toLatin1().data());
|
return env->NewStringUTF(username.toLatin1().data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,31 +10,11 @@
|
||||||
//
|
//
|
||||||
#include "AndroidHelper.h"
|
#include "AndroidHelper.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <AccountManager.h>
|
|
||||||
|
|
||||||
AndroidHelper::AndroidHelper() {
|
AndroidHelper::AndroidHelper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidHelper::~AndroidHelper() {
|
AndroidHelper::~AndroidHelper() {
|
||||||
workerThread.quit();
|
|
||||||
workerThread.wait();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AndroidHelper::init() {
|
|
||||||
workerThread.start();
|
|
||||||
_accountManager = QSharedPointer<AccountManager>(new AccountManager, &QObject::deleteLater);
|
|
||||||
_accountManager->setIsAgent(true);
|
|
||||||
_accountManager->setAuthURL(NetworkingConstants::METAVERSE_SERVER_URL());
|
|
||||||
_accountManager->setSessionID(DependencyManager::get<AccountManager>()->getSessionID());
|
|
||||||
connect(_accountManager.data(), &AccountManager::loginComplete, [](const QUrl& authURL) {
|
|
||||||
DependencyManager::get<AccountManager>()->setAccountInfo(AndroidHelper::instance().getAccountManager()->getAccountInfo());
|
|
||||||
DependencyManager::get<AccountManager>()->setAuthURL(authURL);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(_accountManager.data(), &AccountManager::logoutComplete, [] () {
|
|
||||||
DependencyManager::get<AccountManager>()->logout();
|
|
||||||
});
|
|
||||||
_accountManager->moveToThread(&workerThread);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidHelper::requestActivity(const QString &activityName, const bool backToScene) {
|
void AndroidHelper::requestActivity(const QString &activityName, const bool backToScene) {
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
#define hifi_Android_Helper_h
|
#define hifi_Android_Helper_h
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QThread>
|
|
||||||
#include <AccountManager.h>
|
|
||||||
|
|
||||||
class AndroidHelper : public QObject {
|
class AndroidHelper : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -23,7 +21,6 @@ public:
|
||||||
static AndroidHelper instance;
|
static AndroidHelper instance;
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
void init();
|
|
||||||
void requestActivity(const QString &activityName, const bool backToScene);
|
void requestActivity(const QString &activityName, const bool backToScene);
|
||||||
void notifyLoadComplete();
|
void notifyLoadComplete();
|
||||||
void notifyEnterForeground();
|
void notifyEnterForeground();
|
||||||
|
@ -31,7 +28,6 @@ public:
|
||||||
|
|
||||||
void performHapticFeedback(int duration);
|
void performHapticFeedback(int duration);
|
||||||
|
|
||||||
QSharedPointer<AccountManager> getAccountManager() { return _accountManager; }
|
|
||||||
AndroidHelper(AndroidHelper const&) = delete;
|
AndroidHelper(AndroidHelper const&) = delete;
|
||||||
void operator=(AndroidHelper const&) = delete;
|
void operator=(AndroidHelper const&) = delete;
|
||||||
|
|
||||||
|
@ -49,8 +45,6 @@ signals:
|
||||||
private:
|
private:
|
||||||
AndroidHelper();
|
AndroidHelper();
|
||||||
~AndroidHelper();
|
~AndroidHelper();
|
||||||
QSharedPointer<AccountManager> _accountManager;
|
|
||||||
QThread workerThread;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2256,7 +2256,6 @@ 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();
|
|
||||||
connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground);
|
connect(&AndroidHelper::instance(), &AndroidHelper::enterBackground, this, &Application::enterBackground);
|
||||||
connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);
|
connect(&AndroidHelper::instance(), &AndroidHelper::enterForeground, this, &Application::enterForeground);
|
||||||
AndroidHelper::instance().notifyLoadComplete();
|
AndroidHelper::instance().notifyLoadComplete();
|
||||||
|
|
Loading…
Reference in a new issue