{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fels_137/pulls/comments/66199115","id":66199115,"diff_hunk":"@@ -7,31 +7,191 @@\n //\n \n #import \"CategoriesViewController.h\"\n+#import \"CategoriesTableViewCell.h\"\n+#import \"iOSRequest.h\"\n+#import \"CategoryItem.h\"\n+#import \"DBUtil.h\"\n+#import \"WordItem.h\"\n+#import \"LessonViewController.h\"\n+#import \"CategoryManager.h\"\n+#import \"WordListManager.h\"\n+#import \"LoadingView.h\"\n+#import \"UIImageView+WebCache.h\"\n \n-@interface CategoriesViewController ()\n+#define CELL_HEIGHT 99\n+@interface CategoriesViewController ()<UITableViewDataSource,UITableViewDelegate,CategoryManagerDelegate,WordListManagerDelegate>\n+\n+@property (weak, nonatomic) IBOutlet UITableView *tableView;\n+@property (nonatomic, strong) NSMutableArray *arrCategories;\n+@property (nonatomic, strong) NSMutableArray *arrWords;\n+@property (nonatomic, strong) LoadingView *loadingView;\n \n @end\n \n @implementation CategoriesViewController\n \n - (void)viewDidLoad {\n     [super viewDidLoad];\n-    // Do any additional setup after loading the view.\n+    \n+   \n+}\n+- (void) viewWillAppear:(BOOL)animated {\n+    [super viewWillAppear:animated];\n+    \n+    self.title = @\"Categories\";\n+    \n+    self.tableView.delegate = self;\n+    self.tableView.dataSource = self;\n+    \n+    [self setupLoadingView];\n+    //Get categories\n+    self.arrCategories = [[NSMutableArray alloc] init];\n+    \n+    [self getCategoriesListWithAuthToken:@\"-Kx03yy94NhYc81Shz63_g\"\n+                                    page:1\n+                             perPageData:10];\n }\n+#pragma mark - LoadingView\n \n-- (void)didReceiveMemoryWarning {\n-    [super didReceiveMemoryWarning];\n-    // Dispose of any resources that can be recreated.\n+- (void) setupLoadingView {\n+    \n+    self.loadingView = [[LoadingView alloc] initWithFrame:[UIScreen mainScreen].bounds];\n+    [self.view addSubview:self.loadingView];\n }\n \n-/*\n-#pragma mark - Navigation\n+- (void) animateDismissLoadingView {\n+    [UIView animateWithDuration:0.1 animations:^{\n+        self.loadingView.alpha = 0;\n+    } completion:^(BOOL finished) {\n+        [self.loadingView removeFromSuperview];\n+        self.loadingView = nil;\n+    }];\n+}\n+#pragma mark - GetCategories\n+- (void) getCategoriesListWithAuthToken:(NSString*)authoToken\n+                                   page:(int) page\n+                            perPageData:(int) perPageData {\n+    CategoryManager *catManager = [CategoryManager new];\n+    catManager.delegate = self;\n+    \n+    [catManager doGetCategoryWithAuthToken:authoToken\n+                                      page:page\n+                               perPageData:perPageData];\n+}\n \n-// In a storyboard-based application, you will often want to do a little preparation before navigation\n-- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {\n-    // Get the new view controller using [segue destinationViewController].\n-    // Pass the selected object to the new view controller.\n+- (void)didReceiveCategoriesWithArray:(NSMutableArray *)arrCategories\n+                            withError:(NSError *)error {\n+    if (error) {\n+        [self turnOnAlertWhenDisconneted];\n+    } else {\n+        [self animateDismissLoadingView];\n+        self.arrCategories = arrCategories;\n+        [self.tableView reloadData];\n+    }\n+}\n+\n+#pragma mark - WorldListManageDelegate\n+- (void) getWordListWithCategoryId:(NSString*) categoriesID\n+                            option:(NSString*) optionWords {\n+    WordListManager *wlManager = [[WordListManager alloc] init];\n+    wlManager.delegate = self;\n+    \n+    [wlManager doGetWordListWithCategoryId:categoriesID\n+                                    option:optionWords\n+                                      page:1\n+                               perPageData:10\n+                                 authToken:@\"-Kx03yy94NhYc81Shz63_g\"];\n+}\n+- (void)didReceiveWordListWithArray:(NSMutableArray *)arrWords withError:(NSError *)error {\n+    \n+    if (!error) {\n+        self.arrWords = arrWords;\n+        [self.tableView reloadData];\n+        \n+    } else {\n+        [self turnOnAlertWhenDisconneted];\n+    }\n+}\n+#pragma mark - AlertController\n+\n+- (void) turnOnAlertWhenDisconneted {\n+    UIAlertController *alerController = [UIAlertController alertControllerWithTitle:@\"Reminder\"\n+                                                                            message:@\"Check internet network,please\"\n+                                                                     preferredStyle:UIAlertControllerStyleActionSheet];\n+    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@\"Reload\"\n+                                                       style:UIAlertActionStyleDefault\n+                                                     handler:^(UIAlertAction * _Nonnull action) {\n+                                                         \n+                                                         [self getCategoriesListWithAuthToken:@\"-Kx03yy94NhYc81Shz63_g\"\n+                                                                                         page:1\n+                                                                                  perPageData:10];\n+                                                         \n+                                                     }];\n+    UIAlertAction *quitAction = [UIAlertAction actionWithTitle:@\"Quit\"\n+                                                       style:UIAlertActionStyleDestructive\n+                                                     handler:^(UIAlertAction * _Nonnull action) {\n+                                                         \n+                                                         exit(0);\n+                                                     }];","path":"Elearning/Elearning/ViewControllers/CategoriesViewController/CategoriesViewController.m","position":140,"original_position":140,"commit_id":"4da122cf081eb75d309a133e14889563d5a0d24c","original_commit_id":"c0cce8d4b636c5caee47d32b4667f66df6da5f6f","user":{"login":"quocnb","id":4478445,"avatar_url":"https://avatars.githubusercontent.com/u/4478445?v=3","gravatar_id":"","url":"https://api.github.com/users/quocnb","html_url":"https://github.com/quocnb","followers_url":"https://api.github.com/users/quocnb/followers","following_url":"https://api.github.com/users/quocnb/following{/other_user}","gists_url":"https://api.github.com/users/quocnb/gists{/gist_id}","starred_url":"https://api.github.com/users/quocnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/quocnb/subscriptions","organizations_url":"https://api.github.com/users/quocnb/orgs","repos_url":"https://api.github.com/users/quocnb/repos","events_url":"https://api.github.com/users/quocnb/events{/privacy}","received_events_url":"https://api.github.com/users/quocnb/received_events","type":"User","site_admin":false},"body":"đưa tất cả interger và string thành const","created_at":"2016-06-08T06:33:45Z","updated_at":"2016-06-08T06:33:45Z","html_url":"https://github.com/framgia/fels_137/pull/13#discussion_r66199115","pull_request_url":"https://api.github.com/repos/framgia/fels_137/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/comments/66199115"},"html":{"href":"https://github.com/framgia/fels_137/pull/13#discussion_r66199115"},"pull_request":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fels_137/pulls/13","id":72655361,"html_url":"https://github.com/framgia/fels_137/pull/13","diff_url":"https://github.com/framgia/fels_137/pull/13.diff","patch_url":"https://github.com/framgia/fels_137/pull/13.patch","issue_url":"https://api.github.com/repos/framgia/fels_137/issues/13","number":13,"state":"open","locked":false,"title":"64741 screen category","user":{"login":"vantientu1703","id":13485031,"avatar_url":"https://avatars.githubusercontent.com/u/13485031?v=3","gravatar_id":"","url":"https://api.github.com/users/vantientu1703","html_url":"https://github.com/vantientu1703","followers_url":"https://api.github.com/users/vantientu1703/followers","following_url":"https://api.github.com/users/vantientu1703/following{/other_user}","gists_url":"https://api.github.com/users/vantientu1703/gists{/gist_id}","starred_url":"https://api.github.com/users/vantientu1703/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vantientu1703/subscriptions","organizations_url":"https://api.github.com/users/vantientu1703/orgs","repos_url":"https://api.github.com/users/vantientu1703/repos","events_url":"https://api.github.com/users/vantientu1703/events{/privacy}","received_events_url":"https://api.github.com/users/vantientu1703/received_events","type":"User","site_admin":false},"body":"Screen category","created_at":"2016-06-06T04:35:37Z","updated_at":"2016-06-08T06:33:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2cd92b494c91f2f53d68429b7ddfe12036a6c67f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fels_137/pulls/13/commits","review_comments_url":"https://api.github.com/repos/framgia/fels_137/pulls/13/comments","review_comment_url":"https://api.github.com/repos/framgia/fels_137/pulls/comments{/number}","comments_url":"https://api.github.com/repos/framgia/fels_137/issues/13/comments","statuses_url":"https://api.github.com/repos/framgia/fels_137/statuses/4da122cf081eb75d309a133e14889563d5a0d24c","head":{"label":"vantientu1703:64741_screen_category","ref":"64741_screen_category","sha":"4da122cf081eb75d309a133e14889563d5a0d24c","user":{"login":"vantientu1703","id":13485031,"avatar_url":"https://avatars.githubusercontent.com/u/13485031?v=3","gravatar_id":"","url":"https://api.github.com/users/vantientu1703","html_url":"https://github.com/vantientu1703","followers_url":"https://api.github.com/users/vantientu1703/followers","following_url":"https://api.github.com/users/vantientu1703/following{/other_user}","gists_url":"https://api.github.com/users/vantientu1703/gists{/gist_id}","starred_url":"https://api.github.com/users/vantientu1703/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vantientu1703/subscriptions","organizations_url":"https://api.github.com/users/vantientu1703/orgs","repos_url":"https://api.github.com/users/vantientu1703/repos","events_url":"https://api.github.com/users/vantientu1703/events{/privacy}","received_events_url":"https://api.github.com/users/vantientu1703/received_events","type":"User","site_admin":false},"repo":{"id":59182394,"name":"fels_137","full_name":"vantientu1703/fels_137","owner":{"login":"vantientu1703","id":13485031,"avatar_url":"https://avatars.githubusercontent.com/u/13485031?v=3","gravatar_id":"","url":"https://api.github.com/users/vantientu1703","html_url":"https://github.com/vantientu1703","followers_url":"https://api.github.com/users/vantientu1703/followers","following_url":"https://api.github.com/users/vantientu1703/following{/other_user}","gists_url":"https://api.github.com/users/vantientu1703/gists{/gist_id}","starred_url":"https://api.github.com/users/vantientu1703/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vantientu1703/subscriptions","organizations_url":"https://api.github.com/users/vantientu1703/orgs","repos_url":"https://api.github.com/users/vantientu1703/repos","events_url":"https://api.github.com/users/vantientu1703/events{/privacy}","received_events_url":"https://api.github.com/users/vantientu1703/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/vantientu1703/fels_137","description":"Framgia E-Learning System (training)","fork":true,"url":"https://api.github.com/repos/vantientu1703/fels_137","forks_url":"https://api.github.com/repos/vantientu1703/fels_137/forks","keys_url":"https://api.github.com/repos/vantientu1703/fels_137/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vantientu1703/fels_137/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vantientu1703/fels_137/teams","hooks_url":"https://api.github.com/repos/vantientu1703/fels_137/hooks","issue_events_url":"https://api.github.com/repos/vantientu1703/fels_137/issues/events{/number}","events_url":"https://api.github.com/repos/vantientu1703/fels_137/events","assignees_url":"https://api.github.com/repos/vantientu1703/fels_137/assignees{/user}","branches_url":"https://api.github.com/repos/vantientu1703/fels_137/branches{/branch}","tags_url":"https://api.github.com/repos/vantientu1703/fels_137/tags","blobs_url":"https://api.github.com/repos/vantientu1703/fels_137/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vantientu1703/fels_137/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vantientu1703/fels_137/git/refs{/sha}","trees_url":"https://api.github.com/repos/vantientu1703/fels_137/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vantientu1703/fels_137/statuses/{sha}","languages_url":"https://api.github.com/repos/vantientu1703/fels_137/languages","stargazers_url":"https://api.github.com/repos/vantientu1703/fels_137/stargazers","contributors_url":"https://api.github.com/repos/vantientu1703/fels_137/contributors","subscribers_url":"https://api.github.com/repos/vantientu1703/fels_137/subscribers","subscription_url":"https://api.github.com/repos/vantientu1703/fels_137/subscription","commits_url":"https://api.github.com/repos/vantientu1703/fels_137/commits{/sha}","git_commits_url":"https://api.github.com/repos/vantientu1703/fels_137/git/commits{/sha}","comments_url":"https://api.github.com/repos/vantientu1703/fels_137/comments{/number}","issue_comment_url":"https://api.github.com/repos/vantientu1703/fels_137/issues/comments{/number}","contents_url":"https://api.github.com/repos/vantientu1703/fels_137/contents/{+path}","compare_url":"https://api.github.com/repos/vantientu1703/fels_137/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vantientu1703/fels_137/merges","archive_url":"https://api.github.com/repos/vantientu1703/fels_137/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vantientu1703/fels_137/downloads","issues_url":"https://api.github.com/repos/vantientu1703/fels_137/issues{/number}","pulls_url":"https://api.github.com/repos/vantientu1703/fels_137/pulls{/number}","milestones_url":"https://api.github.com/repos/vantientu1703/fels_137/milestones{/number}","notifications_url":"https://api.github.com/repos/vantientu1703/fels_137/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vantientu1703/fels_137/labels{/name}","releases_url":"https://api.github.com/repos/vantientu1703/fels_137/releases{/id}","deployments_url":"https://api.github.com/repos/vantientu1703/fels_137/deployments","created_at":"2016-05-19T07:06:25Z","updated_at":"2016-05-18T07:44:05Z","pushed_at":"2016-06-08T06:29:19Z","git_url":"git://github.com/vantientu1703/fels_137.git","ssh_url":"git@github.com:vantientu1703/fels_137.git","clone_url":"https://github.com/vantientu1703/fels_137.git","svn_url":"https://github.com/vantientu1703/fels_137","homepage":null,"size":173,"stargazers_count":0,"watchers_count":0,"language":null,"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":"framgia:develop","ref":"develop","sha":"8f14d38685ceb78ae2d0c319f80c12d7a276aafe","user":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"repo":{"id":59093360,"name":"fels_137","full_name":"framgia/fels_137","owner":{"login":"framgia","id":2322183,"avatar_url":"https://avatars.githubusercontent.com/u/2322183?v=3","gravatar_id":"","url":"https://api.github.com/users/framgia","html_url":"https://github.com/framgia","followers_url":"https://api.github.com/users/framgia/followers","following_url":"https://api.github.com/users/framgia/following{/other_user}","gists_url":"https://api.github.com/users/framgia/gists{/gist_id}","starred_url":"https://api.github.com/users/framgia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/framgia/subscriptions","organizations_url":"https://api.github.com/users/framgia/orgs","repos_url":"https://api.github.com/users/framgia/repos","events_url":"https://api.github.com/users/framgia/events{/privacy}","received_events_url":"https://api.github.com/users/framgia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/framgia/fels_137","description":"Framgia E-Learning System (training)","fork":false,"url":"https://api.github.com/repos/framgia/fels_137","forks_url":"https://api.github.com/repos/framgia/fels_137/forks","keys_url":"https://api.github.com/repos/framgia/fels_137/keys{/key_id}","collaborators_url":"https://api.github.com/repos/framgia/fels_137/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/framgia/fels_137/teams","hooks_url":"https://api.github.com/repos/framgia/fels_137/hooks","issue_events_url":"https://api.github.com/repos/framgia/fels_137/issues/events{/number}","events_url":"https://api.github.com/repos/framgia/fels_137/events","assignees_url":"https://api.github.com/repos/framgia/fels_137/assignees{/user}","branches_url":"https://api.github.com/repos/framgia/fels_137/branches{/branch}","tags_url":"https://api.github.com/repos/framgia/fels_137/tags","blobs_url":"https://api.github.com/repos/framgia/fels_137/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/framgia/fels_137/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/framgia/fels_137/git/refs{/sha}","trees_url":"https://api.github.com/repos/framgia/fels_137/git/trees{/sha}","statuses_url":"https://api.github.com/repos/framgia/fels_137/statuses/{sha}","languages_url":"https://api.github.com/repos/framgia/fels_137/languages","stargazers_url":"https://api.github.com/repos/framgia/fels_137/stargazers","contributors_url":"https://api.github.com/repos/framgia/fels_137/contributors","subscribers_url":"https://api.github.com/repos/framgia/fels_137/subscribers","subscription_url":"https://api.github.com/repos/framgia/fels_137/subscription","commits_url":"https://api.github.com/repos/framgia/fels_137/commits{/sha}","git_commits_url":"https://api.github.com/repos/framgia/fels_137/git/commits{/sha}","comments_url":"https://api.github.com/repos/framgia/fels_137/comments{/number}","issue_comment_url":"https://api.github.com/repos/framgia/fels_137/issues/comments{/number}","contents_url":"https://api.github.com/repos/framgia/fels_137/contents/{+path}","compare_url":"https://api.github.com/repos/framgia/fels_137/compare/{base}...{head}","merges_url":"https://api.github.com/repos/framgia/fels_137/merges","archive_url":"https://api.github.com/repos/framgia/fels_137/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/framgia/fels_137/downloads","issues_url":"https://api.github.com/repos/framgia/fels_137/issues{/number}","pulls_url":"https://api.github.com/repos/framgia/fels_137/pulls{/number}","milestones_url":"https://api.github.com/repos/framgia/fels_137/milestones{/number}","notifications_url":"https://api.github.com/repos/framgia/fels_137/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/framgia/fels_137/labels{/name}","releases_url":"https://api.github.com/repos/framgia/fels_137/releases{/id}","deployments_url":"https://api.github.com/repos/framgia/fels_137/deployments","created_at":"2016-05-18T07:44:05Z","updated_at":"2016-05-18T07:44:05Z","pushed_at":"2016-06-08T06:29:19Z","git_url":"git://github.com/framgia/fels_137.git","ssh_url":"git@github.com:framgia/fels_137.git","clone_url":"https://github.com/framgia/fels_137.git","svn_url":"https://github.com/framgia/fels_137","homepage":null,"size":202,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":4,"forks":2,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/13"},"html":{"href":"https://github.com/framgia/fels_137/pull/13"},"issue":{"href":"https://api.github.com/repos/framgia/fels_137/issues/13"},"comments":{"href":"https://api.github.com/repos/framgia/fels_137/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fels_137/statuses/4da122cf081eb75d309a133e14889563d5a0d24c"}}}}
{"actor":{"display_login":"quocnb"}}