diff --git a/scripts/test-ios.js b/scripts/test-ios.js index 472169f6..0a19cbfa 100644 --- a/scripts/test-ios.js +++ b/scripts/test-ios.js @@ -330,7 +330,7 @@ const verifyXcodeInstallation = (log) => { // Generate test data using generate_data.ts const generateTestData = async (log) => { - log('\nšŸ” DEBUG: Starting test data generation...'); + log('\nšŸ” Starting test data generation...'); // Check directory structure log('šŸ“ Current directory:', process.cwd()); diff --git a/src/db/databaseUtil.ts b/src/db/databaseUtil.ts index abded60b..1ccd7428 100644 --- a/src/db/databaseUtil.ts +++ b/src/db/databaseUtil.ts @@ -54,11 +54,6 @@ export async function updateDidSpecificSettings( accountDid: string, settingsChanges: Settings, ): Promise { - console.log("šŸ”§ DEBUG: updateDidSpecificSettings called with:", { - accountDid, - settingsChanges, - }); - settingsChanges.accountDid = accountDid; delete settingsChanges.id; // key off account, not ID @@ -69,13 +64,11 @@ export async function updateDidSpecificSettings( "SELECT * FROM settings WHERE accountDid = ?", [accountDid], ); - console.log("šŸ”§ DEBUG: Pre-update database check:", checkResult); // Get the current values for comparison const currentRecord = checkResult?.values?.length ? mapColumnsToValues(checkResult.columns, checkResult.values)[0] : null; - console.log("šŸ”§ DEBUG: Current record:", currentRecord); // First try to update existing record const { sql: updateSql, params: updateParams } = generateUpdateStatement( @@ -85,11 +78,7 @@ export async function updateDidSpecificSettings( [accountDid], ); - console.log("šŸ”§ DEBUG: Generated SQL:", updateSql); - console.log("šŸ”§ DEBUG: Generated params:", updateParams); - - const updateResult = await platform.dbExec(updateSql, updateParams); - console.log("šŸ”§ DEBUG: Update result:", updateResult); + await platform.dbExec(updateSql, updateParams); // **WORKAROUND**: AbsurdSQL doesn't return changes count correctly // Instead, check if the record was actually updated @@ -101,46 +90,35 @@ export async function updateDidSpecificSettings( const updatedRecord = postUpdateResult?.values?.length ? mapColumnsToValues(postUpdateResult.columns, postUpdateResult.values)[0] : null; - console.log("šŸ”§ DEBUG: Updated record:", updatedRecord); // Check if any of the target fields were actually changed let actuallyUpdated = false; if (currentRecord && updatedRecord) { for (const key of Object.keys(settingsChanges)) { if (key !== "accountDid" && currentRecord[key] !== updatedRecord[key]) { - console.log( - `šŸ”§ DEBUG: Field '${key}' changed from '${currentRecord[key]}' to '${updatedRecord[key]}'`, - ); actuallyUpdated = true; } } } - console.log("šŸ”§ DEBUG: Actually updated:", actuallyUpdated); - // If the standard update didn't work, try a different approach if ( !actuallyUpdated && settingsChanges.firstName && settingsChanges.isRegistered !== undefined ) { - console.log( - "šŸ”§ DEBUG: Standard update failed, trying individual field updates...", - ); // Update firstName - const firstNameResult = await platform.dbExec( + await platform.dbExec( "UPDATE settings SET firstName = ? WHERE accountDid = ?", [settingsChanges.firstName, accountDid], ); - console.log("šŸ”§ DEBUG: firstName update result:", firstNameResult); // Update isRegistered - const isRegisteredResult = await platform.dbExec( + await platform.dbExec( "UPDATE settings SET isRegistered = ? WHERE accountDid = ?", [settingsChanges.isRegistered ? 1 : 0, accountDid], ); - console.log("šŸ”§ DEBUG: isRegistered update result:", isRegisteredResult); // Check if the individual updates worked const finalCheckResult = await platform.dbQuery( @@ -151,10 +129,6 @@ export async function updateDidSpecificSettings( const finalRecord = finalCheckResult?.values?.length ? mapColumnsToValues(finalCheckResult.columns, finalCheckResult.values)[0] : null; - console.log( - "šŸ”§ DEBUG: Final record after individual updates:", - finalRecord, - ); if (finalRecord) { actuallyUpdated = @@ -163,7 +137,6 @@ export async function updateDidSpecificSettings( } } - console.log("šŸ”§ DEBUG: Final success status:", actuallyUpdated); return actuallyUpdated; } @@ -200,21 +173,15 @@ export async function retrieveSettingsForDefaultAccount(): Promise { * @throws Will log specific errors for debugging but returns default settings on failure */ export async function retrieveSettingsForActiveAccount(): Promise { - console.log("šŸ” DEBUG: retrieveSettingsForActiveAccount called"); - try { // Get default settings first const defaultSettings = await retrieveSettingsForDefaultAccount(); - console.log("šŸ” DEBUG: Default settings loaded:", defaultSettings); // If no active DID, return defaults if (!defaultSettings.activeDid) { - console.log("šŸ” DEBUG: No active DID, returning defaults"); return defaultSettings; } - console.log("šŸ” DEBUG: Active DID found:", defaultSettings.activeDid); - // Get account-specific settings try { const platform = PlatformServiceFactory.getInstance(); @@ -223,12 +190,7 @@ export async function retrieveSettingsForActiveAccount(): Promise { [defaultSettings.activeDid], ); - console.log("šŸ” DEBUG: Account-specific query result:", result); - if (!result?.values?.length) { - console.log( - "šŸ” DEBUG: No account-specific settings found, returning defaults", - ); // we created DID-specific settings when generated or imported, so this shouldn't happen return defaultSettings; } @@ -239,22 +201,13 @@ export async function retrieveSettingsForActiveAccount(): Promise { result.values, )[0] as Settings; - console.log("šŸ” DEBUG: Raw override settings:", overrideSettings); - const overrideSettingsFiltered = Object.fromEntries( Object.entries(overrideSettings).filter(([_, v]) => v !== null), ); - console.log( - "šŸ” DEBUG: Filtered override settings:", - overrideSettingsFiltered, - ); - // Merge settings let settings = { ...defaultSettings, ...overrideSettingsFiltered }; - console.log("šŸ” DEBUG: Merged settings before platform fix:", settings); - // **ELECTRON-SPECIFIC FIX**: Force production API endpoints for Electron // This ensures Electron doesn't use localhost development servers that might be saved in user settings if (process.env.VITE_PLATFORM === "electron") { @@ -279,10 +232,8 @@ export async function retrieveSettingsForActiveAccount(): Promise { settings.searchBoxes = parseJsonField(settings.searchBoxes, []); } - console.log("šŸ” DEBUG: Final merged settings:", settings); return settings; } catch (error) { - console.log("šŸ” DEBUG: Error in account settings retrieval:", error); logConsoleAndDb( `[databaseUtil] Failed to retrieve account settings for ${defaultSettings.activeDid}: ${error}`, true, @@ -291,7 +242,6 @@ export async function retrieveSettingsForActiveAccount(): Promise { return defaultSettings; } } catch (error) { - console.log("šŸ” DEBUG: Error in default settings retrieval:", error); logConsoleAndDb( `[databaseUtil] Failed to retrieve default settings: ${error}`, true, diff --git a/src/libs/util.ts b/src/libs/util.ts index 17c207bf..8dfed860 100644 --- a/src/libs/util.ts +++ b/src/libs/util.ts @@ -603,12 +603,9 @@ export async function saveNewIdentity( mnemonic: string, derivationPath: string, ): Promise { - console.log("šŸ’¾ DEBUG: saveNewIdentity called with DID:", identity.did); - try { // add to the new sql db const platformService = PlatformServiceFactory.getInstance(); - console.log("šŸ’¾ DEBUG: Getting secrets from database"); const secrets = await platformService.dbQuery( `SELECT secretBase64 FROM secret`, @@ -620,7 +617,6 @@ export async function saveNewIdentity( } const secretBase64 = secrets.values[0][0] as string; - console.log("šŸ’¾ DEBUG: Found secret, encrypting identity"); const secret = base64ToArrayBuffer(secretBase64); const identityStr = JSON.stringify(identity); @@ -629,8 +625,6 @@ export async function saveNewIdentity( const encryptedIdentityBase64 = arrayBufferToBase64(encryptedIdentity); const encryptedMnemonicBase64 = arrayBufferToBase64(encryptedMnemonic); - console.log("šŸ’¾ DEBUG: Inserting account into database"); - const sql = `INSERT INTO accounts (dateCreated, derivationPath, did, identityEncrBase64, mnemonicEncrBase64, publicKeyHex) VALUES (?, ?, ?, ?, ?, ?)`; const params = [ @@ -642,22 +636,15 @@ export async function saveNewIdentity( identity.keys[0].publicKeyHex, ]; await platformService.dbExec(sql, params); - console.log("šŸ’¾ DEBUG: Account inserted successfully"); - console.log("šŸ’¾ DEBUG: Updating default settings with activeDid"); await databaseUtil.updateDefaultSettings({ activeDid: identity.did }); - console.log("šŸ’¾ DEBUG: Default settings updated"); - console.log("šŸ’¾ DEBUG: Inserting DID-specific settings"); await databaseUtil.insertDidSpecificSettings(identity.did); - console.log("šŸ’¾ DEBUG: DID-specific settings inserted"); // Check what was actually created const createdSettings = await databaseUtil.retrieveSettingsForActiveAccount(); - console.log("šŸ’¾ DEBUG: Created settings:", createdSettings); } catch (error) { - console.log("šŸ’¾ DEBUG: saveNewIdentity error:", error); logger.error("Failed to update default settings:", error); throw new Error( "Failed to set default settings. Please try again or restart the app.", @@ -934,56 +921,37 @@ export async function importFromMnemonic( derivationPath: string = DEFAULT_ROOT_DERIVATION_PATH, shouldErase: boolean = false, ): Promise { - console.log("šŸ“„ DEBUG: importFromMnemonic called with:", { - mnemonicLength: mnemonic.split(" ").length, - derivationPath, - shouldErase, - }); const mne: string = mnemonic.trim().toLowerCase(); - console.log("šŸ“„ DEBUG: Normalized mnemonic length:", mne.split(" ").length); // Check if this is Test User #0 const TEST_USER_0_MNEMONIC = "rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage"; const isTestUser0 = mne === TEST_USER_0_MNEMONIC; - console.log("šŸ“„ DEBUG: Is Test User #0:", isTestUser0); // Derive address and keys from mnemonic const [address, privateHex, publicHex] = deriveAddress(mne, derivationPath); - console.log("šŸ“„ DEBUG: Derived address:", address); - console.log("šŸ“„ DEBUG: Derived DID:", `did:ethr:${address}`); // Create new identifier const newId = newIdentifier(address, publicHex, privateHex, derivationPath); - console.log("šŸ“„ DEBUG: Created new identifier:", { - did: newId.did, - keysLength: newId.keys.length, - }); // Handle erasures if (shouldErase) { - console.log("šŸ“„ DEBUG: Erasing existing accounts"); const platformService = PlatformServiceFactory.getInstance(); await platformService.dbExec("DELETE FROM accounts"); } // Save the new identity - console.log("šŸ“„ DEBUG: Calling saveNewIdentity"); await saveNewIdentity(newId, mne, derivationPath); - console.log("šŸ“„ DEBUG: saveNewIdentity completed"); // Set up Test User #0 specific settings if (isTestUser0) { - console.log("šŸ“„ DEBUG: Setting up Test User #0 specific settings"); - // First, let's see what's currently in the database const platformService = PlatformServiceFactory.getInstance(); const existingResult = await platformService.dbQuery( "SELECT * FROM settings WHERE accountDid = ?", [newId.did], ); - console.log("šŸ“„ DEBUG: Existing settings before update:", existingResult); // Let's also see the actual data by mapping it if (existingResult?.values?.length) { @@ -991,7 +959,6 @@ export async function importFromMnemonic( existingResult.columns, existingResult.values, )[0]; - console.log("šŸ“„ DEBUG: Existing settings mapped:", existingData); } // Let's also check what's in the master settings @@ -999,7 +966,6 @@ export async function importFromMnemonic( "SELECT * FROM settings WHERE id = ?", ["MASTER"], ); - console.log("šŸ“„ DEBUG: Master settings:", masterResult); // Now try the UPDATE with better debugging const updateResult = await databaseUtil.updateDidSpecificSettings( @@ -1009,29 +975,24 @@ export async function importFromMnemonic( isRegistered: true, }, ); - console.log("šŸ“„ DEBUG: Test User #0 settings update result:", updateResult); // Verify the settings were saved const verifyResult = await platformService.dbQuery( "SELECT * FROM settings WHERE accountDid = ?", [newId.did], ); - console.log("šŸ“„ DEBUG: Settings after update attempt:", verifyResult); if (verifyResult?.values?.length) { const verifiedData = databaseUtil.mapColumnsToValues( verifyResult.columns, verifyResult.values, )[0]; - console.log("šŸ“„ DEBUG: Settings after update mapped:", verifiedData); } - console.log("šŸ“„ DEBUG: Test User #0 settings applied"); } // Check what settings were created const settings = await databaseUtil.retrieveSettingsForActiveAccount(); - console.log("šŸ“„ DEBUG: Final settings after import:", settings); } /** diff --git a/src/utils/PlatformServiceMixin.ts b/src/utils/PlatformServiceMixin.ts index b02d7d42..917eca97 100644 --- a/src/utils/PlatformServiceMixin.ts +++ b/src/utils/PlatformServiceMixin.ts @@ -616,8 +616,6 @@ export const PlatformServiceMixin = { did?: string, defaults: Settings = {}, ): Promise { - console.log("šŸ’« DEBUG: $accountSettings called with:", { did, defaults }); - // Import the working retrieveSettingsForActiveAccount function const { retrieveSettingsForActiveAccount } = await import( "@/db/databaseUtil" @@ -626,18 +624,12 @@ export const PlatformServiceMixin = { try { // Use the working function that properly merges settings const settings = await retrieveSettingsForActiveAccount(); - console.log( - "šŸ’« DEBUG: retrieveSettingsForActiveAccount returned:", - settings, - ); // Merge with any provided defaults const mergedSettings = { ...defaults, ...settings }; - console.log("šŸ’« DEBUG: Final merged settings:", mergedSettings); return mergedSettings; } catch (error) { - console.log("šŸ’« DEBUG: Error in $accountSettings:", error); logger.error( "[PlatformServiceMixin] Error in $accountSettings:", error, diff --git a/src/views/ImportAccountView.vue b/src/views/ImportAccountView.vue index 4ff2c3dd..cc5768a7 100644 --- a/src/views/ImportAccountView.vue +++ b/src/views/ImportAccountView.vue @@ -189,12 +189,6 @@ export default class ImportAccountView extends Vue { * Uses importFromMnemonic utility for secure import */ public async onImportClick() { - console.log("šŸ”‘ DEBUG: Import process started"); - console.log("šŸ”‘ DEBUG: Mnemonic length:", this.mnemonic.split(" ").length); - console.log("šŸ”‘ DEBUG: Derivation path:", this.derivationPath); - console.log("šŸ”‘ DEBUG: Should erase:", this.shouldErase); - console.log("šŸ”‘ DEBUG: API Server:", this.apiServer); - if (!this.mnemonic?.trim()) { this.notify.warning( "Seed phrase is required to import an account.", @@ -204,17 +198,14 @@ export default class ImportAccountView extends Vue { } try { - console.log("šŸ”‘ DEBUG: Calling importFromMnemonic..."); await importFromMnemonic( this.mnemonic, this.derivationPath, this.shouldErase, ); - console.log("šŸ”‘ DEBUG: importFromMnemonic completed successfully"); // Check what was actually imported const settings = await this.$accountSettings(); - console.log("šŸ”‘ DEBUG: Post-import settings:", settings); // Check account-specific settings if (settings?.activeDid) { @@ -223,25 +214,13 @@ export default class ImportAccountView extends Vue { "SELECT * FROM settings WHERE accountDid = ?", [settings.activeDid], ); - console.log( - "šŸ”‘ DEBUG: Post-import account-specific settings:", - accountSettings, - ); } catch (error) { - console.log("šŸ”‘ DEBUG: Error checking post-import settings:", error); } } this.notify.success("Account imported successfully!", TIMEOUTS.STANDARD); this.$router.push({ name: "account" }); } catch (error: any) { - console.log("šŸ”‘ DEBUG: Import failed with error:", error); - console.log("šŸ”‘ DEBUG: Error details:", { - message: error.message, - stack: error.stack, - name: error.name, - }); - this.$logError("Import failed: " + error); this.notify.error( error.message || "Failed to import account.", diff --git a/src/views/OnboardMeetingListView.vue b/src/views/OnboardMeetingListView.vue index 92c3b392..c7044fb3 100644 --- a/src/views/OnboardMeetingListView.vue +++ b/src/views/OnboardMeetingListView.vue @@ -154,43 +154,32 @@ export default class OnboardMeetingListView extends Vue { showPasswordDialog = false; async created() { - console.log("šŸ“‹ DEBUG: OnboardMeetingListView created() called"); const settings = await this.$accountSettings(); - console.log("šŸ“‹ DEBUG: Settings loaded:", settings); - // šŸ” TEMPORARY DEBUG: Check raw database for test user registration state if (settings?.activeDid) { - console.log( - "šŸ“‹ DEBUG: Checking raw database settings for DID:", - settings.activeDid, - ); try { // Check master settings const masterSettings = await this.$query( "SELECT * FROM settings WHERE id = ?", [1], ); - console.log("šŸ“‹ DEBUG: Master settings:", masterSettings); // Check account-specific settings const accountSettings = await this.$query( "SELECT * FROM settings WHERE accountDid = ?", [settings.activeDid], ); - console.log("šŸ“‹ DEBUG: Account-specific settings:", accountSettings); // Check if there are any settings with isRegistered = 1 const registeredSettings = await this.$query( "SELECT * FROM settings WHERE isRegistered = 1", ); - console.log("šŸ“‹ DEBUG: All registered settings:", registeredSettings); // Check all settings for this user const allSettings = await this.$query("SELECT * FROM settings"); - console.log("šŸ“‹ DEBUG: All settings in database:", allSettings); } catch (error) { - console.log("šŸ“‹ DEBUG: Error checking raw database:", error); + logger.error("Error checking raw database:", error); } } @@ -199,86 +188,56 @@ export default class OnboardMeetingListView extends Vue { this.firstName = settings?.firstName || ""; this.isRegistered = !!settings?.isRegistered; - console.log("šŸ“‹ DEBUG: activeDid =", this.activeDid); - console.log("šŸ“‹ DEBUG: apiServer =", this.apiServer); - console.log("šŸ“‹ DEBUG: firstName =", this.firstName); - console.log("šŸ“‹ DEBUG: isRegistered =", this.isRegistered); - if (this.isRegistered) { - console.log("šŸ“‹ DEBUG: User is registered, checking for meetings..."); await this.fetchMeetings(); - } else { - console.log("šŸ“‹ DEBUG: User is NOT registered, skipping meeting check"); } } async fetchMeetings() { - console.log("šŸ“‹ DEBUG: fetchMeetings() called"); - console.log("šŸ“‹ DEBUG: activeDid =", this.activeDid); - console.log("šŸ“‹ DEBUG: apiServer =", this.apiServer); - this.isLoading = true; try { - console.log("šŸ“‹ DEBUG: Checking if user is attending a meeting..."); const headers = await getHeaders(this.activeDid); - console.log("šŸ“‹ DEBUG: Headers obtained:", headers); const response = await this.axios.get( this.apiServer + "/api/partner/groupOnboardMember", { headers }, ); - console.log("šŸ“‹ DEBUG: Member response:", response.data); if (response.data?.data) { - console.log( - "šŸ“‹ DEBUG: User is attending a meeting, fetching details...", - ); const attendingMeetingId = response.data.data.groupId; - console.log("šŸ“‹ DEBUG: Attending meeting ID:", attendingMeetingId); const headers2 = await getHeaders(this.activeDid); const response2 = await this.axios.get( this.apiServer + "/api/partner/groupOnboard/" + attendingMeetingId, { headers: headers2 }, ); - console.log("šŸ“‹ DEBUG: Meeting details response:", response2.data); if (response2.data?.data) { - console.log("šŸ“‹ DEBUG: Setting attendingMeeting"); this.attendingMeeting = response2.data.data; - console.log("šŸ“‹ DEBUG: attendingMeeting set:", this.attendingMeeting); return; } else { - console.log( - "šŸ“‹ DEBUG: ERROR: No meeting details found for attending meeting", - ); this.$logAndConsole( "Error fetching meeting for user after saying they are in one.", true, ); } } else { - console.log("šŸ“‹ DEBUG: User is NOT attending a meeting"); + this.$logAndConsole( + "Error fetching meeting for user after saying they are in one.", + true, + ); } - console.log("šŸ“‹ DEBUG: Fetching available meetings..."); const headers2 = await getHeaders(this.activeDid); const response2 = await this.axios.get( this.apiServer + "/api/partner/groupsOnboarding", { headers: headers2 }, ); - console.log("šŸ“‹ DEBUG: Available meetings response:", response2.data); if (response2.data?.data) { - console.log("šŸ“‹ DEBUG: Setting meetings list"); this.meetings = response2.data.data; - console.log("šŸ“‹ DEBUG: meetings set:", this.meetings); - } else { - console.log("šŸ“‹ DEBUG: No meetings found"); } } catch (error: any) { - console.log("šŸ“‹ DEBUG: Error fetching meetings:", error); - console.log("šŸ“‹ DEBUG: Error response:", error.response?.data); this.$logAndConsole( "Error fetching meetings: " + errorStringForLog(error), true, @@ -437,7 +396,6 @@ export default class OnboardMeetingListView extends Vue { } createMeeting() { - console.log("šŸ“‹ DEBUG: createMeeting() called - routing to meeting setup"); this.$router.push({ name: "onboard-meeting-setup" }); } } diff --git a/src/views/OnboardMeetingSetupView.vue b/src/views/OnboardMeetingSetupView.vue index 5d91dd15..41f4e7b5 100644 --- a/src/views/OnboardMeetingSetupView.vue +++ b/src/views/OnboardMeetingSetupView.vue @@ -398,52 +398,27 @@ export default class OnboardMeetingView extends Vue { } async fetchCurrentMeeting() { - console.log("šŸ—ļø DEBUG: fetchCurrentMeeting() called"); - console.log("šŸ—ļø DEBUG: activeDid =", this.activeDid); - console.log("šŸ—ļø DEBUG: apiServer =", this.apiServer); - try { const headers = await getHeaders(this.activeDid); - console.log("šŸ—ļø DEBUG: Headers obtained:", headers); const response = await this.axios.get( this.apiServer + "/api/partner/groupOnboard", { headers }, ); - console.log("šŸ—ļø DEBUG: Meeting response:", response.data); const queryPassword = this.$route.query["password"] as string; - console.log("šŸ—ļø DEBUG: Query password:", queryPassword); if (response?.data?.data) { - console.log("šŸ—ļø DEBUG: Meeting found, setting currentMeeting"); this.currentMeeting = { ...response.data.data, userFullName: this.fullName, password: this.currentMeeting?.password || queryPassword || "", }; - console.log("šŸ—ļø DEBUG: currentMeeting set:", this.currentMeeting); } else { - console.log( - "šŸ—ļø DEBUG: No meeting found, setting up blank meeting for creation", - ); this.newOrUpdatedMeetingInputs = this.blankMeeting(); - console.log( - "šŸ—ļø DEBUG: newOrUpdatedMeetingInputs set:", - this.newOrUpdatedMeetingInputs, - ); } } catch (error: any) { - console.log("šŸ—ļø DEBUG: Error fetching meeting:", error); - console.log("šŸ—ļø DEBUG: Error response:", error.response?.data); - console.log( - "šŸ—ļø DEBUG: Setting up blank meeting for creation due to error", - ); this.newOrUpdatedMeetingInputs = this.blankMeeting(); - console.log( - "šŸ—ļø DEBUG: newOrUpdatedMeetingInputs set:", - this.newOrUpdatedMeetingInputs, - ); } }