Skip to content

Commit 24843b4

Browse files
authored
Merge pull request #228 from Hirobreak/register
fix register for notification
2 parents 40401f9 + a5568ec commit 24843b4

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

iOS-Email-Client/AppDelegate.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
137137
UIUserNotificationSettings(types: [.alert, .sound, .badge], categories: nil)
138138
UIApplication.shared.registerUserNotificationSettings(settings)
139139
}
140-
140+
UIApplication.shared.registerForRemoteNotifications()
141141
UNUserNotificationCenter.current().setNotificationCategories([setupLinkDeviceNotification(), setupNewEmailNotification()])
142142
}
143143

@@ -149,9 +149,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
149149

150150
func setupNewEmailNotification() -> UNNotificationCategory {
151151
let emailMark = UNNotificationAction(identifier: "EMAIL_MARK", title: "Mark as Read", options: .authenticationRequired)
152-
let emailReply = UNNotificationAction(identifier: "EMAIL_REPLY", title: "Reply", options: .foreground)
153152
let emailTrash = UNNotificationAction(identifier: "EMAIL_TRASH", title: "Delete", options: .destructive)
154-
return UNNotificationCategory(identifier: "OPEN_THREAD", actions: [emailMark, emailReply, emailTrash], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: "", options: .customDismissAction)
153+
return UNNotificationCategory(identifier: "OPEN_THREAD", actions: [emailMark, emailTrash], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: "", options: .customDismissAction)
155154
}
156155

157156
func logout(manually: Bool = false){

iOS-Email-Client/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>1.0.12</string>
20+
<string>1.0.14</string>
2121
<key>CFBundleURLTypes</key>
2222
<array>
2323
<dict>

iOS-Email-Client/Managers/WebSocketManager.swift

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protocol WebSocketManagerDelegate {
1616
final class WebSocketManager: NSObject {
1717
static let sharedInstance = WebSocketManager()
1818
var delegate : WebSocketManagerDelegate?
19-
var socket : WebSocket!
19+
var socket : WebSocket?
2020
var myAccount : Account?
2121
var shouldReconnect = true
2222
let SOCKET_URL = Env.socketURL
@@ -29,12 +29,13 @@ final class WebSocketManager: NSObject {
2929
shouldReconnect = true
3030
myAccount = account
3131
socket = WebSocket("\(SOCKET_URL)?token=\(account.jwt)", subProtocol: "criptext-protocol")
32-
socket.delegate = self
32+
socket?.delegate = self
3333
}
3434

3535
func reconnect(){
3636
shouldReconnect = true
37-
guard socket.readyState != .open && socket.readyState != .connecting,
37+
guard let mySocket = socket,
38+
mySocket.readyState != .open && mySocket.readyState != .connecting,
3839
let account = self.myAccount else {
3940
return
4041
}
@@ -43,15 +44,15 @@ final class WebSocketManager: NSObject {
4344

4445
func pause() {
4546
shouldReconnect = false
46-
socket.event.close = {_,_,_ in }
47-
socket.close()
47+
socket?.event.close = {_,_,_ in }
48+
socket?.close()
4849
}
4950

5051
func close(){
5152
shouldReconnect = false
5253
myAccount = nil
53-
socket.event.close = {_,_,_ in }
54-
socket.close()
54+
socket?.event.close = {_,_,_ in }
55+
socket?.close()
5556
}
5657
}
5758

0 commit comments

Comments
 (0)