updatenews error bugfix
This commit is contained in:
parent
d43c18bb76
commit
59fe1ea0df
16 changed files with 117 additions and 105 deletions
|
@ -124,7 +124,7 @@ Rectangle{
|
|||
messageSend.reply_to_user=newsitemobject.user.screen_name;
|
||||
messageSend.parentId=newsitemobject.id
|
||||
} else {
|
||||
messageSend.state="";
|
||||
messageSend.state=null;
|
||||
messageSend.reply_to_user="";
|
||||
messageSend.parentId="";
|
||||
bodyField.text="";
|
||||
|
|
|
@ -38,7 +38,6 @@ import "qrc:/js/service.js" as Service
|
|||
|
||||
Rectangle{
|
||||
id: newsStack
|
||||
//anchors.fill: parent
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
color: Material.backgroundColor
|
||||
|
@ -47,17 +46,6 @@ Rectangle{
|
|||
property int lastnewsid:0
|
||||
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){
|
||||
try{newsBusy.running=true}catch(e){print(e)};
|
||||
root.replySignal("");
|
||||
|
@ -215,14 +203,37 @@ Rectangle{
|
|||
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{
|
||||
target:xhr
|
||||
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;
|
||||
}
|
||||
function onSuccess(data,api){
|
||||
// downloadNotice.text=downloadNotice.text+ "\n xhr finished "+Date.now();
|
||||
const newsApiArray=["/api/statuses/friends_timeline",
|
||||
"/api/direct_messages/all",
|
||||
"/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
|
||||
onTriggered: {
|
||||
|
@ -440,30 +461,8 @@ Rectangle{
|
|||
root.searchSignal.connect(search);
|
||||
try{newsModel.clear()} catch(e){}
|
||||
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";
|
||||
newstabstatus=newstab.newstabstatus;
|
||||
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)
|
||||
})}
|
||||
loadDBNews()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,6 +192,7 @@ Rectangle{
|
|||
//onLoaded: newsSwipeview.stacktype="Notifications"
|
||||
}
|
||||
}
|
||||
|
||||
PageIndicator {
|
||||
id: swipeIndicator
|
||||
z:5
|
||||
|
@ -203,5 +204,16 @@ Rectangle{
|
|||
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)}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue