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
5d042955
Commit
5d042955
authored
Aug 07, 2014
by
DrKLO
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes
parent
87612e00
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
76 deletions
+18
-76
build.gradle
TMessagesProj/build.gradle
+1
-1
ContactsController.java
...rc/main/java/org/telegram/android/ContactsController.java
+15
-73
MessagesStorage.java
...j/src/main/java/org/telegram/android/MessagesStorage.java
+1
-1
MessageObject.java
...roj/src/main/java/org/telegram/objects/MessageObject.java
+1
-1
No files found.
TMessagesProj/build.gradle
View file @
5d042955
...
@@ -83,7 +83,7 @@ android {
...
@@ -83,7 +83,7 @@ android {
defaultConfig
{
defaultConfig
{
minSdkVersion
8
minSdkVersion
8
targetSdkVersion
19
targetSdkVersion
19
versionCode
30
2
versionCode
30
3
versionName
"1.7.0"
versionName
"1.7.0"
}
}
}
}
TMessagesProj/src/main/java/org/telegram/android/ContactsController.java
View file @
5d042955
...
@@ -47,10 +47,7 @@ public class ContactsController {
...
@@ -47,10 +47,7 @@ public class ContactsController {
private
final
Integer
observerLock
=
1
;
private
final
Integer
observerLock
=
1
;
public
boolean
contactsLoaded
=
false
;
public
boolean
contactsLoaded
=
false
;
private
boolean
contactsBookLoaded
=
false
;
private
boolean
contactsBookLoaded
=
false
;
private
int
lastContactsPhonesCount
=
-
1
;
private
String
lastContactsVersions
=
""
;
private
int
lastContactsPhonesMaxId
=
-
1
;
private
int
lastContactsNamesCount
=
-
1
;
private
int
lastContactsNamesMaxId
=
-
1
;
private
ArrayList
<
Integer
>
delayedContactsUpdate
=
new
ArrayList
<
Integer
>();
private
ArrayList
<
Integer
>
delayedContactsUpdate
=
new
ArrayList
<
Integer
>();
public
static
class
Contact
{
public
static
class
Contact
{
...
@@ -119,10 +116,7 @@ public class ContactsController {
...
@@ -119,10 +116,7 @@ public class ContactsController {
contactsSyncInProgress
=
false
;
contactsSyncInProgress
=
false
;
contactsLoaded
=
false
;
contactsLoaded
=
false
;
contactsBookLoaded
=
false
;
contactsBookLoaded
=
false
;
lastContactsPhonesCount
=
-
1
;
lastContactsVersions
=
""
;
lastContactsPhonesMaxId
=
-
1
;
lastContactsNamesCount
=
-
1
;
lastContactsNamesMaxId
=
-
1
;
}
}
public
void
checkAppAccount
()
{
public
void
checkAppAccount
()
{
...
@@ -191,70 +185,17 @@ public class ContactsController {
...
@@ -191,70 +185,17 @@ public class ContactsController {
ContentResolver
cr
=
ApplicationLoader
.
applicationContext
.
getContentResolver
();
ContentResolver
cr
=
ApplicationLoader
.
applicationContext
.
getContentResolver
();
Cursor
pCur
=
null
;
Cursor
pCur
=
null
;
try
{
try
{
pCur
=
cr
.
query
(
ContactsContract
.
CommonDataKinds
.
Phone
.
CONTENT_URI
,
new
String
[]{
ContactsContract
.
CommonDataKinds
.
Phone
.
_ID
},
null
,
null
,
ContactsContract
.
CommonDataKinds
.
Phone
.
_ID
+
" desc LIMIT 1"
);
pCur
=
cr
.
query
(
ContactsContract
.
RawContacts
.
CONTENT_URI
,
new
String
[]{
ContactsContract
.
RawContacts
.
VERSION
},
null
,
null
,
null
);
if
(
pCur
!=
null
)
{
StringBuilder
currentVersion
=
new
StringBuilder
();
if
(
pCur
.
getCount
()
>
0
&&
pCur
.
moveToFirst
())
{
while
(
pCur
.
moveToNext
())
{
int
value
=
pCur
.
getInt
(
0
);
int
col
=
pCur
.
getColumnIndex
(
ContactsContract
.
RawContacts
.
VERSION
);
if
(
lastContactsPhonesMaxId
!=
-
1
&&
value
!=
lastContactsPhonesMaxId
)
{
currentVersion
.
append
(
pCur
.
getString
(
col
));
reload
=
true
;
}
lastContactsPhonesMaxId
=
value
;
}
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
finally
{
if
(
pCur
!=
null
)
{
pCur
.
close
();
}
}
try
{
pCur
=
cr
.
query
(
ContactsContract
.
CommonDataKinds
.
Phone
.
CONTENT_URI
,
new
String
[]{
ContactsContract
.
CommonDataKinds
.
Phone
.
_COUNT
},
null
,
null
,
null
);
if
(
pCur
!=
null
)
{
if
(
pCur
.
getCount
()
>
0
&&
pCur
.
moveToFirst
())
{
int
value
=
pCur
.
getInt
(
0
);
if
(
lastContactsPhonesCount
!=
-
1
&&
value
!=
lastContactsPhonesCount
)
{
reload
=
true
;
}
lastContactsPhonesCount
=
value
;
}
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
finally
{
if
(
pCur
!=
null
)
{
pCur
.
close
();
}
}
try
{
pCur
=
cr
.
query
(
ContactsContract
.
Data
.
CONTENT_URI
,
new
String
[]{
ContactsContract
.
Data
.
_COUNT
},
ContactsContract
.
Data
.
MIMETYPE
+
" = '"
+
ContactsContract
.
CommonDataKinds
.
StructuredName
.
CONTENT_ITEM_TYPE
+
"'"
,
null
,
null
);
if
(
pCur
!=
null
)
{
if
(
pCur
.
getCount
()
>
0
&&
pCur
.
moveToFirst
())
{
int
value
=
pCur
.
getInt
(
0
);
if
(
lastContactsNamesCount
!=
-
1
&&
value
!=
lastContactsNamesCount
)
{
reload
=
true
;
}
lastContactsNamesCount
=
value
;
}
}
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
}
finally
{
if
(
pCur
!=
null
)
{
pCur
.
close
();
}
}
}
String
newContactsVersion
=
currentVersion
.
toString
();
try
{
if
(
lastContactsVersions
.
length
()
!=
0
&&
!
lastContactsVersions
.
equals
(
newContactsVersion
))
{
pCur
=
cr
.
query
(
ContactsContract
.
Data
.
CONTENT_URI
,
new
String
[]{
ContactsContract
.
Data
.
_ID
},
ContactsContract
.
Data
.
MIMETYPE
+
" = '"
+
ContactsContract
.
CommonDataKinds
.
StructuredName
.
CONTENT_ITEM_TYPE
+
"'"
,
null
,
ContactsContract
.
Data
.
_ID
+
" desc LIMIT 1"
);
reload
=
true
;
if
(
pCur
!=
null
)
{
if
(
pCur
.
getCount
()
>
0
&&
pCur
.
moveToFirst
())
{
int
value
=
pCur
.
getInt
(
0
);
if
(
lastContactsNamesMaxId
!=
-
1
&&
value
!=
lastContactsNamesMaxId
)
{
reload
=
true
;
}
lastContactsNamesMaxId
=
value
;
}
}
}
lastContactsVersions
=
newContactsVersion
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
FileLog
.
e
(
"tmessages"
,
e
);
FileLog
.
e
(
"tmessages"
,
e
);
}
finally
{
}
finally
{
...
@@ -368,7 +309,7 @@ public class ContactsController {
...
@@ -368,7 +309,7 @@ public class ContactsController {
String
sname2
=
pCur
.
getString
(
3
);
String
sname2
=
pCur
.
getString
(
3
);
String
mname
=
pCur
.
getString
(
4
);
String
mname
=
pCur
.
getString
(
4
);
Contact
contact
=
contactsMap
.
get
(
id
);
Contact
contact
=
contactsMap
.
get
(
id
);
if
(
contact
!=
null
)
{
if
(
contact
!=
null
&&
contact
.
first_name
.
length
()
==
0
&&
contact
.
last_name
.
length
()
==
0
)
{
contact
.
first_name
=
fname
;
contact
.
first_name
=
fname
;
contact
.
last_name
=
sname
;
contact
.
last_name
=
sname
;
if
(
contact
.
first_name
==
null
)
{
if
(
contact
.
first_name
==
null
)
{
...
@@ -535,7 +476,8 @@ public class ContactsController {
...
@@ -535,7 +476,8 @@ public class ContactsController {
}
}
}
}
if
(
existing
==
null
||
existing
!=
null
&&
(!
existing
.
first_name
.
equals
(
value
.
first_name
)
||
!
existing
.
last_name
.
equals
(
value
.
last_name
)))
{
boolean
nameChanged
=
existing
!=
null
&&
(!
existing
.
first_name
.
equals
(
value
.
first_name
)
||
!
existing
.
last_name
.
equals
(
value
.
last_name
));
if
(
existing
==
null
||
nameChanged
)
{
for
(
int
a
=
0
;
a
<
value
.
phones
.
size
();
a
++)
{
for
(
int
a
=
0
;
a
<
value
.
phones
.
size
();
a
++)
{
String
sphone
=
value
.
shortPhones
.
get
(
a
);
String
sphone
=
value
.
shortPhones
.
get
(
a
);
contactsBookShort
.
put
(
sphone
,
value
);
contactsBookShort
.
put
(
sphone
,
value
);
...
@@ -550,7 +492,7 @@ public class ContactsController {
...
@@ -550,7 +492,7 @@ public class ContactsController {
}
}
}
}
if
(
request
)
{
if
(
request
)
{
if
(
contactsByPhone
.
containsKey
(
sphone
))
{
if
(
!
nameChanged
&&
contactsByPhone
.
containsKey
(
sphone
))
{
continue
;
continue
;
}
}
...
...
TMessagesProj/src/main/java/org/telegram/android/MessagesStorage.java
View file @
5d042955
...
@@ -2009,7 +2009,7 @@ public class MessagesStorage {
...
@@ -2009,7 +2009,7 @@ public class MessagesStorage {
}
else
{
}
else
{
state
.
bindInteger
(
2
,
dialog_date
!=
0
?
dialog_date
:
value
.
date
);
state
.
bindInteger
(
2
,
dialog_date
!=
0
?
dialog_date
:
value
.
date
);
}
}
state
.
bindInteger
(
3
,
unread_count
);
state
.
bindInteger
(
3
,
old_unread_count
+
unread_count
);
state
.
bindInteger
(
4
,
messageId
);
state
.
bindInteger
(
4
,
messageId
);
state
.
step
();
state
.
step
();
}
}
...
...
TMessagesProj/src/main/java/org/telegram/objects/MessageObject.java
View file @
5d042955
...
@@ -380,7 +380,7 @@ public class MessageObject {
...
@@ -380,7 +380,7 @@ public class MessageObject {
photoThumbs
.
add
(
obj
);
photoThumbs
.
add
(
obj
);
}
else
if
(
photoThumbs
!=
null
&&
!
photoThumbs
.
isEmpty
()
&&
messageOwner
.
media
.
document
.
thumb
!=
null
)
{
}
else
if
(
photoThumbs
!=
null
&&
!
photoThumbs
.
isEmpty
()
&&
messageOwner
.
media
.
document
.
thumb
!=
null
)
{
PhotoObject
photoObject
=
photoThumbs
.
get
(
0
);
PhotoObject
photoObject
=
photoThumbs
.
get
(
0
);
photoObject
.
photoOwner
.
location
=
messageOwner
.
media
.
video
.
thumb
.
location
;
photoObject
.
photoOwner
.
location
=
messageOwner
.
media
.
document
.
thumb
.
location
;
}
}
}
}
}
}
...
...
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