Skip to Content
React NativeComponentUserDevice Manager

📱 Device Manager Screen

A practical implementation of the DeviceSessions component that enables users to securely view and manage all active device sessions within the Zezo OTT app.


📸 Preview

Device Manager Light Preview
Device Manager Dark Preview

🧹 Key Components & Libraries Used

Component / LibraryPurpose
DeviceSessionsRenders and manages the list of active sessions
SafeAreaWrapperEnsures UI stays within safe viewable area
react-queryHandles fetching and mutating session data
useAuthStoreRetrieves the current session token
Alert (React Native)Confirms logout actions with the user

📡 API Call Methods

⚙️ First, set up the getZezoOtt API client: API Client Setup

🧪 The following API methods are used to manage device sessions:


📲 Usage Example

DeviceManagerScreen.tsx
import React from "react"; import { DeviceSessions, SafeAreaWrapper, } from "@zezosoft/zezo-ott-react-native-ui-kit"; import { Alert } from "react-native"; import { goBack } from "src/navigation"; const DeviceManagerScreen = () => { return ( <SafeAreaWrapper> <DeviceSessions title="Manage Devices" sessions={[]} // your API response array of sessions activeSessionId={"session-1"} onLogout={({ session }) => Alert.alert(`Logout from ${session.deviceType}?`) } onBackPress={() => {}} /> </SafeAreaWrapper> ); }; export default DeviceManagerScreen;

🔗 See related route definition: Route enum from @navigation/routes.ts


⚙️ DeviceSessions Props

PropTypeDescription
titlestringTitle shown at the top of the screen
sessionsISession[]Array of active session objects
activeSessionIdstringID of the current session (to prevent logout)
isLoadingbooleanShow a loading skeleton
errorstringError message for fetch failure
isLoadingLogoutbooleanShows loader when logging out a session
onLogoutfunctionCalled when user taps logout
onBackPressfunctionHandles back navigation
themeAppThemeOptional theme override

👤 Identifying the Current Session

const activeSessionId = sessions.find( (session) => session.refreshToken === currentRefreshToken )?.id;
  • Matches the current session using refreshToken.
  • Prevents users from accidentally logging out of their own session.

🔁 Logout Flow

  1. User taps Logout on a session.

  2. Confirmation dialog appears.

  3. If confirmed:

    • Calls removeSession({ token_id }) via backend
    • Removes the session remotely
  4. Displays error alert if something goes wrong.


✅ Summary

  • 🔐 Displays all active device sessions securely
  • 🧠 Smart handling to prevent logging out of the current session
  • 💡 Clear UI with support for loading and error states
  • 🎨 Themeable and highly customizable

✍️ Created by Naresh Dhamu – Powered by ZezoSoft

Last updated on