MCPcopy Create free account
hub / github.com/CommE2E/comm / componentDidUpdate

Method componentDidUpdate

native/push/push-handler.react.js:279–321  ·  view source on GitHub ↗
(prevProps: Props, prevState: State)

Source from the content-addressed store, hash-verified

277 }
278
279 componentDidUpdate(prevProps: Props, prevState: State) {
280 if (this.props.activeThread !== prevProps.activeThread) {
281 this.clearNotifsOfThread();
282 }
283 void this.updateBadgeCount();
284
285 for (const threadID of this.openThreadOnceReceived) {
286 const threadInfo = this.props.threadInfos[threadID];
287 if (threadInfo) {
288 this.navigateToThread(threadInfo, false);
289 this.openThreadOnceReceived.clear();
290 break;
291 }
292 }
293
294 if (this.props.loggedIn && !prevProps.loggedIn) {
295 void this.ensurePushNotifsEnabled();
296 } else if (!this.props.localToken && prevProps.localToken) {
297 void this.ensurePushNotifsEnabled();
298 } else {
299 for (const keyserverID in this.props.deviceTokens) {
300 const deviceToken = this.props.deviceTokens[keyserverID];
301 const prevDeviceToken = prevProps.deviceTokens[keyserverID];
302 if (!deviceToken && prevDeviceToken) {
303 void this.ensurePushNotifsEnabled();
304 break;
305 }
306 }
307 }
308
309 if (!this.props.loggedIn && prevProps.loggedIn) {
310 this.clearAllNotifs();
311 void this.resetBadgeCount();
312 }
313
314 if (
315 this.state.inAppNotifProps &&
316 this.state.inAppNotifProps !== prevState.inAppNotifProps
317 ) {
318 Haptics.notificationAsync();
319 InAppNotification.show();
320 }
321 }
322
323 async updateBadgeCount() {
324 const curThinUnreadCounts = this.props.thinThreadsUnreadCount;

Callers

nothing calls this directly

Calls 7

clearNotifsOfThreadMethod · 0.95
updateBadgeCountMethod · 0.95
navigateToThreadMethod · 0.95
clearAllNotifsMethod · 0.95
resetBadgeCountMethod · 0.95
clearMethod · 0.65

Tested by

no test coverage detected