Caller.temp_caseinsensitive_rename.swift
2.08キロバイト
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
//
// caller.swift
// jacket_test_ios
//
// Created by USER on 2017/10/11.
// Copyright © 2017年 ドラッサル 亜嵐. All rights reserved.
//
import Foundation
class Caller{
UserNofitication.sharedInstance.easyNofitication(
/* nofitication detail */
identifier : "accident",
title : DefaultText.AccidentTitle.rawValue,
body : DefaultText.AccidentBody.rawValue,
actions : [
UNNotificationAction(
identifier:"negative",
title: DefaultText.AccidentNegativeButton.rawValue,
options: []),
UNNotificationAction(
identifier: "possitive",
title: DefaultText.AccidentPositiveButton.rawValue,
options:[])], completionHandler: ({(Error)->Void in
/* 応答がなければ アクシデントとみなす */
if(UserState.instance._hasAccident)!{
_ = Timer.scheduledTimer(
timeInterval: 120.0,
target : self,
selector : #selector(core_functions.sharedInstance.accidentHappend),
userInfo : nil,
repeats : false ).fire()
}
}),
/* response callback */
response : UNResponseManager.sharedInstance.setResponse(identifier: "accident") {(_ actionIdentifier:String) in
NSLog("accident happend")
switch actionIdentifier {
case "negative":
core_functions.sharedInstance.accidentHappend()
break
case "positive":
core_functions.sharedInstance.accidentCancel()
break
case UNNotificationDismissActionIdentifier:
/* 選択せずにnofiticationを消去の場合*/
break
case UNNotificationDefaultActionIdentifier:
/* 選択せずにアプリ起動場合*/
break
default:
break
}
})
}
}