{"action":"created","comment":{"url":"https://api.github.com/repos/framgia/fels_137/pulls/comments/67278424","id":67278424,"diff_hunk":"@@ -7,31 +7,290 @@\n //\n \n #import \"LessonViewController.h\"\n+#import \"WordItem.h\"\n+#import \"DBUtil.h\"\n+#import \"AnswerItem.h\"\n+#import \"ResultViewController.h\"\n+#import \"LessonCategoryManager.h\"\n+#import \"LessonCategoryItem.h\"\n+#import \"LoadingView.h\"\n+#import \"Constants.h\"\n \n-@interface LessonViewController ()\n+@interface LessonViewController ()<UIScrollViewDelegate,LessonCategoryManagerDelegate>\n+\n+@property (weak, nonatomic) IBOutlet UILabel *labelTotalWords;\n+@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;\n+@property (weak, nonatomic) IBOutlet UIButton *btnAnswer1;\n+@property (weak, nonatomic) IBOutlet UIButton *btnAnswer2;\n+@property (weak, nonatomic) IBOutlet UIButton *btnAnswer3;\n+@property (weak, nonatomic) IBOutlet UIButton *btnAnswer4;\n+@property (strong, nonatomic) NSMutableArray *arrAnswers;\n+@property (strong, nonatomic) NSMutableArray *arrWords;\n+@property (strong, nonatomic) NSMutableArray *arrLearnedWords;\n+@property (strong, nonatomic) LessonCategoryItem *lesson;\n+@property (strong, nonatomic) LoadingView *loadingView;\n+@property (strong, nonatomic) User *user;\n \n @end\n \n @implementation LessonViewController\n+{\n+    NSInteger _pagingAtScrollView;\n+    NSInteger _numberOfLearnedWords;\n+}\n \n+NSString *const TITLER_REMINDER_CONTROLLER = @\"Reminder\";\n+NSString *const RELOAD_ACT_CONTROLLER = @\"Reload\";\n+NSString *const QUIT_ACT_CONTROLLER = @\"Quit\";\n+NSString *const CHECK_INTERNET = @\"Check internet network,please\";\n+NSInteger const NUMBER_OF_PAGE_SCROLLVIEW = 5;\n+NSInteger const NUMBER_OF_TAG = 4;\n - (void)viewDidLoad {\n     [super viewDidLoad];\n-    // Do any additional setup after loading the view.\n+    self.title = self.categoryItem.name;\n+    self.user = [StoreData getUser];\n+    [self setupLoadingView];\n+    _pagingAtScrollView = 0;\n+    self.scrollView.delegate = self;\n+    self.scrollView.pagingEnabled = YES;\n+    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(btnResultView:)];\n+    [self getLessonWithCategoryID:self.categoryItem.ID authToken:self.user.authToken];\n+}\n+\n+#pragma mark - LoadingView\n+\n+- (void)setupLoadingView {\n+    self.loadingView = [[LoadingView alloc] initWithFrame:[UIScreen mainScreen].bounds];\n+    [self.view addSubview:self.loadingView];\n+}\n+- (void)animateDismissLoadingView {\n+    [UIView animateWithDuration:0.1f animations:^{\n+        self.loadingView.alpha = 0.f;\n+    } completion:^(BOOL finished) {\n+        [self.loadingView removeFromSuperview];\n+    }];\n }\n+- (IBAction)btnResultView:(id)sender {\n \n-- (void)didReceiveMemoryWarning {\n-    [super didReceiveMemoryWarning];\n-    // Dispose of any resources that can be recreated.\n+//    UIStoryboard *st = [UIStoryboard storyboardWithName:@\"SecondStoryboard\" bundle:nil];\n+//    ResultViewController *revc = [st instantiateViewControllerWithIdentifier:@\"resultviewcontroller\"];\n+//    \n+//    revc.arrLearnedWords = self.arrLearnedWords;\n+//    revc.arrWords = self.arrWords;\n+//    \n+//    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:revc];\n+//    nav.modalPresentationStyle = UIModalPresentationFormSheet;\n+//    [self presentViewController:nav animated:YES completion:nil];\n }\n \n-/*\n-#pragma mark - Navigation\n+#pragma mark - LessonCategoryManagerDelegate\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)getLessonWithCategoryID:(NSString *)categoryID\n+                       authToken:(NSString *)authToken{\n+    LessonCategoryManager *lessManager = [[LessonCategoryManager alloc] init];\n+    lessManager.delegate = self;\n+    [lessManager getLessonWithCategoryId:categoryID authToken:authToken];\n+}\n+- (void)didReceiveLessonObject:(LessonCategoryItem *)lesson\n+                       message:(NSString *)message\n+                         error:(NSError *)error {\n+    if (error) {\n+        [self turnOnAlertWithMessage:message];\n+    } else {\n+        if (!message.length) {\n+            [self animateDismissLoadingView];\n+            self.lesson = lesson;\n+            [self loadData];\n+        } else {\n+            [self turnOnAlertWithMessage:message];\n+        }\n+    }\n+}\n+- (void)didReceiveUpdateLessonWithBool:(BOOL)success withMessage:(NSString *)message{\n+    if (success) {\n+        if (message.length) {\n+            [self turnOnAlertWithMessage:message];\n+        }\n+    } else {\n+        [self turnOnAlertWithMessage:message];\n+    }\n+}\n+#pragma mark - AlertController\n+\n+- (void)turnOnAlertWithMessage:(NSString *)message {\n+    UIAlertController *alerController;\n+    if (!message.length) {\n+        alerController = [UIAlertController alertControllerWithTitle:TITLER_REMINDER_CONTROLLER message:CHECK_INTERNET preferredStyle:UIAlertControllerStyleActionSheet];\n+    } else {\n+        alerController = [UIAlertController alertControllerWithTitle:TITLER_REMINDER_CONTROLLER message:message preferredStyle:UIAlertControllerStyleActionSheet];\n+    }\n+    UIAlertAction *reloadAction = [UIAlertAction actionWithTitle:RELOAD_ACT_CONTROLLER style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {\n+    }];\n+    UIAlertAction *quitAction = [UIAlertAction actionWithTitle:QUIT_ACT_CONTROLLER style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {\n+        exit(0);\n+    }];\n+    [alerController addAction:reloadAction];\n+    [alerController addAction:quitAction];\n+    [self presentViewController:alerController\n+                       animated:YES\n+                     completion:nil];\n+}\n+- (void)loadData {\n+    self.arrWords = self.lesson.arrWords;\n+    self.arrLearnedWords = [[NSMutableArray alloc] init];\n+    //Label learnedwords/totalword\n+    self.labelTotalWords.text = [NSString stringWithFormat:@\"0/%lu\",NUMBER_OF_PAGE_SCROLLVIEW];\n+    // Init arrLearnedWords is blank\n+    for (int i = 0; i < NUMBER_OF_PAGE_SCROLLVIEW; i ++) {\n+        NSMutableArray *arr = [[NSMutableArray alloc] init];\n+        arr = [@[@\"\",@\"\"] mutableCopy];\n+        [self.arrLearnedWords addObject:arr];\n+    }\n+    CGSize size = self.scrollView.frame.size;\n+    // setup content size for scrollview\n+    if (self.arrWords.count > 0) {","path":"Elearning/Elearning/ViewControllers/LessonViewController/LessonViewController.m","position":156,"original_position":156,"commit_id":"c823cf92d14a31f3efb940a37cb23822262ac8e4","original_commit_id":"c823cf92d14a31f3efb940a37cb23822262ac8e4","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":"dùng enumerate thì k cần check count","created_at":"2016-06-16T02:19:30Z","updated_at":"2016-06-16T02:19:30Z","html_url":"https://github.com/framgia/fels_137/pull/30#discussion_r67278424","pull_request_url":"https://api.github.com/repos/framgia/fels_137/pulls/30","_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/comments/67278424"},"html":{"href":"https://github.com/framgia/fels_137/pull/30#discussion_r67278424"},"pull_request":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/30"}}},"pull_request":{"url":"https://api.github.com/repos/framgia/fels_137/pulls/30","id":73878780,"html_url":"https://github.com/framgia/fels_137/pull/30","diff_url":"https://github.com/framgia/fels_137/pull/30.diff","patch_url":"https://github.com/framgia/fels_137/pull/30.patch","issue_url":"https://api.github.com/repos/framgia/fels_137/issues/30","number":30,"state":"open","locked":false,"title":"Code screen lesson","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 lesson","created_at":"2016-06-15T09:28:32Z","updated_at":"2016-06-16T02:19:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"102aa7d5697b00ab4c8369a9aed677ded2ae0a58","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/framgia/fels_137/pulls/30/commits","review_comments_url":"https://api.github.com/repos/framgia/fels_137/pulls/30/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/30/comments","statuses_url":"https://api.github.com/repos/framgia/fels_137/statuses/c823cf92d14a31f3efb940a37cb23822262ac8e4","head":{"label":"vantientu1703:64763_screen_lesson","ref":"64763_screen_lesson","sha":"c823cf92d14a31f3efb940a37cb23822262ac8e4","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-16T02:12:10Z","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":248,"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":"ac0be6ba53fe3e75e75d07a56eed4fe6480d0788","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-16T02:12:11Z","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":250,"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":2,"forks":2,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/30"},"html":{"href":"https://github.com/framgia/fels_137/pull/30"},"issue":{"href":"https://api.github.com/repos/framgia/fels_137/issues/30"},"comments":{"href":"https://api.github.com/repos/framgia/fels_137/issues/30/comments"},"review_comments":{"href":"https://api.github.com/repos/framgia/fels_137/pulls/30/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/30/commits"},"statuses":{"href":"https://api.github.com/repos/framgia/fels_137/statuses/c823cf92d14a31f3efb940a37cb23822262ac8e4"}}}}
{"actor":{"display_login":"quocnb"}}