updatenews error bugfix
This commit is contained in:
parent
d43c18bb76
commit
59fe1ea0df
|
@ -103,9 +103,7 @@ Currently supported:
|
||||||
* Maximum news (deleted after use of Quit button)
|
* Maximum news (deleted after use of Quit button)
|
||||||
* Sync home timeline, replies, DM, Events, friend requests; Notify yes/no
|
* Sync home timeline, replies, DM, Events, friend requests; Notify yes/no
|
||||||
* Hide #nsfw
|
* Hide #nsfw
|
||||||
|
* OAuth2 as authorization method
|
||||||
|
|
||||||
* OAuth
|
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
|
|
||||||
|
@ -120,7 +118,7 @@ ToDo
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
|
|
||||||
* German, Spanish, Italian, Hungarian, dutch
|
* German, Spanish, Italian, Hungarian, Dutch
|
||||||
* To contribute translations: <https://translate.codeberg.org/projects/friendiqa/friendiqa/>
|
* To contribute translations: <https://translate.codeberg.org/projects/friendiqa/friendiqa/>
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
|
|
|
@ -2,14 +2,6 @@
|
||||||
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.6.8" android:versionCode="34" android:installLocation="auto">
|
<manifest package="org.qtproject.friendiqa" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="0.6.8" android:versionCode="34" android:installLocation="auto">
|
||||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31"/>
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="31"/>
|
||||||
|
|
||||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
|
||||||
Remove the comment if you do not require these default permissions. -->
|
|
||||||
<!-- %%INSERT_PERMISSIONS -->
|
|
||||||
|
|
||||||
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
|
|
||||||
Remove the comment if you do not require these default features. -->
|
|
||||||
<!-- %%INSERT_FEATURES android:requestLegacyExternalStorage="true" -->
|
|
||||||
|
|
||||||
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
|
||||||
|
|
||||||
<application android:hardwareAccelerated="true"
|
<application android:hardwareAccelerated="true"
|
||||||
|
@ -96,7 +88,7 @@
|
||||||
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
|
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
|
||||||
* none - useful for apps that don't use any of the above Qt modules
|
* none - useful for apps that don't use any of the above Qt modules
|
||||||
-->
|
-->
|
||||||
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
|
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
|
||||||
<!-- extract android style -->
|
<!-- extract android style -->
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
@ -138,4 +130,7 @@
|
||||||
</application>
|
</application>
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
/home/pankraz/ownCloud/clientsync/Friendiqa/v0.6/source-linux/common/oauth.cpp
|
../../source-linux/common/oauth.cpp
|
|
@ -1 +1 @@
|
||||||
/home/pankraz/ownCloud/clientsync/Friendiqa/v0.6/source-linux/common/oauth.h
|
../../source-linux/common/oauth.h
|
|
@ -13,7 +13,7 @@
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
TARGET = friendiqa
|
TARGET = friendiqa
|
||||||
CONFIG += release
|
CONFIG += release
|
||||||
QT += core core-private qml quick gui widgets sql androidextras network networkauth #webengine webview
|
QT += core core-private qml quick gui widgets sql androidextras network networkauth
|
||||||
|
|
||||||
include(androidnative.pri/androidnative.pri)
|
include(androidnative.pri/androidnative.pri)
|
||||||
|
|
||||||
|
@ -88,8 +88,6 @@ DISTFILES += \
|
||||||
android/src/FriendiqaActivity.java \
|
android/src/FriendiqaActivity.java \
|
||||||
android/src/FriendiqaService.java
|
android/src/FriendiqaService.java
|
||||||
|
|
||||||
ANDROID_EXTRA_LIBS = /home/pankraz/android-sdk/android_openssl/latest/arm/libcrypto_1_1.so /home/pankraz/android-sdk/android_openssl/latest/arm/libssl_1_1.so /home/pankraz/android-sdk/android_openssl/latest/arm64/libcrypto_1_1.so /home/pankraz/android-sdk/android_openssl/latest/arm64/libssl_1_1.so /home/pankraz/android-sdk/android_openssl/latest/x86/libcrypto_1_1.so /home/pankraz/android-sdk/android_openssl/latest/x86/libssl_1_1.so /home/pankraz/android-sdk/android_openssl/latest/x86_64/libcrypto_1_1.so /home/pankraz/android-sdk/android_openssl/latest/x86_64/libssl_1_1.so /home/pankraz/android-sdk/android_openssl/latest/arm/libcrypto_1_1.so /home/pankraz/android-sdk/android_openssl/latest/arm/libssl_1_1.so /home/pankraz/android-sdk/android_openssl/latest/arm64/libcrypto_1_1.so /home/pankraz/android-sdk/android_openssl/latest/arm64/libssl_1_1.so /home/pankraz/android-sdk/android_openssl/latest/x86/libcrypto_1_1.so /home/pankraz/android-sdk/android_openssl/latest/x86/libssl_1_1.so /home/pankraz/android-sdk/android_openssl/latest/x86_64/libcrypto_1_1.so /home/pankraz/android-sdk/android_openssl/latest/x86_64/libssl_1_1.so
|
|
||||||
|
|
||||||
#ANDROID_ABIS = arm64-v8a
|
#ANDROID_ABIS = arm64-v8a
|
||||||
#android: include(/home/pankraz/git/android_openssl/openssl.pri)
|
|
||||||
android: include(/home/pankraz/android-sdk/android_openssl/openssl.pri)
|
android: include(/home/pankraz/android-sdk/android_openssl/openssl.pri)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// This file is part of Friendiqa
|
// This file is part of Friendiqa
|
||||||
// https://github.com/lubuwest/Friendiqa
|
// https://github.com/lubuwest/Friendiqa
|
||||||
// Copyright (C) 2020 Marco R. <thomasschmidt45@gmx.net>
|
// Copyright (C) 2023 Marco R. <thomasschmidt45@gmx.net>
|
||||||
//
|
//
|
||||||
// This program is free software: you can redistribute it and/or modify
|
// This program is free software: you can redistribute it and/or modify
|
||||||
// it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
|
|
@ -161,6 +161,7 @@ void UPDATENEWS::login()
|
||||||
QJsonObject currentAccount =acc[usernameindex].toObject();
|
QJsonObject currentAccount =acc[usernameindex].toObject();
|
||||||
xhr.setAccount(currentAccount.toVariantMap());
|
xhr.setAccount(currentAccount.toVariantMap());
|
||||||
username = currentAccount["username"].toString();
|
username = currentAccount["username"].toString();
|
||||||
|
m_url=currentAccount["server"].toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +207,7 @@ void UPDATENEWS::timeline()
|
||||||
{
|
{
|
||||||
m_api="/api/statuses/friends_timeline";
|
m_api="/api/statuses/friends_timeline";
|
||||||
xhr.clearParams();
|
xhr.clearParams();
|
||||||
//xhr.setUrl(m_url);
|
xhr.setUrl(m_url);
|
||||||
xhr.setApi(m_api);
|
xhr.setApi(m_api);
|
||||||
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=0 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
|
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=0 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
|
||||||
if (query.isActive() && query.isSelect()){
|
if (query.isActive() && query.isSelect()){
|
||||||
|
@ -226,6 +227,7 @@ void UPDATENEWS::replies()
|
||||||
{
|
{
|
||||||
m_api="/api/statuses/replies";
|
m_api="/api/statuses/replies";
|
||||||
xhr.clearParams();
|
xhr.clearParams();
|
||||||
|
xhr.setUrl(m_url);
|
||||||
xhr.setApi(m_api);
|
xhr.setApi(m_api);
|
||||||
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=3 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
|
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=3 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
|
||||||
if (query.isActive() && query.isSelect()){
|
if (query.isActive() && query.isSelect()){
|
||||||
|
@ -245,6 +247,7 @@ void UPDATENEWS::directmessages()
|
||||||
{
|
{
|
||||||
m_api="/api/direct_messages/all";
|
m_api="/api/direct_messages/all";
|
||||||
xhr.clearParams();
|
xhr.clearParams();
|
||||||
|
xhr.setUrl(m_url);
|
||||||
xhr.setApi(m_api);
|
xhr.setApi(m_api);
|
||||||
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=1 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
|
QSqlQuery query("SELECT status_id FROM news WHERE messagetype=1 AND username='"+ username +"' ORDER BY status_id DESC LIMIT 1",m_db);
|
||||||
if (query.isActive() && query.isSelect()){
|
if (query.isActive() && query.isSelect()){
|
||||||
|
@ -263,6 +266,7 @@ void UPDATENEWS::notifications()
|
||||||
{
|
{
|
||||||
m_api="/api/friendica/notification";
|
m_api="/api/friendica/notification";
|
||||||
xhr.clearParams();
|
xhr.clearParams();
|
||||||
|
xhr.setUrl(m_url);
|
||||||
xhr.setApi(m_api);
|
xhr.setApi(m_api);
|
||||||
xhr.get();
|
xhr.get();
|
||||||
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
|
QObject::connect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
|
||||||
|
@ -273,6 +277,7 @@ void UPDATENEWS::notifications()
|
||||||
void UPDATENEWS::events()
|
void UPDATENEWS::events()
|
||||||
{ m_api="/api/friendica/events";
|
{ m_api="/api/friendica/events";
|
||||||
xhr.clearParams();
|
xhr.clearParams();
|
||||||
|
xhr.setUrl(m_url);
|
||||||
xhr.setApi(m_api);
|
xhr.setApi(m_api);
|
||||||
QSqlQuery query("SELECT id FROM events WHERE username='"+ username +"' ORDER BY id DESC LIMIT 1",m_db);
|
QSqlQuery query("SELECT id FROM events WHERE username='"+ username +"' ORDER BY id DESC LIMIT 1",m_db);
|
||||||
if (query.isActive() && query.isSelect()){
|
if (query.isActive() && query.isSelect()){
|
||||||
|
@ -291,6 +296,7 @@ void UPDATENEWS::events()
|
||||||
void UPDATENEWS::friendrequests()
|
void UPDATENEWS::friendrequests()
|
||||||
{ m_api="/api/v1/follow_requests";
|
{ m_api="/api/v1/follow_requests";
|
||||||
xhr.clearParams();
|
xhr.clearParams();
|
||||||
|
xhr.setUrl(m_url);
|
||||||
xhr.setApi(m_api);
|
xhr.setApi(m_api);
|
||||||
xhr.get();
|
xhr.get();
|
||||||
QObject::disconnect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
|
QObject::disconnect(&xhr,SIGNAL(success(QByteArray,QString)),this,SLOT(store(QByteArray,QString)));
|
||||||
|
@ -300,7 +306,6 @@ void UPDATENEWS::friendrequests()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
||||||
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
|
{ if (apiname!=m_api || xhr.downloadtype()!=""){} else {
|
||||||
QJsonDocument news;
|
QJsonDocument news;
|
||||||
|
@ -430,6 +435,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QList<QJsonValue> newcontacts=findNewContacts(news);
|
QList<QJsonValue> newcontacts=findNewContacts(news);
|
||||||
|
emit this->success(m_api);
|
||||||
if (newcontacts.size()>0){
|
if (newcontacts.size()>0){
|
||||||
updateContacts(newcontacts);
|
updateContacts(newcontacts);
|
||||||
startImagedownload("contactlist");
|
startImagedownload("contactlist");
|
||||||
|
@ -442,7 +448,7 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qDebug()<< m_api << "Friendiqa updatenews error " << serverreply <<username ;
|
qDebug()<< m_api <<username << "Friendiqa updatenews error " << serverreply ;
|
||||||
//emit this->error(m_api,QTextCodec::codecForName("utf-8")->toUnicode(serverreply));
|
//emit this->error(m_api,QTextCodec::codecForName("utf-8")->toUnicode(serverreply));
|
||||||
emit this->error(m_api,QString(serverreply));
|
emit this->error(m_api,QString(serverreply));
|
||||||
if(m_syncAll){
|
if(m_syncAll){
|
||||||
|
@ -454,8 +460,6 @@ void UPDATENEWS::store(QByteArray serverreply,QString apiname)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QString filename, int index){
|
void UPDATENEWS::updateImageLocation(QString downloadtype,QString imageurl, QString filename, int index){
|
||||||
if (downloadtype=="contactlist"){
|
if (downloadtype=="contactlist"){
|
||||||
QSqlQuery testquery("SELECT profile_image FROM contacts WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
QSqlQuery testquery("SELECT profile_image FROM contacts WHERE profile_image_url ='"+imageurl+ "' AND username = '" +username+"'",m_db);
|
||||||
|
@ -812,7 +816,7 @@ void UPDATENEWS::storeEvents(QByteArray serverreply,QString apiname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(notifylist.contains("notify_Events")){
|
if(notifylist.contains("notify_Events")){
|
||||||
QSqlQuery eventnotifyquery("SELECT start,title FROM events WHERE (start BETWEEN " + QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch()) + " AND "+QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch()+(m_updateInterval*60*1000))+") AND username='"+ username +"'",m_db);
|
QSqlQuery eventnotifyquery("SELECT start,title FROM events WHERE (start BETWEEN " + QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch()) + " AND "+QString::number(QDateTime::currentDateTime().toMSecsSinceEpoch()+(m_updateInterval*119*1000))+") AND username='"+ username +"'",m_db);
|
||||||
while (eventnotifyquery.next()) {
|
while (eventnotifyquery.next()) {
|
||||||
alarm.notify("Event: "+ QDateTime::fromMSecsSinceEpoch(eventnotifyquery.value(0).toLongLong()).toString("dd.MM.yyyy hh:mm"),eventnotifyquery.value(1).toString(),1);
|
alarm.notify("Event: "+ QDateTime::fromMSecsSinceEpoch(eventnotifyquery.value(0).toLongLong()).toString("dd.MM.yyyy hh:mm"),eventnotifyquery.value(1).toString(),1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ public slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_api;
|
QString m_api;
|
||||||
|
QString m_url;
|
||||||
QString username;
|
QString username;
|
||||||
bool m_syncAll;
|
bool m_syncAll;
|
||||||
int syncindex;
|
int syncindex;
|
||||||
|
|
|
@ -363,7 +363,10 @@ void XHR::onRequestFinished()
|
||||||
{
|
{
|
||||||
// Save the file here
|
// Save the file here
|
||||||
//qDebug() << "buffer " << buffer;
|
//qDebug() << "buffer " << buffer;
|
||||||
if (buffer.isNull()){qDebug() << "File empty"<<m_url; buffer.clear(); emit this->error(m_downloadtype,m_url,m_api,1);}
|
if (buffer.isNull()){qDebug() << "File empty"<<m_url;
|
||||||
|
buffer.clear();
|
||||||
|
emit this->error(m_downloadtype,m_url,m_api,1);
|
||||||
|
}
|
||||||
else if (m_downloadtype=="picturelist") {
|
else if (m_downloadtype=="picturelist") {
|
||||||
QJsonDocument jsonResponse = QJsonDocument::fromJson(buffer);
|
QJsonDocument jsonResponse = QJsonDocument::fromJson(buffer);
|
||||||
QJsonObject jsonObject = jsonResponse.object();
|
QJsonObject jsonObject = jsonResponse.object();
|
||||||
|
@ -391,7 +394,6 @@ void XHR::onRequestFinished()
|
||||||
jsonObject["data"]="";
|
jsonObject["data"]="";
|
||||||
jsonObject["filename"]=helpfile+filesuffix;
|
jsonObject["filename"]=helpfile+filesuffix;
|
||||||
emit this->downloadedjson(m_downloadtype,m_url,m_filename,dlindex,jsonObject);
|
emit this->downloadedjson(m_downloadtype,m_url,m_filename,dlindex,jsonObject);
|
||||||
if(downloadtype()=="picturelist"){dlindex=dlindex+1;XHR::getlist();}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
QFile file(m_filename);
|
QFile file(m_filename);
|
||||||
|
@ -400,10 +402,11 @@ void XHR::onRequestFinished()
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
file.close();
|
file.close();
|
||||||
emit this->downloaded(m_downloadtype,m_url,m_filename,dlindex);
|
emit this->downloaded(m_downloadtype,m_url,m_filename,dlindex);
|
||||||
if(downloadtype()=="contactlist" || downloadtype()=="friendrequests"){dlindex=dlindex+1;XHR::getlist();}
|
|
||||||
|
|
||||||
//reply->deleteLater();
|
//reply->deleteLater();
|
||||||
}
|
}
|
||||||
|
if(downloadtype()=="contactlist" || downloadtype()=="friendrequests" || downloadtype()=="picturelist"){
|
||||||
|
dlindex=dlindex+1;XHR::getlist();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void XHR::onReadyRead()
|
void XHR::onReadyRead()
|
||||||
|
|
|
@ -43,11 +43,9 @@ Dialog {
|
||||||
standardButtons: Dialog.Yes | Dialog.No
|
standardButtons: Dialog.Yes | Dialog.No
|
||||||
modal: true
|
modal: true
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
// username.visible=true;
|
username.visible=true;
|
||||||
// password.visible=true;
|
|
||||||
ruleButton.visible=false;
|
ruleButton.visible=false;
|
||||||
// confirmation.visible=true
|
confirmationOAuth.visible=true
|
||||||
accountPage.state="oauth"
|
|
||||||
}
|
}
|
||||||
onRejected: {close()}
|
onRejected: {close()}
|
||||||
ScrollView{
|
ScrollView{
|
||||||
|
|
|
@ -67,10 +67,13 @@ Page{
|
||||||
else{
|
else{
|
||||||
if (users.length==0){Service.setDefaultOptions(db);}
|
if (users.length==0){Service.setDefaultOptions(db);}
|
||||||
if (userconfig.APIVersion!=""){userconfig.password=""}
|
if (userconfig.APIVersion!=""){userconfig.password=""}
|
||||||
if (imagestoredir==""){imagestoredir=filesystem.homePath+"/"+credentials.username+"/";
|
if (imagestoredir==""){
|
||||||
userconfig.imagestore=imagestoredir}
|
imagestoredir=filesystem.homePath+"/"+credentials.username+"/";
|
||||||
if(userconfig.imagestore == filesystem.homePath+"/"+username.text+"/")
|
userconfig.imagestore=imagestoredir
|
||||||
{filesystem.makePath(filesystem.homePath+"/"+username.text);}
|
}
|
||||||
|
if(userconfig.imagestore == filesystem.homePath+"/"+credentials.username+"/")
|
||||||
|
{filesystem.makePath(filesystem.homePath+"/"+credentials.username);}
|
||||||
|
print("imagestoredir "+imagestoredir)
|
||||||
filesystem.Directory=imagestoredir;
|
filesystem.Directory=imagestoredir;
|
||||||
filesystem.makeDir("contacts");
|
filesystem.makeDir("contacts");
|
||||||
filesystem.makeDir("albums");
|
filesystem.makeDir("albums");
|
||||||
|
@ -373,7 +376,7 @@ Page{
|
||||||
rulestext=rulestext+rulesarray[rule].text+"\n"
|
rulestext=rulestext+rulesarray[rule].text+"\n"
|
||||||
}
|
}
|
||||||
var component = Qt.createComponent("qrc:/qml/configqml/AcceptRules.qml");
|
var component = Qt.createComponent("qrc:/qml/configqml/AcceptRules.qml");
|
||||||
var rulesdialog = component.createObject(root,{"rules": rulestext});
|
var rulesdialog = component.createObject(accountPage,{"rules": rulestext});
|
||||||
rulesdialog.open();
|
rulesdialog.open();
|
||||||
}
|
}
|
||||||
else if(api=="/api/statusnet/config"){
|
else if(api=="/api/statusnet/config"){
|
||||||
|
@ -385,7 +388,7 @@ Page{
|
||||||
catch(e){print(e)}
|
catch(e){print(e)}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (api=="/api/v1/apps"){
|
else if (api=="/api/v1/apps"){print("/api/v1/apps text "+text)
|
||||||
let app=JSON.parse(text);
|
let app=JSON.parse(text);
|
||||||
accountPage.appdata=app;
|
accountPage.appdata=app;
|
||||||
oauth2.setClientId(app.client_id);
|
oauth2.setClientId(app.client_id);
|
||||||
|
@ -565,6 +568,10 @@ Page{
|
||||||
})
|
})
|
||||||
accountPage.users=storedUsers;
|
accountPage.users=storedUsers;
|
||||||
Service.readConfig(db,function(obj){
|
Service.readConfig(db,function(obj){
|
||||||
|
if (obj==null){
|
||||||
|
accountPage.state="new_oauth"
|
||||||
|
}
|
||||||
|
else{
|
||||||
userButton.text=obj.username;
|
userButton.text=obj.username;
|
||||||
servername.text=obj.server;
|
servername.text=obj.server;
|
||||||
serverModel.insert(0,{text:obj.server})
|
serverModel.insert(0,{text:obj.server})
|
||||||
|
@ -577,6 +584,8 @@ Page{
|
||||||
if(obj.password!=""){accountPage.state="password"}
|
if(obj.password!=""){accountPage.state="password"}
|
||||||
else if (obj.token!=""){accountPage.state="oauth"}
|
else if (obj.token!=""){accountPage.state="oauth"}
|
||||||
else {accountPage.state="new_oauth"}
|
else {accountPage.state="new_oauth"}
|
||||||
|
}
|
||||||
|
|
||||||
},"isActive",0)
|
},"isActive",0)
|
||||||
})}
|
})}
|
||||||
catch (e){//print("onCompleted" +users.count +e)
|
catch (e){//print("onCompleted" +users.count +e)
|
||||||
|
|
|
@ -80,7 +80,7 @@ ApplicationWindow{
|
||||||
color: Material.backgroundColor
|
color: Material.backgroundColor
|
||||||
|
|
||||||
function onLoginChanged(login){
|
function onLoginChanged(login){
|
||||||
if(login==""){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
|
if(login=="" || login==null){rootstackView.push("qrc:/qml/configqml/AccountPage.qml")}
|
||||||
else{
|
else{
|
||||||
// if (login.newsViewType!="" || login.newsViewType!=null){
|
// if (login.newsViewType!="" || login.newsViewType!=null){
|
||||||
// newstab.newstabstatus=login.newsViewType;}
|
// newstab.newstabstatus=login.newsViewType;}
|
||||||
|
|
|
@ -39,7 +39,6 @@ Item {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
|
|
||||||
y:0.5*root.fontFactor*osSettings.bigFontSize
|
y:0.5*root.fontFactor*osSettings.bigFontSize
|
||||||
width:parent.width
|
width:parent.width
|
||||||
height: 1.5*osSettings.bigFontSize*root.fontFactor
|
height: 1.5*osSettings.bigFontSize*root.fontFactor
|
||||||
|
@ -47,11 +46,6 @@ Item {
|
||||||
font.pointSize: osSettings.bigFontSize
|
font.pointSize: osSettings.bigFontSize
|
||||||
text: account.username
|
text: account.username
|
||||||
}
|
}
|
||||||
// Label{
|
|
||||||
// text:login.hasOwnProperty("server")?"@"+login.server:""
|
|
||||||
// font.pixelSize: 5*mm
|
|
||||||
// width: parent.width
|
|
||||||
// }
|
|
||||||
|
|
||||||
Label{
|
Label{
|
||||||
y:2*root.fontFactor*osSettings.bigFontSize
|
y:2*root.fontFactor*osSettings.bigFontSize
|
||||||
|
@ -64,6 +58,7 @@ Item {
|
||||||
login=account;
|
login=account;
|
||||||
if(!wideScreen){leftDrawerAndroid.close()}
|
if(!wideScreen){leftDrawerAndroid.close()}
|
||||||
// newstypeSignal("refresh")
|
// newstypeSignal("refresh")
|
||||||
|
newsBusy.running=true;
|
||||||
updatenews.setDatabase();
|
updatenews.setDatabase();
|
||||||
updatenews.login();
|
updatenews.login();
|
||||||
updatenews.startsync();
|
updatenews.startsync();
|
||||||
|
|
|
@ -124,7 +124,7 @@ Rectangle{
|
||||||
messageSend.reply_to_user=newsitemobject.user.screen_name;
|
messageSend.reply_to_user=newsitemobject.user.screen_name;
|
||||||
messageSend.parentId=newsitemobject.id
|
messageSend.parentId=newsitemobject.id
|
||||||
} else {
|
} else {
|
||||||
messageSend.state="";
|
messageSend.state=null;
|
||||||
messageSend.reply_to_user="";
|
messageSend.reply_to_user="";
|
||||||
messageSend.parentId="";
|
messageSend.parentId="";
|
||||||
bodyField.text="";
|
bodyField.text="";
|
||||||
|
|
|
@ -38,7 +38,6 @@ import "qrc:/js/service.js" as Service
|
||||||
|
|
||||||
Rectangle{
|
Rectangle{
|
||||||
id: newsStack
|
id: newsStack
|
||||||
//anchors.fill: parent
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
color: Material.backgroundColor
|
color: Material.backgroundColor
|
||||||
|
@ -47,17 +46,6 @@ Rectangle{
|
||||||
property int lastnewsid:0
|
property int lastnewsid:0
|
||||||
property string newstabstatus: ""
|
property string newstabstatus: ""
|
||||||
|
|
||||||
BusyIndicator{
|
|
||||||
id: newsBusy
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.top:parent.top
|
|
||||||
anchors.topMargin: mm
|
|
||||||
width: 2*root.fontFactor*osSettings.bigFontSize
|
|
||||||
height: 2*root.fontFactor*osSettings.bigFontSize
|
|
||||||
z:2
|
|
||||||
running: false
|
|
||||||
}
|
|
||||||
|
|
||||||
function newstypeHandling(newstype){
|
function newstypeHandling(newstype){
|
||||||
try{newsBusy.running=true}catch(e){print(e)};
|
try{newsBusy.running=true}catch(e){print(e)};
|
||||||
root.replySignal("");
|
root.replySignal("");
|
||||||
|
@ -215,14 +203,37 @@ Rectangle{
|
||||||
xhr.get()
|
xhr.get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function loadDBNews(){
|
||||||
|
var messagetype=0;
|
||||||
|
switch(newsSwipeview.stacktype){
|
||||||
|
case "Home":messagetype=0;break;
|
||||||
|
case "DirectMessages": messagetype=1;break;
|
||||||
|
case "Notifications":messagetype=2;break;
|
||||||
|
case "Replies":messagetype=3;break;
|
||||||
|
default:messagetype=0;
|
||||||
|
}
|
||||||
|
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
||||||
|
Newsjs.chatsfromdb(db,login,messagetype,[],function(dbnews,lastid){
|
||||||
|
lastnewsid=lastid;
|
||||||
|
showNews(dbnews);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
||||||
|
lastnewsid=lastid;
|
||||||
|
showNews(dbnews)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Connections{
|
Connections{
|
||||||
target:xhr
|
target:xhr
|
||||||
function onError(data,url,api,code){
|
function onError(data,url,api,code){
|
||||||
//if (data !="contactlist"){Helperjs.showMessage(qsTr("Network Error"),"API:\n" +login.server+api+"\n Return: \n"+data,root);}
|
|
||||||
newsBusy.running=false;
|
newsBusy.running=false;
|
||||||
}
|
}
|
||||||
function onSuccess(data,api){
|
function onSuccess(data,api){
|
||||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
|
||||||
const newsApiArray=["/api/statuses/friends_timeline",
|
const newsApiArray=["/api/statuses/friends_timeline",
|
||||||
"/api/direct_messages/all",
|
"/api/direct_messages/all",
|
||||||
"/api/direct_messages/conversation",
|
"/api/direct_messages/conversation",
|
||||||
|
@ -244,6 +255,16 @@ Rectangle{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Connections{
|
||||||
|
target:updatenews
|
||||||
|
function onError(api,data){print("updatnews error "+api);
|
||||||
|
newsBusy.running=false;
|
||||||
|
}
|
||||||
|
function onSuccess(api){
|
||||||
|
loadDBNews();
|
||||||
|
newsBusy.running=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
|
@ -440,30 +461,8 @@ Rectangle{
|
||||||
root.searchSignal.connect(search);
|
root.searchSignal.connect(search);
|
||||||
try{newsModel.clear()} catch(e){}
|
try{newsModel.clear()} catch(e){}
|
||||||
swipeIndicator.visible=true;
|
swipeIndicator.visible=true;
|
||||||
//newsSwipeview.height=rootstack.height
|
|
||||||
//newsSwipeview.y=5*mm;
|
|
||||||
//rootStackItem.state=""
|
|
||||||
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
|
root.globaloptions.hasOwnProperty("newsViewType")?newstab.newstabstatus=root.globaloptions.newsViewType:newstab.newstabstatus="Conversations";
|
||||||
newstabstatus=newstab.newstabstatus;
|
newstabstatus=newstab.newstabstatus;
|
||||||
var messagetype=0;
|
loadDBNews()
|
||||||
switch(newsSwipeview.stacktype){
|
|
||||||
case "Home":messagetype=0;break;
|
|
||||||
case "DirectMessages": messagetype=1;break;
|
|
||||||
case "Notifications":messagetype=2;break;
|
|
||||||
case "Replies":messagetype=3;break;
|
|
||||||
default:messagetype=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((newstabstatus=="Conversations")&&(newsSwipeview.stacktype=="Home")){
|
|
||||||
Newsjs.chatsfromdb(db,login,messagetype,[],function(dbnews,lastid){
|
|
||||||
lastnewsid=lastid;
|
|
||||||
showNews(dbnews);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
Newsjs.newsfromdb(db,login,messagetype,function(dbnews,lastid){
|
|
||||||
lastnewsid=lastid;
|
|
||||||
showNews(dbnews)
|
|
||||||
})}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,6 +192,7 @@ Rectangle{
|
||||||
//onLoaded: newsSwipeview.stacktype="Notifications"
|
//onLoaded: newsSwipeview.stacktype="Notifications"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PageIndicator {
|
PageIndicator {
|
||||||
id: swipeIndicator
|
id: swipeIndicator
|
||||||
z:5
|
z:5
|
||||||
|
@ -203,5 +204,16 @@ Rectangle{
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BusyIndicator{
|
||||||
|
id: newsBusy
|
||||||
|
anchors.horizontalCenter: newsSwipeview.horizontalCenter
|
||||||
|
anchors.top:parent.top
|
||||||
|
anchors.topMargin: mm
|
||||||
|
width: 2*root.fontFactor*osSettings.bigFontSize
|
||||||
|
height: 2*root.fontFactor*osSettings.bigFontSize
|
||||||
|
z:2
|
||||||
|
running: false
|
||||||
|
}
|
||||||
|
|
||||||
Component.onCompleted: {root.directmessageSignal.connect(newsSwipeview.onDirectMessage)}
|
Component.onCompleted: {root.directmessageSignal.connect(newsSwipeview.onDirectMessage)}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue