* fix bug in search history for typeahead

This commit is contained in:
walljm 2019-06-23 09:20:08 -04:00
parent 91dcfe846b
commit b0b7b696e9
5 changed files with 1084 additions and 718 deletions

File diff suppressed because one or more lines are too long

View File

@ -131,5 +131,4 @@
<splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" /> <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" />
</platform> </platform>
<engine name="android" spec="7.0.0" /> <engine name="android" spec="7.0.0" />
<engine name="ios" spec="4.5.5" />
</widget> </widget>

File diff suppressed because it is too large Load Diff

View File

@ -1,129 +1,129 @@
{ {
"version": "3.2.0", "version": "3.2.0",
"name": "dynamicbible", "name": "dynamicbible",
"author": "Jason Wall", "author": "Jason Wall",
"homepage": "http://dynamicbible.com/", "homepage": "http://dynamicbible.com/",
"private": true, "private": true,
"config": { "config": {
"ionic_source_map": "source-map" "ionic_source_map": "source-map"
},
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve",
"start": "ionic serve",
"lab": "ionic serve --lab",
"test": "ng test",
"test-coverage": "ng test --code-coverage",
"release-android": "ionic cordova build android --release -- --buildConfig=./build.json",
"android": "ionic cordova run android"
},
"dependencies": {
"@angular/common": "5.0.0",
"@angular/compiler": "5.0.0",
"@angular/compiler-cli": "5.0.0",
"@angular/core": "5.0.0",
"@angular/forms": "5.0.0",
"@angular/http": "5.0.0",
"@angular/platform-browser": "5.0.0",
"@angular/platform-browser-dynamic": "5.0.0",
"@ionic-native/core": "4.3.1",
"@ionic-native/splash-screen": "4.3.1",
"@ionic-native/status-bar": "4.3.1",
"@ionic/storage": "2.1.3",
"angularfire2": "^5.0.0-rc.4",
"cordova-android": "7.0.0",
"cordova-android-support-gradle-release": "^1.4.7",
"cordova-ios": "4.5.5",
"cordova-plugin-browsertab": "^0.2.0",
"cordova-plugin-buildinfo": "^2.0.2",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-customurlscheme": "^4.3.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-inappbrowser": "^2.0.2",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-universal-links-plugin": "git+https://github.com/walteram/cordova-universal-links-plugin.git",
"firebase": "^4.8.0",
"ionic-angular": "3.9.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionic2-auto-complete": "^1.6.2-alpha",
"ionicons": "3.0.0",
"ios-deploy": "^1.9.4",
"promise-polyfill": "^6.0.2",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"@angular/cli": "1.6.3",
"@ionic/app-scripts": "3.1.0",
"@types/jasmine": "2.5.41",
"@types/node": "7.0.4",
"codecov": "2.2.0",
"connect": "3.6.2",
"ionic-mocks": "0.10.1",
"jasmine-core": "2.6.2",
"jasmine-reporters": "2.2.1",
"karma": "1.7.0",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.2.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-junit-reporter": "1.2.0",
"protractor": "5.1.2",
"serve-static": "1.12.3",
"ts-node": "3.0.4",
"tslint": "5.3.2",
"tslint-eslint-rules": "4.1.1",
"typescript": "~2.4.2",
"ws": "3.3.2"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-statusbar",
"cordova-plugin-console",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "Dynamic Bible: A bible made for studying scripture",
"-vs-binding": {
"AfterBuild": [
"ionic:serve"
]
},
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-buildinfo": {},
"cordova-plugin-browsertab": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-customurlscheme": {
"URL_SCHEME": "com.firebase.cordova",
"ANDROID_SCHEME": " ",
"ANDROID_HOST": " ",
"ANDROID_PATHPREFIX": "/"
},
"cordova-universal-links-plugin": {},
"cordova-android-support-gradle-release": {
"ANDROID_SUPPORT_VERSION": "27.+"
}
}, },
"platforms": [ "scripts": {
"android", "clean": "ionic-app-scripts clean",
"ios" "build": "ionic-app-scripts build",
] "lint": "ionic-app-scripts lint",
} "ionic:build": "ionic-app-scripts build",
} "ionic:serve": "ionic-app-scripts serve",
"start": "ionic serve",
"lab": "ionic serve --lab",
"test": "ng test",
"test-coverage": "ng test --code-coverage",
"release-android": "ionic cordova build android --release -- --buildConfig=./build.json",
"android": "ionic cordova run android"
},
"dependencies": {
"@angular/common": "5.0.0",
"@angular/compiler": "5.0.0",
"@angular/compiler-cli": "5.0.0",
"@angular/core": "5.0.0",
"@angular/forms": "5.0.0",
"@angular/http": "5.0.0",
"@angular/platform-browser": "5.0.0",
"@angular/platform-browser-dynamic": "5.0.0",
"@ionic-native/core": "4.3.1",
"@ionic-native/splash-screen": "4.3.1",
"@ionic-native/status-bar": "4.3.1",
"@ionic/storage": "2.1.3",
"angularfire2": "^5.0.0-rc.4",
"cordova-android": "7.0.0",
"cordova-android-support-gradle-release": "^1.4.7",
"cordova-ios": "4.5.5",
"cordova-plugin-browsertab": "^0.2.0",
"cordova-plugin-buildinfo": "^2.0.2",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-customurlscheme": "^4.3.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-inappbrowser": "^2.0.2",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-universal-links-plugin": "git+https://github.com/walteram/cordova-universal-links-plugin.git",
"firebase": "^4.8.0",
"ionic-angular": "3.9.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionic2-auto-complete": "^1.6.2-alpha",
"ionicons": "3.0.0",
"node-gyp": "^5.0.1",
"node-sass": "^4.5.3",
"promise-polyfill": "^6.0.2",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"@angular/cli": "1.6.3",
"@ionic/app-scripts": "3.1.0",
"@types/jasmine": "2.5.41",
"@types/node": "7.0.4",
"codecov": "2.2.0",
"connect": "3.6.2",
"ionic-mocks": "0.10.1",
"jasmine-core": "2.6.2",
"jasmine-reporters": "2.2.1",
"karma": "1.7.0",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.2.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-junit-reporter": "1.2.0",
"protractor": "5.1.2",
"serve-static": "1.12.3",
"ts-node": "3.0.4",
"tslint": "5.3.2",
"tslint-eslint-rules": "4.1.1",
"typescript": "~2.4.2",
"ws": "3.3.2"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-statusbar",
"cordova-plugin-console",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "Dynamic Bible: A bible made for studying scripture",
"-vs-binding": {
"AfterBuild": [
"ionic:serve"
]
},
"cordova": {
"plugins": {
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-buildinfo": {},
"cordova-plugin-browsertab": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-customurlscheme": {
"URL_SCHEME": "com.firebase.cordova",
"ANDROID_SCHEME": " ",
"ANDROID_HOST": " ",
"ANDROID_PATHPREFIX": "/"
},
"cordova-universal-links-plugin": {},
"cordova-android-support-gradle-release": {
"ANDROID_SUPPORT_VERSION": "27.+"
}
},
"platforms": [
"android"
]
}
}

View File

@ -1,19 +1,19 @@
/// <reference path='../../typings/globals/jquery/index.d.ts' /> /// <reference path='../../typings/globals/jquery/index.d.ts' />
import { Injectable } from "@angular/core"; import { Injectable } from '@angular/core';
import { AngularFireDatabase, AngularFireObject } from "angularfire2/database"; import { AngularFireDatabase, AngularFireObject } from 'angularfire2/database';
import { AngularFireAuth } from "angularfire2/auth"; import { AngularFireAuth } from 'angularfire2/auth';
import * as firebase from "firebase/app"; import * as firebase from 'firebase/app';
import { Observable } from "rxjs/Observable"; import { Observable } from 'rxjs/Observable';
import { Catch } from "rxjs/add/operator"; import { Catch } from 'rxjs/add/operator';
import { Storage } from "@ionic/storage"; import { Storage } from '@ionic/storage';
import { CardItem } from "../pages/search/search"; import { CardItem } from '../pages/search/search';
import { Promise } from "q"; import { Promise } from 'q';
import { setTimeout } from "timers"; import { setTimeout } from 'timers';
import { Output, EventEmitter } from "@angular/core"; import { Output, EventEmitter } from '@angular/core';
export const DEFAULT_USER_NAME = "john_doe"; export const DEFAULT_USER_NAME = 'john_doe';
@Injectable() @Injectable()
export class ProfileService { export class ProfileService {
@ -38,10 +38,10 @@ export class ProfileService {
constructor(private local: Storage, private db: AngularFireDatabase, public firebaseAuth: AngularFireAuth) { constructor(private local: Storage, private db: AngularFireDatabase, public firebaseAuth: AngularFireAuth) {
this.url = document.URL; this.url = document.URL;
this.isWeb = document.URL.startsWith("http") && !document.URL.startsWith("http://localhost:8080"); this.isWeb = document.URL.startsWith('http') && !document.URL.startsWith('http://localhost:8080');
this.localIsLoaded = false; this.localIsLoaded = false;
this.local.get("searchHistory").then(v => { this.local.get('searchHistory').then(v => {
if (v === null) { if (v === null) {
this.searchHistory = []; this.searchHistory = [];
} else { } else {
@ -59,9 +59,9 @@ export class ProfileService {
// If we have a remote profile then save it there too // If we have a remote profile then save it there too
if (self.remoteProfile && self.localProfile.uid) { if (self.remoteProfile && self.localProfile.uid) {
let st = new Date(); let st = new Date();
console.log("Saving the remote profile..."); console.log('Saving the remote profile...');
self.remoteProfile.ref.set(self.localProfile); self.remoteProfile.ref.set(self.localProfile);
console.log(" Finished saving remote profile. " + self.elapsed(st, new Date()) + "ms"); console.log(' Finished saving remote profile. ' + self.elapsed(st, new Date()) + 'ms');
} }
self.needsSync = false; self.needsSync = false;
} }
@ -70,7 +70,7 @@ export class ProfileService {
}, 2000); }, 2000);
})(this); })(this);
this.local.get("profile").then(json_profile => { this.local.get('profile').then(json_profile => {
let t = this.profile(); let t = this.profile();
if (json_profile !== null) t = JSON.parse(json_profile); if (json_profile !== null) t = JSON.parse(json_profile);
@ -89,19 +89,18 @@ export class ProfileService {
} }
// if the query already exists, remove it so it will be unique // if the query already exists, remove it so it will be unique
this.searchHistory = this.searchHistory.filter( v => v === qry); this.searchHistory = this.searchHistory.filter(v => v !== qry);
// put it at the top. // put it at the top.
this.searchHistory.unshift(qry); this.searchHistory.unshift(qry);
// no more than 5. // no more than 5.
if (this.searchHistory.length > 5) if (this.searchHistory.length > 5) {
{
this.searchHistory = this.searchHistory.slice(0, 5); this.searchHistory = this.searchHistory.slice(0, 5);
} }
// save it to storage. // save it to storage.
this.local.set("searchHistory", this.searchHistory); this.local.set('searchHistory', this.searchHistory);
} }
//#region Profile //#region Profile
@ -130,7 +129,7 @@ export class ProfileService {
} }
isOnSearchPage() { isOnSearchPage() {
return this.title !== "Search"; return this.title !== 'Search';
} }
profile(): User { profile(): User {
@ -142,10 +141,10 @@ export class ProfileService {
} }
subscribeToRemoteProfile(db: AngularFireDatabase, user: firebase.User) { subscribeToRemoteProfile(db: AngularFireDatabase, user: firebase.User) {
console.log("subscribeToRemoteProfile"); console.log('subscribeToRemoteProfile');
if (!user || this.firebaseUser) return; if (!user || this.firebaseUser) return;
console.log("You got the firebase user."); console.log('You got the firebase user.');
let obj = db.object("/settings/" + user.uid); let obj = db.object('/settings/' + user.uid);
this.remoteProfile = { this.remoteProfile = {
ref: obj as AngularFireObject<User>, ref: obj as AngularFireObject<User>,
stream: obj.valueChanges() as Observable<User> stream: obj.valueChanges() as Observable<User>
@ -167,7 +166,7 @@ export class ProfileService {
} }
handleRemotePreferenceChange(user: User) { handleRemotePreferenceChange(user: User) {
console.log("handleRemotePreferenceChange"); console.log('handleRemotePreferenceChange');
if (user) { if (user) {
let changed = false; let changed = false;
if (user.saved_pages !== undefined) { if (user.saved_pages !== undefined) {
@ -208,7 +207,7 @@ export class ProfileService {
} }
authenticate() { authenticate() {
console.log("Authenticating to remote..."); console.log('Authenticating to remote...');
let self = this; let self = this;
let provider = new firebase.auth.GoogleAuthProvider(); let provider = new firebase.auth.GoogleAuthProvider();
@ -231,13 +230,13 @@ export class ProfileService {
} }
refresh() { refresh() {
console.log("refresh"); console.log('refresh');
this.logout(); this.logout();
this.authenticate(); this.authenticate();
} }
logout() { logout() {
console.log("logout"); console.log('logout');
this.firebaseAuth.auth.signOut(); // sign out this.firebaseAuth.auth.signOut(); // sign out
this.remoteProfile = null; // inform the profile service not to bother this.remoteProfile = null; // inform the profile service not to bother
this.remoteLoggedIn = false; this.remoteLoggedIn = false;
@ -249,8 +248,8 @@ export class ProfileService {
} }
localSave() { localSave() {
console.log("saving local"); console.log('saving local');
this.local.set("profile", JSON.stringify(this.profile())); this.local.set('profile', JSON.stringify(this.profile()));
} }
private elapsed(start: Date, finish: Date) { private elapsed(start: Date, finish: Date) {
@ -312,11 +311,11 @@ export class ProfileService {
// TODO(jwall): This belongs somewhere else. // TODO(jwall): This belongs somewhere else.
textSizeChanged() { textSizeChanged() {
$("html").css("font-size", this.profile().font_size + "px"); $('html').css('font-size', this.profile().font_size + 'px');
} }
fontFamilyChanged() { fontFamilyChanged() {
document.querySelector("html").style.cssText = "--card-font: " + this.profile().font_family; document.querySelector('html').style.cssText = '--card-font: ' + this.profile().font_family;
this.textSizeChanged(); this.textSizeChanged();
} }
@ -325,7 +324,7 @@ export class ProfileService {
username: DEFAULT_USER_NAME, username: DEFAULT_USER_NAME,
uid: null, uid: null,
font_size: 10, font_size: 10,
font_family: "roboto, helvetica, arial, sans-serif", font_family: 'roboto, helvetica, arial, sans-serif',
saved_pages: [], saved_pages: [],
items: [], items: [],
strongs_modal: true, strongs_modal: true,