From b09a73a581d4bcfb241c6caabc9919a0a5ac67ff Mon Sep 17 00:00:00 2001 From: walljm Date: Sat, 31 Dec 2016 18:12:50 -0500 Subject: [PATCH] FEATURE: added font resizing * removed test that didnt work * refactored user and user profile classes to better contain user logic --- DynamicBibleIonic/config.xml | 6 +- DynamicBibleIonic/src/Helpers.ts | 24 ------- DynamicBibleIonic/src/UserProfile.ts | 65 +++++++++++++++++++ DynamicBibleIonic/src/bible-service.spec.ts | 1 - .../src/pages/search/search.html | 10 +-- .../src/pages/search/search.scss | 8 +-- DynamicBibleIonic/src/pages/search/search.ts | 64 ++++++++---------- .../src/pages/settings/settings.html | 24 +++++-- .../src/pages/settings/settings.ts | 41 +++++------- DynamicBibleIonic/src/types.ts | 3 +- 10 files changed, 139 insertions(+), 107 deletions(-) delete mode 100644 DynamicBibleIonic/src/Helpers.ts create mode 100644 DynamicBibleIonic/src/UserProfile.ts delete mode 100644 DynamicBibleIonic/src/bible-service.spec.ts diff --git a/DynamicBibleIonic/config.xml b/DynamicBibleIonic/config.xml index b1de5ee8..8262d106 100644 --- a/DynamicBibleIonic/config.xml +++ b/DynamicBibleIonic/config.xml @@ -1,8 +1,8 @@ - db - An awesome Ionic/Cordova app. - Ionic Framework Team + Dynamic Bible + A bible app designed for bible study + Dynamic Bible diff --git a/DynamicBibleIonic/src/Helpers.ts b/DynamicBibleIonic/src/Helpers.ts deleted file mode 100644 index 7d0082ef..00000000 --- a/DynamicBibleIonic/src/Helpers.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Storage } from '@ionic/storage'; - -export class UserHelpers -{ - constructor(public local: Storage) - { - } - - public validate(u: User, t: User) - { - let updated = false; - for (var k in u) - { - if (t[k] === undefined) - { - t[k] = u[k]; - updated = true; - } - } - if (updated) - this.local.set('profile', JSON.stringify(t)); - } - -} \ No newline at end of file diff --git a/DynamicBibleIonic/src/UserProfile.ts b/DynamicBibleIonic/src/UserProfile.ts new file mode 100644 index 00000000..2c903468 --- /dev/null +++ b/DynamicBibleIonic/src/UserProfile.ts @@ -0,0 +1,65 @@ +import { Storage } from '@ionic/storage'; + +export class UserProfile +{ + user: User; + + constructor(u: User) + { + this.user = u; + } + + public textSizeChanged() + { + $("html").css("font-size", this.user.font_size + "px"); + } + + public update(t: UserProfile, local: Storage) + { + let updated = false; + for (var k in this.user) + { + if (t[k] === undefined) + { + t[k] = this.user[k]; + updated = true; + } + } + + for (var k in this.user) + this.user[k] = t[k]; + + if (updated) + this.save(local); + + this.textSizeChanged(); + } + + save(local: Storage) + { + local.set('profile', JSON.stringify(this.user)); + } + + reset(local: Storage) + { + this.user.strongs_modal = true; + this.user.clear_search_after_query = true; + this.user.items = []; + this.user.append_to_bottom = false; + this.user.insert_next_to_item = false; + this.user.font_size = 10; + this.save(local); + } + + public static createDefaultUser(): User + { + return { + strongs_modal: true, + clear_search_after_query: true, + items: [], + append_to_bottom: false, + insert_next_to_item: false, + font_size: 10 + }; + } +} \ No newline at end of file diff --git a/DynamicBibleIonic/src/bible-service.spec.ts b/DynamicBibleIonic/src/bible-service.spec.ts deleted file mode 100644 index 5f282702..00000000 --- a/DynamicBibleIonic/src/bible-service.spec.ts +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/DynamicBibleIonic/src/pages/search/search.html b/DynamicBibleIonic/src/pages/search/search.html index 25a408a2..a330c65c 100644 --- a/DynamicBibleIonic/src/pages/search/search.html +++ b/DynamicBibleIonic/src/pages/search/search.html @@ -1,13 +1,13 @@ - - + @@ -15,13 +15,13 @@
Close
- Settings -