{"action":"created","comment":{"url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/comments/67456993","id":67456993,"diff_hunk":"@@ -71,21 +73,40 @@ - (instancetype)init {\n         self.isShowBotRedirectBtn = false;\n         \n         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(socketStatusChanged:) name:MQ_NOTIFICATION_SOCKET_STATUS_CHANGE object:nil];\n+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backFromBackground) name:UIApplicationWillEnterForegroundNotification object:nil];\n+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cleanTimer) name:MQ_NOTIFICATION_CHAT_END object:nil];\n+        \n+        self.positionCheckTimer = [NSTimer scheduledTimerWithTimeInterval:15 target:self selector:@selector(checkAndUpdateWaitingQueueStatus) userInfo:nil repeats:YES];\n #endif\n         currentViewMessageIdSet = [NSMutableSet new];\n     }\n     return self;\n }\n \n+- (void)cleanTimer {\n+    if (self.positionCheckTimer.isValid) {\n+        [self.positionCheckTimer invalidate];\n+        self.positionCheckTimer = nil;\n+    }\n+}\n+\n - (void)dealloc {\n     [[NSNotificationCenter defaultCenter] removeObserver:self];\n }\n \n+- (void)backFromBackground {\n+    if ([MQServiceToViewInterface waitingInQueuePosition] > 0) {\n+        [self setClientOnline];\n+    }\n+}\n+\n #ifdef INCLUDE_MEIQIA_SDK\n - (void)socketStatusChanged:(NSNotification *)notification {\n     static BOOL shouldHandleSocketConnectNotification = NO; //当第一次进入的时候，会收到 socket 连上的消息，但是这个时候并不应该执行重新上线的逻辑，重新上线的逻辑必须是 socket 断开之后才有必要去执行的，这个标志的作用就是在 socket 有过断开的情况才去执行。\n     if ([[notification.userInfo objectForKey:MQ_NOTIFICATION_SOCKET_STATUS_CHANGE] isEqualToString:SOCKET_STATUS_CONNECTED] && shouldHandleSocketConnectNotification) {\n-        [self setClientOnline];\n+        if ([MQServiceToViewInterface waitingInQueuePosition] > 0) {\n+            [self setClientOnline];","path":"Meiqia-SDK-files/MQChatViewController/Controllers/MQChatViewService.m","position":46,"original_position":46,"commit_id":"87a4d17327ded69dd3e6eae0d9e73391ccffae15","original_commit_id":"87a4d17327ded69dd3e6eae0d9e73391ccffae15","user":{"login":"IanLuo","id":1792574,"avatar_url":"https://avatars.githubusercontent.com/u/1792574?v=3","gravatar_id":"","url":"https://api.github.com/users/IanLuo","html_url":"https://github.com/IanLuo","followers_url":"https://api.github.com/users/IanLuo/followers","following_url":"https://api.github.com/users/IanLuo/following{/other_user}","gists_url":"https://api.github.com/users/IanLuo/gists{/gist_id}","starred_url":"https://api.github.com/users/IanLuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IanLuo/subscriptions","organizations_url":"https://api.github.com/users/IanLuo/orgs","repos_url":"https://api.github.com/users/IanLuo/repos","events_url":"https://api.github.com/users/IanLuo/events{/privacy}","received_events_url":"https://api.github.com/users/IanLuo/received_events","type":"User","site_admin":false},"body":"指定客服被转接之后，在上线的话，现在回返回 fail，这个是为了过滤掉这种情况\r\n之前加这个是为了更新可能改变的客服的在线状态，现在加上这个在没有排队的情况下会更新不了，不过相比用户重新连上之后变成留言好些。","created_at":"2016-06-17T03:33:01Z","updated_at":"2016-06-17T03:33:01Z","html_url":"https://github.com/Meiqia/MeiqiaSDK-iOS/pull/119#discussion_r67456993","pull_request_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/119","_links":{"self":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/comments/67456993"},"html":{"href":"https://github.com/Meiqia/MeiqiaSDK-iOS/pull/119#discussion_r67456993"},"pull_request":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/119"}}},"pull_request":{"url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/119","id":74061090,"html_url":"https://github.com/Meiqia/MeiqiaSDK-iOS/pull/119","diff_url":"https://github.com/Meiqia/MeiqiaSDK-iOS/pull/119.diff","patch_url":"https://github.com/Meiqia/MeiqiaSDK-iOS/pull/119.patch","issue_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/issues/119","number":119,"state":"open","locked":false,"title":"更新聊天界面 input bar， 排队支持","user":{"login":"IanLuo","id":1792574,"avatar_url":"https://avatars.githubusercontent.com/u/1792574?v=3","gravatar_id":"","url":"https://api.github.com/users/IanLuo","html_url":"https://github.com/IanLuo","followers_url":"https://api.github.com/users/IanLuo/followers","following_url":"https://api.github.com/users/IanLuo/following{/other_user}","gists_url":"https://api.github.com/users/IanLuo/gists{/gist_id}","starred_url":"https://api.github.com/users/IanLuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IanLuo/subscriptions","organizations_url":"https://api.github.com/users/IanLuo/orgs","repos_url":"https://api.github.com/users/IanLuo/repos","events_url":"https://api.github.com/users/IanLuo/events{/privacy}","received_events_url":"https://api.github.com/users/IanLuo/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-16T11:00:55Z","updated_at":"2016-06-17T03:33:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b76fd94c5be010487ede8a40a2d5057df182fe1b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/119/commits","review_comments_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/119/comments","review_comment_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/issues/119/comments","statuses_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/statuses/87a4d17327ded69dd3e6eae0d9e73391ccffae15","head":{"label":"IanLuo:master","ref":"master","sha":"87a4d17327ded69dd3e6eae0d9e73391ccffae15","user":{"login":"IanLuo","id":1792574,"avatar_url":"https://avatars.githubusercontent.com/u/1792574?v=3","gravatar_id":"","url":"https://api.github.com/users/IanLuo","html_url":"https://github.com/IanLuo","followers_url":"https://api.github.com/users/IanLuo/followers","following_url":"https://api.github.com/users/IanLuo/following{/other_user}","gists_url":"https://api.github.com/users/IanLuo/gists{/gist_id}","starred_url":"https://api.github.com/users/IanLuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IanLuo/subscriptions","organizations_url":"https://api.github.com/users/IanLuo/orgs","repos_url":"https://api.github.com/users/IanLuo/repos","events_url":"https://api.github.com/users/IanLuo/events{/privacy}","received_events_url":"https://api.github.com/users/IanLuo/received_events","type":"User","site_admin":false},"repo":{"id":53825404,"name":"MeiqiaSDK-iOS","full_name":"IanLuo/MeiqiaSDK-iOS","owner":{"login":"IanLuo","id":1792574,"avatar_url":"https://avatars.githubusercontent.com/u/1792574?v=3","gravatar_id":"","url":"https://api.github.com/users/IanLuo","html_url":"https://github.com/IanLuo","followers_url":"https://api.github.com/users/IanLuo/followers","following_url":"https://api.github.com/users/IanLuo/following{/other_user}","gists_url":"https://api.github.com/users/IanLuo/gists{/gist_id}","starred_url":"https://api.github.com/users/IanLuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IanLuo/subscriptions","organizations_url":"https://api.github.com/users/IanLuo/orgs","repos_url":"https://api.github.com/users/IanLuo/repos","events_url":"https://api.github.com/users/IanLuo/events{/privacy}","received_events_url":"https://api.github.com/users/IanLuo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/IanLuo/MeiqiaSDK-iOS","description":"美洽 iOS SDK 3.0 面向开发者的 Demo。","fork":true,"url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS","forks_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/forks","keys_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/teams","hooks_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/hooks","issue_events_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/events","assignees_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/tags","blobs_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/languages","stargazers_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/stargazers","contributors_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/contributors","subscribers_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/subscribers","subscription_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/subscription","commits_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/merges","archive_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/downloads","issues_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/labels{/name}","releases_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/releases{/id}","deployments_url":"https://api.github.com/repos/IanLuo/MeiqiaSDK-iOS/deployments","created_at":"2016-03-14T03:54:21Z","updated_at":"2016-03-14T03:54:22Z","pushed_at":"2016-06-16T10:57:52Z","git_url":"git://github.com/IanLuo/MeiqiaSDK-iOS.git","ssh_url":"git@github.com:IanLuo/MeiqiaSDK-iOS.git","clone_url":"https://github.com/IanLuo/MeiqiaSDK-iOS.git","svn_url":"https://github.com/IanLuo/MeiqiaSDK-iOS","homepage":"","size":206041,"stargazers_count":0,"watchers_count":0,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"Meiqia:master","ref":"master","sha":"fe1ec49b29d54c4c4885e16223107e33a5d38e8d","user":{"login":"Meiqia","id":8907899,"avatar_url":"https://avatars.githubusercontent.com/u/8907899?v=3","gravatar_id":"","url":"https://api.github.com/users/Meiqia","html_url":"https://github.com/Meiqia","followers_url":"https://api.github.com/users/Meiqia/followers","following_url":"https://api.github.com/users/Meiqia/following{/other_user}","gists_url":"https://api.github.com/users/Meiqia/gists{/gist_id}","starred_url":"https://api.github.com/users/Meiqia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Meiqia/subscriptions","organizations_url":"https://api.github.com/users/Meiqia/orgs","repos_url":"https://api.github.com/users/Meiqia/repos","events_url":"https://api.github.com/users/Meiqia/events{/privacy}","received_events_url":"https://api.github.com/users/Meiqia/received_events","type":"Organization","site_admin":false},"repo":{"id":47674876,"name":"MeiqiaSDK-iOS","full_name":"Meiqia/MeiqiaSDK-iOS","owner":{"login":"Meiqia","id":8907899,"avatar_url":"https://avatars.githubusercontent.com/u/8907899?v=3","gravatar_id":"","url":"https://api.github.com/users/Meiqia","html_url":"https://github.com/Meiqia","followers_url":"https://api.github.com/users/Meiqia/followers","following_url":"https://api.github.com/users/Meiqia/following{/other_user}","gists_url":"https://api.github.com/users/Meiqia/gists{/gist_id}","starred_url":"https://api.github.com/users/Meiqia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Meiqia/subscriptions","organizations_url":"https://api.github.com/users/Meiqia/orgs","repos_url":"https://api.github.com/users/Meiqia/repos","events_url":"https://api.github.com/users/Meiqia/events{/privacy}","received_events_url":"https://api.github.com/users/Meiqia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Meiqia/MeiqiaSDK-iOS","description":"美洽 iOS SDK 3.0 面向开发者的 Demo。","fork":false,"url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS","forks_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/forks","keys_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/teams","hooks_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/hooks","issue_events_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/issues/events{/number}","events_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/events","assignees_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/assignees{/user}","branches_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/branches{/branch}","tags_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/tags","blobs_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/git/refs{/sha}","trees_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/statuses/{sha}","languages_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/languages","stargazers_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/stargazers","contributors_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/contributors","subscribers_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/subscribers","subscription_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/subscription","commits_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/commits{/sha}","git_commits_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/git/commits{/sha}","comments_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/comments{/number}","issue_comment_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/issues/comments{/number}","contents_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/contents/{+path}","compare_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/merges","archive_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/downloads","issues_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/issues{/number}","pulls_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls{/number}","milestones_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/milestones{/number}","notifications_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/labels{/name}","releases_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/releases{/id}","deployments_url":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/deployments","created_at":"2015-12-09T07:08:36Z","updated_at":"2016-06-07T02:40:17Z","pushed_at":"2016-06-16T11:00:56Z","git_url":"git://github.com/Meiqia/MeiqiaSDK-iOS.git","ssh_url":"git@github.com:Meiqia/MeiqiaSDK-iOS.git","clone_url":"https://github.com/Meiqia/MeiqiaSDK-iOS.git","svn_url":"https://github.com/Meiqia/MeiqiaSDK-iOS","homepage":"","size":146853,"stargazers_count":32,"watchers_count":32,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":2,"forks":19,"open_issues":2,"watchers":32,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/119"},"html":{"href":"https://github.com/Meiqia/MeiqiaSDK-iOS/pull/119"},"issue":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/issues/119"},"comments":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/issues/119/comments"},"review_comments":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/119/comments"},"review_comment":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/pulls/119/commits"},"statuses":{"href":"https://api.github.com/repos/Meiqia/MeiqiaSDK-iOS/statuses/87a4d17327ded69dd3e6eae0d9e73391ccffae15"}}}}
{"actor":{"display_login":"IanLuo"}}