forked from gureum/gureum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainViewController.swift
74 lines (67 loc) · 3.11 KB
/
MainViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//
// MainViewController.swift
// Gureum
//
// Created by Jeong YunWon on 2014. 12. 31..
// Copyright (c) 2014년 youknowone.org. All rights reserved.
//
import Crashlytics
import GoogleMobileAds
@objc class MainViewController: UITableViewController {
@IBOutlet var _bannerAdsView: GADBannerView!
@objc override var bannerAdsView: GADBannerView! { return self._bannerAdsView }
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
loadBannerAds()
let quickhelper = preferences.object(forKey: "quickhelper", defaultValue: false) as! Bool
if !quickhelper {
if QuickHelperJoined {
let alert = UIAlertController(title: "빠른 설정 도우미", message: "빠른 설정 도우미를 취소할까요? 취소하면 기본 설정이 그대로 사용됩니다.", preferredStyle: .alert)
let continueAction = UIAlertAction(title: "계속", style: .default) {
_ in
self.performSegue(withIdentifier: "quickhelper", sender: self)
}
alert.addAction(continueAction)
let cancelAction = UIAlertAction(title: "취소", style: .cancel) {
_ in
preferences.setObject(true, forKey: "quickhelper")
}
alert.addAction(cancelAction)
present(alert, animated: true, completion: nil)
} else {
performSegue(withIdentifier: "quickhelper", sender: self)
let alert = UIAlertController(title: "빠른 설정 도우미", message: "구름 키보드를 처음 설치하셨기 때문에 빠른 설정 메뉴로 안내합니다. 빠른 설정에서는 키보드 이용 패턴에 맞게 빠르고 쉽게 배열을 고를 수 있습니다. 언제든 다시 실행할 수 있으니 부담 없이 설정해 보고 맘에 들지 않으면 다시 골라 주세요.", preferredStyle: .alert)
let action = UIAlertAction(title: "확인", style: .default, handler: nil)
alert.addAction(action)
present(alert, animated: true, completion: nil)
}
}
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = super.tableView(tableView, cellForRowAt: indexPath)
if indexPath.section == 2 {
switch indexPath.row {
case 1:
cell.accessoryType = preferences.swipe ? .checkmark : .none
case 2:
cell.accessoryType = preferences.inglobe ? .checkmark : .none
default:
break
}
}
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.section == 2 {
switch indexPath.row {
case 1:
preferences.swipe = !preferences.swipe
case 2:
preferences.inglobe = !preferences.inglobe
default:
return
}
tableView.reloadData()
}
}
}