Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shared services into core #10

Merged
merged 3 commits into from
Aug 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import {
Component,
ViewEncapsulation,
OnInit,
} from '@angular/core';
import { Component, ViewEncapsulation, OnInit } from '@angular/core';

import { AuthService } from './shared';
import { AuthService } from './core';

@Component({
selector: 'app-root',
Expand Down
18 changes: 3 additions & 15 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ import { AgmCoreModule } from '@agm/core';
import { AngularFireModule } from 'angularfire2';

import { environment } from '../environments/environment';
import {
SharedModule,
AuthService,
UserService,
UserPrivateService,
} from './shared';
import { SharedModule } from './shared';
import { CoreModule } from './core/core.module';
import { AppRoutingModule } from './app-routing.module';
import { NavbarModule } from './parts/navbar';
import { SidenavModule } from './parts/sidenav';
import { AppComponent } from './app.component';

@NgModule({
Expand All @@ -27,18 +21,12 @@ import { AppComponent } from './app.component';
}),
AngularFireModule.initializeApp(environment.firebase),
SharedModule,
NavbarModule,
SidenavModule,
CoreModule,
AppRoutingModule,
],
declarations: [
AppComponent,
],
providers: [
AuthService,
UserService,
UserPrivateService,
],
bootstrap: [AppComponent]
})
export class AppModule { }
51 changes: 51 additions & 0 deletions src/app/core/core.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { NgModule } from '@angular/core';
import { DatePipe } from '@angular/common';

import { NavbarModule } from './navbar';
import { SidenavModule } from './sidenav';
import {
KmlService,
AuthGuard,
AuthService,
CastService,
CommentService,
FileService,
IdService,
JourneyService,
LocationService,
PwService,
StoryService,
UrlShortenerService,
UserPrivateService,
UserService,
} from './services';

@NgModule({
imports: [
NavbarModule,
SidenavModule,
],
exports: [
NavbarModule,
SidenavModule,
],
declarations: [],
providers: [
DatePipe,
KmlService,
AuthGuard,
AuthService,
CastService,
CommentService,
FileService,
IdService,
JourneyService,
LocationService,
PwService,
StoryService,
UrlShortenerService,
UserPrivateService,
UserService,
],
})
export class CoreModule { }
1 change: 1 addition & 0 deletions src/app/core/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './services';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import { ReplaySubject } from 'rxjs/Rx';
import { LiquidGalaxyServer } from 'liquid-galaxy';
import { BehaviorSubject } from 'rxjs/Rx';

import { AuthService, User, UserService } from '../../shared';
import { CastService } from '../cast';
import { User } from '../../shared';
import {
AuthService,
UserService,
CastService,
} from '../services';
import { SidenavService } from '../sidenav/sidenav.service';
import { SigninComponent } from './signin.component';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from '@angular/material';

import { SharedModule } from '../../shared';
import { CastModule } from '../cast';
import { CastModule } from '../../parts/cast';
import { SidenavService } from '../sidenav/sidenav.service';
import { NavbarComponent } from './navbar.component';
import { SigninComponent } from './signin.component';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core';

import { AuthService } from '../../shared';
import { AuthService } from '../services';

@Component({
selector: 'app-signin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Observable } from 'rxjs/Rx';
import { AngularFireAuth } from 'angularfire2/auth';
import * as firebase from 'firebase/app';

import { User, UserPrivate } from '../models';
import { User, UserPrivate } from '../../shared';
import { UserService } from './user.service';
import { UserPrivateService } from './user-private.service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export class CastService {
// The solo (or no) server that has a connection established.
active: BehaviorSubject<LiquidGalaxyServer> = new BehaviorSubject(undefined);

constructor() { }

setActive(server: LiquidGalaxyServer) {
this.unsetActive();
this.active.next(server);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { AngularFireDatabase } from 'angularfire2/database';

import { Comment } from '../models';
import { Comment } from '../../shared';

@Injectable()
export class CommentService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './kml';
export * from './auth-guard.service';
export * from './auth.service';
export * from './cast.service';
export * from './comment.service';
export * from './id.service';
export * from './file.service';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { JourneyService } from './journey.service';
import { StoryService } from './story.service';
import { FileService } from './file.service';
import { IdService } from './id.service';
import { Journey } from '../models';
import { Journey } from '../../shared';

class MockAngularFireDatabase {
read = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Observable } from 'rxjs/Observable';
import { AngularFireDatabase } from 'angularfire2/database';
import * as firebase from 'firebase';

import { Journey, Story } from '../models';
import { Journey, Story } from '../../shared';
import { FileService } from './file.service';
import { StoryService } from './story.service';
import { IdService } from './id.service';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { DatePipe } from '@angular/common';

import { Story, User } from '../../models';
import { Story, User } from '../../../shared';
import html from './html-templates';
import xml from './xml-templates';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFireDatabase } from 'angularfire2/database';
import * as firebase from 'firebase';

import { Pw } from '../models';
import { Pw } from '../../shared';

@Injectable()
export class PwService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Observable } from 'rxjs/Observable';
import { AngularFireDatabase } from 'angularfire2/database';
import * as firebase from 'firebase';

import { Story } from '../models';
import { Story } from '../../shared';
import { FileService } from './file.service';
import { IdService } from './id.service';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Rx';
import { AngularFireDatabase } from 'angularfire2/database';

import { UserPrivate } from '../models';
import { UserPrivate } from '../../shared';

@Injectable()
export class UserPrivateService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFireDatabase } from 'angularfire2/database';
import * as firebase from 'firebase';

import { User } from '../models';
import { User } from '../../shared';

@Injectable()
export class UserService {
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions src/app/journey/detail/journey-detail-cast.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { LiquidGalaxyServer } from 'liquid-galaxy';
import {
User,
Story,
KmlService,
} from '../../shared';
import { CastService } from '../../parts/cast';
import {
CastService,
KmlService,
} from '../../core';

@Component({
selector: 'app-journey-detail-cast',
Expand Down
10 changes: 6 additions & 4 deletions src/app/journey/detail/journey-detail.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import {
FormUtils,
SafeStylePipe,
User,
UserService,
Journey,
JourneyService,
Story,
StoryService,
} from '../../shared';
import { CastService } from '../../parts/cast';
import {
UserService,
JourneyService,
StoryService,
CastService,
} from '../../core';
import { ConfirmComponent } from '../../parts/confirm';

@Component({
Expand Down
6 changes: 2 additions & 4 deletions src/app/journey/journey-resolver.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ import { Injectable } from '@angular/core';
import { Resolve, Router, RouterStateSnapshot, ActivatedRouteSnapshot } from '@angular/router';
import { Observable } from 'rxjs/Rx';

import {
Journey,
JourneyService,
} from '../shared';
import { Journey } from '../shared';
import { JourneyService } from '../core';

@Injectable()
export class JourneyResolver implements Resolve<Journey> {
Expand Down
2 changes: 1 addition & 1 deletion src/app/journey/journey-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';

import { AuthGuard } from '../shared';
import { AuthGuard } from '../core';
import { JourneyResolver } from './journey-resolver.service';
import { JourneyListComponent } from './list/journey-list.component';
import { JourneyNewComponent } from './new/journey-new.component';
Expand Down
12 changes: 0 additions & 12 deletions src/app/journey/journey.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ import {
import {
SharedModule,
SafeStylePipe,
AuthGuard,
JourneyService,
FileService,
StoryService,
IdService,
PwService,
} from '../shared';
import { CastModule } from '../parts/cast';
import { ConfirmModule, ConfirmComponent } from '../parts/confirm';
Expand Down Expand Up @@ -63,14 +57,8 @@ import { JourneyRoutingModule } from './journey-routing.module';
ConfirmComponent,
],
providers: [
AuthGuard,
JourneyResolver,
JourneyService,
FileService,
StoryService,
IdService,
SafeStylePipe,
PwService,
],
})
export class JourneyModule { }
6 changes: 2 additions & 4 deletions src/app/journey/list/journey-list-owner.component.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Component, OnInit, Input } from '@angular/core';

import {
User,
UserService,
} from '../../shared';
import { User } from '../../shared';
import { UserService } from '../../core';

@Component({
selector: 'app-journey-list-owner',
Expand Down
6 changes: 2 additions & 4 deletions src/app/journey/list/journey-list.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ReplaySubject } from 'rxjs/Rx';

import {
Journey,
JourneyService,
} from '../../shared';
import { Journey } from '../../shared';
import { JourneyService } from '../../core';

@Component({
selector: 'app-journey-list',
Expand Down
2 changes: 1 addition & 1 deletion src/app/journey/new/journey-new.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import * as firebase from 'firebase';
import {
FormUtils,
Journey,
JourneyService,
} from '../../shared';
import { JourneyService } from '../../core';

@Component({
selector: 'app-journey-new',
Expand Down
2 changes: 1 addition & 1 deletion src/app/journey/story-new/story-new.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import * as firebase from 'firebase';
import {
Journey,
Story,
StoryService,
} from '../../shared';
import { StoryService } from '../../core';

@Component({
selector: 'app-story-new',
Expand Down
2 changes: 1 addition & 1 deletion src/app/parts/cast/cast-to.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { BehaviorSubject } from 'rxjs/Rx';
import { LiquidGalaxy, LiquidGalaxyServer } from 'liquid-galaxy';

import { CastService } from './cast.service';
import { CastService } from '../../core';

@Component({
selector: 'app-cast-to',
Expand Down
10 changes: 3 additions & 7 deletions src/app/parts/cast/cast.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component } from '@angular/core';
import { MdDialog } from '@angular/material';

import { CastToComponent } from './cast-to.component';
Expand All @@ -7,12 +7,8 @@ import { CastToComponent } from './cast-to.component';
selector: 'app-cast',
templateUrl: 'cast.component.html',
})
export class CastComponent implements OnInit {
constructor(
private dialog: MdDialog,
) { }

ngOnInit() { }
export class CastComponent {
constructor(private dialog: MdDialog) { }

openCastToDialog() {
this.dialog.open(CastToComponent);
Expand Down
Loading