mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 07:19:50 -04:00
Merge branch 'bug-fixes-4' into 'main'
Bug fixes 4 See merge request walljm/dynamicbible!26
This commit is contained in:
commit
e2a91055cb
@ -22,11 +22,7 @@ export class NoteCardComponent extends CardComponent {
|
|||||||
return this.cardItem.data as NoteItem;
|
return this.cardItem.data as NoteItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(protected elementRef: ElementRef, protected appService: AppService, public dialog: MatDialog) {
|
||||||
protected elementRef: ElementRef,
|
|
||||||
protected appService: AppService,
|
|
||||||
public dialog: MatDialog
|
|
||||||
) {
|
|
||||||
super(elementRef, dialog, appService);
|
super(elementRef, dialog, appService);
|
||||||
|
|
||||||
this.icon$ = appService.select((state) => state.settings.value.cardIcons.note);
|
this.icon$ = appService.select((state) => state.settings.value.cardIcons.note);
|
||||||
@ -38,8 +34,12 @@ export class NoteCardComponent extends CardComponent {
|
|||||||
this.copyToClip(text, html);
|
this.copyToClip(text, html);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private xrefs: BibleReference[];
|
||||||
prepXref(xref: string) {
|
prepXref(xref: string) {
|
||||||
return xref.split(';').map((o) => new BibleReference(o));
|
if (this.xrefs === undefined) {
|
||||||
|
this.xrefs = xref.split(';').map((o) => new BibleReference(o));
|
||||||
|
}
|
||||||
|
return this.xrefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
openPassage(ref: BibleReference) {
|
openPassage(ref: BibleReference) {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
type="search"
|
type="search"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
matInput
|
matInput
|
||||||
|
#contentView
|
||||||
#autoCompleteInput
|
#autoCompleteInput
|
||||||
[formControl]="searchControl"
|
[formControl]="searchControl"
|
||||||
[matAutocomplete]="auto"
|
[matAutocomplete]="auto"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit, ViewChild, ChangeDetectionStrategy } from '@angular/core';
|
import { Component, OnInit, ViewChild, ChangeDetectionStrategy, ElementRef } from '@angular/core';
|
||||||
import { ActivatedRoute, Router, NavigationEnd } from '@angular/router';
|
import { ActivatedRoute, Router, NavigationEnd } from '@angular/router';
|
||||||
import { UntypedFormControl } from '@angular/forms';
|
import { UntypedFormControl } from '@angular/forms';
|
||||||
import { MatDialog } from '@angular/material/dialog';
|
import { MatDialog } from '@angular/material/dialog';
|
||||||
@ -27,9 +27,13 @@ export class SearchPageComponent extends SubscriberBase implements OnInit {
|
|||||||
|
|
||||||
@ViewChild(MatAutocomplete)
|
@ViewChild(MatAutocomplete)
|
||||||
autoComplete: MatAutocomplete;
|
autoComplete: MatAutocomplete;
|
||||||
|
|
||||||
@ViewChild('autoCompleteInput', { read: MatAutocompleteTrigger })
|
@ViewChild('autoCompleteInput', { read: MatAutocompleteTrigger })
|
||||||
autoCompleteTrigger: MatAutocompleteTrigger;
|
autoCompleteTrigger: MatAutocompleteTrigger;
|
||||||
|
|
||||||
|
@ViewChild('contentView')
|
||||||
|
contentView: ElementRef;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
private appService: AppService,
|
private appService: AppService,
|
||||||
@ -84,6 +88,7 @@ export class SearchPageComponent extends SubscriberBase implements OnInit {
|
|||||||
onSavedPagedLoaded(id: string) {
|
onSavedPagedLoaded(id: string) {
|
||||||
if (this.savedPagedLoaded) {
|
if (this.savedPagedLoaded) {
|
||||||
this.appService.getSavedPage(id);
|
this.appService.getSavedPage(id);
|
||||||
|
this.contentView?.nativeElement?.focus();
|
||||||
return; // you did it! stop trying.
|
return; // you did it! stop trying.
|
||||||
}
|
}
|
||||||
// the saved page hasn't loaded yet, wait then try again.
|
// the saved page hasn't loaded yet, wait then try again.
|
||||||
|
@ -156,7 +156,8 @@ export class AppService extends createStateService(reducer, initialState) {
|
|||||||
|
|
||||||
async updateCards(queries: IStorable<readonly DataReference[]>) {
|
async updateCards(queries: IStorable<readonly DataReference[]>) {
|
||||||
const cards: CardItem[] = [];
|
const cards: CardItem[] = [];
|
||||||
for (const q of queries.value) {
|
const values = queries.value ?? [];
|
||||||
|
for (const q of values) {
|
||||||
const card = await this.getCardByQuery(q.qry.trim(), q.type);
|
const card = await this.getCardByQuery(q.qry.trim(), q.type);
|
||||||
cards.push(card);
|
cards.push(card);
|
||||||
}
|
}
|
||||||
|
@ -122,7 +122,7 @@ export class StorageService extends SubscriberBase {
|
|||||||
this.savedPagesRemoteObject
|
this.savedPagesRemoteObject
|
||||||
.valueChanges() // when the value changes
|
.valueChanges() // when the value changes
|
||||||
.subscribe((remoteData) => {
|
.subscribe((remoteData) => {
|
||||||
if (!isNullOrUndefined(remoteData) && !isNullOrUndefined(remoteData.value)) {
|
if (!isNullOrUndefined(remoteData)) {
|
||||||
// update the app state with remote data if it isn't null
|
// update the app state with remote data if it isn't null
|
||||||
// console.log('Data recieved from remote store', remoteData);
|
// console.log('Data recieved from remote store', remoteData);
|
||||||
this.appService.updateSavedPages(remoteData);
|
this.appService.updateSavedPages(remoteData);
|
||||||
@ -135,7 +135,7 @@ export class StorageService extends SubscriberBase {
|
|||||||
this.noteItemsRemoteObject
|
this.noteItemsRemoteObject
|
||||||
.valueChanges() // when the value changes
|
.valueChanges() // when the value changes
|
||||||
.subscribe((remoteData) => {
|
.subscribe((remoteData) => {
|
||||||
if (!isNullOrUndefined(remoteData) && !isNullOrUndefined(remoteData.value)) {
|
if (!isNullOrUndefined(remoteData)) {
|
||||||
// update the app state with remote data if it isn't null
|
// update the app state with remote data if it isn't null
|
||||||
// console.log('Data recieved from remote store', remoteData);
|
// console.log('Data recieved from remote store', remoteData);
|
||||||
this.appService.updateNotes(remoteData);
|
this.appService.updateNotes(remoteData);
|
||||||
@ -150,7 +150,11 @@ export class StorageService extends SubscriberBase {
|
|||||||
this.cardsRemoteObject
|
this.cardsRemoteObject
|
||||||
.valueChanges() // when the value changes
|
.valueChanges() // when the value changes
|
||||||
.subscribe((remoteData) => {
|
.subscribe((remoteData) => {
|
||||||
if (!isNullOrUndefined(remoteData) && !isNullOrUndefined(remoteData.value) && this.syncCurrentItems) {
|
if (!this.syncCurrentItems) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isNullOrUndefined(remoteData)) {
|
||||||
// update the app state with remote data, but only if syncing is turned on.
|
// update the app state with remote data, but only if syncing is turned on.
|
||||||
this.appService.updateCards(remoteData);
|
this.appService.updateCards(remoteData);
|
||||||
}
|
}
|
||||||
@ -285,15 +289,15 @@ export class StorageService extends SubscriberBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update local
|
// update local
|
||||||
this.local.set(this.cardsPath, v.currentCards).subscribe(
|
this.local.set(this.cardsPath, v.currentCards).subscribe({
|
||||||
() => {
|
next: () => {
|
||||||
// nop
|
// nop
|
||||||
},
|
},
|
||||||
// error
|
// error
|
||||||
() => {
|
error: () => {
|
||||||
this.appService.dispatchError(`Something went wrong and the current cards weren't saved. :(`);
|
this.appService.dispatchError(`Something went wrong and the current cards weren't saved. :(`);
|
||||||
}
|
},
|
||||||
);
|
});
|
||||||
|
|
||||||
// since you updated the local variable above, this remote update will
|
// since you updated the local variable above, this remote update will
|
||||||
// get picked up by the remote subscription below.
|
// get picked up by the remote subscription below.
|
||||||
|
@ -5,14 +5,7 @@
|
|||||||
<title>Dynamic Bible</title>
|
<title>Dynamic Bible</title>
|
||||||
<meta
|
<meta
|
||||||
name="viewport"
|
name="viewport"
|
||||||
content="
|
content="width=device-width,height=device-height,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"
|
||||||
width=device-width,
|
|
||||||
height=device-height,
|
|
||||||
initial-scale=1.0,
|
|
||||||
minimum-scale=1.0,
|
|
||||||
maximum-scale=1.0,
|
|
||||||
user-scalable=no
|
|
||||||
"
|
|
||||||
/>
|
/>
|
||||||
<meta name="format-detection" content="telephone=no" />
|
<meta name="format-detection" content="telephone=no" />
|
||||||
<meta name="msapplication-tap-highlight" content="no" />
|
<meta name="msapplication-tap-highlight" content="no" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user