ChatSecure / ChatSecure-iOS

ChatSecure is a free and open source encrypted chat client for iOS that supports OTR and OMEMO encryption over XMPP.
https://chatsecure.org
Other
3.13k stars 1.03k forks source link

App disconnect in backgroung #200

Closed KeyideasGlobal closed 10 years ago

KeyideasGlobal commented 10 years ago

When app go to background after some time its disconnect how we prevent this.

thanks in Adv mahendra

vitalyster commented 10 years ago

See https://chatsecure.org/faq/

KeyideasGlobal commented 10 years ago

Thank u,

but Im + is similar like Chat secure and its live in background , can you give me any idea how this happened.

vitalyster commented 10 years ago

@KeyideasGlobal IM+ relies on their own server which stores your account data and send your private messages to Apple Push service. Do you want to rename ChatSecure to ChatInsecure? :)

KeyideasGlobal commented 10 years ago

Thank you can you tell me process of push notification in jabber/xmpp . i know about simple push notification service

Thanks mahendra

KeyideasGlobal commented 10 years ago

how we stop its disconnect process when app go to background . can u tell me what is the exact function within which class who is responsible for disconnection and again connection if u.

Thanks in Adv mahendra

KeyideasGlobal commented 10 years ago

Hi i want to get all registered user i got a function like

but i don't know which xml class have this function . in my xmpp framework library haven't this function how can i got all register user list within a perticular domain. plz help me

Thanks Mahendra

xn-zhao commented 10 years ago

In file OTRAppDelegate.m go to function: - (void) timerUpdate:(NSTimer)timer comment this fragment: // if ([application backgroundTimeRemaining] < 10) // { // // Clean up here // [self.backgroundTimer invalidate]; // self.backgroundTimer = nil; //
// OTRProtocolManager
protocolManager = [OTRProtocolManager sharedInstance]; // for(id key in protocolManager.protocolManagers) // { // id protocol = [protocolManager.protocolManagers objectForKey:key]; // [protocol disconnect]; // } // [OTRManagedAccount resetAccountsConnectionStatus]; //
//
// [application endBackgroundTask:self.backgroundTask]; // self.backgroundTask = UIBackgroundTaskInvalid; // }

KeyideasGlobal commented 10 years ago

Thanks for reply i think its helpful for me and above query to get all registered user i use xmpp 0055 framework its running get. i will try your code.

Thanks a lot Mahendra

KeyideasGlobal commented 10 years ago

Hi, could you tell me which xmpp api give us buddy list and all friends(buddy in formation like picture/display name/ etc) in iOS app.

Thanks Mahendra Pratap Singh.

xn-zhao commented 10 years ago

this is an example of buddy list in some view controllers, you can use it to fetch all contacts. (this is example in OTRBuddyListViewController) , you can use this code in the other viewController when you want to get contact list. -(NSFetchedResultsController *)buddyFetchedResultsController{ if (_buddyFetchedResultsController) { return _buddyFetchedResultsController; }

NSPredicate * buddyFilter = [NSPredicate predicateWithFormat:@"accountName != nil OR displayName != nil"];

_buddyFetchedResultsController = [OTRManagedBuddy MR_fetchAllGroupedBy:nil withPredicate:buddyFilter sortedBy:@"currentStatus,displayName" ascending:YES delegate:self];

return _buddyFetchedResultsController;

}

KeyideasGlobal commented 10 years ago

Hi , thanks for reply, i have another problem could you tell me how filter in online friend section which have unread message top then alphabetical sorting in section.

-(NSFetchedResultsController ) onlineBuddiesFetchedResultsController { if(_onlineBuddiesFetchedResultsController) { return _onlineBuddiesFetchedResultsController; } //roxie//comented_for_showing_online_user_too NSPredicate * onlineBuddyFilter = [NSPredicate predicateWithFormat:@"%K == %d",OTRManagedBuddyAttributes.currentStatus,OTRBuddyStatusAvailable]; //end// NSPredicate * selfBuddyFilter = [NSPredicate predicateWithFormat:@"accountName != account.username"]; NSPredicate * compoundPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[onlineBuddyFilter, selfBuddyFilter]]; NSString \ sortByString = [NSString stringWithFormat:@"%@",OTRManagedBuddyAttributes.accountName]; _onlineBuddiesFetchedResultsController = [OTRManagedBuddy MR_fetchAllGroupedBy:nil withPredicate:compoundPredicate sortedBy:sortByString ascending:YES delegate:self];

// NSMutableArray arr=[[NSMutableArray alloc]initWithArray:[_onlineBuddiesFetchedResultsController fetchedObjects]]; //
// NSLog(@"fetchedObjects] %@",[_onlineBuddiesFetchedResultsController fetchedObjects]); // for (int i=0; i<[arr count]; i++) { // OTRManagedBuddy
buddy =[arr objectAtIndex:i]; // if ([buddy numberOfUnreadMessages]>1) { // [arr removeObjectAtIndex:i]; // [arr insertObject:buddy atIndex:0]; // } // } // // _onlineBuddiesFetchedResultsController=nil; // _onlineBuddiesFetchedResultsController=(NSFetchedResultsController *)arr;

// for (int i=0; i<[[_onlineBuddiesFetchedResultsController fetchedObjects] count]; i++) { //
// OTRManagedBuddy *buddy =[[_onlineBuddiesFetchedResultsController fetchedObjects] objectAtIndex:i]; // if ([buddy numberOfUnreadMessages]>1) { // NSLog(@"BUDDY....%@",buddy.accountName); // // [[_onlineBuddiesFetchedResultsController fetchedObjects] delete:buddy]; // // [[_onlineBuddiesFetchedResultsController fetchedObjects] d//insertObject:buddy atIndex:0]; // } // }

return _onlineBuddiesFetchedResultsController;

}

Plz help me shorting this out.

Thanks Mahendra

chrisballinger commented 10 years ago

Please keep discussion of each topic in a separate issue