Skip to content

Commit cd29aae

Browse files
committed
chore(mobile): remove unnecessary comments and fix linting issues
1 parent b74f81c commit cd29aae

File tree

5 files changed

+7
-26
lines changed

5 files changed

+7
-26
lines changed

apps/mobile/v1/src/components/FileUpload.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { Ionicons } from '@expo/vector-icons';
1111
import * as Haptics from 'expo-haptics';
1212
import { useTheme } from '../theme';
13-
import { useApiService, type FileAttachment, type PickedFile } from '../services/api';
13+
import { useApiService, type FileAttachment } from '../services/api';
1414

1515
interface FileUploadProps {
1616
noteId: string;
@@ -37,7 +37,7 @@ export function FileUpload({
3737
const files = await api.pickFiles();
3838

3939
if (files.length === 0) {
40-
return; // User cancelled
40+
return;
4141
}
4242

4343
setIsUploading(true);

apps/mobile/v1/src/hooks/useNoteEditor.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { useTheme } from '../theme';
66
import { useApiService, type Note } from '../services/api';
77
import { generateEditorStyles } from '../screens/EditNote/styles';
88

9-
const EDITOR_LOAD_DELAY = 500;
109
const CSS_INJECTION_DELAY = 100;
1110

1211
interface UseNoteEditorReturn {
@@ -27,29 +26,25 @@ export function useNoteEditor(noteId?: string): UseNoteEditorReturn {
2726
const editorReadyRef = useRef(false);
2827
const pendingContentRef = useRef<string | null>(null);
2928

30-
// Initialize editor with TenTapStartKit
3129
const editor = useEditorBridge({
3230
autofocus: false,
3331
avoidIosKeyboard: true,
3432
initialContent: '<p></p>',
3533
bridgeExtensions: TenTapStartKit,
3634
});
3735

38-
// Generate custom CSS memoized on theme colors
3936
const customCSS = useMemo(
4037
() => generateEditorStyles(theme.colors),
4138
[theme.colors]
4239
);
4340

44-
// Handler for when WebView loads - inject CSS at the right time
4541
const handleEditorLoad = useCallback(() => {
4642
editor.injectCSS(customCSS, 'theme-css');
4743

48-
// Also inject after a slight delay to ensure it overrides TenTap's default styles
44+
// Inject after delay to override TenTap's default styles
4945
setTimeout(() => {
5046
editor.injectCSS(customCSS, 'theme-css');
5147

52-
// Mark editor as ready and set pending content if any
5348
editorReadyRef.current = true;
5449
if (pendingContentRef.current !== null) {
5550
if (__DEV__) {
@@ -61,7 +56,6 @@ export function useNoteEditor(noteId?: string): UseNoteEditorReturn {
6156
}, CSS_INJECTION_DELAY);
6257
}, [editor, customCSS]);
6358

64-
// Load note content if editing
6559
const loadNote = useCallback(async () => {
6660
if (!noteId) return;
6761

@@ -73,7 +67,6 @@ export function useNoteEditor(noteId?: string): UseNoteEditorReturn {
7367

7468
const content = note.content || '';
7569

76-
// If editor is ready, set content immediately
7770
if (editorReadyRef.current) {
7871
setTimeout(() => {
7972
if (__DEV__) {
@@ -82,7 +75,6 @@ export function useNoteEditor(noteId?: string): UseNoteEditorReturn {
8275
editor.setContent(content);
8376
}, 100);
8477
} else {
85-
// Otherwise, store content to be set when editor is ready
8678
if (__DEV__) {
8779
console.log('Editor not ready yet, storing content...');
8880
}

apps/mobile/v1/src/screens/EditNote/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react';
2-
import { View, Text, StyleSheet, Alert, TextInput, Platform, ScrollView } from 'react-native';
2+
import { View, Text, StyleSheet, Alert, TextInput, Platform } from 'react-native';
33
import { SafeAreaView } from 'react-native-safe-area-context';
44
import { useRouter, useLocalSearchParams } from 'expo-router';
55
import * as Haptics from 'expo-haptics';
@@ -40,7 +40,6 @@ export default function EditNoteScreen() {
4040
setNoteData(note || null);
4141
setTitle(note?.title || '');
4242

43-
// Load attachments
4443
if (note) {
4544
const noteAttachments = await api.getAttachments(noteId as string);
4645
setAttachments(noteAttachments);
@@ -92,6 +91,7 @@ export default function EditNoteScreen() {
9291
starred: false,
9392
archived: false,
9493
deleted: false,
94+
hidden: false,
9595
});
9696
}
9797

@@ -195,7 +195,6 @@ export default function EditNoteScreen() {
195195
</View>
196196
)}
197197

198-
{/* File Attachments - only show when toggled */}
199198
{isEditing && noteId && showAttachments && (
200199
<View style={styles.attachmentsSection}>
201200
<FileUpload

apps/mobile/v1/src/screens/ViewNote/index.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export default function ViewNoteScreen() {
2626
const { note, loading, htmlContent, handleEdit, handleToggleStar, handleToggleHidden } = useViewNote(noteId as string);
2727

2828
useEffect(() => {
29-
// Reset scroll position when note changes
3029
scrollY.setValue(0);
3130
if (scrollViewRef.current) {
3231
scrollViewRef.current.scrollTo({ y: 0, animated: false });
@@ -54,7 +53,6 @@ export default function ViewNoteScreen() {
5453
}
5554
}, [noteId, api]);
5655

57-
// Load attachments when note loads
5856
useEffect(() => {
5957
if (noteId && lastLoadedNoteId.current !== noteId) {
6058
loadAttachments();
@@ -69,11 +67,8 @@ export default function ViewNoteScreen() {
6967

7068
try {
7169
setDownloadingId(attachment.id);
72-
console.log('Starting download for:', attachment.originalName);
7370
const fileUri = await api.downloadFile(attachment);
74-
console.log('File downloaded to:', fileUri);
7571
await api.shareFile(fileUri);
76-
console.log('Share dialog opened');
7772
} catch (error) {
7873
console.error('Failed to download attachment:', error);
7974
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
@@ -88,19 +83,15 @@ export default function ViewNoteScreen() {
8883
}
8984
};
9085

91-
// Reload attachments when coming back to this screen
9286
useFocusEffect(
9387
useCallback(() => {
94-
// Reset scroll position when screen comes into focus
9588
scrollY.setValue(0);
9689
if (scrollViewRef.current) {
9790
scrollViewRef.current.scrollTo({ y: 0, animated: false });
9891
}
9992

100-
// Force reload attachments when coming back (e.g., from EditNote)
101-
// But only if this is our note and we're not already loading
10293
if (noteId && lastLoadedNoteId.current === noteId && !loadingRef.current) {
103-
lastLoadedNoteId.current = null; // Reset to force reload
94+
lastLoadedNoteId.current = null;
10495
loadAttachments();
10596
}
10697
// eslint-disable-next-line react-hooks/exhaustive-deps

apps/mobile/v1/src/services/fileService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import forge from 'node-forge';
1111
import { encryptWithAESGCM, decryptWithAESGCM } from '../lib/encryption/core/aes';
1212
import { deriveEncryptionKey } from '../lib/encryption/core/keyDerivation';
1313
import { ENCRYPTION_CONFIG } from '../lib/encryption/config';
14-
import { encryptionService } from '../lib/encryption';
1514
import { getUserSecret, getMasterKey } from '../lib/encryption/storage/secureStorage';
1615
import type { FileAttachment } from './api/types';
1716

@@ -70,7 +69,7 @@ class FileService {
7069
*/
7170
private base64ToArrayBuffer(base64: string): ArrayBuffer {
7271
const bytes = this.base64ToUint8Array(base64);
73-
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
72+
return bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) as ArrayBuffer;
7473
}
7574

7675
/**

0 commit comments

Comments
 (0)