项目作者: highjump0615

项目描述 :
Ionic App; Help real estate agents match buyer and seller
高级语言: TypeScript
项目地址: git://github.com/highjump0615/RealEstateHelper.git
创建时间: 2019-03-23T20:43:38Z
项目社区:https://github.com/highjump0615/RealEstateHelper

开源协议:

下载


Real Estate Helper App

Ionic App; Help real estate agents match buyer and seller

Overview

1. Main Features

  • Manage agent users
  • Manage Properties with buyers and sellers
  • Match buyers and sellers

Techniques

Ionic Framework v4.0.0
Angular v7.2.2

1. UI Implementation

1.1 Implement UI pages based on Flexbox layout

1.2 UI layout when keyboard appears

Problems
  • In default, the whole view content shrinks when keyboard appears.
  • Keyboard covers the text inputs on the bottom of the screen and cannot scroll up
To solve this problem:
  • Introduce KeyboardService to detect keyboard height manually
  1. <ion-content>
  2. <div
  3. class="flex-column"
  4. [style.margin-bottom] = "kbService.keyboardHeight + 'px'">
  5. </div>
  6. </ion-content>
  1. export class KeyboardService {
  2. keyboardHeight = 0;
  3. constructor() {
  4. window.addEventListener('keyboardWillShow', (event) => {
  5. // Describe your logic which will be run each time when keyboard is about to be shown.
  6. this.keyboardHeight = event['keyboardHeight'];
  7. });
  8. window.addEventListener('keyboardWillHide', () => {
  9. // Describe your logic which will be run each time when keyboard is about to be closed.
  10. this.keyboardHeight = 0;
  11. });
  12. }
  13. }

1.3 Custom components

  • Image Uploader <app-image-uploader>
    Integrated <input type="file"> for selecting images
    • Can set any default content when no image selected

2. Function Implementation

2.1 Auth module

AuthService in app/services/auth/auth.service.ts
User signup, login, signout, …

2.2 Auth guard

AuthGuard in app/guards/auth/auth.guard.ts

  • Redirect to log in page when not authenticated
  • Redirect to home page when visits log in page with authenticated

2.3 Api module

ApiService in app/services/api/api.service.ts
Main interfaces for fetching and writing data to database

  • Google Firebase for backend

3. Code tricks

3.1 Make <span> no wrapping ending with ellipse

  • Chat list page
    1. span {
    2. white-space: nowrap;
    3. overflow: hidden;
    4. text-overflow: ellipsis;
    5. display: inline-block;
    6. width: 100%;
    7. }

3.2 Keyboard Problem

Prevent keyboard resizes content size
  • iOS

    1. <preference name="KeyboardResize" value="false" ></preference>
  • Android

    1. android:windowSoftInputMode="adjustPan"
Bottom space for scroll when keyboard appears

Get keyboard height from KeyboardService and set bottom margin

  • Signup profile page
  • Add profile page
Allow page resize for specific pages

Prevent it back when leaves the page

  • Chat message page

4. Third-Party Libraries

4.1 Cordova plugins

4.2 Firebase JS SDK v5.8.6

Main backend & database for the app

4.3 Moment.js v2.24.0

  • Showing date in property info

Need to Improve

Complete implementing of features