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
e27094b9
Commit
e27094b9
authored
Jul 30, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
755446e9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
149 additions
and
63 deletions
+149
-63
build.gradle
TMessagesProj/build.gradle
+1
-1
MessagesController.java
...rc/main/java/org/telegram/android/MessagesController.java
+114
-46
NotificationsController.java
...in/java/org/telegram/android/NotificationsController.java
+11
-8
ChatActivity.java
...sagesProj/src/main/java/org/telegram/ui/ChatActivity.java
+23
-8
No files found.
TMessagesProj/build.gradle
View file @
e27094b9
...
@@ -83,7 +83,7 @@ android {
...
@@ -83,7 +83,7 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
8
minSdkVersion
8
targetSdkVersion
19
targetSdkVersion
19
versionCode
29
3
versionCode
29
6
versionName
"1.7.0"
versionName
"1.7.0"
}
}
}
}
TMessagesProj/src/main/java/org/telegram/android/MessagesController.java
View file @
e27094b9
...
@@ -777,10 +777,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -777,10 +777,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
dialog
.
unread_count
=
0
;
dialog
.
unread_count
=
0
;
}
}
dialogMessage
.
remove
(
dialog
.
top_message
);
dialogMessage
.
remove
(
dialog
.
top_message
);
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
did
,
0
,
Integer
.
MAX_VALUE
);
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
@Override
dialogsToUpdate
.
put
(
did
,
0
);
public
void
run
()
{
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
did
,
0
,
Integer
.
MAX_VALUE
);
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
dialogsToUpdate
.
put
(
did
,
0
);
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
}
});
}
});
MessagesStorage
.
getInstance
().
deleteDialog
(
did
,
onlyHistory
);
MessagesStorage
.
getInstance
().
deleteDialog
(
did
,
onlyHistory
);
NotificationCenter
.
getInstance
().
postNotificationName
(
removeAllMessagesFromDialog
,
did
);
NotificationCenter
.
getInstance
().
postNotificationName
(
removeAllMessagesFromDialog
,
did
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
...
@@ -1344,7 +1354,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1344,7 +1354,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
});
});
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
if
((
int
)
d
.
id
!=
0
)
{
int
high_id
=
(
int
)(
d
.
id
>>
32
);
if
((
int
)
d
.
id
!=
0
&&
high_id
!=
1
)
{
dialogsServerOnly
.
add
(
d
);
dialogsServerOnly
.
add
(
d
);
}
}
}
}
...
@@ -1508,7 +1519,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1508,7 +1519,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
});
});
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
if
((
int
)
d
.
id
!=
0
)
{
int
high_id
=
(
int
)(
d
.
id
>>
32
);
if
((
int
)
d
.
id
!=
0
&&
high_id
!=
1
)
{
dialogsServerOnly
.
add
(
d
);
dialogsServerOnly
.
add
(
d
);
}
}
}
}
...
@@ -1583,7 +1595,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1583,7 +1595,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
req
.
max_id
=
max_positive_id
;
req
.
max_id
=
max_positive_id
;
req
.
offset
=
offset
;
req
.
offset
=
offset
;
if
(
offset
==
0
)
{
if
(
offset
==
0
)
{
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
dialog_id
,
0
,
max_positive_id
);
MessagesStorage
.
getInstance
().
processPendingRead
(
dialog_id
,
max_positive_id
,
max_date
,
false
);
MessagesStorage
.
getInstance
().
processPendingRead
(
dialog_id
,
max_positive_id
,
max_date
,
false
);
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
@Override
...
@@ -1596,6 +1607,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1596,6 +1607,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
dialog
.
unread_count
=
0
;
dialog
.
unread_count
=
0
;
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
}
}
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
dialog_id
,
0
,
max_positive_id
);
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
dialogsToUpdate
.
put
(
dialog_id
,
0
);
dialogsToUpdate
.
put
(
dialog_id
,
0
);
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
...
@@ -1652,7 +1664,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1652,7 +1664,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if
(
max_date
==
0
)
{
if
(
max_date
==
0
)
{
return
;
return
;
}
}
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
dialog_id
,
max_date
,
0
);
TLRPC
.
EncryptedChat
chat
=
encryptedChats
.
get
(
high_id
);
TLRPC
.
EncryptedChat
chat
=
encryptedChats
.
get
(
high_id
);
if
(
chat
.
auth_key
!=
null
&&
chat
.
auth_key
.
length
>
1
&&
chat
instanceof
TLRPC
.
TL_encryptedChat
)
{
if
(
chat
.
auth_key
!=
null
&&
chat
.
auth_key
.
length
>
1
&&
chat
instanceof
TLRPC
.
TL_encryptedChat
)
{
TLRPC
.
TL_messages_readEncryptedHistory
req
=
new
TLRPC
.
TL_messages_readEncryptedHistory
();
TLRPC
.
TL_messages_readEncryptedHistory
req
=
new
TLRPC
.
TL_messages_readEncryptedHistory
();
...
@@ -1676,6 +1687,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -1676,6 +1687,7 @@ public class MessagesController implements NotificationCenter.NotificationCenter
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
dialog_id
,
max_date
,
0
);
TLRPC
.
TL_dialog
dialog
=
dialogs_dict
.
get
(
dialog_id
);
TLRPC
.
TL_dialog
dialog
=
dialogs_dict
.
get
(
dialog_id
);
if
(
dialog
!=
null
)
{
if
(
dialog
!=
null
)
{
dialog
.
unread_count
=
0
;
dialog
.
unread_count
=
0
;
...
@@ -3693,14 +3705,19 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -3693,14 +3705,19 @@ public class MessagesController implements NotificationCenter.NotificationCenter
updateInterfaceWithMessages
(
key
,
value
);
updateInterfaceWithMessages
(
key
,
value
);
}
}
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
if
(!
pushMessages
.
isEmpty
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
pushMessages
,
!(
res
instanceof
TLRPC
.
TL_updates_differenceSlice
));
}
}
}
});
});
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(!
pushMessages
.
isEmpty
())
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
NotificationsController
.
getInstance
().
processNewMessages
(
pushMessages
,
!(
res
instanceof
TLRPC
.
TL_updates_differenceSlice
));
}
});
}
MessagesStorage
.
getInstance
().
startTransaction
(
false
);
MessagesStorage
.
getInstance
().
startTransaction
(
false
);
MessagesStorage
.
getInstance
().
putMessages
(
res
.
new_messages
,
false
,
false
,
false
);
MessagesStorage
.
getInstance
().
putMessages
(
res
.
new_messages
,
false
,
false
,
false
);
MessagesStorage
.
getInstance
().
putUsersAndChats
(
res
.
users
,
res
.
chats
,
false
,
false
);
MessagesStorage
.
getInstance
().
putUsersAndChats
(
res
.
users
,
res
.
chats
,
false
,
false
);
...
@@ -3795,13 +3812,24 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -3795,13 +3812,24 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if
(
printUpdate
)
{
if
(
printUpdate
)
{
NotificationCenter
.
getInstance
().
postNotificationName
(
updateInterfaces
,
UPDATE_MASK_USER_PRINT
);
NotificationCenter
.
getInstance
().
postNotificationName
(
updateInterfaces
,
UPDATE_MASK_USER_PRINT
);
}
}
if
(!
obj
.
isFromMe
()
&&
obj
.
isUnread
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
objArr
,
true
);
}
updateInterfaceWithMessages
(-
updates
.
chat_id
,
objArr
);
updateInterfaceWithMessages
(-
updates
.
chat_id
,
objArr
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
}
}
});
});
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(!
obj
.
isFromMe
()
&&
obj
.
isUnread
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
objArr
,
true
);
}
}
});
}
});
MessagesStorage
.
getInstance
().
putMessages
(
arr
,
false
,
true
,
false
);
MessagesStorage
.
getInstance
().
putMessages
(
arr
,
false
,
true
,
false
);
}
else
if
(
MessagesStorage
.
lastSeqValue
!=
updates
.
seq
)
{
}
else
if
(
MessagesStorage
.
lastSeqValue
!=
updates
.
seq
)
{
FileLog
.
e
(
"tmessages"
,
"need get diff TL_updateShortChatMessage, seq: "
+
MessagesStorage
.
lastSeqValue
+
" "
+
updates
.
seq
);
FileLog
.
e
(
"tmessages"
,
"need get diff TL_updateShortChatMessage, seq: "
+
MessagesStorage
.
lastSeqValue
+
" "
+
updates
.
seq
);
...
@@ -3850,13 +3878,23 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -3850,13 +3878,23 @@ public class MessagesController implements NotificationCenter.NotificationCenter
if
(
printUpdate
)
{
if
(
printUpdate
)
{
NotificationCenter
.
getInstance
().
postNotificationName
(
updateInterfaces
,
UPDATE_MASK_USER_PRINT
);
NotificationCenter
.
getInstance
().
postNotificationName
(
updateInterfaces
,
UPDATE_MASK_USER_PRINT
);
}
}
if
(!
obj
.
isFromMe
()
&&
obj
.
isUnread
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
objArr
,
true
);
}
updateInterfaceWithMessages
(
updates
.
from_id
,
objArr
);
updateInterfaceWithMessages
(
updates
.
from_id
,
objArr
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
}
}
});
});
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(!
obj
.
isFromMe
()
&&
obj
.
isUnread
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
objArr
,
true
);
}
}
});
}
});
MessagesStorage
.
getInstance
().
putMessages
(
arr
,
false
,
true
,
false
);
MessagesStorage
.
getInstance
().
putMessages
(
arr
,
false
,
true
,
false
);
}
else
if
(
MessagesStorage
.
lastSeqValue
!=
updates
.
seq
)
{
}
else
if
(
MessagesStorage
.
lastSeqValue
!=
updates
.
seq
)
{
FileLog
.
e
(
"tmessages"
,
"need get diff TL_updateShortMessage, seq: "
+
MessagesStorage
.
lastSeqValue
+
" "
+
updates
.
seq
);
FileLog
.
e
(
"tmessages"
,
"need get diff TL_updateShortMessage, seq: "
+
MessagesStorage
.
lastSeqValue
+
" "
+
updates
.
seq
);
...
@@ -4265,7 +4303,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4265,7 +4303,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
});
});
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
if
((
int
)
d
.
id
!=
0
)
{
int
high_id
=
(
int
)(
d
.
id
>>
32
);
if
((
int
)
d
.
id
!=
0
&&
high_id
!=
1
)
{
dialogsServerOnly
.
add
(
d
);
dialogsServerOnly
.
add
(
d
);
}
}
}
}
...
@@ -4327,6 +4366,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4327,6 +4366,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
ContactsController
.
getInstance
().
processContactsUpdates
(
contactsIds
,
usersDict
);
ContactsController
.
getInstance
().
processContactsUpdates
(
contactsIds
,
usersDict
);
}
}
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(!
pushMessages
.
isEmpty
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
pushMessages
,
true
);
}
}
});
}
});
if
(!
messagesArr
.
isEmpty
())
{
if
(!
messagesArr
.
isEmpty
())
{
MessagesStorage
.
getInstance
().
putMessages
(
messagesArr
,
true
,
true
,
false
);
MessagesStorage
.
getInstance
().
putMessages
(
messagesArr
,
true
,
true
,
false
);
}
}
...
@@ -4415,9 +4468,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4415,9 +4468,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
}
}
if
(!
pushMessages
.
isEmpty
())
{
NotificationsController
.
getInstance
().
processNewMessages
(
pushMessages
,
true
);
}
if
(!
markAsReadMessages
.
isEmpty
())
{
if
(!
markAsReadMessages
.
isEmpty
())
{
for
(
Integer
id
:
markAsReadMessages
)
{
for
(
Integer
id
:
markAsReadMessages
)
{
MessageObject
obj
=
dialogMessage
.
get
(
id
);
MessageObject
obj
=
dialogMessage
.
get
(
id
);
...
@@ -4441,9 +4491,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4441,9 +4491,6 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
}
}
}
}
if
(!
markAsReadMessages
.
isEmpty
())
{
NotificationsController
.
getInstance
().
processReadMessages
(
markAsReadMessages
,
0
,
0
,
0
);
}
if
(!
deletedMessages
.
isEmpty
())
{
if
(!
deletedMessages
.
isEmpty
())
{
NotificationCenter
.
getInstance
().
postNotificationName
(
messagesDeleted
,
deletedMessages
);
NotificationCenter
.
getInstance
().
postNotificationName
(
messagesDeleted
,
deletedMessages
);
for
(
Integer
id
:
deletedMessages
)
{
for
(
Integer
id
:
deletedMessages
)
{
...
@@ -4472,21 +4519,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4472,21 +4519,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
});
});
if
(!
markAsReadMessages
.
isEmpty
()
||
!
markAsReadEncrypted
.
isEmpty
())
{
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(!
markAsReadMessages
.
isEmpty
())
{
if
(!
markAsReadMessages
.
isEmpty
())
{
NotificationCenter
.
getInstance
().
postNotificationName
(
messagesReaded
,
markAsReadMessages
);
NotificationCenter
.
getInstance
().
postNotificationName
(
messagesReaded
,
markAsReadMessages
);
NotificationsController
.
getInstance
().
processReadMessages
(
markAsReadMessages
,
0
,
0
,
0
);
}
}
}
}
);
}
}
}
);
}
);
}
}
}
);
if
(!
markAsReadMessages
.
isEmpty
()
||
!
markAsReadEncrypted
.
isEmpty
())
{
if
(!
markAsReadMessages
.
isEmpty
()
||
!
markAsReadEncrypted
.
isEmpty
())
{
if
(!
markAsReadMessages
.
isEmpty
())
{
if
(!
markAsReadMessages
.
isEmpty
())
{
...
@@ -4566,13 +4612,23 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4566,13 +4612,23 @@ public class MessagesController implements NotificationCenter.NotificationCenter
updateInterfaceWithMessages
(
uid
,
messages
,
false
);
updateInterfaceWithMessages
(
uid
,
messages
,
false
);
}
}
private
void
updateInterfaceWithMessages
(
long
uid
,
ArrayList
<
MessageObject
>
messages
,
boolean
isBroadcast
)
{
private
void
updateInterfaceWithMessages
(
final
long
uid
,
final
ArrayList
<
MessageObject
>
messages
,
boolean
isBroadcast
)
{
MessageObject
lastMessage
=
null
;
MessageObject
lastMessage
=
null
;
TLRPC
.
TL_dialog
dialog
=
dialogs_dict
.
get
(
uid
);
TLRPC
.
TL_dialog
dialog
=
dialogs_dict
.
get
(
uid
);
boolean
isEncryptedChat
=
((
int
)
uid
)
==
0
;
boolean
isEncryptedChat
=
((
int
)
uid
)
==
0
;
NotificationCenter
.
getInstance
().
postNotificationName
(
didReceivedNewMessages
,
uid
,
messages
);
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
@Override
public
void
run
()
{
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
NotificationCenter
.
getInstance
().
postNotificationName
(
didReceivedNewMessages
,
uid
,
messages
);
}
});
}
});
for
(
MessageObject
message
:
messages
)
{
for
(
MessageObject
message
:
messages
)
{
if
(
lastMessage
==
null
||
(!
isEncryptedChat
&&
message
.
messageOwner
.
id
>
lastMessage
.
messageOwner
.
id
||
isEncryptedChat
&&
message
.
messageOwner
.
id
<
lastMessage
.
messageOwner
.
id
)
||
message
.
messageOwner
.
date
>
lastMessage
.
messageOwner
.
date
)
{
if
(
lastMessage
==
null
||
(!
isEncryptedChat
&&
message
.
messageOwner
.
id
>
lastMessage
.
messageOwner
.
id
||
isEncryptedChat
&&
message
.
messageOwner
.
id
<
lastMessage
.
messageOwner
.
id
)
||
message
.
messageOwner
.
date
>
lastMessage
.
messageOwner
.
date
)
{
...
@@ -4623,7 +4679,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4623,7 +4679,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
});
});
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
if
((
int
)
d
.
id
!=
0
)
{
int
high_id
=
(
int
)(
d
.
id
>>
32
);
if
((
int
)
d
.
id
!=
0
&&
high_id
!=
1
)
{
dialogsServerOnly
.
add
(
d
);
dialogsServerOnly
.
add
(
d
);
}
}
}
}
...
@@ -4854,10 +4911,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -4854,10 +4911,20 @@ public class MessagesController implements NotificationCenter.NotificationCenter
dialog
.
unread_count
=
0
;
dialog
.
unread_count
=
0
;
dialogMessage
.
remove
(
dialog
.
top_message
);
dialogMessage
.
remove
(
dialog
.
top_message
);
}
}
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
did
,
0
,
Integer
.
MAX_VALUE
);
MessagesStorage
.
getInstance
().
storageQueue
.
postRunnable
(
new
Runnable
()
{
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
@Override
dialogsToUpdate
.
put
(
did
,
0
);
public
void
run
()
{
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
Utilities
.
RunOnUIThread
(
new
Runnable
()
{
@Override
public
void
run
()
{
NotificationsController
.
getInstance
().
processReadMessages
(
null
,
did
,
0
,
Integer
.
MAX_VALUE
);
HashMap
<
Long
,
Integer
>
dialogsToUpdate
=
new
HashMap
<
Long
,
Integer
>();
dialogsToUpdate
.
put
(
did
,
0
);
NotificationsController
.
getInstance
().
processDialogsUpdateRead
(
dialogsToUpdate
,
true
);
}
});
}
});
MessagesStorage
.
getInstance
().
deleteDialog
(
did
,
true
);
MessagesStorage
.
getInstance
().
deleteDialog
(
did
,
true
);
NotificationCenter
.
getInstance
().
postNotificationName
(
removeAllMessagesFromDialog
,
did
);
NotificationCenter
.
getInstance
().
postNotificationName
(
removeAllMessagesFromDialog
,
did
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
NotificationCenter
.
getInstance
().
postNotificationName
(
dialogsNeedReload
);
...
@@ -5145,7 +5212,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
...
@@ -5145,7 +5212,8 @@ public class MessagesController implements NotificationCenter.NotificationCenter
}
}
});
});
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
for
(
TLRPC
.
TL_dialog
d
:
dialogs
)
{
if
((
int
)
d
.
id
!=
0
)
{
int
high_id
=
(
int
)(
d
.
id
>>
32
);
if
((
int
)
d
.
id
!=
0
&&
high_id
!=
1
)
{
dialogsServerOnly
.
add
(
d
);
dialogsServerOnly
.
add
(
d
);
}
}
}
}
...
...
TMessagesProj/src/main/java/org/telegram/android/NotificationsController.java
View file @
e27094b9
...
@@ -183,6 +183,8 @@ public class NotificationsController {
...
@@ -183,6 +183,8 @@ public class NotificationsController {
}
}
msg
=
LocaleController
.
formatString
(
"NotificationGroupKickMember"
,
R
.
string
.
NotificationGroupKickMember
,
Utilities
.
formatName
(
user
.
first_name
,
user
.
last_name
),
chat
.
title
,
Utilities
.
formatName
(
u2
.
first_name
,
u2
.
last_name
));
msg
=
LocaleController
.
formatString
(
"NotificationGroupKickMember"
,
R
.
string
.
NotificationGroupKickMember
,
Utilities
.
formatName
(
user
.
first_name
,
user
.
last_name
),
chat
.
title
,
Utilities
.
formatName
(
u2
.
first_name
,
u2
.
last_name
));
}
}
}
else
if
(
messageObject
.
messageOwner
.
action
instanceof
TLRPC
.
TL_messageActionChatCreate
)
{
msg
=
messageObject
.
messageText
.
toString
();
}
}
}
else
{
}
else
{
if
(
messageObject
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaEmpty
)
{
if
(
messageObject
.
messageOwner
.
media
instanceof
TLRPC
.
TL_messageMediaEmpty
)
{
...
@@ -508,9 +510,6 @@ public class NotificationsController {
...
@@ -508,9 +510,6 @@ public class NotificationsController {
if
(
oldCount
!=
popupMessages
.
size
())
{
if
(
oldCount
!=
popupMessages
.
size
())
{
NotificationCenter
.
getInstance
().
postNotificationName
(
pushMessagesUpdated
);
NotificationCenter
.
getInstance
().
postNotificationName
(
pushMessagesUpdated
);
}
}
// if (readMessages != null || oldCount2 != pushMessages.size() || readMessages == null && dialog_id == 0) {
// showOrUpdateNotification(notifyCheck);
// }
}
}
public
void
processNewMessages
(
ArrayList
<
MessageObject
>
messageObjects
,
boolean
isLast
)
{
public
void
processNewMessages
(
ArrayList
<
MessageObject
>
messageObjects
,
boolean
isLast
)
{
...
@@ -585,6 +584,15 @@ public class NotificationsController {
...
@@ -585,6 +584,15 @@ public class NotificationsController {
}
}
if
(
newCount
==
0
)
{
if
(
newCount
==
0
)
{
pushDialogs
.
remove
(
dialog_id
);
pushDialogs
.
remove
(
dialog_id
);
for
(
int
a
=
0
;
a
<
pushMessages
.
size
();
a
++)
{
MessageObject
messageObject
=
pushMessages
.
get
(
a
);
if
(
messageObject
.
getDialogId
()
==
dialog_id
)
{
pushMessages
.
remove
(
a
);
a
--;
pushMessagesDict
.
remove
(
messageObject
.
messageOwner
.
id
);
popupMessages
.
remove
(
messageObject
);
}
}
}
else
if
(
canAddValue
)
{
}
else
if
(
canAddValue
)
{
total_unread_count
+=
newCount
;
total_unread_count
+=
newCount
;
pushDialogs
.
put
(
dialog_id
,
newCount
);
pushDialogs
.
put
(
dialog_id
,
newCount
);
...
@@ -611,7 +619,6 @@ public class NotificationsController {
...
@@ -611,7 +619,6 @@ public class NotificationsController {
pushDialogs
.
clear
();
pushDialogs
.
clear
();
total_unread_count
=
0
;
total_unread_count
=
0
;
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Context
.
MODE_PRIVATE
);
SharedPreferences
preferences
=
ApplicationLoader
.
applicationContext
.
getSharedPreferences
(
"Notifications"
,
Context
.
MODE_PRIVATE
);
String
dialogsToLoad
=
""
;
for
(
HashMap
.
Entry
<
Long
,
Integer
>
entry
:
dialogs
.
entrySet
())
{
for
(
HashMap
.
Entry
<
Long
,
Integer
>
entry
:
dialogs
.
entrySet
())
{
long
dialog_id
=
entry
.
getKey
();
long
dialog_id
=
entry
.
getKey
();
int
notify_override
=
preferences
.
getInt
(
"notify2_"
+
dialog_id
,
0
);
int
notify_override
=
preferences
.
getInt
(
"notify2_"
+
dialog_id
,
0
);
...
@@ -619,10 +626,6 @@ public class NotificationsController {
...
@@ -619,10 +626,6 @@ public class NotificationsController {
if
(!(
notify_override
==
2
||
(!
preferences
.
getBoolean
(
"EnableAll"
,
true
)
||
isChat
&&
!
preferences
.
getBoolean
(
"EnableGroup"
,
true
))
&&
notify_override
==
0
))
{
if
(!(
notify_override
==
2
||
(!
preferences
.
getBoolean
(
"EnableAll"
,
true
)
||
isChat
&&
!
preferences
.
getBoolean
(
"EnableGroup"
,
true
))
&&
notify_override
==
0
))
{
pushDialogs
.
put
(
dialog_id
,
entry
.
getValue
());
pushDialogs
.
put
(
dialog_id
,
entry
.
getValue
());
total_unread_count
+=
entry
.
getValue
();
total_unread_count
+=
entry
.
getValue
();
if
(
dialogsToLoad
.
length
()
!=
0
)
{
dialogsToLoad
+=
","
;
}
dialogsToLoad
+=
""
+
dialog_id
;
}
}
}
}
if
(
total_unread_count
==
0
)
{
if
(
total_unread_count
==
0
)
{
...
...
TMessagesProj/src/main/java/org/telegram/ui/ChatActivity.java
View file @
e27094b9
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
package
org
.
telegram
.
ui
;
package
org
.
telegram
.
ui
;
import
android.animation.Animator
;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.app.AlertDialog
;
import
android.content.Context
;
import
android.content.Context
;
...
@@ -149,7 +150,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -149,7 +150,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
private
int
unread_to_load
=
0
;
private
int
unread_to_load
=
0
;
private
int
first_unread_id
=
0
;
private
int
first_unread_id
=
0
;
private
int
last_unread_id
=
0
;
private
int
last_unread_id
=
0
;
private
boolean
unread_end_reached
=
tru
e
;
private
boolean
unread_end_reached
=
fals
e
;
private
boolean
loadingForward
=
false
;
private
boolean
loadingForward
=
false
;
private
MessageObject
unreadMessageObject
=
null
;
private
MessageObject
unreadMessageObject
=
null
;
...
@@ -617,6 +618,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -617,6 +618,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
View
bottomOverlayChat
=
fragmentView
.
findViewById
(
R
.
id
.
bottom_overlay_chat
);
View
bottomOverlayChat
=
fragmentView
.
findViewById
(
R
.
id
.
bottom_overlay_chat
);
progressView
=
fragmentView
.
findViewById
(
R
.
id
.
progressLayout
);
progressView
=
fragmentView
.
findViewById
(
R
.
id
.
progressLayout
);
pagedownButton
=
fragmentView
.
findViewById
(
R
.
id
.
pagedown_button
);
pagedownButton
=
fragmentView
.
findViewById
(
R
.
id
.
pagedown_button
);
pagedownButton
.
setVisibility
(
View
.
GONE
);
View
progressViewInner
=
progressView
.
findViewById
(
R
.
id
.
progressLayoutInner
);
View
progressViewInner
=
progressView
.
findViewById
(
R
.
id
.
progressLayoutInner
);
...
@@ -743,8 +745,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -743,8 +745,6 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
if
(
firstVisibleItem
+
visibleItemCount
==
totalItemCount
&&
unread_end_reached
)
{
if
(
firstVisibleItem
+
visibleItemCount
==
totalItemCount
&&
unread_end_reached
)
{
showPagedownButton
(
false
,
true
);
showPagedownButton
(
false
,
true
);
}
}
}
else
{
showPagedownButton
(
false
,
false
);
}
}
for
(
int
a
=
0
;
a
<
visibleItemCount
;
a
++)
{
for
(
int
a
=
0
;
a
<
visibleItemCount
;
a
++)
{
View
view
=
absListView
.
getChildAt
(
a
);
View
view
=
absListView
.
getChildAt
(
a
);
...
@@ -873,7 +873,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -873,7 +873,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
if
(
show
)
{
if
(
show
)
{
if
(
pagedownButton
.
getVisibility
()
==
View
.
GONE
)
{
if
(
pagedownButton
.
getVisibility
()
==
View
.
GONE
)
{
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
1
6
&&
animated
)
{
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
1
2
&&
animated
)
{
pagedownButton
.
setVisibility
(
View
.
VISIBLE
);
pagedownButton
.
setVisibility
(
View
.
VISIBLE
);
pagedownButton
.
setAlpha
(
0
);
pagedownButton
.
setAlpha
(
0
);
pagedownButton
.
animate
().
alpha
(
1
).
setDuration
(
200
).
start
();
pagedownButton
.
animate
().
alpha
(
1
).
setDuration
(
200
).
start
();
...
@@ -883,13 +883,28 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
...
@@ -883,13 +883,28 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
}
}
}
else
{
}
else
{
if
(
pagedownButton
.
getVisibility
()
==
View
.
VISIBLE
)
{
if
(
pagedownButton
.
getVisibility
()
==
View
.
VISIBLE
)
{
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
1
6
&&
animated
)
{
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
1
2
&&
animated
)
{
pagedownButton
.
animate
().
alpha
(
0
).
withEndAction
(
new
Runnable
()
{
pagedownButton
.
animate
().
alpha
(
0
).
setDuration
(
200
).
setListener
(
new
Animator
.
AnimatorListener
()
{
@Override
@Override
public
void
run
()
{
public
void
onAnimationStart
(
Animator
animation
)
{
}
@Override
public
void
onAnimationEnd
(
Animator
animation
)
{
pagedownButton
.
setVisibility
(
View
.
GONE
);
pagedownButton
.
setVisibility
(
View
.
GONE
);
}
}
}).
setDuration
(
200
).
start
();
@Override
public
void
onAnimationCancel
(
Animator
animation
)
{
}
@Override
public
void
onAnimationRepeat
(
Animator
animation
)
{
}
}).
start
();
}
else
{
}
else
{
pagedownButton
.
setVisibility
(
View
.
GONE
);
pagedownButton
.
setVisibility
(
View
.
GONE
);
}
}
...
...
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