mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Removed Friend aggregation for suggestions
This commit is contained in:
parent
ccf7ff82a1
commit
72e7445f87
3 changed files with 32 additions and 43 deletions
|
|
@ -46,6 +46,7 @@ import org.linphone.databinding.MainActivityBinding
|
|||
import org.linphone.ui.assistant.AssistantActivity
|
||||
import org.linphone.ui.main.settings.fragment.AccountProfileFragmentDirections
|
||||
import org.linphone.ui.main.viewmodel.DrawerMenuViewModel
|
||||
import org.linphone.ui.welcome.WelcomeActivity
|
||||
import org.linphone.utils.slideInToastFromTopForDuration
|
||||
|
||||
@UiThread
|
||||
|
|
@ -124,7 +125,7 @@ class MainActivity : AppCompatActivity() {
|
|||
override fun onPostCreate(savedInstanceState: Bundle?) {
|
||||
super.onPostCreate(savedInstanceState)
|
||||
|
||||
// TODO startActivity(Intent(this, WelcomeActivity::class.java))
|
||||
startActivity(Intent(this, WelcomeActivity::class.java))
|
||||
|
||||
if (checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(
|
||||
|
|
|
|||
|
|
@ -24,11 +24,10 @@ import androidx.annotation.WorkerThread
|
|||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import java.util.ArrayList
|
||||
import org.linphone.LinphoneApplication
|
||||
import org.linphone.LinphoneApplication.Companion.coreContext
|
||||
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||
import org.linphone.contacts.ContactsManager.ContactsListener
|
||||
import org.linphone.core.Address
|
||||
import org.linphone.core.Friend
|
||||
import org.linphone.core.MagicSearch
|
||||
import org.linphone.core.MagicSearchListenerStub
|
||||
import org.linphone.core.SearchResult
|
||||
|
|
@ -37,7 +36,6 @@ import org.linphone.ui.main.calls.model.NumpadModel
|
|||
import org.linphone.ui.main.calls.model.SuggestionModel
|
||||
import org.linphone.ui.main.model.isInSecureMode
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.LinphoneUtils
|
||||
|
||||
class StartCallViewModel @UiThread constructor() : ViewModel() {
|
||||
companion object {
|
||||
|
|
@ -86,9 +84,9 @@ class StartCallViewModel @UiThread constructor() : ViewModel() {
|
|||
Log.i("$TAG Contacts have been (re)loaded, updating list")
|
||||
applyFilter(
|
||||
currentFilter,
|
||||
if (limitSearchToLinphoneAccounts) LinphoneApplication.corePreferences.defaultDomain else "",
|
||||
if (limitSearchToLinphoneAccounts) corePreferences.defaultDomain else "",
|
||||
MagicSearch.Source.CallLogs.toInt() or MagicSearch.Source.ChatRooms.toInt() or MagicSearch.Source.Request.toInt(),
|
||||
MagicSearch.Aggregation.Friend
|
||||
MagicSearch.Aggregation.None
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -199,9 +197,9 @@ class StartCallViewModel @UiThread constructor() : ViewModel() {
|
|||
coreContext.postOnCoreThread {
|
||||
applyFilter(
|
||||
filter,
|
||||
if (limitSearchToLinphoneAccounts) LinphoneApplication.corePreferences.defaultDomain else "",
|
||||
if (limitSearchToLinphoneAccounts) corePreferences.defaultDomain else "",
|
||||
MagicSearch.Source.CallLogs.toInt() or MagicSearch.Source.ChatRooms.toInt() or MagicSearch.Source.Request.toInt(),
|
||||
MagicSearch.Aggregation.Friend
|
||||
MagicSearch.Aggregation.None
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -233,19 +231,4 @@ class StartCallViewModel @UiThread constructor() : ViewModel() {
|
|||
aggregation
|
||||
)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
private fun createFriendFromSearchResult(searchResult: SearchResult): Friend {
|
||||
val friend = coreContext.core.createFriend()
|
||||
|
||||
val address = searchResult.address
|
||||
if (address != null) {
|
||||
friend.address = address
|
||||
|
||||
friend.name = LinphoneUtils.getDisplayName(address)
|
||||
friend.refKey = address.asStringUriOnly().hashCode().toString()
|
||||
}
|
||||
|
||||
return friend
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,26 +110,8 @@ class NewContactFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
binding.setBackClickListener {
|
||||
val model = ConfirmationDialogModel()
|
||||
val dialog = DialogUtils.getCancelContactChangesConfirmationDialog(
|
||||
requireActivity(),
|
||||
model
|
||||
)
|
||||
|
||||
model.dismissEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
model.confirmRemovalEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
goBack()
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
dialog.show()
|
||||
goBack()
|
||||
// TODO: confirmation dialog
|
||||
}
|
||||
|
||||
binding.setPickImageClickListener {
|
||||
|
|
@ -203,4 +185,27 @@ class NewContactFragment : GenericFragment() {
|
|||
private fun pickImage() {
|
||||
pickMedia.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageOnly))
|
||||
}
|
||||
|
||||
private fun showAbortConfirmationDialog() {
|
||||
val model = ConfirmationDialogModel()
|
||||
val dialog = DialogUtils.getCancelContactChangesConfirmationDialog(
|
||||
requireActivity(),
|
||||
model
|
||||
)
|
||||
|
||||
model.dismissEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
model.confirmRemovalEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
goBack()
|
||||
dialog.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
dialog.show()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue