@Override void clearConversation() { super.clearConversation(); this.messageDB.clearConversation(); if (secret) { NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(this.receiver, CLEAR_SECRET_MESSAGES); nc.postNotification(notification); } else { NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(this.receiver, CLEAR_MESSAGES); nc.postNotification(notification); } }
@Override void clearConversation() { super.clearConversation(); CustomerMessageDB db = CustomerMessageDB.getInstance(); db.clearCoversation(this.storeID); NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(this.storeID, CLEAR_MESSAGES); nc.postNotification(notification); } }
@Override protected void clearConversation() { super.clearConversation(); GroupMessageDB db = GroupMessageDB.getInstance(); db.clearCoversation(this.groupID); NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(this.receiver, CLEAR_MESSAGES); nc.postNotification(notification); }
@Override protected void onDestroy() { super.onDestroy(); Log.i(TAG, "peer message activity destory"); if (secret) { NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(this.receiver, CLEAR_SECRET_NEW_MESSAGES); nc.postNotification(notification); } else { NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(this.receiver, CLEAR_NEW_MESSAGES); nc.postNotification(notification); } PeerOutbox.getInstance().removeObserver(this); IMService.getInstance().removeObserver(this); IMService.getInstance().removePeerObserver(this); FileDownloader.getInstance().removeObserver(this); }
@Override protected void onDestroy() { super.onDestroy(); Log.i(TAG, "peer message activity destory"); NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(this.groupID, CLEAR_NEW_MESSAGES); nc.postNotification(notification); GroupOutbox.getInstance().removeObserver(this); IMService.getInstance().removeObserver(this); IMService.getInstance().removeGroupObserver(this); FileDownloader.getInstance().removeObserver(this); }
@Override protected void onDestroy() { super.onDestroy(); Log.i(TAG, "peer message activity destory"); NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(this.storeID, CLEAR_NEW_MESSAGES); nc.postNotification(notification); CustomerOutbox.getInstance().removeObserver(this); IMService.getInstance().removeObserver(this); IMService.getInstance().removeCustomerServiceObserver(this); FileDownloader.getInstance().removeObserver(this); }
@Override protected boolean sendMessage(IMessage imsg) { boolean r = true; if (imsg.content.getType() == MessageContent.MessageType.MESSAGE_AUDIO) { GroupOutbox ob = GroupOutbox.getInstance(); Audio audio = (Audio)imsg.content; imsg.setUploading(true); ob.uploadAudio(imsg, FileCache.getInstance().getCachedFilePath(audio.url)); } else if (imsg.content.getType() == MessageContent.MessageType.MESSAGE_IMAGE) { Image image = (Image)imsg.content; //prefix:"file:" String path = image.url.substring(5); imsg.setUploading(true); GroupOutbox.getInstance().uploadImage(imsg, path); } else { IMMessage msg = new IMMessage(); msg.sender = imsg.sender; msg.receiver = imsg.receiver; msg.content = imsg.content.getRaw(); msg.msgLocalID = imsg.msgLocalID; IMService im = IMService.getInstance(); r = im.sendGroupMessage(msg); } NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(imsg, SEND_MESSAGE_NAME); nc.postNotification(notification); return r; }
nc.postNotification(notification); return r;
NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(imsg, SEND_SECRET_MESSAGE_NAME); nc.postNotification(notification); } else { NotificationCenter nc = NotificationCenter.defaultCenter(); Notification notification = new Notification(imsg, SEND_MESSAGE_NAME); nc.postNotification(notification);