Allow spaces in names!

This commit is contained in:
Zakary Timson 2019-09-08 12:33:08 -04:00
parent 02c5b60e5d
commit 0732d1c4a6
3 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,6 @@
export const Adjectives = [
'Strict',
'poor',
'Poor',
'Old',
'Hot',
'Huge',

View File

@ -98,11 +98,10 @@ export class SyncService {
load(mapCode: string, username: string) {
this.mapCode = mapCode;
this.username = username;
this.username = username.replace(/\s/g, '');
this.mapDoc = this.db.collection(MAP_COLLECTION).doc(mapCode);
this.locationDoc = this.mapDoc.collection(LOCATION_COLLECTION).doc(username);
this.mapSub = combineLatest(this.mapDoc.valueChanges(), this.mapDoc.collection(LOCATION_COLLECTION, ref => {
let aMinuteAgo = new Date();
aMinuteAgo.setMinutes(aMinuteAgo.getMinutes() - 1);

View File

@ -1,4 +1,4 @@
import {Component, isDevMode, OnDestroy, OnInit} from "@angular/core";
import {Component, OnDestroy, OnInit} from "@angular/core";
import {PhysicsService} from "../../services/physics.service";
import {filter, finalize, skip, take} from "rxjs/operators";
import {MatBottomSheet, MatSnackBar} from "@angular/material";
@ -12,7 +12,7 @@ import {ActivatedRoute} from "@angular/router";
import {DimensionsDialogComponent} from "../../components/dimensionsDialog/dimensionsDialog.component";
import {MatDialog} from "@angular/material/dialog";
import {SyncService} from "../../services/sync.service";
import {MapData, MapSymbol, Marker} from "../../models/mapSymbol";
import {MapData, Marker} from "../../models/mapSymbol";
import {Adjectives} from "../../adjectives";
import {Nouns} from "../../nounes";
import {EditSymbolComponent} from "../../components/editSymbol/editSymbol.component";
@ -44,7 +44,7 @@ export class MapComponent implements OnDestroy, OnInit {
constructor(public physicsService: PhysicsService, public syncService: SyncService, private snackBar: MatSnackBar, private bottomSheet: MatBottomSheet, private dialog: MatDialog, private route: ActivatedRoute) {
this.name = localStorage.getItem('callSign');
if(!this.name) {
this.name = Adjectives[Math.floor(Math.random() * Adjectives.length)] + Nouns[Math.floor(Math.random() * Nouns.length)];
this.name = Adjectives[Math.floor(Math.random() * Adjectives.length)] + ' ' + Nouns[Math.floor(Math.random() * Nouns.length)];
localStorage.setItem('callSign', this.name);
}