mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-30 10:19:27 +00:00
[Presence] update in progress
This commit is contained in:
parent
b75f90999e
commit
ab761d1a1d
12 changed files with 60 additions and 22 deletions
|
|
@ -80,7 +80,7 @@ uuid=3ac65678-272f-47d9-8aff-19950c565687
|
|||
friends_migration_done=1
|
||||
user_certificates_path=/data/user/0/org.linphone/files
|
||||
file_transfer_server_url=https://www.linphone.org:444/lft.php
|
||||
config-uri=https://85.233.205.218/xmlrpc?username=sylvain&password=cotcot&domain=sip.orangecyberdefense.com
|
||||
config-uri=https://85.233.205.218/xmlrpc?username=margaux&password=cotcot&domain=sip.orangecyberdefense.com
|
||||
|
||||
[audio_codec_0]
|
||||
mime=opus
|
||||
|
|
@ -219,10 +219,10 @@ rate=90000
|
|||
enabled=1
|
||||
recv_fmtp=profile-level-id=42801F
|
||||
|
||||
[friend_0]
|
||||
[friend_1]
|
||||
url="Sylvain Berfini" <sip:sylvain@sip.linphone.org>
|
||||
|
||||
[friend_1]
|
||||
[friend_0]
|
||||
url="Margaux Clerc" <sip:margaux@sip.linphone.org>
|
||||
|
||||
[friend_2]
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
|
||||
AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence);
|
||||
avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_SMALL);
|
||||
if(contact != null && contact.isLinphoneFriend() && contact.getFriendPresenceModel() != null) {
|
||||
if(contact != null && contact.isLinphoneFriend()) {
|
||||
avatarWithPresenceImage.setLinphoneContact(contact);
|
||||
LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
|
||||
AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence);
|
||||
avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_BIG);
|
||||
if(contact != null && contact.isLinphoneFriend() && contact.getFriendPresenceModel() != null) {
|
||||
if(contact != null && contact.isLinphoneFriend()) {
|
||||
avatarWithPresenceImage.setLinphoneContact(contact);
|
||||
LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -414,6 +414,8 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
View view = null;
|
||||
LinphoneContact contact = (LinphoneContact) getItem(position);
|
||||
if (contact == null) return null;
|
||||
Log.e("===>> getView - contact : isAndroidContact = "+contact.isAndroidContact()+" - is LinphoneFriend = "+contact.isLinphoneFriend());
|
||||
contact.refresh();
|
||||
|
||||
if (convertView != null) {
|
||||
view = convertView;
|
||||
|
|
@ -443,11 +445,17 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
*/
|
||||
AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence);
|
||||
avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_SMALL);
|
||||
if(contact != null && contact.isLinphoneFriend() && contact.getFriendPresenceModel() != null) {
|
||||
if(contact != null ) {
|
||||
avatarWithPresenceImage.setLinphoneContact(contact);
|
||||
LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage);
|
||||
if (contact.isLinphoneFriend()) {
|
||||
Log.e("===>> getView - contact != null");
|
||||
LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage);
|
||||
}
|
||||
}else {
|
||||
Log.e("===>> getView - everything == null");
|
||||
avatarWithPresenceImage.setLinphoneContact(contact);
|
||||
LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ public class ContactsManager extends ContentObserver {
|
|||
}
|
||||
|
||||
public List<LinphoneContact> fetchContactsAsync() {
|
||||
List<LinphoneContact> contacts = new ArrayList<LinphoneContact>();
|
||||
List<LinphoneContact> contacts = new ArrayList<LinphoneContact>();
|
||||
|
||||
if (mAccount != null && hasContactsAccess()) {
|
||||
Cursor c = Compatibility.getContactsCursor(contentResolver, null);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
try {
|
||||
LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||
if (contact != null && contact.isLinphoneFriend() && contact.getFriendPresenceModel() != null) {
|
||||
if (contact != null && contact.isLinphoneFriend() ) {
|
||||
avatarWithPresenceImage.setLinphoneContact(contact);
|
||||
LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
// }
|
||||
|
||||
holder.avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_SMALL);
|
||||
if(c != null && c.isLinphoneFriend() && c.getFriendPresenceModel() != null) {
|
||||
if(c != null && c.isLinphoneFriend() ) {
|
||||
holder.avatarWithPresenceImage.setLinphoneContact(c);
|
||||
LinphoneActivity.instance().addPresenceUpdatedListener(holder.avatarWithPresenceImage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,8 +148,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||
}
|
||||
|
||||
listeners = new ArrayList<AvatarWithPresenceImage>();
|
||||
//Obiane specifics
|
||||
//HTTP to HTTPS migration
|
||||
//HTTP to HTTPS migrationf
|
||||
if(LinphonePreferences.instance().getRemoteProvisioningUrl() != null) {
|
||||
if(LinphonePreferences.instance().getRemoteProvisioningUrl().startsWith("http://")) {
|
||||
LinphonePreferences.instance().setRemoteProvisioningUrl(LinphonePreferences.instance().getRemoteProvisioningUrl().replace("http://", "https://"));
|
||||
|
|
@ -282,8 +283,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
|
||||
@Override
|
||||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
||||
Log.e("===>> LinphoneActivity : notifyPresenceReceived 1 : "+lf.getName().toString());
|
||||
for(AvatarWithPresenceImage listener : listeners){
|
||||
Log.e("===>> LinphoneActivity : notifyPresenceReceived : "+lf.getName().toString());
|
||||
Log.e("===>> LinphoneActivity : notifyPresenceReceived 2 : "+lf.getName().toString());
|
||||
if(listener.isThisFriend(lf)){
|
||||
listener.updatePresenceIcon(lc, lf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.linphone.core.LinphoneCoreException;
|
|||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneFriend.SubscribePolicy;
|
||||
import org.linphone.core.PresenceActivityType;
|
||||
import org.linphone.core.PresenceModel;
|
||||
import org.linphone.mediastream.Log;
|
||||
|
||||
|
|
@ -417,6 +418,13 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
}
|
||||
}
|
||||
}else if (isLinphoneFriend()) {
|
||||
friend.enableSubscribes(true);
|
||||
friend.setIncSubscribePolicy(SubscribePolicy.SPAccept);
|
||||
PresenceModel model = LinphoneCoreFactory.instance().createPresenceModel(PresenceActivityType.Online, null);
|
||||
//friend.setPresenceModel(model);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -433,7 +441,10 @@ public class LinphoneContact implements Serializable, Comparable<LinphoneContact
|
|||
}
|
||||
|
||||
public PresenceModel getFriendPresenceModel(){
|
||||
if(friend != null)return friend.getPresenceModel();
|
||||
if(friend != null) {
|
||||
Log.e("===>> getFriendPresenceModel - friend != null : "+friend.getPresenceModel());
|
||||
return friend.getPresenceModel();
|
||||
}
|
||||
else return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -243,6 +243,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE;
|
||||
setGsmIdle(gsmIdle);
|
||||
|
||||
instance.enableProxyPublish(true);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
|
@ -349,6 +350,16 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
return false;
|
||||
}
|
||||
|
||||
private void enableProxyPublish( boolean enabled) {
|
||||
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
|
||||
LinphoneProxyConfig[] proxyList = lc.getProxyConfigList();
|
||||
for (LinphoneProxyConfig proxyConfig : proxyList){
|
||||
proxyConfig.edit();
|
||||
proxyConfig.enablePublish(enabled);
|
||||
proxyConfig.done();
|
||||
}
|
||||
}
|
||||
|
||||
public void changeStatusToOnline() {
|
||||
LinphoneCore lc = getLcIfManagerNotDestroyedOrNull();
|
||||
if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Online) {
|
||||
|
|
@ -790,6 +801,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
private void doDestroy() {
|
||||
enableProxyPublish(false);
|
||||
if (LinphoneService.isReady()) // indeed, no need to crash
|
||||
ChatStorage.getInstance().close();
|
||||
|
||||
|
|
@ -809,6 +821,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
}
|
||||
|
||||
public static synchronized void destroy() {
|
||||
instance.enableProxyPublish(false);
|
||||
if (instance == null) return;
|
||||
getInstance().changeStatusToOffline();
|
||||
sExited = true;
|
||||
|
|
@ -853,7 +866,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) {
|
||||
|
||||
// TODO:
|
||||
Log.e("===>> notifyPresenceReceived : "+lf.getName());
|
||||
Log.e("===>> LinphoneMAnager - notifyPresenceReceived : "+lf.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -75,6 +75,8 @@ public class AvatarWithPresenceImage extends RelativeLayout implements onPresenc
|
|||
|
||||
public void setLinphoneContact(LinphoneContact mContact){
|
||||
this.contact = mContact;
|
||||
//this.contact.refresh();
|
||||
updatePresenceIcon(null, null);
|
||||
}
|
||||
|
||||
public boolean isThisFriend(LinphoneFriend myFriend){
|
||||
|
|
@ -102,6 +104,10 @@ public class AvatarWithPresenceImage extends RelativeLayout implements onPresenc
|
|||
friendStatusSmall.setImageResource(R.drawable.presence_offline);
|
||||
friendStatusBig.setImageResource(R.drawable.presence_offline);
|
||||
}
|
||||
} else if(contact.isLinphoneFriend()){
|
||||
Log.e("===>>> updateAvatarPresence friend infromation is null ");
|
||||
friendStatusSmall.setImageResource(R.drawable.presence_offline);
|
||||
friendStatusBig.setImageResource(R.drawable.presence_offline);
|
||||
} else{
|
||||
Log.e("===>>> updateAvatarPresence friend is null ");
|
||||
friendStatusSmall.setImageResource(R.drawable.presence_unregistered);
|
||||
|
|
|
|||
|
|
@ -206,22 +206,20 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
|||
|
||||
TextView contact = (TextView) view.findViewById(R.id.contact_header);
|
||||
|
||||
|
||||
|
||||
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
//contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
|
||||
String displayName = nativeMessage.getFrom().getUserName();
|
||||
final String sipUri = nativeMessage.getFrom().asStringUriOnly();
|
||||
if(!nativeMessage.isOutgoing()) {
|
||||
if (c != null) {
|
||||
displayName = c.getFullName();
|
||||
LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, c.getPhotoUri(), c.getThumbnailUri());
|
||||
} else {
|
||||
contactPicture.setImageResource(R.drawable.avatar);
|
||||
// LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, c.getPhotoUri(), c.getThumbnailUri());
|
||||
//} else {
|
||||
// contactPicture.setImageResource(R.drawable.avatar);
|
||||
}
|
||||
}
|
||||
|
||||
contact.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName);
|
||||
|
||||
}
|
||||
|
||||
public View getView() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue