KMSignUpView.swift 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. //
  2. // KMSignUpView.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by wanjun on 2024/10/23.
  6. //
  7. import Cocoa
  8. import Combine
  9. class KMSignUpView: KMBaseXibView {
  10. @IBOutlet weak var signUpLabel: NSTextField!
  11. @IBOutlet weak var loginModeBox: NSBox!
  12. @IBOutlet weak var verificationCodeButton: NSButton!
  13. @IBOutlet weak var selectBox1: NSBox!
  14. @IBOutlet weak var passwordButton: NSButton!
  15. @IBOutlet weak var selectBox2: NSBox!
  16. @IBOutlet weak var emailBox: NSBox!
  17. @IBOutlet weak var emailTextField: NSTextField!
  18. @IBOutlet weak var emailErrorLabel: NSTextField!
  19. @IBOutlet weak var passwordBox: NSBox!
  20. @IBOutlet weak var verifficationView: NSView!
  21. @IBOutlet weak var verifficationBox: NSBox!
  22. @IBOutlet weak var verifficationTextField: NSTextField!
  23. @IBOutlet weak var sendBox: KMBox!
  24. @IBOutlet weak var sendLabel: NSTextField!
  25. @IBOutlet weak var passwordView: NSView!
  26. @IBOutlet weak var passwordTextField: NSTextField!
  27. @IBOutlet weak var passwordTextField1: NSSecureTextField!
  28. @IBOutlet weak var visibleButton: NSButton!
  29. @IBOutlet weak var passwordErrorLabel: NSTextField!
  30. @IBOutlet weak var stayCheckButton: NSButton!
  31. @IBOutlet weak var stayLabel: NSTextField!
  32. @IBOutlet weak var forgetButton: NSButton!
  33. @IBOutlet weak var signUpBox: NSBox!
  34. @IBOutlet weak var signUpButton: NSButton!
  35. @IBOutlet weak var privacyCheckButton: NSButton!
  36. @IBOutlet weak var privacyLabel: NSTextField!
  37. private var viewModel = KMSignUpViewModel()
  38. private var cancellables = Set<AnyCancellable>()
  39. convenience init(model: KMSignUpViewModel, superView: NSView) {
  40. self.init(frame: superView.bounds)
  41. viewModel = model
  42. bindViewModel()
  43. languageLocalized()
  44. initializeUI()
  45. }
  46. public override init(frame frameRect: NSRect) {
  47. super.init(frame: frameRect)
  48. }
  49. public required init?(coder decoder: NSCoder) {
  50. fatalError("init(coder:) has not been implemented")
  51. }
  52. public func resetTextFileData() {
  53. if(self.superview != nil) {
  54. emailTextField.stringValue = ""
  55. passwordTextField.stringValue = ""
  56. passwordTextField1.stringValue = ""
  57. verifficationTextField.stringValue = ""
  58. emailErrorLabel.isHidden = true
  59. passwordErrorLabel.isHidden = true
  60. sendLabel.stringValue = NSLocalizedString("Send", tableName: "MemberCenterLocalizable", comment: "")
  61. viewModel.sendContent = NSLocalizedString("Send", tableName: "MemberCenterLocalizable", comment: "")
  62. viewModel.email = ""
  63. sendBoxRefresh()
  64. }
  65. }
  66. override func updateUI() {
  67. super.updateUI()
  68. NotificationCenter.default.addObserver(self, selector: #selector(loginSuccessNotification), name: NSNotification.Name(rawValue: "MemberCenterLoginSuccess"), object: nil)
  69. bindViewModel()
  70. languageLocalized()
  71. initializeUI()
  72. }
  73. // MARK: Private Method
  74. private func languageLocalized() -> Void {
  75. signUpLabel.stringValue = NSLocalizedString("Sign in(titile)", tableName: "MemberCenterLocalizable", comment: "")
  76. verificationCodeButton.title = NSLocalizedString("Verification Code", tableName: "MemberCenterLocalizable", comment: "")
  77. passwordButton.title = NSLocalizedString("Password", tableName: "MemberCenterLocalizable", comment: "")
  78. stayLabel.stringValue = NSLocalizedString("Stay signed in", tableName: "MemberCenterLocalizable", comment: "")
  79. forgetButton.title = NSLocalizedString("Forgot password?", tableName: "MemberCenterLocalizable", comment: "")
  80. signUpButton.title = NSLocalizedString("Sign in(button)", tableName: "MemberCenterLocalizable", comment: "")
  81. emailErrorLabel.stringValue = String(format: "*%@", NSLocalizedString("Email format error. Please enter the correct email.", tableName: "MemberCenterLocalizable", comment: ""))
  82. passwordErrorLabel.stringValue = String(format: "*%@", NSLocalizedString("Verification code error.", tableName: "MemberCenterLocalizable", comment: ""))
  83. emailTextField.placeholderString = NSLocalizedString("Please enter email address", tableName: "MemberCenterLocalizable", comment: "")
  84. verifficationTextField.placeholderString = NSLocalizedString("Please enter code", tableName: "MemberCenterLocalizable", comment: "")
  85. passwordTextField.placeholderString = NSLocalizedString("Please enter password", tableName: "MemberCenterLocalizable", comment: "")
  86. passwordTextField1.placeholderString = NSLocalizedString("Please enter password", tableName: "MemberCenterLocalizable", comment: "")
  87. privacyCheckButton.toolTip = NSLocalizedString("Please agree and check the above agreement first.", tableName: "MemberCenterLocalizable", comment: "")
  88. emailTextField.stringValue = viewModel.email
  89. verifficationTextField.stringValue = viewModel.verificationCode
  90. passwordTextField.stringValue = viewModel.password
  91. passwordTextField1.stringValue = viewModel.password
  92. }
  93. private func initializeUI() -> Void {
  94. emailBox.fillColor = NSColor(named: "texefiedfillcolor") ?? NSColor.white
  95. passwordBox.fillColor = NSColor(named: "texefiedfillcolor") ?? NSColor.white
  96. emailTextField.delegate = self
  97. verifficationTextField.delegate = self
  98. passwordTextField.delegate = self
  99. passwordTextField1.delegate = self
  100. emailErrorLabel.isHidden = !viewModel.emailError()
  101. passwordErrorLabel.isHidden = !viewModel.passwordError()
  102. signUpLabel.textColor = NSColor(named: "000000")
  103. signUpLabel.font = NSFont.SFMediumFontWithSize(20)
  104. selectBox1.fillColor = NSColor(named: "4982E6") ?? NSColor.blue
  105. emailErrorLabel.textColor = NSColor(named: "FA1E5D")
  106. emailErrorLabel.font = NSFont.SFProTextRegularFont(9)
  107. passwordBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
  108. verifficationBox.borderColor = NSColor(named: "FA1E5D") ?? NSColor.gray
  109. if viewModel.isValidEmail() {
  110. sendBox.fillColor = NSColor(named: "273C62") ?? NSColor.blue
  111. } else {
  112. sendBox.fillColor = NSColor(named: "273C62_0.4") ?? NSColor.blue
  113. }
  114. sendBox.borderColor = NSColor(named: "273C62") ?? NSColor.blue
  115. sendLabel.textColor = NSColor(named: "FFFFFF") ?? NSColor.white
  116. sendLabel.font = NSFont.SFProTextRegularFont(13)
  117. passwordErrorLabel.textColor = NSColor(named: "FA1E5D")
  118. passwordErrorLabel.font = NSFont.SFProTextRegularFont(9)
  119. stayCheckButton.image = NSImage(named: "CheckBoxNor")
  120. stayLabel.textColor = NSColor(named: "0E1114") ?? NSColor.black
  121. stayLabel.font = NSFont.SFProTextRegularFont(12)
  122. forgetButton.setTitleColor(color: NSColor(named: "4982E6") ?? NSColor.blue, font: NSFont.SFProTextRegularFont(12))
  123. signUpBox.fillColor = NSColor(named: "273C62") ?? NSColor.blue
  124. signUpButton.setTitleColor(color: NSColor(named: "FFFFFF") ?? NSColor.white, font: NSFont.SFProTextRegularFont(16))
  125. privacyCheckButton.image = NSImage(named: "CheckBoxNor")
  126. privacyLabel.isEditable = false
  127. privacyLabel.isSelectable = true
  128. privacyLabel.allowsEditingTextAttributes = true
  129. privacyLabel.textColor = NSColor.black
  130. privacyLabel.font = NSFont.SFProTextRegularFont(16.0)
  131. let tipsString = NSLocalizedString("I have read and agreed to the %@ and %@. An account will be automatically created after signing in with an unregistered email address.", tableName: "MemberCenterLocalizable", comment: "")
  132. let specialOffer = NSLocalizedString("Terms of Service", tableName: "MemberCenterLocalizable", comment: "")
  133. let contactsUs = NSLocalizedString("Privacy Policy", tableName: "MemberCenterLocalizable", comment: "")
  134. let fullString = String(format: tipsString, specialOffer, contactsUs)
  135. let attributedString = NSMutableAttributedString(string: fullString)
  136. // 定义链接的范围
  137. let specialOfferRange = (fullString as NSString).range(of: specialOffer)
  138. let contactsUsRange = (fullString as NSString).range(of: contactsUs)
  139. let linkColor = NSColor(named: "4982E6") ?? NSColor.blue
  140. let font = NSFont.SFProTextRegularFont(11.0) // 与普通文本相同的字体
  141. attributedString.addAttributes([
  142. .foregroundColor: NSColor(named: "0E1114") ?? NSColor.black as Any,
  143. .font: font
  144. ], range: (fullString as NSString).range(of: fullString))
  145. attributedString.addAttributes([
  146. .foregroundColor: linkColor,
  147. .link: NSLocalizedString("https://www.pdfreaderpro.com/terms_of_service", comment: ""),
  148. .font: font
  149. ], range: specialOfferRange)
  150. attributedString.addAttributes([
  151. .foregroundColor: linkColor,
  152. .link: NSLocalizedString("https://www.pdfreaderpro.com/privacy-policy", comment: ""),
  153. .font: font
  154. ], range: contactsUsRange)
  155. privacyLabel.attributedStringValue = attributedString
  156. signUpStateChange()
  157. visibleStateChange()
  158. textfieldInputState(isEmail: true)
  159. textfieldInputState(isEmail: false)
  160. sendBoxRefresh()
  161. sendBox.moveCallback = { [weak self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
  162. guard let self = self else { return }
  163. if self.viewModel.email.count <= 0 { return }
  164. if self.viewModel.sendBoxSelect { return }
  165. if !self.viewModel.isValidEmail() { return }
  166. if mouseEntered {
  167. self.sendBox.fillColor = NSColor(named: "000000_0.1") ?? NSColor.blue
  168. } else {
  169. self.sendBox.fillColor = NSColor(named: "273C62") ?? NSColor.blue
  170. }
  171. }
  172. sendBox.downCallback = { [weak self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
  173. guard let self = self else { return }
  174. if self.viewModel.email.count <= 0 { return }
  175. if self.viewModel.sendBoxSelect { return }
  176. if downEntered {
  177. self.sendBox.fillColor = NSColor(named: "273C62_0.4") ?? NSColor.blue
  178. viewModel.countDown(type: .login)
  179. }
  180. }
  181. }
  182. private func signUpStateChange() -> Void {
  183. if viewModel.signUpState == .verificationCode {
  184. selectBox1.isHidden = false
  185. selectBox2.isHidden = true
  186. verificationCodeButton.setTitleColor(color: NSColor(named: "4982E6") ?? NSColor.systemBlue, font: NSFont.SFProTextRegularFont(14))
  187. passwordButton.setTitleColor(color: NSColor(named: "42464D") ?? NSColor.black, font: NSFont.SFProTextRegularFont(14))
  188. verifficationView.isHidden = false
  189. passwordView.isHidden = true
  190. verifficationTextField.placeholderString = NSLocalizedString("Please enter code", tableName: "MemberCenterLocalizable", comment: "")
  191. forgetButton.isHidden = true
  192. } else if viewModel.signUpState == .password {
  193. selectBox1.isHidden = true
  194. selectBox2.isHidden = false
  195. verificationCodeButton.setTitleColor(color: NSColor(named: "42464D") ?? NSColor.black, font: NSFont.SFProTextRegularFont(14))
  196. passwordButton.setTitleColor(color: NSColor(named: "4982E6") ?? NSColor.black, font: NSFont.SFProTextRegularFont(14))
  197. verifficationView.isHidden = true
  198. passwordView.isHidden = false
  199. passwordTextField.placeholderString = NSLocalizedString("Please enter password", tableName: "MemberCenterLocalizable", comment: "")
  200. passwordTextField1.placeholderString = NSLocalizedString("Please enter password", tableName: "MemberCenterLocalizable", comment: "")
  201. forgetButton.isHidden = false
  202. }
  203. }
  204. private func checkStateChange(button: NSButton!, state: Bool) -> Void {
  205. button.state = state ? .on : .off
  206. if button.state == .on {
  207. button.image = NSImage(named: "CheckBoxSel")
  208. } else {
  209. button.image = NSImage(named: "CheckBoxNor")
  210. }
  211. }
  212. private func visibleStateChange() -> Void {
  213. if viewModel.isVisible {
  214. visibleButton.image = NSImage(named: "passwordVisible")
  215. passwordTextField.isHidden = false
  216. passwordTextField1.isHidden = true
  217. passwordTextField.stringValue = viewModel.password
  218. } else {
  219. visibleButton.image = NSImage(named: "passwordUnVisible")
  220. passwordTextField.isHidden = true
  221. passwordTextField1.isHidden = false
  222. passwordTextField1.stringValue = viewModel.password
  223. }
  224. }
  225. private func textfieldInputState(isEmail: Bool) -> Void {
  226. if isEmail {
  227. if viewModel.emailError() {
  228. emailBox.borderColor = NSColor(named: "FA1E5D") ?? NSColor.red
  229. } else {
  230. emailBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
  231. }
  232. emailErrorLabel.isHidden = !viewModel.emailError()
  233. } else {
  234. if viewModel.passwordError() {
  235. if viewModel.signUpState == .verificationCode {
  236. passwordBox.borderWidth = 0
  237. verifficationBox.borderWidth = 1
  238. passwordBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
  239. verifficationBox.borderColor = NSColor(named: "FA1E5D") ?? NSColor.red
  240. } else if viewModel.signUpState == .password {
  241. passwordBox.borderWidth = 1
  242. verifficationBox.borderWidth = 0
  243. verifficationBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
  244. passwordBox.borderColor = NSColor(named: "FA1E5D") ?? NSColor.red
  245. }
  246. } else {
  247. if viewModel.signUpState == .verificationCode {
  248. passwordBox.borderWidth = 1
  249. verifficationBox.borderWidth = 0
  250. } else if viewModel.signUpState == .password {
  251. passwordBox.borderWidth = 1
  252. verifficationBox.borderWidth = 0
  253. }
  254. }
  255. passwordErrorLabel.isHidden = !viewModel.passwordError()
  256. }
  257. }
  258. private func sendBoxRefresh() -> Void {
  259. sendLabel.stringValue = viewModel.sendContent
  260. if viewModel.sendContent == NSLocalizedString("Send", tableName: "MemberCenterLocalizable", comment: "") ||
  261. viewModel.sendContent == NSLocalizedString("Resend", tableName: "MemberCenterLocalizable", comment: "") {
  262. if viewModel.email.count > 0 {
  263. if viewModel.isValidEmail() {
  264. sendBox.fillColor = NSColor(named: "273C62") ?? NSColor.blue
  265. } else {
  266. sendBox.fillColor = NSColor(named: "273C62_0.4") ?? NSColor.blue
  267. }
  268. } else {
  269. sendBox.fillColor = NSColor(named: "273C62_0.4") ?? NSColor.blue
  270. }
  271. sendLabel.textColor = NSColor(named: "FFFFFF") ?? NSColor.white
  272. } else {
  273. sendBox.fillColor = NSColor(named: "DADBDE") ?? NSColor.gray
  274. sendLabel.stringValue = String(format: "%@s", viewModel.sendContent)
  275. sendLabel.textColor = NSColor(named: "0E1114") ?? NSColor.black
  276. }
  277. }
  278. // MARK: Bind Method
  279. func bindViewModel() -> Void {
  280. viewModel.$isVisible
  281. .receive(on: RunLoop.main)
  282. .sink { [weak self] newValue in
  283. self?.visibleStateChange()
  284. }
  285. .store(in: &cancellables)
  286. viewModel.$stayState
  287. .receive(on: RunLoop.main)
  288. .sink { [weak self] newValue in
  289. self?.checkStateChange(button: self?.stayCheckButton, state: newValue)
  290. }
  291. .store(in: &cancellables)
  292. viewModel.$privacyState
  293. .receive(on: RunLoop.main)
  294. .sink { [weak self] newValue in
  295. self?.checkStateChange(button: self?.privacyCheckButton, state: newValue)
  296. }
  297. .store(in: &cancellables)
  298. viewModel.$signUpState
  299. .receive(on: RunLoop.main)
  300. .sink { [weak self] newValue in
  301. self?.signUpStateChange()
  302. }
  303. .store(in: &cancellables)
  304. viewModel.$emailErrorMessage
  305. .receive(on: RunLoop.main)
  306. .sink { [weak self] newValue in
  307. self?.emailErrorLabel.stringValue = newValue
  308. self?.emailErrorLabel.isHidden = false
  309. self?.textfieldInputState(isEmail: true)
  310. }
  311. .store(in: &cancellables)
  312. viewModel.$passwordErrorMessage
  313. .receive(on: RunLoop.main)
  314. .sink { [weak self] newValue in
  315. self?.passwordErrorLabel.stringValue = newValue
  316. if self?.viewModel.passwordErrorMessage == "" {
  317. self?.passwordErrorLabel.isHidden = true
  318. } else {
  319. self?.passwordErrorLabel.isHidden = false
  320. }
  321. }
  322. .store(in: &cancellables)
  323. viewModel.$sendContent
  324. .receive(on: RunLoop.main)
  325. .sink { [weak self] newValue in
  326. self?.sendBoxRefresh()
  327. }
  328. .store(in: &cancellables)
  329. viewModel.$email
  330. .receive(on: RunLoop.main)
  331. .sink { [weak self] newValue in
  332. self?.sendBoxRefresh()
  333. }
  334. .store(in: &cancellables)
  335. viewModel.$verificationCode
  336. .receive(on: RunLoop.main)
  337. .sink { [weak self] newValue in
  338. if newValue.count <= 6 && newValue.count >= 0 {
  339. self?.viewModel.passwordErrorMessage = ""
  340. } else {
  341. self?.viewModel.passwordErrorMessage = NSLocalizedString("Verification code error.", tableName: "MemberCenterLocalizable", comment: "")
  342. }
  343. }
  344. .store(in: &cancellables)
  345. viewModel.$password
  346. .receive(on: RunLoop.main)
  347. .sink { [weak self] newValue in
  348. if newValue.count <= 30 && newValue.count >= 0 {
  349. self?.viewModel.passwordErrorMessage = ""
  350. } else {
  351. self?.viewModel.passwordErrorMessage = NSLocalizedString("Account or password error.", tableName: "MemberCenterLocalizable", comment: "")
  352. }
  353. }
  354. .store(in: &cancellables)
  355. }
  356. // MARK: Action Method
  357. @IBAction func verificationCodeAction(_ sender: NSButton) {
  358. viewModel.signUpStateChange(state: .verificationCode)
  359. }
  360. @IBAction func passwordAction(_ sender: NSButton) {
  361. viewModel.signUpStateChange(state: .password)
  362. }
  363. @IBAction func visibleAction(_ sender: NSButton) {
  364. viewModel.isVisible.toggle()
  365. }
  366. @IBAction func stayCheckAction(_ sender: NSButton) {
  367. viewModel.stayState.toggle()
  368. viewModel.stayStateAction()
  369. }
  370. @IBAction func signUpAction(_ sender: NSButton) {
  371. self.window?.makeFirstResponder(nil)
  372. viewModel.emailErrorMessage = ""
  373. viewModel.passwordErrorMessage = ""
  374. viewModel.signUpAction()
  375. }
  376. @IBAction func forgetAction(_ sender: NSButton) {
  377. guard let parentView = self.superview else { return }
  378. if parentView is NSBox {
  379. let model = KMSignUpViewModel()
  380. model.email = viewModel.email
  381. let forgotView = KMForgotPasswordView(model: model, superView: parentView)
  382. NSAnimationContext.runAnimationGroup { context in
  383. context.duration = 0.3
  384. self.animator().alphaValue = 0
  385. } completionHandler: {
  386. self.removeFromSuperview()
  387. forgotView.alphaValue = 0
  388. (parentView as! NSBox).contentView = forgotView
  389. NSAnimationContext.runAnimationGroup({ context in
  390. context.duration = 0.3
  391. forgotView.animator().alphaValue = 1
  392. }, completionHandler: nil)
  393. }
  394. } else {
  395. let model = KMSignUpViewModel()
  396. model.email = viewModel.email
  397. let forgotView = KMForgotPasswordView(model: model, superView: parentView)
  398. NSAnimationContext.runAnimationGroup { context in
  399. context.duration = 0.3
  400. self.animator().alphaValue = 0
  401. } completionHandler: {
  402. self.removeFromSuperview()
  403. forgotView.alphaValue = 0
  404. parentView.addSubview(forgotView)
  405. NSAnimationContext.runAnimationGroup({ context in
  406. context.duration = 0.3
  407. forgotView.animator().alphaValue = 1
  408. }, completionHandler: nil)
  409. }
  410. }
  411. }
  412. @IBAction func privacyCheckAction(_ sender: NSButton) {
  413. viewModel.privacyState.toggle()
  414. }
  415. }
  416. extension KMSignUpView: NSTextFieldDelegate {
  417. func controlTextDidEndEditing(_ obj: Notification) {
  418. let textField = obj.object as? NSTextField
  419. if textField == emailTextField {
  420. viewModel.email = textField!.stringValue
  421. } else if textField == verifficationTextField {
  422. viewModel.verificationCode = textField!.stringValue
  423. } else if textField == passwordTextField {
  424. viewModel.password = textField!.stringValue
  425. } else if textField == passwordTextField1 {
  426. viewModel.password = textField!.stringValue
  427. }
  428. }
  429. func controlTextDidChange(_ obj: Notification) {
  430. let textField = obj.object as? NSTextField
  431. if textField == emailTextField {
  432. viewModel.emailErrorMessage = ""
  433. viewModel.email = textField!.stringValue
  434. emailBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
  435. } else if textField == verifficationTextField {
  436. viewModel.passwordErrorMessage = ""
  437. viewModel.verificationCode = textField!.stringValue
  438. verifficationBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
  439. } else if textField == passwordTextField {
  440. viewModel.passwordErrorMessage = ""
  441. viewModel.password = textField!.stringValue
  442. passwordBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
  443. } else if textField == passwordTextField1 {
  444. viewModel.passwordErrorMessage = ""
  445. viewModel.password = textField!.stringValue
  446. passwordBox.borderColor = NSColor(named: "DADBDE") ?? NSColor.gray
  447. }
  448. }
  449. @objc func loginSuccessNotification() -> Void {
  450. resetTextFileData()
  451. }
  452. }