forked from jsnbuchanan/crowd-funder-for-time-pwa
fix: standardize FontAwesome usage and improve error handling
- Change <fa> to <font-awesome> for consistent component naming - Add structured error logging in QR scanner services - Fix cacheImage event handling in ActivityListItem - Improve code formatting and error wrapping
This commit is contained in:
@@ -114,7 +114,6 @@ import { MASTER_SETTINGS_KEY } from "../db/tables/settings";
|
||||
import { getContactJwtFromJwtUrl } from "../libs/crypto";
|
||||
import {
|
||||
generateEndorserJwtUrlForAccount,
|
||||
isDid,
|
||||
register,
|
||||
setVisibilityUtil,
|
||||
} from "../libs/endorserServer";
|
||||
@@ -170,12 +169,15 @@ export default class ContactQRScanShow extends Vue {
|
||||
this.activeDid = settings.activeDid || "";
|
||||
this.apiServer = settings.apiServer || "";
|
||||
this.givenName = settings.firstName || "";
|
||||
this.hideRegisterPromptOnNewContact = !!settings.hideRegisterPromptOnNewContact;
|
||||
this.hideRegisterPromptOnNewContact =
|
||||
!!settings.hideRegisterPromptOnNewContact;
|
||||
this.isRegistered = !!settings.isRegistered;
|
||||
|
||||
const account = await retrieveAccountMetadata(this.activeDid);
|
||||
if (account) {
|
||||
const name = (settings.firstName || "") + (settings.lastName ? ` ${settings.lastName}` : "");
|
||||
const name =
|
||||
(settings.firstName || "") +
|
||||
(settings.lastName ? ` ${settings.lastName}` : "");
|
||||
this.qrValue = await generateEndorserJwtUrlForAccount(
|
||||
account,
|
||||
!!settings.isRegistered,
|
||||
@@ -294,7 +296,10 @@ export default class ContactQRScanShow extends Vue {
|
||||
async onScanDetect(result: string | QRScanResult) {
|
||||
try {
|
||||
// Extract raw value from different possible formats
|
||||
const rawValue = typeof result === 'string' ? result : (result?.rawValue || result?.barcode);
|
||||
const rawValue =
|
||||
typeof result === "string"
|
||||
? result
|
||||
: result?.rawValue || result?.barcode;
|
||||
if (!rawValue) {
|
||||
logger.warn("Invalid scan result - no value found:", result);
|
||||
return;
|
||||
@@ -558,7 +563,7 @@ export default class ContactQRScanShow extends Vue {
|
||||
|
||||
async handleAppPause() {
|
||||
if (!this.isMounted) return;
|
||||
|
||||
|
||||
logger.info("App paused, stopping scanner");
|
||||
await this.stopScanning();
|
||||
}
|
||||
@@ -574,11 +579,13 @@ export default class ContactQRScanShow extends Vue {
|
||||
try {
|
||||
logger.info("Opening database connection for new contact");
|
||||
await db.open();
|
||||
|
||||
|
||||
// Check if contact already exists
|
||||
const existingContacts = await db.contacts.toArray();
|
||||
const existingContact = existingContacts.find(c => c.did === contact.did);
|
||||
|
||||
const existingContact = existingContacts.find(
|
||||
(c) => c.did === contact.did,
|
||||
);
|
||||
|
||||
if (existingContact) {
|
||||
logger.info("Contact already exists", { did: contact.did });
|
||||
this.$notify(
|
||||
@@ -676,4 +683,3 @@ export default class ContactQRScanShow extends Vue {
|
||||
aspect-ratio: 1 / 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user