GithubHelp home page GithubHelp logo

sphchatbubble's People

Contributors

gitter-badger avatar sibahota059 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sphchatbubble's Issues

Pull to Refresh load earlier Message Issue

Hi Siba
There is a issue when you continue pull earlier message. You keep add more and more data into memory. It could be a big problem when the user have large number of earlier message,and keep drag pull them to the array.
I think you should do some memory management when the table is scrolling. Remove some no longer visible data , and preload some data in advance according to the scrolling direction.

Thanks.

not able to sent message and see in same screen as sender and receiver xmpp

i am working on XMPP based ios project. i am tring to send message but i am not able to send message. means receiver will not receive the message.
here is my code.

- (IBAction)sendMessageNow:(id)sender
{

 NSString *messageStr =messageField.text;

if([messageStr length] > 0)
{
    NSLog(@"Message sending fron Gmail");
    NSXMLElement *body = [NSXMLElement elementWithName:@"body"];
    [body setStringValue:messageStr];
    NSXMLElement *message = [NSXMLElement elementWithName:@"message"];
    [message addAttributeWithName:@"type" stringValue:@"chat"];
    [message addAttributeWithName:@"to" stringValue:@"destination address"];
    [message addChild:body];
    NSLog(@"message1%@",message);

    [[self appDelegate].xmppStream sendElement:message];
}

  NSDate *date = [NSDate date];
  NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
 [formatter setDateFormat:@"hh:mm a"];
//[self sendMessage];

if ([self.messageField.text length]>0) {

    if (isfromMe)
    {
        NSString *rowNum=[NSString stringWithFormat:@"%d",(int)sphBubbledata.count];
        [self adddMediaBubbledata:kTextByme mediaPath:self.messageField.text mtime:[formatter stringFromDate:date] thumb:@"" downloadstatus:@"" sendingStatus:kSending msg_ID:[self genRandStringLength:7]];
        [self performSelector:@selector(messageSent:) withObject:rowNum afterDelay:1];

        isfromMe=NO;
    }
    else
    {
        [self adddMediaBubbledata:kTextByOther mediaPath:self.messageField.text mtime:[formatter stringFromDate:date] thumb:@"" downloadstatus:@"" sendingStatus:kSent msg_ID:[self genRandStringLength:7]];
        isfromMe=YES;
    }
    self.messageField.text=@"";
    [self.chattable reloadData];
    [self scrollTableview];
  }
  }

and here is my senderdidreceivemessage method from appdelegate.m

- (void)xmppStream:(XMPPStream *)sender didReceiveMessage:(XMPPMessage *)message
 {
   DDLogVerbose(@"%@: %@", THIS_FILE, THIS_METHOD);


 [[self xmppStream] sendElement:message];

        UILocalNotification *localNotification = [[UILocalNotification alloc] init];
    localNotification.alertAction = @"OK";
   localNotification.fireDate = [NSDate date];
  //  localNotification.alertBody = xmppmessage;
 localNotification.soundName = UILocalNotificationDefaultSoundName;
   [[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];




   // A simple example of inbound message handling.

if ([message isChatMessageWithBody])
 {
    XMPPUserCoreDataStorageObject *user = [xmppRosterStorage userForJID:[message from]
                                                             xmppStream:xmppStream
                                                   managedObjectContext:[self managedObjectContext_roster]];

    NSString *body = [[message elementForName:@"body"] stringValue];
    NSString *displayName = [user displayName];

    if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
    {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:displayName
                                                            message:body
                                                            delegate:nil
                                                  cancelButtonTitle:@"Ok"
                                                  otherButtonTitles:nil];
        [alertView show];
    }
    else
    {
        // We are not active, so use a local notification instead
          UILocalNotification *localNotification =     [[UILocalNotification alloc] init];
        localNotification.alertAction = @"Ok";
        localNotification.alertBody = [NSString stringWithFormat:@"From: %@\n\n%@",displayName,body];

        [[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
    }
  }
}

EDIT

   - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
  static NSString *L_CellIdentifier = @"SPHTextBubbleCell";
  static NSString *R_CellIdentifier = @"SPHMediaBubbleCell";



   SPH_PARAM_List *feed_data=[[SPH_PARAM_List alloc]init];
   feed_data=[sphBubbledata objectAtIndex:indexPath.row];

   if ([feed_data.chat_media_type isEqualToString:kTextByme]||[feed_data.chat_media_type isEqualToString:kTextByOther])
   {
     SPHTextBubbleCell *cell = (SPHTextBubbleCell *) [tableView dequeueReusableCellWithIdentifier:L_CellIdentifier];
      if (cell == nil)
     {
        cell = [[SPHTextBubbleCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:L_CellIdentifier];
    }
    XMPPUserCoreDataStorageObject *user = [[self fetchedResultsController] objectAtIndexPath:indexPath];
    //cell.textLabel.text = user.displayName;
    //[self configurePhotoForCell:cell user:user];


    cell.bubbletype=([feed_data.chat_media_type isEqualToString:kTextByme])?@"LEFT":@"RIGHT";
    cell.textLabel.text = user.displayName;
    cell.textLabel.tag=indexPath.row;

    cell.timestampLabel.text =  @"02:20 AM";
    cell.CustomDelegate=self;
    cell.AvatarImageView.image=([feed_data.chat_media_type isEqualToString:kTextByme])?[UIImage imageNamed:@"ProfilePic"]:[UIImage imageNamed:@"person"];
  //  cell.AvatarImageView.image=[
    [self configurePhotoForCell:cell user:user] ;
    return cell;

   }



 SPHMediaBubbleCell *cell = (SPHMediaBubbleCell *) [tableView dequeueReusableCellWithIdentifier:R_CellIdentifier];
if (cell == nil)
 {
    cell = [[SPHMediaBubbleCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:R_CellIdentifier];
 }
cell.bubbletype=([feed_data.chat_media_type isEqualToString:kImagebyme])?@"LEFT":@"RIGHT";
cell.textLabel.text = feed_data.chat_message;
cell.messageImageView.tag=indexPath.row;
cell.CustomDelegate=self;
cell.timestampLabel.text = @"02:20 AM";
cell.AvatarImageView.image=([feed_data.chat_media_type isEqualToString:kImagebyme])?[UIImage imageNamed:@"ProfilePic"]:[UIImage imageNamed:@"person"];

return cell;
}

and configure photo method

- (void)configurePhotoForCell:(UITableViewCell *)cell user:(XMPPUserCoreDataStorageObject *)user
 {
// Our xmppRosterStorage will cache photos as they arrive from the xmppvCardAvatarModule.
// We only need to ask the avatar module for a photo, if the roster doesn't have it.

if (user.photo != nil)
{
    cell.imageView.image = user.photo;
}
else
{
    NSData *photoData = [[[self appDelegate] xmppvCardAvatarModule] photoDataForJID:user.jid];

    if (photoData != nil)
        cell.imageView.image = [UIImage imageWithData:photoData];
    else
        cell.imageView.image = [UIImage imageNamed:@"user2"];
  }
 }

EDIT

Both are send by me but it looks in same window, when i click on one time send button it looks in sender message and second time looks in receiver message. and receiver will not receive message.

Error

EDIT

Here is response after i click on send button.

function:-[ChathistryViewController sendMessageNow:] line:414 content:Message sending fron Gmail
function:-[ChathistryViewController sendMessageNow:] line:421 content:message1ghfhxfghh
2015-06-12 13:03:22:071 projectname[7556:2f03] SEND: ghfhxfghh
2015-06-12 13:03:22:389 projectname[7556:7347] RECV: ghfhxfghh
2015-06-12 13:03:22:390 CloseChat[7556:2f03] SEND: ghfhxfghh
2015-06-12 13:03:22.393 projectname[7556:49110] Attempting to schedule a local notification <UIConcreteLocalNotification: 0x7fcfcd90cdd0>{fire date = (null), time zone = (null), repeat interval = 0, repeat count = UILocalNotificationInfiniteRepeatCount, next fire date = Friday, June 12, 2015 at 1:03:22 PM India Standard Time, user info = (null)} with a sound but haven't received permission from the user to play sounds
2015-06-12 13:03:22:697 CloseChat[7556:7347] RECV: <stream:error xmlns:stream="http://etherx.jabber.org/streams">/stream:error
2015-06-12 13:03:23:004 projectname[7556:7347] SEND:
2015-06-12 13:03:23:004 projectname[7556:7347] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='jwchat.org'>
2015-06-12 13:03:23:619 projectname[7556:7347] RECV: <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" id="2203821381" from="jwchat.org" version="1.0" stream1:lang="en"/>
2015-06-12 13:03:23:619 projectname[7556:7347] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">/stream:features
2015-06-12 13:03:23:619 CloseChat[7556:7347] SEND:
2015-06-12 13:03:23:925 projectname[7556:7347] RECV:
2015-06-12 13:03:23:926 projectname[7556:7347] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='jwchat.org'>
2015-06-12 13:03:25:063 projectname[7556:7627] RECV: <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" id="3121080186" from="jwchat.org" version="1.0" stream1:lang="en"/>
2015-06-12 13:03:25:064 projectname[7556:7347] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">PLAINDIGEST-MD5SCRAM-SHA-1/stream:features
2015-06-12 13:03:25:065 CloseChat[7556:607] SEND: biwsbj1jaGlyYWcscj1EMjUxMEQ2NC05MzZFLTQxMkUtQjY1Ri0zM0VFQjE1ODcxRjc=
2015-06-12 13:03:25:306 projectname[7556:7347] RECV: cj1EMjUxMEQ2NC05MzZFLTQxMkUtQjY1Ri0zM0VFQjE1ODcxRjdXVnB5eEp3b2lCRC9rUThvRkdhbGdRPT0scz1DZVZpSFFXNW9XRDVVNU90WUNMWExnPT0saT00MDk2
2015-06-12 13:03:25:321 projectname[7556:7347] SEND: Yz1iaXdzLHI9RDI1MTBENjQtOTM2RS00MTJFLUI2NUYtMzNFRUIxNTg3MUY3V1ZweXhKd29pQkQva1E4b0ZHYWxnUT09LHA9TWlsaW5TczI4b2VBd1dtQ3pWY21TWXZQWEFnPQ==
2015-06-12 13:03:25:562 projectname[7556:7627] RECV: dj1WeVdSaWRTTHVxYzhkV0E2aEg3OW9mU0FpYmc9
2015-06-12 13:03:25:562 projectname[7556:7627] SEND: <stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='jwchat.org'>
2015-06-12 13:03:25:871 projectname[7556:7627] RECV: <stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" id="1662838027" from="jwchat.org" version="1.0" stream1:lang="en"/>
2015-06-12 13:03:25:871 projectname[7556:7627] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">/stream:features
2015-06-12 13:03:25:872 projectname[7556:7627] SEND:
2015-06-12 13:03:26:178 projectname[7556:7347] RECV: [email protected]/341204969114349440629043
2015-06-12 13:03:26:179 projectname[7556:7347] SEND:
2015-06-12 13:03:26:485 projectname[7556:7347] RECV:
2015-06-12 13:03:26:486 projectname[7556:7627] SEND:
2015-06-12 13:03:26:487 projectname[7556:7347] SEND:
2015-06-12 13:03:26:488 projectname[7556:7627] SEND:
2015-06-12 13:03:26:714 projectname[7556:7347] RECV:
2015-06-12 13:03:26:946 projectname[7556:7347] RECV:
2015-06-12 13:03:26:947 projectname[7556:6e13] SEND:
2015-06-12 13:03:26:948 projectname[7556:6e13] RECV:
2015-06-12 13:03:27:180 projectname[7556:7627] RECV:

How to know the indexpath of image when user click it?

I need to know which image user clicked(to see in full screen) from chat screen. for this i added UITapGestureRecognizer on the image, i'm able to find indexpath but image doesn't turn into full screen mode, because didTap method of MHFacebookImageViewer class didn't get called .Any help?

CocoaPods

Please submit your component to CocoaPods ;)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.