Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions rnmodules/react-native-kb/ios/Kb.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ FOUNDATION_EXPORT void KbSetDeviceToken(NSString *token);
FOUNDATION_EXPORT void KbSetInitialNotification(NSDictionary *notification);
FOUNDATION_EXPORT void KbEmitPushNotification(NSDictionary *notification);
FOUNDATION_EXPORT NSDictionary *KbGetAndClearInitialNotification(void);

// Init result - stored for inclusion in ReadArr error logs
FOUNDATION_EXPORT void KbSetInitResult(NSString *result);
10 changes: 8 additions & 2 deletions rnmodules/react-native-kb/ios/Kb.mm
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ - (void)dealloc {
static BOOL kbPasteImageEnabled = NO;
static NSString *kbStoredDeviceToken = nil;
static NSDictionary *kbInitialNotification = nil;
static NSString *kbInitResult = nil;

@interface RCTBridge (JSIRuntime)
- (void *)runtime;
Expand Down Expand Up @@ -396,10 +397,11 @@ - (NSDictionary *)getConstants {
}
if (consecutiveErrors <= 5 || consecutiveErrors % 50 == 0) {
__typeof__(self) strongSelf = weakSelf;
os_log(OS_LOG_DEFAULT, "ReadArr loop[%llu] error streak=%llu total=%llu domain=%{public}s code=%ld desc=%{public}s self=%p bridge=%p jsRuntime=%p currentRuntime=%p",
os_log(OS_LOG_DEFAULT, "ReadArr loop[%llu] error streak=%llu total=%llu domain=%{public}s code=%ld desc=%{public}s initResult=%{public}s self=%p bridge=%p jsRuntime=%p currentRuntime=%p",
(unsigned long long)readLoopGen, (unsigned long long)consecutiveErrors,
(unsigned long long)totalErrors, KBStringOrNil(error.domain), (long)error.code,
KBStringOrNil(error.localizedDescription), strongSelf, strongSelf.bridge,
KBStringOrNil(error.localizedDescription), KBStringOrNil(kbInitResult),
strongSelf, strongSelf.bridge,
strongSelf ? [strongSelf javaScriptRuntimePointer] : nil, currentRuntime);
}
// Back off on error to avoid spinning at ~35K/sec and starving the main thread CPU
Expand Down Expand Up @@ -752,3 +754,7 @@ void KbEmitPushNotification(NSDictionary *notification) {
kbInitialNotification = nil;
return notification;
}

void KbSetInitResult(NSString *result) {
kbInitResult = result;
}
6 changes: 4 additions & 2 deletions shared/ios/Keybase/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,17 @@ public class AppDelegate: ExpoAppDelegate, UNUserNotificationCenterDelegate,
securityAccessGroupOverride, nil, nil, systemVer, isIPad, nil, isIOS, shareIntentDonator, &err
)
if let err {
let initResult = "FAILED: \(err.localizedDescription) (code=\(err.code) domain=\(err.domain))"
KbSetInitResult(initResult)
// Log to system log with public annotation so it's not redacted in logarchive.
os_log(
.error, log: AppDelegate.initLog,
"KeybaseInit FAILED: %{public}@ (code=%ld domain=%{public}@)",
err.localizedDescription, err.code, err.domain)
// Also write to ios.log so it's captured in xcappdata even without a device attached.
self.writeStartupTimingLog(
"KeybaseInit FAILED: \(err.localizedDescription) (code=\(err.code) domain=\(err.domain))")
self.writeStartupTimingLog("KeybaseInit \(initResult)")
} else {
KbSetInitResult("succeeded")
self.writeStartupTimingLog("KeybaseInit succeeded")
}

Expand Down