← ClaudeAtlas

mobile-offline-supportlisted

Offline-first mobile apps with local storage, sync queues, conflict resolution. Use for offline functionality, data sync, connectivity handling, or encountering sync conflicts, queue management, storage limits, network transition errors.
secondsky/claude-skills · ★ 248 · Data & Documents · score 90
Install: claude install-skill secondsky/claude-skills
# Mobile Offline Support Build offline-first mobile applications with local storage and synchronization. ## React Native Implementation ```javascript import AsyncStorage from '@react-native-async-storage/async-storage'; import NetInfo from '@react-native-community/netinfo'; class OfflineManager { constructor() { this.syncQueue = []; this.isOnline = true; // Maximum items in sync queue before discarding oldest this.MAX_SYNC_QUEUE_LENGTH = 1000; NetInfo.addEventListener(state => { this.isOnline = state.isConnected; if (this.isOnline) this.processQueue(); }); } /** * Fetch data from server. * TODO: Replace with actual API endpoint implementation. */ async fetchFromServer(key) { try { // Example implementation - replace with your API const response = await fetch(`${API_BASE_URL}/data/${key}`); if (!response.ok) { throw new Error(`Server returned ${response.status}`); } return await response.json(); } catch (error) { console.error('fetchFromServer failed:', error); throw new Error(`Failed to fetch ${key}: ${error.message}`); } } /** * Sync data to server. * TODO: Replace with actual API endpoint implementation. */ async syncToServer(key, data) { try { // Example implementation - replace with your API const response = await fetch(`${API_BASE_URL}/data/${key}`, { method: 'POST', headers: { 'Content-Type': 'applicatio