diff --git a/client/FJClient/FJOperation.cpp b/client/FJClient/FJOperation.cpp index 862ff01..f757da9 100644 --- a/client/FJClient/FJOperation.cpp +++ b/client/FJClient/FJOperation.cpp @@ -33,7 +33,6 @@ FJOperation::FJOperation(const QString& name, const QString& checkFetch, FJOperation::~FJOperation() { - qDebug() << "[" << _name << "] FJOperation::~FJOperation()"; } void @@ -117,6 +116,7 @@ FJOperation::_OnAuthenticationRequired(QNetworkReply *, void _NetworkErrorPrintError(const QNetworkReply::NetworkError& error) { + return; switch(error) { case QNetworkReply::NoError: qDebug() << "No Error"; @@ -142,10 +142,13 @@ FJOperation::_OnReplyFinished(QNetworkAccessManagerSharedPtr accessManager, _RunRequest(accessManager, baseUrl, opType); } else { _StoreCSRF(accessManager, baseUrl); + // Read the rest of the buffer, if there's anything left + _buffer.append(_reply->readAll()); QJsonDocument jsonDoc = _GetJsonFromContent(_buffer); if (jsonDoc.isNull() || jsonDoc.isEmpty()) { _NetworkErrorPrintError(_reply->error()); qDebug() << "Invalid JSON for " << baseUrl << ": " << _buffer; + _status = FJCompletedStatus; } else if (opType == FJCheckOperationType) { if (_ProcessCheck(jsonDoc)) { _RunRequest(accessManager, baseUrl, FJFetchOperationType); @@ -161,7 +164,6 @@ FJOperation::_OnReplyFinished(QNetworkAccessManagerSharedPtr accessManager, _status = FJCompletedStatus; } } - qDebug() << "_OnReplyfinished completed"; } void @@ -173,8 +175,13 @@ FJOperation::_OnBytesReceived(qint64 bytesReceived, qint64 ) } char buffer[bytesReceived+1]; qint64 bytesRead = _reply->read(buffer, bytesReceived); - if (bytesRead != bytesReceived) { + if (bytesRead == -1) { + qDebug() << "-1 returned from QIODevice::read()"; + return; + } else if (bytesRead != bytesReceived) { + // This was garbage (on android, at least), so throw it out. qDebug() << "Read " << bytesRead << ", expected " << bytesReceived; + // << "[" << buffer << "]"; } _buffer.append(buffer); } @@ -193,10 +200,10 @@ void FJOperation::_OnFinished(QNetworkAccessManagerSharedPtr accessManager, const QUrl& baseUrl) { - qDebug() << "Operation: OnFinished"; QObject::disconnect(_reply, 0, 0, 0); _StoreCSRF(accessManager, baseUrl); - _buffer.append(_reply->readAll()); + QByteArray rest = _reply->readAll(); + _buffer.append(rest); QJsonDocument jsonDoc = _GetJsonFromContent(_buffer); if (!jsonDoc.isNull() and !jsonDoc.isEmpty()) { if (_caller) { @@ -252,7 +259,7 @@ FJOperation::_GetJsonFromContent(const QByteArray& content) cleanedContent.chop(1); desiredSize--; } - //qDebug() << "Trunc: <<" << _buffer.data() << ">>"; + //qDebug() << "Trunc: <<" << cleanedContent << ">>"; return QJsonDocument::fromJson(cleanedContent); } diff --git a/client/SFOsaka/SFOContext.cpp b/client/SFOsaka/SFOContext.cpp index fbe172f..314a5f2 100644 --- a/client/SFOsaka/SFOContext.cpp +++ b/client/SFOsaka/SFOContext.cpp @@ -188,6 +188,7 @@ SFOContext::FlushToDisk() QJsonObject obj = QJsonObject::fromVariantMap(partnerMap); QJsonDocument doc; doc.setObject(obj); + qDebug() << "Saving " << _partners.size() << " partners"; _WriteCacheFile(doc, PartnerCacheFileName); } @@ -201,6 +202,7 @@ SFOContext::FlushToDisk() QJsonObject obj = QJsonObject::fromVariantMap(allDicts); QJsonDocument doc; doc.setObject(obj); + qDebug() << "Saving " << allDicts.size() << " words"; _WriteCacheFile(doc, DictionaryCacheFileName); } } @@ -455,12 +457,12 @@ SFOContext::_UpdateDictionaryIfNecessary() } void -SFOContext::HandleResponse(const QJsonDocument& document, FJError /*error*/, +SFOContext::HandleResponse(const QJsonDocument& document, FJError error, const FJOperation* operation) { - // qDebug() << QThread::currentThreadId() << "HandleResponse: " - // << operation->GetName() ; - // << ", (" << error << ") Doc: [" << document << "]"; + qDebug() << QThread::currentThreadId() << "HandleResponse: " + << operation->GetName() + << ", (" << error << ") Doc: [" << document << "]"; if (operation && (operation->GetName() == "start")) { _HandleStartResponse(document); } else if (operation && (operation->GetName() == "partners")) { diff --git a/client/SFOsaka/SFOsaka.pro b/client/SFOsaka/SFOsaka.pro index 6731811..0f6baaa 100644 --- a/client/SFOsaka/SFOsaka.pro +++ b/client/SFOsaka/SFOsaka.pro @@ -74,9 +74,11 @@ LIBS += -L$$PWD/../build-FJClient-iphonesimulator_clang_Qt_5_6_0_for_iOS-Debug/ } iphoneos{ LIBS += -L$$PWD/../build-FJClient-iphoneos_clang_Qt_5_6_0_for_iOS-Debug/ -lFJClient +#LIBS += -L$$PWD/../build-FJClient-iphoneos_clang_Qt_5_6_0_for_iOS-Release/ -lFJClient } android{ -LIBS += -L$$PWD/../build-FJClient-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_0-Debug/ -lFJClient +Debug:LIBS += -L$$PWD/../build-FJClient-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_0-Debug/ -lFJClient +Release:LIBS += -L$$PWD/../build-FJClient-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_0-Release/ -lFJClient } osx{ LIBS += -L$$PWD/../build-FJClient-Desktop_Qt_5_6_0_clang_64bit-Debug/ -lFJClient @@ -90,7 +92,8 @@ iphonesimulator { PRE_TARGETDEPS += $$PWD/../build-FJClient-iphonesimulator_clang_Qt_5_6_0_for_iOS-Debug/libFJClient.a } iphoneos{ -PRE_TARGETDEPS += $$PWD/../build-FJClient-iphoneos_clang_Qt_5_6_0_for_iOS-Debug/libFJClient.a +Debug:PRE_TARGETDEPS += $$PWD/../build-FJClient-iphoneos_clang_Qt_5_6_0_for_iOS-Debug/libFJClient.a +Release:PRE_TARGETDEPS += $$PWD/../build-FJClient-iphoneos_clang_Qt_5_6_0_for_iOS-Release/libFJClienta. } android{ Debug:PRE_TARGETDEPS += $$PWD/../build-FJClient-Android_for_armeabi_v7a_GCC_4_9_Qt_5_6_0-Debug/libFJClient.a diff --git a/client/SFOsaka/android/AndroidManifest.xml b/client/SFOsaka/android/AndroidManifest.xml index b0ed2aa..6f0ee12 100644 --- a/client/SFOsaka/android/AndroidManifest.xml +++ b/client/SFOsaka/android/AndroidManifest.xml @@ -1,5 +1,5 @@ - + diff --git a/client/SFOsaka/ios/Info.plist b/client/SFOsaka/ios/Info.plist index ae9c195..464092b 100644 --- a/client/SFOsaka/ios/Info.plist +++ b/client/SFOsaka/ios/Info.plist @@ -3,7 +3,7 @@ CFBundleDisplayName - SFOsaka + ${PRODUCT_NAME} CFBundleExecutable SFOsaka CFBundleGetInfoString @@ -29,7 +29,7 @@ CFBundleIdentifier - net.futomen.${PRODUCT_NAME} + net.futomen.${PRODUCT_NAME:rfc1034identifier} CFBundleName ${PRODUCT_NAME} CFBundlePackageType @@ -39,7 +39,7 @@ CFBundleSignature ???? CFBundleVersion - 1.0 + 2.0 ITSAppUsesNonExemptEncryption LSRequiresIPhoneOS