//
//  AppInfoViewController.h
//  kneet
//
//  Created by Jason Lee on 5/13/15.
//  Copyright (c) 2015 ntels. All rights reserved.
//

#import "JDObject.h"
#import "CustomLabel.h"
#import "CustomButton.h"

#import "WebBrowseViewController.h"

#import "AppInfoViewController.h"

@interface AppInfoViewController () {

}
@end


#pragma mark - Class Definition

@implementation AppInfoViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    [self initUI];
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    self.title = NSLocalizedString(@"앱 정보", @"앱 정보");
    [self prepareViewDidLoad];
}

- (void)initUI {

    
    

    //set tableview option
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.backgroundColor = [UIColor clearColor];
    
    //Localization
    _lblVersion.text = NSLocalizedString(@"버전", @"버전");
    _lblManufacturer.text = NSLocalizedString(@"만든 곳", @"만든 곳");
    _lblPolicy.text = NSLocalizedString(@"약관", @"약관");
//    _lblOpenSource.text = NSLocalizedString(@"오픈 라이센스", @"오픈 라이센스");
    
//    [_btnLicense setTitle:NSLocalizedString(@"자세히 보기", @"자세히 보기") forState:UIControlStateNormal];
    [_btnServiceTerm setTitle:NSLocalizedString(@"서비스 이용약관", @"서비스 이용약관") forState:UIControlStateNormal];
    [_btnPrivatePolicy setTitle:NSLocalizedString(@"개인정보 취급정책", @"개인정보 취급정책") forState:UIControlStateNormal];
    [_btnLBSTerm setTitle:NSLocalizedString(@"위치기반 서비스 이용약관", @"위치기반 서비스 이용약관") forState:UIControlStateNormal];
}

- (void)prepareViewDidLoad {
    [_btnAppVersion setTitle:[CommonUtil applicationShortVersion] forState:UIControlStateNormal];

}

#pragma mark - Main Logic



#pragma mark - UI Events

- (void)btnLicenseTouched:(id)sender {
    WebBrowseViewController *vc = (WebBrowseViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"WebBrowseViewController" storyboardName:@"Common"];
    vc.titleString = NSLocalizedString(@"오픈 라이센스", @"오픈 라이센스");
    vc.URLString = @"http://naver.com";
    
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)btnServiceTermsTouched:(id)sender {
    WebBrowseViewController *vc = (WebBrowseViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"WebBrowseViewController" storyboardName:@"Common"];
    vc.titleString = NSLocalizedString(@"서비스 이용약관", @"서비스 이용약관");

    vc.URLString = [NSString stringWithFormat:@"%@/guide/service", kAPIServer];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)btnPrivatePolicyTouched:(id)sender {
    WebBrowseViewController *vc = (WebBrowseViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"WebBrowseViewController" storyboardName:@"Common"];
    vc.titleString = NSLocalizedString(@"개인정보 취급정책", @"개인정보 취급정책");

    vc.URLString = [NSString stringWithFormat:@"%@/guide/policy", kAPIServer];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)btnLBSTermsTouched:(id)sender {
    WebBrowseViewController *vc = (WebBrowseViewController *)[CommonUtil instantiateViewControllerWithIdentifier:@"WebBrowseViewController" storyboardName:@"Common"];
    vc.titleString = NSLocalizedString(@"위치기반 서비스 이용약관", @"위치기반 서비스 이용약관");

    vc.URLString = [NSString stringWithFormat:@"%@/guide/geo", kAPIServer];
    [self.navigationController pushViewController:vc animated:YES];
}


#pragma mark - MemoryWarning
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
