v0.6.1 no conversation update with news length 0
This commit is contained in:
parent
72d0f8ff69
commit
c5df85b820
|
@ -138,7 +138,7 @@ if(msg.deleteId!==undefined)
|
|||
msg.model.sync()
|
||||
}
|
||||
else{
|
||||
if(msg.method=="refresh" ||msg.method=="conversation"){msg.model.clear()};
|
||||
if(msg.method=="refresh" ||(msg.method=="conversation"&&msg.news.length>0)){msg.model.clear()};
|
||||
msg.model.sync()
|
||||
for (var j=0;j<msg.news.length;j++){
|
||||
if (msg.news[j]) {
|
||||
|
|
|
@ -61,7 +61,7 @@ Rectangle{
|
|||
newsBusy.running=true;
|
||||
replySignal("");
|
||||
//messagesend.state="";
|
||||
newsModel.clear();
|
||||
//newsModel.clear();
|
||||
switch(newstype){
|
||||
case "timeline":
|
||||
newstab.newstabstatus="Timeline";
|
||||
|
@ -71,6 +71,7 @@ Rectangle{
|
|||
})}catch(e){Helperjs.showMessage("Error",e,root)};
|
||||
break;
|
||||
case "conversation":
|
||||
newsStack.updateMethodNews="conversation";
|
||||
newstab.newstabstatus="Conversations";
|
||||
Newsjs.chatsfromdb(root.db,root.login,0,function(news,lastid){
|
||||
lastnewsid=lastid;
|
||||
|
@ -105,10 +106,12 @@ Rectangle{
|
|||
var searchItem = component.createObject(newsStack,{y:mm,x:leftoffset,width:root.width-leftoffset,height: 5*mm});
|
||||
break;
|
||||
case "refresh":
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//print("Refresh "+newsSwipeview.stacktype+newstab.newstabstatus)
|
||||
} else if (newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
|
||||
newsStack.updateMethodNews="conversation"}
|
||||
else {newsStack.updateMethodNews="refresh"}
|
||||
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
|
@ -120,9 +123,11 @@ Rectangle{
|
|||
}
|
||||
break;
|
||||
default:
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
} else if (newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
|
||||
newsStack.updateMethodNews="conversation"}
|
||||
else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
|
@ -151,7 +156,7 @@ Rectangle{
|
|||
|
||||
|
||||
|
||||
function search(term){//print("Search "+term)
|
||||
function search(term){
|
||||
if (term!=""){
|
||||
//newstab.newstabstatus="Search";
|
||||
newstabstatus="Search";
|
||||
|
@ -166,7 +171,7 @@ Rectangle{
|
|||
newsView.anchors.topMargin=mm
|
||||
}
|
||||
|
||||
function getOldNews(){print("newstab.newstabstatus" +newstab.newstabstatus)
|
||||
function getOldNews(){
|
||||
var currentTime= new Date();
|
||||
try{var lastnews_id=newsModel.get(newsModel.count-1).newsitemobject.created_at;} catch(e){var lastnews_id=99999999999999 }
|
||||
var messagetype=0;
|
||||
|
@ -177,21 +182,21 @@ Rectangle{
|
|||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
//if(newstab.newstabstatus=="Timeline"){//print("lastnewsid "+lastnews_id);
|
||||
|
||||
if(newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline" ){
|
||||
Newsjs.newsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},false,lastnews_id)}
|
||||
//else if(newstab.newstabstatus=="Conversations"){
|
||||
|
||||
else if(newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
|
||||
Newsjs.chatsfromdb(root.db,root.login, messagetype,function(news){
|
||||
var msg = {'currentTime': currentTime, 'model': newsModel,'news':news,'method':"", 'options':globaloptions};
|
||||
newsWorker.sendMessage(msg);
|
||||
},lastnews_id)}
|
||||
//else if (newstab.newstabstatus=="Notifications"){}
|
||||
|
||||
else if (newstab.newstabstatus=="Notifications" || newstabstatus=="Notifications"){}
|
||||
else{print("no conversations or timeline "+newstabstatus);
|
||||
else{
|
||||
switch(newsSwipeview.stacktype){
|
||||
case "Home":messagetype=0;break;
|
||||
case "DirectMessages": messagetype=1;break;
|
||||
|
@ -199,7 +204,7 @@ Rectangle{
|
|||
case "Replies":messagetype=3;break;
|
||||
default:messagetype=0;
|
||||
}
|
||||
//newsStack.appendNews=true;
|
||||
|
||||
try{xhr.setParam("max_id",newsModel.get(newsModel.count-1).newsitemobject.id-1);}catch(e){}
|
||||
xhr.get()
|
||||
}
|
||||
|
@ -218,14 +223,16 @@ Rectangle{
|
|||
}
|
||||
|
||||
Timer {id:replytimer; interval: 1000; running: false; repeat: false
|
||||
onTriggered: {"replytimer triggered";
|
||||
onTriggered: {
|
||||
newsBusy.running=true;
|
||||
if(newstab.newstabstatus=="Conversation"){
|
||||
showConversation(newsStack.timelineIndex-1,newsModel.get(0).newsitemobject)}
|
||||
else{
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
} else if (newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
|
||||
newsStack.updateMethodNews="conversation"}
|
||||
else {newsStack.updateMethodNews="refresh"}
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Service.updateView(newstab.newstabstatus)
|
||||
}
|
||||
|
@ -269,7 +276,7 @@ Rectangle{
|
|||
Service.updateView("Replies")
|
||||
}
|
||||
}
|
||||
else {print("Footer newstab.newstabstatus "+newstab.newstabstatus);getOldNews();}
|
||||
else {getOldNews();}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -321,10 +328,12 @@ Rectangle{
|
|||
var onlynew=true;
|
||||
newsBusy.running=true;
|
||||
viewdragged=false
|
||||
if (newstab.newstabstatus=="Timeline"){
|
||||
if (newstab.newstabstatus=="Timeline" || newstabstatus=="Timeline"){
|
||||
newsStack.updateMethodNews="append"
|
||||
} else {newsStack.updateMethodNews="refresh"}
|
||||
//root.contactLoadType="news";
|
||||
} else if (newstab.newstabstatus=="Conversations" || newstabstatus=="Conversations"){
|
||||
newsStack.updateMethodNews="conversation"}
|
||||
else {newsStack.updateMethodNews="refresh"}
|
||||
|
||||
if (newsSwipeview.stacktype=="Home"){
|
||||
Newsjs.getLastNews(root.login,root.db,function(currentlastnews){
|
||||
if (currentlastnews>lastnewsid){
|
||||
|
@ -357,7 +366,7 @@ Rectangle{
|
|||
}
|
||||
}
|
||||
onViewdraggedpositiveChanged: {
|
||||
if (viewdraggedpositive){print("listview dragged newstab.newstabstatus "+newstab.newstabstatus)
|
||||
if (viewdraggedpositive){
|
||||
getOldNews();
|
||||
viewdraggedpositive=false
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue