Skip to content

Commit

Permalink
Add apns error to notification debug ui
Browse files Browse the repository at this point in the history
  • Loading branch information
tmolitor-stud-tu committed Nov 12, 2023
1 parent 8410cba commit 3388661
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions Monal/Classes/MLXMPPManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Sends a message to a specified contact in account. Calls completion handler on s

@property (nonatomic, assign) BOOL hasAPNSToken;
@property (nonatomic, strong) NSString* pushToken;
@property (nonatomic, strong) NSError* _Nullable apnsError;

@property (nonatomic, readonly) BOOL isBackgrounded;
@property (nonatomic, readonly) BOOL isNotInFocus;
Expand Down
1 change: 1 addition & 0 deletions Monal/Classes/MonalAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ -(void) application:(UIApplication*) application didFailToRegisterForRemoteNotif
{
DDLogError(@"APNS push reg error %@", error);
[[MLXMPPManager sharedInstance] removeToken];
[MLXMPPManager sharedInstance].apnsError = error;
}

#pragma mark - notification actions
Expand Down
3 changes: 3 additions & 0 deletions Monal/Classes/NotificationSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ struct NotificationSettings: View {
buildLabel(Text("Apple Push Service"), isWorking: self.applePushEnabled);
Divider()
Text("Apple push service should always be on. If it is off, your device can not talk to Apple's server.").font(.footnote)
if self.applePushEnabled, let apnsError = MLXMPPManager.sharedInstance().apnsError {
Text("Error: \(String(describing:apnsError))").foregroundColor(.red).font(.footnote)
}
}.onTapGesture(count: 2, perform: {
showPushToken = true
}).alert(isPresented: $showPushToken) {
Expand Down

0 comments on commit 3388661

Please sign in to comment.