Add debug logs (#7225)

* Add debug logs

* Fix lint
This commit is contained in:
Daniel Espino García 2023-03-22 12:41:59 +01:00 committed by GitHub
parent c0cb14e927
commit db18151a67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import {t} from '@i18n';
import NetworkManager from '@managers/network_manager';
import {getDeviceToken} from '@queries/app/global';
import {getExpandedLinks, getPushVerificationStatus} from '@queries/servers/system';
import {logDebug} from '@utils/log';
import {forceLogoutIfNecessary} from './session';
@ -63,10 +64,12 @@ export const doPing = async (serverUrl: string, verifyPushProxy: boolean, timeou
}
if (!response.ok) {
logDebug('Server ping returned not ok response', response);
NetworkManager.invalidateClient(serverUrl);
return {error: {intl: pingError}};
}
} catch (error) {
logDebug('Server ping threw an exception', error);
NetworkManager.invalidateClient(serverUrl);
return {error: {intl: pingError}};
}

View file

@ -26,7 +26,7 @@ import {queryAllUsers} from '@queries/servers/user';
import {setFetchingThreadState} from '@store/fetching_thread_store';
import {getValidEmojis, matchEmoticons} from '@utils/emoji/helpers';
import {isServerError} from '@utils/errors';
import {logError} from '@utils/log';
import {logDebug, logError} from '@utils/log';
import {processPostsFetched} from '@utils/post';
import {getPostIdsForCombinedUserActivityPost} from '@utils/post_list';
@ -136,6 +136,7 @@ export async function createPost(serverUrl: string, post: Partial<Post>, files:
try {
created = await client.createPost(newPost);
} catch (error) {
logDebug('Error sending a post', error);
const errorPost = {
...newPost,
id: pendingPostId,

View file

@ -12,6 +12,7 @@ import {subscribeAllServers} from '@database/subscription/servers';
import {subscribeUnreadAndMentionsByServer, UnreadObserverArgs} from '@database/subscription/unreads';
import {useAppState} from '@hooks/device';
import NativeNotification from '@notifications';
import {logDebug} from '@utils/log';
import {changeOpacity} from '@utils/theme';
import type ServersModel from '@typings/database/models/app/servers';
@ -56,9 +57,11 @@ const Home = ({isFocused, theme}: Props) => {
if (Platform.OS === 'ios') {
NativeNotification.getDeliveredNotifications().then((delivered) => {
if (mentions === 0 && delivered.length > 0) {
logDebug('Not updating badge count, since we have no mentions in the database, and the number of notifications in the notification center is', delivered.length);
return;
}
logDebug('Setting the badge count based on database values to', mentions);
Notifications.ios.setBadgeCount(mentions);
});
}