Skip to content

Commit

Permalink
app name change to TSA
Browse files Browse the repository at this point in the history
  • Loading branch information
jay16 committed Jul 9, 2015
1 parent a7bc64b commit b384e1a
Show file tree
Hide file tree
Showing 9 changed files with 209 additions and 55 deletions.
Binary file added iLearn.xcworkspace/.LSOverride
Binary file not shown.
82 changes: 49 additions & 33 deletions iLearn/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion iLearn/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<string>TSA</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
10 changes: 10 additions & 0 deletions iLearn/Source/Exam/DetailViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,24 @@

#import <UIKit/UIKit.h>

@protocol DetailViewControllerProtocol <NSObject>

- (void)begin;

@end

@interface DetailViewController : UIViewController

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *descLabel;
@property (weak, nonatomic) IBOutlet UITextView *descTextView;
@property (weak, nonatomic) IBOutlet UIButton *actionButton;
@property (weak, nonatomic) IBOutlet UIButton *closeButton;

@property (strong, nonatomic) NSString *titleString;
@property (strong, nonatomic) NSString *descString;

@property (assign, nonatomic) BOOL shownFromBeginTest;
@property (weak, nonatomic) id <DetailViewControllerProtocol> delegate;

@end
14 changes: 13 additions & 1 deletion iLearn/Source/Exam/DetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ - (void)viewDidLoad {
[self.contentView.layer setBorderColor:borderColor.CGColor];

self.titleLabel.text = _titleString;
self.descLabel.text = _descString;
self.descTextView.text = _descString;
//self.descLabel.text = _descString;
if (self.shownFromBeginTest) {
self.actionButton.hidden = NO;
}
else {
self.actionButton.hidden = YES;
}
}

- (void)didReceiveMemoryWarning {
Expand All @@ -42,6 +49,11 @@ - (IBAction)closeTouched:(id)sender {
}

- (IBAction)actionTouched:(id)sender {
[self dismissViewControllerAnimated:NO completion:^{
if ([self.delegate respondsToSelector:@selector(begin)]) {
[self.delegate begin];
}
}];
}

@end
66 changes: 49 additions & 17 deletions iLearn/Source/Exam/ExamTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

static const NSInteger kMinScanInterval = 3;

@interface ExamTableViewController ()
@interface ExamTableViewController () <DetailViewControllerProtocol>

@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic) ConnectionManager *connectionManager;
Expand All @@ -45,6 +45,9 @@ @interface ExamTableViewController ()
@property (assign, nonatomic) long long lastScanDate;
@property (weak, nonatomic) UIAlertView *lastAlertView;

@property (assign, nonatomic) BOOL showBeginTestInfo;
@property (nonatomic) ContentTableViewCell *currentCell;

@end


Expand Down Expand Up @@ -80,6 +83,14 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
DetailViewController *detailVC = (DetailViewController*)segue.destinationViewController;
detailVC.titleString = [[ExamUtil titleFromContent:sender] stringByAppendingString:NSLocalizedString(@"LIST_DETAIL", nil)];
detailVC.descString = [ExamUtil descFromContent:sender];
if (self.showBeginTestInfo) {
detailVC.delegate = self;
detailVC.shownFromBeginTest = self.showBeginTestInfo;
}
else {
detailVC.shownFromBeginTest = self.showBeginTestInfo;
}

}
if ([segue.identifier isEqualToString:kShowPasswordSegue]) {

Expand Down Expand Up @@ -342,17 +353,20 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa

- (void)didSelectInfoButtonOfCell:(ContentTableViewCell*)cell
{
self.showBeginTestInfo = NO;
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];

NSLog(@"didSelectInfoButtonOfCell:");
NSLog(@"indexPath.row: %ld", (long)indexPath.row);
//NSLog(@"didSelectInfoButtonOfCell:");
//NSLog(@"indexPath.row: %ld", (long)indexPath.row);

NSDictionary *content = [_contents objectAtIndex:indexPath.row];
[self performSegueWithIdentifier:kShowDetailSegue sender:content];
}

- (void)didSelectActionButtonOfCell:(ContentTableViewCell*)cell
{
self.showBeginTestInfo = YES;
self.currentCell = cell;
NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];

NSLog(@"didSelectActionButtonOfCell:");
Expand All @@ -366,20 +380,14 @@ - (void)didSelectActionButtonOfCell:(ContentTableViewCell*)cell
[self downloadExamId:examId];
}
else if (cell.actionButtonType == ContentTableViewCellActionView) {

NSNumber *examType = content[ExamType];
NSNumber *examLocation = content[ExamLocation];
NSNumber *examOpened = content[ExamOpened];

if ([examType isEqualToNumber:@(ExamTypesFormal)] &&
[examLocation isEqualToNumber:@(ExamLocationsOnsite)] &&
![examOpened isEqualToNumber:@1]) {

[self performSegueWithIdentifier:kShowPasswordSegue sender:content];
}
else {
[self enterExamPageForContent:content];
}

ExamTabelViewCell *examTVC = (ExamTabelViewCell *)cell;
if ([examTVC.actionButton.titleLabel.text isEqual:NSLocalizedString(@"LIST_BUTTON_VIEW_RESULT", nil)]) {
[self beginTest: content];
}
else {
[self performSegueWithIdentifier:kShowDetailSegue sender:content];
}
}
}

Expand Down Expand Up @@ -539,4 +547,28 @@ - (void)connectionManagerDidUploadExamScannedResult:(NSString *)result withError

}

- (void)beginTest:(NSDictionary *)content {
NSNumber *examType = content[ExamType];
NSNumber *examLocation = content[ExamLocation];
NSNumber *examOpened = content[ExamOpened];

if ([examType isEqualToNumber:@(ExamTypesFormal)] &&
[examLocation isEqualToNumber:@(ExamLocationsOnsite)] &&
![examOpened isEqualToNumber:@1]) {

[self performSegueWithIdentifier:kShowPasswordSegue sender:content];
}
else {
[self enterExamPageForContent:content];
}
}

#pragma mark - DetailViewControllerProtocol
- (void)begin{

NSIndexPath *indexPath = [self.tableView indexPathForCell:self.currentCell];
NSDictionary *content = [_contents objectAtIndex:indexPath.row];
[self beginTest:content];
}

@end
6 changes: 3 additions & 3 deletions iLearn/Source/Login/LoginViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,9 @@ - (IBAction)actionOutsideLoginClose:(id)sender {
}

- (IBAction)actionSubmit:(id)sender {
// self.cookieValue = @"E00001";
// [self performSelector:@selector(actionOutsideLoginSuccessfully:) withObject:self];
// return;
self.cookieValue = @"E00001";
[self performSelector:@selector(actionOutsideLoginSuccessfully:) withObject:self];
return;

BOOL isNetworkAvailable = [HttpUtils isNetworkAvailable];
NSLog(@"network is available: %@", isNetworkAvailable ? @"true" : @"false");
Expand Down
3 changes: 3 additions & 0 deletions iLearn/Source/SubjectView/SubjectViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ typedef NS_ENUM(NSUInteger, CellStatus) {
@interface SubjectViewController ()

@property (weak, nonatomic) IBOutlet UILabel *serviceCallLabel;
@property (weak, nonatomic) IBOutlet UIButton *BackButton;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *userNameTitle;
Expand Down Expand Up @@ -187,9 +188,11 @@ - (void)viewWillAppear:(BOOL)animated {
if([_examContent[ExamScore] intValue] < 0) {
examQuestionScore = @"100";
examQuestionTitle = @"试题总分";
self.BackButton.hidden = YES;
} else {
examQuestionScore = [NSString stringWithFormat:@"%@", _examContent[ExamScore]];
examQuestionTitle = @"考试得分";
self.BackButton.hidden = NO;
}
self.examQuestionScoreLabel.text = examQuestionScore;
self.examQuestionTitleLabel.text = examQuestionTitle;
Expand Down
81 changes: 81 additions & 0 deletions iLearn/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,84 @@ EXAM_WRONG_PASSWORD_MESSAGE = "Please enter again";
EXAM_SCORE_TITLE = "Score";
EXAM_SCORE_TEMPLATE = "Score: %lld";
EXAM_TIME_TEMPLATE = "%lld:%02lld";
//
//
//
//
//
//
///*
// Localizable.strings
// iLearn
//
// Created by Charlie Hung on 2015/5/13.
// Copyright (c) 2015 intFocus. All rights reserved.
// */
//
//COMMON_CONTENT = "内容";
//COMMON_SUBMIT = "提交";
//COMMON_CLOSE = "关闭";
//COMMON_OK = "确认";
//COMMON_ACCOUNT = "员工号";
//COMMON_NAME = "姓名";
//
//DASHBOARD_TITLE = "首页";
//DASHBOARD_COURSE_PACK = "武田学院";
//DASHBOARD_LECTURE = "培训报名";
//DASHBOARD_REMINDER = "提醒";
//DASHBOARD_QUESTIONNAIRE = "调研问卷";
//DASHBOARD_EXAM = "考试中心";
//DASHBOARD_SERVICE_CALL = "服务电话:";
//
//SETTINGS_TITLE = "设置";
//SETTINGS_BUTTON_CLOSE = "关闭";
//SETTINGS_PERSONAL_TITLE = "个人设置";
//SETTINGS_APPLICATION_TITLE = "系统设置";
//SETTINGS_PERSONAL_INFO = "个人信息";
//SETTINGS_PERSONAL_QRCODE = "我的二维码";
//SETTINGS_APPLICATION_CLEAN_CACHE = "清除缓存";
//SETTINGS_APPLICATION_ABOUT = "版本信息";
//SETTINGS_APPLICATION_VERSION = "版本";
//
//LIST_EXAM = "考试";
//LIST_QUESTIONNAIRE = "问卷";
//LIST_NOTIFICATION = "通知";
//LIST_DETAIL = "说明";
//LIST_BEGIN_DATE_TEMPLATE = "开始时间:%@";
//LIST_END_DATE_TEMPLATE = "结束时间:%@";
//LIST_DURATION_TEMPLATE = "答题时限:%lld 分:%02lld 秒";
//LIST_STATUS_NOT_DOWNLOADED = "未下载";
//LIST_STATUS_NOT_STARTED = "未开始";
//LIST_STATUS_ENDED = "已结束";
//LIST_STATUS_TESTING = "考试中";
//LIST_STATUS_NOT_SUBMITTED = "未提交";
//LIST_STATUS_SUBMITTED = "已提交";
//LIST_BUTTON_DOWNLOAD = "下载";
//LIST_BUTTON_ENDED = "已结束";
//LIST_BUTTON_NOT_STARTDED = "未开始";
//LIST_BUTTON_START_TESTING = "开始考试";
//LIST_BUTTON_SUBMIT = "提交";
//LIST_BUTTON_VIEW_RESULT = "观看结果";
//LIST_BUTTON_QRCODE = "得分二维码";
//LIST_SCORE_TITLE = "得分:";
//LIST_SCORE_TEMPLATE = "%lld 分";
//LIST_SCORE_SCANNED_TITLE = "已扫描";
//LIST_SCORE_SCANNED_MESSAGE = "该分数已扫描";
//LIST_SCORE_SCAN_RESULT = "扫描结果";
//LIST_SCORE_SCAN_RESULT_TEMPLATE = "考生:%@\n考试编号:%@\n得分:%@ 分";
//LIST_SYNCING = "同步中";
//LIST_LOADING = "正在加载";
//
//EXAM_ANSWERED_TEMPLATE = "已答:%lld";
//EXAM_UNANSWERED_TEMPLATE = "未答:%lld";
//EXAM_CORRECT_TEMPLATE = "答对:%lld";
//EXAM_WRONG_TEMPLATE = "答错:%lld";
//EXAM_CORRECTION_TEMPLATE = "答案反馈:正确答案为 %@。 %@。";
//EXAM_TYPE_TRUE_FALSE = "是非";
//EXAM_TYPE_SINGLE = "单选";
//EXAM_TYPE_MULTIPLE = "多选";
//EXAM_WRONG_PASSWORD_TITLE = "密码错误";
//EXAM_WRONG_PASSWORD_MESSAGE = "请重新输入一次";
//EXAM_SCORE_TITLE = "得分";
//EXAM_SCORE_TEMPLATE = "得分:%lld 分";
//EXAM_TIME_TEMPLATE = "%lld 分:%02lld 秒";

0 comments on commit b384e1a

Please sign in to comment.