mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Removed hardcoded account, improved things in chat rooms list
This commit is contained in:
parent
41ea5e4cc7
commit
78d55d6c78
6 changed files with 51 additions and 84 deletions
|
|
@ -4,6 +4,7 @@ plugins {
|
|||
id 'kotlin-kapt'
|
||||
id 'org.jlleitschuh.gradle.ktlint' version '11.3.1'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
id 'com.google.gms.google-services'
|
||||
}
|
||||
|
||||
static def getPackageName() {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,16 @@
|
|||
|
||||
</activity>
|
||||
|
||||
<!-- Services -->
|
||||
|
||||
<service android:name="org.linphone.core.tools.firebase.FirebaseMessaging"
|
||||
android:enabled="true"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="com.google.firebase.MESSAGING_EVENT" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<!-- Receivers -->
|
||||
|
||||
<receiver android:name=".core.CorePushReceiver"
|
||||
|
|
|
|||
|
|
@ -37,8 +37,4 @@ max_calls=10
|
|||
history_max_size=100
|
||||
conference_layout=1
|
||||
|
||||
[in-app-purchase]
|
||||
server_url=https://subscribe.linphone.org:444/inapp.php
|
||||
purchasable_items_ids=test_account_subscription
|
||||
|
||||
## End of default rc
|
||||
|
|
|
|||
|
|
@ -51,48 +51,4 @@ url=https://subscribe.linphone.org/api/
|
|||
[lime]
|
||||
lime_update_threshold=86400
|
||||
|
||||
[nat_policy_0]
|
||||
ref=HQ0DK7mVDOPAY3i
|
||||
stun_server=stun.linphone.org
|
||||
protocols=stun,ice
|
||||
|
||||
[proxy_0]
|
||||
reg_proxy=<sip:sip.linphone.org;transport=tls>
|
||||
reg_route=sip:sip.linphone.org;transport=tls
|
||||
reg_identity="Sylvain Berfini" <sip:sylvain@sip.linphone.org>
|
||||
realm=sip.linphone.org
|
||||
contact_parameters=message-expires=604800
|
||||
quality_reporting_collector=sip:voip-metrics@sip.linphone.org;transport=tls
|
||||
push_parameters=pn-silent=1;pn-timeout=0;
|
||||
quality_reporting_enabled=1
|
||||
quality_reporting_interval=180
|
||||
reg_expires=600
|
||||
reg_sendregister=1
|
||||
publish=1
|
||||
avpf=1
|
||||
avpf_rr_interval=1
|
||||
dial_escape_plus=0
|
||||
dial_prefix=33
|
||||
use_dial_prefix_for_calls_and_chats=1
|
||||
privacy=32768
|
||||
push_notification_allowed=1
|
||||
remote_push_notification_allowed=0
|
||||
cpim_in_basic_chat_rooms_enabled=1
|
||||
idkey=proxy_config_WSik0NIEZbTW4fM
|
||||
publish_expires=120
|
||||
nat_policy_ref=-ulaFqPYu2HOZ90
|
||||
conference_factory_uri=sip:conference-factory@sip.linphone.org
|
||||
audio_video_conference_factory_uri=sip:videoconference-factory@sip.linphone.org
|
||||
rtp_bundle=1
|
||||
rtp_bundle_assumption=0
|
||||
lime_server_url=https://lime.linphone.org/lime-server/lime-server.php
|
||||
|
||||
[auth_info_0]
|
||||
username=sylvain
|
||||
ha1=4028ae98f54e8ffd1ab5c90985a6e89752aa0228b3e14b7ffcc40e42b4787e56
|
||||
realm=sip.linphone.org
|
||||
domain=sip.linphone.org
|
||||
algorithm=SHA-256
|
||||
available_algorithms=SHA-256
|
||||
|
||||
## End of factory rc
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ class ConversationsListAdapter(
|
|||
data = chatRoomData
|
||||
|
||||
lifecycleOwner = viewLifecycleOwner
|
||||
executePendingBindings()
|
||||
|
||||
binding.root.isSelected = bindingAdapterPosition == selectedAdapterPosition
|
||||
|
||||
|
|
@ -69,6 +68,8 @@ class ConversationsListAdapter(
|
|||
chatRoomLongClickedEvent.value = Event(chatRoomData)
|
||||
}
|
||||
}
|
||||
|
||||
executePendingBindings()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -80,6 +81,6 @@ private class ConversationDiffCallback : DiffUtil.ItemCallback<ChatRoomData>() {
|
|||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: ChatRoomData, newItem: ChatRoomData): Boolean {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,8 +95,12 @@ class ConversationsListViewModel : ViewModel() {
|
|||
coreContext.postOnCoreThread { core ->
|
||||
core.addListener(coreListener)
|
||||
}
|
||||
|
||||
coreContext.contactsManager.addListener(contactsListener)
|
||||
updateChatRoomsList()
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
updateChatRoomsList()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
|
|
@ -108,32 +112,35 @@ class ConversationsListViewModel : ViewModel() {
|
|||
}
|
||||
|
||||
private fun addChatRoomToList(chatRoom: ChatRoom) {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val list = arrayListOf<ChatRoomData>()
|
||||
|
||||
val data = ChatRoomData(chatRoom)
|
||||
list.add(data)
|
||||
list.addAll(chatRoomsList.value.orEmpty())
|
||||
|
||||
chatRoomsList.postValue(list)
|
||||
val index = findChatRoomIndex(chatRoom)
|
||||
if (index != -1) {
|
||||
Log.w("[Conversations List] Chat room already exists in list, do not add it again")
|
||||
return
|
||||
}
|
||||
|
||||
val list = arrayListOf<ChatRoomData>()
|
||||
|
||||
val data = ChatRoomData(chatRoom)
|
||||
list.add(data)
|
||||
list.addAll(chatRoomsList.value.orEmpty())
|
||||
list.sortByDescending { data -> data.chatRoom.lastUpdateTime }
|
||||
|
||||
chatRoomsList.postValue(list)
|
||||
}
|
||||
|
||||
private fun removeChatRoomFromList(chatRoom: ChatRoom) {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val list = arrayListOf<ChatRoomData>()
|
||||
val list = arrayListOf<ChatRoomData>()
|
||||
|
||||
for (data in chatRoomsList.value.orEmpty()) {
|
||||
if (LinphoneUtils.getChatRoomId(chatRoom) != LinphoneUtils.getChatRoomId(
|
||||
data.chatRoom
|
||||
)
|
||||
) {
|
||||
list.add(data)
|
||||
}
|
||||
for (data in chatRoomsList.value.orEmpty()) {
|
||||
if (LinphoneUtils.getChatRoomId(chatRoom) != LinphoneUtils.getChatRoomId(
|
||||
data.chatRoom
|
||||
)
|
||||
) {
|
||||
list.add(data)
|
||||
}
|
||||
|
||||
chatRoomsList.postValue(list)
|
||||
}
|
||||
|
||||
chatRoomsList.postValue(list)
|
||||
}
|
||||
|
||||
private fun findChatRoomIndex(chatRoom: ChatRoom): Int {
|
||||
|
|
@ -163,25 +170,21 @@ class ConversationsListViewModel : ViewModel() {
|
|||
|
||||
private fun updateChatRoomsList() {
|
||||
Log.i("[Conversations List] Updating chat rooms list")
|
||||
coreContext.postOnCoreThread { core ->
|
||||
chatRoomsList.value.orEmpty().forEach(ChatRoomData::onCleared)
|
||||
chatRoomsList.value.orEmpty().forEach(ChatRoomData::onCleared)
|
||||
|
||||
val list = arrayListOf<ChatRoomData>()
|
||||
val chatRooms = core.chatRooms
|
||||
for (chatRoom in chatRooms) {
|
||||
list.add(ChatRoomData(chatRoom))
|
||||
}
|
||||
chatRoomsList.postValue(list)
|
||||
val list = arrayListOf<ChatRoomData>()
|
||||
val chatRooms = coreContext.core.chatRooms
|
||||
for (chatRoom in chatRooms) {
|
||||
list.add(ChatRoomData(chatRoom))
|
||||
}
|
||||
chatRoomsList.postValue(list)
|
||||
}
|
||||
|
||||
private fun reorderChatRoomsList() {
|
||||
Log.i("[Conversations List] Re-ordering chat rooms list")
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val list = arrayListOf<ChatRoomData>()
|
||||
list.addAll(chatRoomsList.value.orEmpty())
|
||||
list.sortByDescending { data -> data.chatRoom.lastUpdateTime }
|
||||
chatRoomsList.postValue(list)
|
||||
}
|
||||
val list = arrayListOf<ChatRoomData>()
|
||||
list.addAll(chatRoomsList.value.orEmpty())
|
||||
list.sortByDescending { data -> data.chatRoom.lastUpdateTime }
|
||||
chatRoomsList.postValue(list)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue