Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apk
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apk
Commits
9667a246
Commit
9667a246
authored
Jul 12, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to fix wrong unread count in notification
parent
780ca63d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
35 deletions
+27
-35
build.gradle
TMessagesProj/build.gradle
+1
-1
MessagesController.java
...rc/main/java/org/telegram/android/MessagesController.java
+25
-30
MessagesStorage.java
...j/src/main/java/org/telegram/android/MessagesStorage.java
+1
-4
No files found.
TMessagesProj/build.gradle
View file @
9667a246
...
...
@@ -83,7 +83,7 @@ android {
defaultConfig
{
minSdkVersion
8
targetSdkVersion
19
versionCode
27
5
versionCode
27
6
versionName
"1.6.0"
}
}
TMessagesProj/src/main/java/org/telegram/android/MessagesController.java
View file @
9667a246
...
...
@@ -1535,8 +1535,27 @@ public class MessagesController implements NotificationCenter.NotificationCenter
req
.
max_id
=
max_positive_id
;
req
.
offset
=
offset
;
if
(
offset
==
0
)
{
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
dialogsToUpdate
.
put
(
dialog_id
,
0
);
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
dialog_id
,
0
,
max_id
);
MessagesStorage
.
getInstance
().
processPendingRead
(
dialog_id
,
max_positive_id
,
max_date
,
false
);
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
TLRPC
.
TL_dialog
dialog
=
dialogs_dict
.
get
(
dialog_id
);
if
(
dialog
!=
null
)
{
dialog
.
unread_count
=
0
;
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
}
}
});
}
});
}
if
(
req
.
max_id
!=
Integer
.
MAX_VALUE
)
{
ConnectionsManager
.
getInstance
().
performRpc
(
req
,
new
RPCRequest
.
RPCRequestDelegate
()
{
...
...
@@ -1572,26 +1591,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
});
}
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
offset
==
0
)
{
TLRPC
.
TL_dialog
dialog
=
dialogs_dict
.
get
(
dialog_id
);
if
(
dialog
!=
null
)
{
dialog
.
unread_count
=
0
;
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
}
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
dialogsToUpdate
.
put
(
dialog_id
,
0
);
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
}
}
});
}
});
if
(
offset
==
0
)
{
TLRPC
.
TL_messages_receivedMessages
req2
=
new
TLRPC
.
TL_messages_receivedMessages
();
req2
.
max_id
=
max_positive_id
;
...
...
@@ -1625,6 +1624,10 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
MessagesStorage
.
getInstance
().
processPendingRead
(
dialog_id
,
max_id
,
max_date
,
false
);
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
dialogsToUpdate
.
put
(
dialog_id
,
0
);
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
@@ -1636,9 +1639,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
dialog
.
unread_count
=
0
;
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
}
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
dialogsToUpdate
.
put
(
dialog_id
,
0
);
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
}
});
}
...
...
@@ -2616,7 +2616,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
public
void
run
()
{
newMsgObj
.
messageOwner
.
send_state
=
MESSAGE_SEND_STATE_SENT
;
NotificationCenter
.
getInstance
().
postNotificationName
(
messageReceivedByServer
,
oldId
,
newMsgObj
.
messageOwner
.
id
,
newMsgObj
);
sendingMessages
.
remove
(
oldId
);
sendingMessages
.
remove
(
oldId
);
//TODO CHECK THIS!!!
}
});
}
...
...
@@ -3430,9 +3430,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
if
(!
pushMessages
.
isEmpty
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
pushMessages
,
!(
res
instanceof
TLRPC
.
TL_updates_differenceSlice
));
if
(
res
.
other_updates
==
null
||
res
.
other_updates
.
isEmpty
())
{
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
0
,
0
,
0
);
}
}
}
});
...
...
@@ -3535,7 +3532,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
if
(!
obj
.
isFromMe
()
&&
obj
.
isUnread
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
objArr
,
true
);
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
0
,
0
,
0
);
}
updateInterfaceWithMessages
(-
updates
.
chat_id
,
objArr
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
...
...
@@ -3591,7 +3587,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
if
(!
obj
.
isFromMe
()
&&
obj
.
isUnread
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
objArr
,
true
);
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
0
,
0
,
0
);
}
updateInterfaceWithMessages
(
updates
.
from_id
,
objArr
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
...
...
@@ -4181,7 +4176,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
if
(!
markAsReadMessages
.
isEmpty
()
||
!
messages
.
isEmpty
()
)
{
if
(!
markAsReadMessages
.
isEmpty
())
{
NotificationsController
.
getInstance
().
processReadMessages
(
markAsReadMessages
,
0
,
0
,
0
);
}
if
(!
deletedMessages
.
isEmpty
())
{
...
...
TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java
View file @
9667a246
...
...
@@ -789,7 +789,7 @@ public class MessagesStorage {
//database.executeFast("DELETE FROM pending_read WHERE uid = " + dialog_id).stepThis().dispose();
}
else
{
database
.
beginTransaction
();
SQLitePreparedStatement
state
;
/*
)
= database.executeFast("REPLACE INTO pending_read VALUES(?, ?)");
SQLitePreparedStatement
state
;
/* = database.executeFast("REPLACE INTO pending_read VALUES(?, ?)");
state.requery();
state.bindLong(1, dialog_id);
state.bindInteger(2, max_id);
...
...
@@ -1801,9 +1801,6 @@ public class MessagesStorage {
}
private
void
putMessagesInternal
(
final
ArrayList
<
TLRPC
.
Message
>
messages
,
final
boolean
withTransaction
)
{
if
(
Thread
.
currentThread
().
getId
()
!=
storageQueue
.
getId
())
{
throw
new
RuntimeException
(
"wrong db thread"
);
}
try
{
if
(
withTransaction
)
{
database
.
beginTransaction
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment