4
4
//
5
5
// The MIT License (MIT)
6
6
//
7
- // Copyright (c) 2017 Studyplus inc.
7
+ // Copyright (c) 2021 Studyplus inc.
8
8
//
9
9
// Permission is hereby granted, free of charge, to any person obtaining a copy
10
10
// of this software and associated documentation files (the "Software"), to deal
27
27
import UIKit
28
28
import StudyplusSDK
29
29
30
- class ViewController : UIViewController , StudyplusLoginDelegate {
30
+ class ViewController : UIViewController {
31
31
32
32
@IBOutlet weak var isConnectedLabel : UILabel !
33
33
@IBOutlet weak var resultLabel : UILabel !
@@ -39,14 +39,6 @@ class ViewController: UIViewController, StudyplusLoginDelegate {
39
39
Studyplus . shared. delegate = self
40
40
}
41
41
42
- // MARK: - Label
43
-
44
- private func updateIsConnected( ) {
45
- isConnectedLabel. text = Studyplus . shared. isConnected ( ) ? " True " : " False "
46
- }
47
-
48
- // MARK: - Button Action
49
-
50
42
@IBAction func loginButton( _ sender: UIButton ) {
51
43
Studyplus . shared. login ( )
52
44
}
@@ -81,29 +73,25 @@ class ViewController: UIViewController, StudyplusLoginDelegate {
81
73
} )
82
74
}
83
75
84
- // MARK: - Picker
85
-
86
76
@IBAction func studyRecordDurationPicker( _ sender: UIDatePicker ) {
87
77
duration = sender. countDownDuration
88
78
}
89
79
90
- // MARK: - StudyplusLoginDelegate
80
+ private func updateIsConnected( ) {
81
+ isConnectedLabel. text = Studyplus . shared. isConnected ( ) ? " True " : " False "
82
+ }
83
+ }
91
84
92
- func studyplusDidSuccessToLogin( ) {
85
+ extension ViewController : StudyplusLoginDelegate {
86
+ func studyplusLoginSuccess( ) {
93
87
print ( " -- Called studyplusDidSuccessToLogin -- " )
94
88
resultLabel. text = " Login succeeded "
95
89
updateIsConnected ( )
96
90
}
97
91
98
- func studyplusDidFailToLogin ( error: StudyplusLoginError ) {
92
+ func studyplusLoginFail ( error: StudyplusLoginError ) {
99
93
print ( " -- Called studyplusDidFailToLogin -- " )
100
94
resultLabel. text = " Error Code: \( error) "
101
95
updateIsConnected ( )
102
96
}
103
-
104
- func studyplusDidCancelToLogin( ) {
105
- print ( " -- Called studyplusDidCancelToLogin -- " )
106
- resultLabel. text = " Login canceled "
107
- updateIsConnected ( )
108
- }
109
97
}
0 commit comments