Working on saving the api information to the database and then saving the token. After that work on fetching the songs from icarus and viewing them.

This commit is contained in:
kdeng00
2019-10-12 01:28:12 -04:00
parent 58825427d0
commit f9304a52e2
9 changed files with 248 additions and 25 deletions
+23
View File
@@ -23,9 +23,11 @@
#include <curl/curl.h>
#include <sqlite3.h>
#include "model/APIInfo.h"
#include "model/Song.h"
#include "model/Token.h"
#include "model/User.h"
#include "APIRepository.h"
#include "SongRepository.h"
#include "Tok.h"
#include "UserRepository.h"
@@ -44,6 +46,7 @@ model::User retrieveCredentials(const std::string&);
std::string fetchToken(const std::string&, const std::string&, const std::string&);
bool doesDatabaseExist(const std::string&);
bool apiInformationExist(const std::string&);
bool userCredentialExist(const std::string&);
void saveCredentials(const model::User&, const std::string&);
@@ -150,6 +153,13 @@ bool doesDatabaseExist(const std::string& dataPath)
return result;
}
bool apiInformationExist(const std::string& dataPath)
{
repository::local::APIRepository apiRepo;
return apiRepo.isTableEmpty(dataPath);
}
bool userCredentialExist(const std::string& dataPath)
{
repository::local::UserRepository userRepo;
@@ -381,6 +391,19 @@ Java_com_example_mear_activities_LoginActivity_logUser(
}
extern "C"
JNIEXPORT jboolean
JNICALL
Java_com_example_mear_repositories_APIRepository_isAPIInfoTableEmpty(
JNIEnv *env,
jobject thisObj,
jstring pathStr
) {
const std::string datapath = env->GetStringUTFChars(pathStr, nullptr);
return apiInformationExist(datapath);
}
extern "C"
JNIEXPORT jboolean
JNICALL