Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android 5 Fix #2234

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,12 @@ public void initializeConnection(){
@Override
public void onBillingSetupFinished(BillingResult billingResult) {
Log.w(TAG, "onBillingSetupFinished");
if (billingResult.getResponseCode() == RESULT_OK) {
return;
/* if (billingResult.getResponseCode() == RESULT_OK) {
purchasedProductsQueried(m_nativePointer);
} else {
Log.w(TAG, "onBillingSetupFinished error!" + billingResult.getResponseCode());
}
}*/
}

@Override
Expand Down
18 changes: 9 additions & 9 deletions src/homeform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ homeform::homeform(QQmlApplicationEngine *engine, bluetooth *bl) {
}
#endif

m_speech.setLocale(QLocale::English);
//m_speech.setLocale(QLocale::English);

#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
QBluetoothDeviceInfo b;
Expand Down Expand Up @@ -3721,8 +3721,8 @@ void homeform::Start_inner(bool send_event_to_device) {

m_overridePower = false;

if (settings.value(QZSettings::tts_enabled, QZSettings::default_tts_enabled).toBool())
m_speech.say("Start pressed");
/*if (settings.value(QZSettings::tts_enabled, QZSettings::default_tts_enabled).toBool())
m_speech.say("Start pressed");*/

if (!paused && !stopped) {
paused = true;
Expand Down Expand Up @@ -3846,8 +3846,8 @@ void homeform::Stop() {
this->innerTemplateManager->reinit();
#endif

if (settings.value(QZSettings::tts_enabled, QZSettings::default_tts_enabled).toBool())
m_speech.say("Stop pressed");
/*if (settings.value(QZSettings::tts_enabled, QZSettings::default_tts_enabled).toBool())
m_speech.say("Stop pressed");*/

if (bluetoothManager->device()) {

Expand Down Expand Up @@ -5588,7 +5588,7 @@ void homeform::update() {
setToastRequested("AutoLap " + QString::number(settings.value(QZSettings::autolap_distance, QZSettings::default_autolap_distance).toDouble(), 'f', 1));
}
}

/*
if (settings.value(QZSettings::tts_enabled, QZSettings::default_tts_enabled).toBool()) {
static double tts_speed_played = 0;
bool description =
Expand Down Expand Up @@ -5637,7 +5637,7 @@ void homeform::update() {
if (settings.value(QZSettings::tts_avg_cadence, QZSettings::default_tts_avg_cadence).toBool())
s.append((description ? tr(", Average cadence ") : ",") +
QString::number(bluetoothManager->device()->currentCadence().average(), 'f', 0));
if (settings.value(QZSettings::tts_max_cadence, QZSettings::default_tts_max_cadence /* true */)
if (settings.value(QZSettings::tts_max_cadence, QZSettings::default_tts_max_cadence)
.toBool())
s.append((description ? tr(", Max cadence ") : ",") +
QString::number(bluetoothManager->device()->currentCadence().max()));
Expand Down Expand Up @@ -5703,7 +5703,7 @@ void homeform::update() {
if (settings.value(QZSettings::tts_max_watt, QZSettings::default_tts_max_watt).toBool())
s.append((description ? tr(", max watt ") : ",") +
QString::number(bluetoothManager->device()->wattsMetric().max(), 'f', 0));
if (settings.value(QZSettings::tts_act_ftp, QZSettings::default_tts_act_ftp /* true */)
if (settings.value(QZSettings::tts_act_ftp, QZSettings::default_tts_act_ftp )
.toBool())
s.append((description ? tr(", ftp ") : ",") + QString::number(ftpZone, 'f', 1));
if (settings.value(QZSettings::tts_act_heart, QZSettings::default_tts_act_heart).toBool())
Expand Down Expand Up @@ -5825,7 +5825,7 @@ void homeform::update() {
m_speech.say(s);
}
}
}
}*/

if(bluetoothManager->device()->currentSpeed().value() > 0 && !isinf(bluetoothManager->device()->currentSpeed().value()))
bluetoothManager->device()->addCurrentDistance1s((bluetoothManager->device()->currentSpeed().value() / 3600.0));
Expand Down
2 changes: 1 addition & 1 deletion src/homeform.h
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ class homeform : public QObject {
bool getLap();
void Start_inner(bool send_event_to_device);

QTextToSpeech m_speech;
//QTextToSpeech m_speech;
int tts_summary_count = 0;

#if defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || (defined(Q_OS_ANDROID) && defined(LICENSE))
Expand Down
6 changes: 6 additions & 0 deletions src/purchasing/android/androidjni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@
QT_USE_NAMESPACE

static void purchasedProductsQueried(JNIEnv *, jclass, jlong nativePointer) {
return;
AndroidInAppPurchaseBackend *backend = reinterpret_cast<AndroidInAppPurchaseBackend *>(nativePointer);
QMetaObject::invokeMethod(backend, "registerReady", Qt::AutoConnection);
}

static void registerProduct(JNIEnv *, jclass, jlong nativePointer, jstring productId, jstring price, jstring title,
jstring description) {
return;
AndroidInAppPurchaseBackend *backend = reinterpret_cast<AndroidInAppPurchaseBackend *>(nativePointer);
QMetaObject::invokeMethod(
backend, "registerProduct", Qt::AutoConnection, Q_ARG(QString, QAndroidJniObject(productId).toString()),
Expand All @@ -72,6 +74,7 @@ static void registerProduct(JNIEnv *, jclass, jlong nativePointer, jstring produ

static void registerPurchased(JNIEnv *, jclass, jlong nativePointer, jstring identifier, jstring signature,
jstring data, jstring purchaseToken, jstring orderId, jlong timestamp) {
return;
QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(qint64(timestamp));
dateTime.setTimeSpec(Qt::LocalTime);

Expand All @@ -85,6 +88,7 @@ static void registerPurchased(JNIEnv *, jclass, jlong nativePointer, jstring ide

static void purchaseSucceeded(JNIEnv *, jclass, jlong nativePointer, jint requestCode, jstring signature, jstring data,
jstring purchaseToken, jstring orderId, jlong timestamp) {
return;
QDateTime dateTime = QDateTime::fromMSecsSinceEpoch(qint64(timestamp));
dateTime.setTimeSpec(Qt::LocalTime);

Expand All @@ -98,6 +102,7 @@ static void purchaseSucceeded(JNIEnv *, jclass, jlong nativePointer, jint reques

static void purchaseFailed(JNIEnv *, jclass, jlong nativePointer, jint requestCode, jint failureReason,
jstring errorString) {
return;
AndroidInAppPurchaseBackend *backend = reinterpret_cast<AndroidInAppPurchaseBackend *>(nativePointer);
QMetaObject::invokeMethod(backend, "purchaseFailed", Qt::AutoConnection, Q_ARG(int, int(requestCode)),
Q_ARG(int, int(failureReason)),
Expand All @@ -116,6 +121,7 @@ static JNINativeMethod methods[] = {
{"purchaseFailed", "(JIILjava/lang/String;)V", (void *)purchaseFailed}};

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *) {
return JNI_VERSION_1_6;
static bool initialized = false;
if (initialized) {
return JNI_VERSION_1_6;
Expand Down
2 changes: 1 addition & 1 deletion src/qdomyos-zwift.pri
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include(../defaults.pri)
QT += bluetooth widgets xml positioning quick networkauth websockets texttospeech location multimedia
QT += bluetooth widgets xml positioning quick networkauth websockets location multimedia
QTPLUGIN += qavfmediaplayer
QT+= charts core-private

Expand Down