* feat: implement floating banner system - Add FloatingBanner component with gesture support and keyboard awareness - Implement BannerManager singleton for banner lifecycle management - Create floating banner screen with SafeAreaProvider integration - Add comprehensive banner configuration types and positioning - Update Banner component to use modern gesture handling - Enhance BannerItem with improved typography and spacing (40px height) - Add ConnectionBanner improvements with better sizing - Remove ConnectionBanner from channel list (moved to floating system) - Update screens constants (remove FLOATING_BANNER - handled as overlay) - Add i18n support for limited network connection message The system provides: - Auto-hide functionality with customizable duration - Position-aware rendering (top/bottom with keyboard adjustment) - Tablet-specific offset handling - Swipe-to-dismiss with configurable thresholds - Custom component support alongside default banner items - Comprehensive test coverage with device-specific scenarios * docs: add floating banner system documentation and cleanup - Add comprehensive floating-banner.md with architecture diagrams - Remove incompatible connection_banner/index.ts file - Update device.ts hooks for better keyboard handling - Simplify screens/index.tsx floating banner registration - Update test/setup.ts to remove deprecated keyboard mocks - Clean up keyboard height logic and ESLint issues The documentation covers: - System architecture and component relationships - API reference and usage patterns - Performance considerations and best practices - Integration points and troubleshooting guide - Comprehensive testing strategy All tests now pass with the updated setup. * fix issue with translation file * some self cleanup. * renamed index.tsx => Banner.tsx * creaete meaningful tests for Banner component and all the hooks. * fix tests * cleanup based on initial review by AI * dismissible was set to true, changing to what was configured. * making title and message optional * feat(MM-65145): Network connectivity/performance observer * add MONITOR_NETWORK_PERFORMANCE * i18n stuff * remove unused props * Undo some AI changes that caught by another AI * network connectivity observation md * addressed some comments in PR * more fixes based on PR review. * added future enhancement * dismissOverlay will be awaited * delay dismissing overlay so we don't have to show a new one all the time * make the banner stackable * Fix issue with last banner dismissal delayed by 2s * update floating-banner test * put back an extra space * add a todo to use namespace * add comment on priority order for connectivity performance * use static const vs magic number * add a guard against adding performanceSubject when server has been removed * fix failing tests * clean-up based on review by @enahum * fix failing test * fix failiing tests * rename confusing var * update changes to types * fixed issue with swipe not working on android * performance and connectivity use the same id so that 2 banners won't appear * fix issue w/ android not registering touch events behind the overlay * fix failing test * hideBanner now needs id. * Connection status unknown added in en.json * update the doc * animate the banner moving up when bottom banner first appear. * removed unused functions and update tests * add useMemo and useCallback * update jsdoc to say dismissable is default true * fix failing test
79 lines
2.7 KiB
TypeScript
79 lines
2.7 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {CallsManager} from '@calls/calls_manager';
|
|
import DatabaseManager from '@database/manager';
|
|
import {getAllServerCredentials, getActiveServerUrl} from '@init/credentials';
|
|
import {initialLaunch} from '@init/launch';
|
|
import ManagedApp from '@init/managed_app';
|
|
import PushNotifications from '@init/push_notifications';
|
|
import GlobalEventHandler from '@managers/global_event_handler';
|
|
import NetworkConnectivityManager from '@managers/network_connectivity_manager';
|
|
import NetworkConnectivitySubscriptionManager from '@managers/network_connectivity_subscription_manager';
|
|
import NetworkManager from '@managers/network_manager';
|
|
import SessionManager from '@managers/session_manager';
|
|
import WebsocketManager from '@managers/websocket_manager';
|
|
import {registerScreens} from '@screens/index';
|
|
import {registerNavigationListeners} from '@screens/navigation';
|
|
import EphemeralStore from '@store/ephemeral_store';
|
|
import NavigationStore from '@store/navigation_store';
|
|
|
|
// Controls whether the main initialization (database, etc...) is done, either on app launch
|
|
// or on the Share Extension, for example.
|
|
let baseAppInitialized = false;
|
|
|
|
let serverCredentials: ServerCredential[];
|
|
|
|
// Fallback Polyfill for Promise.allSettle
|
|
Promise.allSettled = Promise.allSettled || (<T>(promises: Array<Promise<T>>) => Promise.all(
|
|
promises.map((p) => p.
|
|
then((value) => ({
|
|
status: 'fulfilled',
|
|
value,
|
|
})).
|
|
catch((reason) => ({
|
|
status: 'rejected',
|
|
reason,
|
|
})),
|
|
),
|
|
));
|
|
|
|
export async function initialize() {
|
|
if (!baseAppInitialized) {
|
|
baseAppInitialized = true;
|
|
serverCredentials = await getAllServerCredentials();
|
|
const serverUrls = serverCredentials.map((credential) => credential.serverUrl);
|
|
|
|
await DatabaseManager.init(serverUrls);
|
|
await NetworkManager.init(serverCredentials);
|
|
|
|
GlobalEventHandler.init();
|
|
ManagedApp.init();
|
|
SessionManager.init();
|
|
CallsManager.initialize();
|
|
|
|
const activeServerUrl = await getActiveServerUrl();
|
|
NetworkConnectivityManager.init(activeServerUrl || null);
|
|
}
|
|
}
|
|
|
|
export async function start() {
|
|
// Clean relevant information on ephemeral stores
|
|
NavigationStore.reset();
|
|
EphemeralStore.setCurrentThreadId('');
|
|
EphemeralStore.setProcessingNotification('');
|
|
|
|
await initialize();
|
|
|
|
PushNotifications.init(serverCredentials.length > 0);
|
|
|
|
registerNavigationListeners();
|
|
registerScreens();
|
|
|
|
await WebsocketManager.init(serverCredentials);
|
|
|
|
NetworkConnectivitySubscriptionManager.init();
|
|
|
|
initialLaunch();
|
|
}
|
|
|