Tempo: Properly handle expired tokens

pull/600/head
Michael Zanetti 2022-08-29 14:39:59 +02:00
parent 860fbac0e8
commit ff4cd2a50c
3 changed files with 46 additions and 169 deletions

View File

@ -59,7 +59,7 @@ void IntegrationPluginTempo::startPairing(ThingPairingInfo *info)
info->finish(Thing::ThingErrorNoError, QT_TR_NOOP("Please enter your Tempo API integration token."));
} else {
qCWarning(dcTempo()) << "Got online check error" << reply->error() << reply->errorString();
info->finish(Thing::ThingErrorSetupFailed, tr("Tempo server not reachable, please check the internet connection."));
info->finish(Thing::ThingErrorSetupFailed, QT_TR_NOOP("Tempo server not reachable, please check the internet connection."));
}
});
} else {
@ -196,6 +196,8 @@ void IntegrationPluginTempo::setupThing(ThingSetupInfo *info)
connect(tempo, &Tempo::accountWorklogsReceived, this, &IntegrationPluginTempo::onAccountWorkloadReceived);
connect(tempo, &Tempo::teamWorklogsReceived, this, &IntegrationPluginTempo::onTeamWorkloadReceived);
info->finish(Thing::ThingErrorNoError);
} else {
info->finish(Thing::ThingErrorAuthenticationFailure, tr("The Token seems to be expired."));
}
});
tempo->getAccounts();

View File

@ -225,10 +225,9 @@ void Tempo::getWorkloadByTeam(int teamId, QDate from, QDate to, int offset, int
void Tempo::setAuthenticated(bool state)
{
if (state != m_authenticated) {
m_authenticated = state;
emit authenticationStatusChanged(state);
}
// We'll want to emit this in any case, even if it going from false to false, so we can properly handle the expired token case
m_authenticated = state;
emit authenticationStatusChanged(state);
}
void Tempo::setConnected(bool state)

View File

@ -23,204 +23,110 @@
<source>Token is not available.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../integrationplugintempo.cpp" line="200"/>
<source>The Token seems to be expired.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>tempo</name>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="81"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="49"/>
<source>Account</source>
<extracomment>The name of the ThingClass ({8be71352-bdfd-450b-903e-79a4ed203701})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="84"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="87"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="52"/>
<source>Category</source>
<extracomment>The name of the ParamType (ThingClass: account, EventType: category, ID: {3af6d1c0-bb0a-406f-809b-2c367e1a16bb})
----------
The name of the StateType ({3af6d1c0-bb0a-406f-809b-2c367e1a16bb}) of ThingClass account</extracomment>
<extracomment>The name of the StateType ({3af6d1c0-bb0a-406f-809b-2c367e1a16bb}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="90"/>
<source>Category changed</source>
<extracomment>The name of the EventType ({3af6d1c0-bb0a-406f-809b-2c367e1a16bb}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="93"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="96"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="99"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="102"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="105"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="108"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="55"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="58"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="61"/>
<source>Connected</source>
<extracomment>The name of the ParamType (ThingClass: team, EventType: connected, ID: {a125d3b5-676f-49eb-bb93-feae233c2e91})
----------
The name of the StateType ({a125d3b5-676f-49eb-bb93-feae233c2e91}) of ThingClass team
----------
The name of the ParamType (ThingClass: account, EventType: connected, ID: {0b776bc1-9e56-4205-9bc3-b356026f5b64})
<extracomment>The name of the StateType ({a125d3b5-676f-49eb-bb93-feae233c2e91}) of ThingClass team
----------
The name of the StateType ({0b776bc1-9e56-4205-9bc3-b356026f5b64}) of ThingClass account
----------
The name of the ParamType (ThingClass: tempoConnection, EventType: connected, ID: {15f45315-5419-4e1b-ace3-fc21503d3b70})
----------
The name of the StateType ({15f45315-5419-4e1b-ace3-fc21503d3b70}) of ThingClass tempoConnection</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="111"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="114"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="117"/>
<source>Connected changed</source>
<extracomment>The name of the EventType ({a125d3b5-676f-49eb-bb93-feae233c2e91}) of ThingClass team
----------
The name of the EventType ({0b776bc1-9e56-4205-9bc3-b356026f5b64}) of ThingClass account
----------
The name of the EventType ({15f45315-5419-4e1b-ace3-fc21503d3b70}) of ThingClass tempoConnection</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="120"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="123"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="64"/>
<source>Contact</source>
<extracomment>The name of the ParamType (ThingClass: account, EventType: contact, ID: {ece43b12-4a0d-4e25-b811-b1aca610bea8})
----------
The name of the StateType ({ece43b12-4a0d-4e25-b811-b1aca610bea8}) of ThingClass account</extracomment>
<extracomment>The name of the StateType ({ece43b12-4a0d-4e25-b811-b1aca610bea8}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="126"/>
<source>Contact changed</source>
<extracomment>The name of the EventType ({ece43b12-4a0d-4e25-b811-b1aca610bea8}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="129"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="132"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="67"/>
<source>Customer</source>
<extracomment>The name of the ParamType (ThingClass: account, EventType: Customer, ID: {3dcc1426-51f8-46fa-9967-5a93d7bb2633})
----------
The name of the StateType ({3dcc1426-51f8-46fa-9967-5a93d7bb2633}) of ThingClass account</extracomment>
<extracomment>The name of the StateType ({3dcc1426-51f8-46fa-9967-5a93d7bb2633}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="135"/>
<source>Customer changed</source>
<extracomment>The name of the EventType ({3dcc1426-51f8-46fa-9967-5a93d7bb2633}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="138"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="141"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="70"/>
<source>Global</source>
<extracomment>The name of the ParamType (ThingClass: account, EventType: global, ID: {abd55ea0-ad4e-413e-bc77-3e8b7f0a9be4})
----------
The name of the StateType ({abd55ea0-ad4e-413e-bc77-3e8b7f0a9be4}) of ThingClass account</extracomment>
<extracomment>The name of the StateType ({abd55ea0-ad4e-413e-bc77-3e8b7f0a9be4}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="144"/>
<source>Global changed</source>
<extracomment>The name of the EventType ({abd55ea0-ad4e-413e-bc77-3e8b7f0a9be4}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="147"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="73"/>
<source>Id</source>
<extracomment>The name of the ParamType (ThingClass: team, Type: thing, ID: {bb90e986-fcfa-47e8-8783-f2b5a887314a})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="150"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="76"/>
<source>Key</source>
<extracomment>The name of the ParamType (ThingClass: account, Type: thing, ID: {c6aeddae-56af-496d-a419-1635ff9bae50})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="153"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="156"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="159"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="162"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="79"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="82"/>
<source>Lead</source>
<extracomment>The name of the ParamType (ThingClass: team, EventType: lead, ID: {667a9d8d-4e80-4c7c-938c-d698853fa4b1})
----------
The name of the StateType ({667a9d8d-4e80-4c7c-938c-d698853fa4b1}) of ThingClass team
----------
The name of the ParamType (ThingClass: account, EventType: lead, ID: {f1f2af66-d09a-4242-9058-401145f662c4})
<extracomment>The name of the StateType ({667a9d8d-4e80-4c7c-938c-d698853fa4b1}) of ThingClass team
----------
The name of the StateType ({f1f2af66-d09a-4242-9058-401145f662c4}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="165"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="168"/>
<source>Lead changed</source>
<extracomment>The name of the EventType ({667a9d8d-4e80-4c7c-938c-d698853fa4b1}) of ThingClass team
----------
The name of the EventType ({f1f2af66-d09a-4242-9058-401145f662c4}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="171"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="174"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="85"/>
<source>Logged in</source>
<extracomment>The name of the ParamType (ThingClass: tempoConnection, EventType: loggedIn, ID: {e4b5be87-dbc9-481e-88da-608c71be8bda})
----------
The name of the StateType ({e4b5be87-dbc9-481e-88da-608c71be8bda}) of ThingClass tempoConnection</extracomment>
<extracomment>The name of the StateType ({e4b5be87-dbc9-481e-88da-608c71be8bda}) of ThingClass tempoConnection</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="177"/>
<source>Logged in changed</source>
<extracomment>The name of the EventType ({e4b5be87-dbc9-481e-88da-608c71be8bda}) of ThingClass tempoConnection</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="180"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="183"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="88"/>
<source>Monthly budget</source>
<extracomment>The name of the ParamType (ThingClass: account, EventType: monthlyBudget, ID: {44ebbc18-7511-48c0-860b-c4de5f634ed6})
----------
The name of the StateType ({44ebbc18-7511-48c0-860b-c4de5f634ed6}) of ThingClass account</extracomment>
<extracomment>The name of the StateType ({44ebbc18-7511-48c0-860b-c4de5f634ed6}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="186"/>
<source>Monthly budget changed</source>
<extracomment>The name of the EventType ({44ebbc18-7511-48c0-860b-c4de5f634ed6}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="189"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="91"/>
<source>Start date</source>
<extracomment>The name of the ParamType (ThingClass: account, Type: settings, ID: {56c460b2-37d8-453a-b4f4-8e58be348f85})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="192"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="195"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="94"/>
<source>Status</source>
<extracomment>The name of the ParamType (ThingClass: account, EventType: status, ID: {7948f15b-7243-404e-9e67-18e915e8b328})
----------
The name of the StateType ({7948f15b-7243-404e-9e67-18e915e8b328}) of ThingClass account</extracomment>
<extracomment>The name of the StateType ({7948f15b-7243-404e-9e67-18e915e8b328}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="198"/>
<source>Status changed</source>
<extracomment>The name of the EventType ({7948f15b-7243-404e-9e67-18e915e8b328}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="201"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="97"/>
<source>Team</source>
<extracomment>The name of the ThingClass ({11c85176-e7fe-44b4-995a-24757273f3af})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="204"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="207"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="100"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="103"/>
<source>Tempo</source>
<extracomment>The name of the vendor ({58fc1ab7-b8b5-4e52-8388-72957ce5852d})
----------
@ -228,58 +134,28 @@ The name of the plugin tempo ({809bc4ca-d1cd-4279-9e0d-7324537ccb5a})</extracomm
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="210"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="106"/>
<source>Tempo connection</source>
<extracomment>The name of the ThingClass ({878eae0a-6217-4b36-bd46-72c911e52e73})</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="213"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="216"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="219"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="222"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="109"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="112"/>
<source>This month time spent</source>
<extracomment>The name of the ParamType (ThingClass: team, EventType: monthTimeSpent, ID: {f5ec7b30-3074-41e9-b1fc-62b6307ddbe1})
----------
The name of the StateType ({f5ec7b30-3074-41e9-b1fc-62b6307ddbe1}) of ThingClass team
----------
The name of the ParamType (ThingClass: account, EventType: monthTimeSpent, ID: {81bec4e8-9fd3-43d1-b339-2a7fdd83e8cb})
<extracomment>The name of the StateType ({f5ec7b30-3074-41e9-b1fc-62b6307ddbe1}) of ThingClass team
----------
The name of the StateType ({81bec4e8-9fd3-43d1-b339-2a7fdd83e8cb}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="225"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="228"/>
<source>This month time spent changed</source>
<extracomment>The name of the EventType ({f5ec7b30-3074-41e9-b1fc-62b6307ddbe1}) of ThingClass team
----------
The name of the EventType ({81bec4e8-9fd3-43d1-b339-2a7fdd83e8cb}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="231"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="234"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="237"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="240"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="115"/>
<location filename="../../../build/nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="118"/>
<source>Total time spent</source>
<extracomment>The name of the ParamType (ThingClass: team, EventType: totalTimeSpent, ID: {a694682e-3c2a-4146-aa56-9e75fd82bcab})
----------
The name of the StateType ({a694682e-3c2a-4146-aa56-9e75fd82bcab}) of ThingClass team
----------
The name of the ParamType (ThingClass: account, EventType: totalTimeSpent, ID: {1ac39002-56a1-4911-aa68-9d14e142edae})
<extracomment>The name of the StateType ({a694682e-3c2a-4146-aa56-9e75fd82bcab}) of ThingClass team
----------
The name of the StateType ({1ac39002-56a1-4911-aa68-9d14e142edae}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="243"/>
<location filename="../../../build-nymea-plugins-Desktop-Debug/tempo/plugininfo.h" line="246"/>
<source>Total time spent changed</source>
<extracomment>The name of the EventType ({a694682e-3c2a-4146-aa56-9e75fd82bcab}) of ThingClass team
----------
The name of the EventType ({1ac39002-56a1-4911-aa68-9d14e142edae}) of ThingClass account</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
</TS>