Skip to content
This repository has been archived by the owner on Jun 23, 2020. It is now read-only.

Commit

Permalink
Merge pull request #6 from deissh/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
deissh authored Apr 28, 2019
2 parents b491f99 + 3423258 commit 499e54d
Show file tree
Hide file tree
Showing 39 changed files with 1,402 additions and 90 deletions.
2 changes: 0 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: yarn install
- save_cache:
paths:
Expand All @@ -37,7 +36,6 @@ jobs:
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-

- run: npm install

Expand Down
1 change: 1 addition & 0 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<allow-navigation href="http://192.168.1.45:8100" sessionid="fe6b0f34" />
<allow-navigation href="http://192.168.43.165:8100" sessionid="72b26593" />
<content src="index.html" />
<allow-navigation href="http://172.17.0.1:8100" sessionid="24230ce3" />
<engine name="browser" spec="5.0.4" />
<engine name="android" spec="7.1.4" />
</widget>
42 changes: 34 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"core-js": "^2.5.4",
"hammerjs": "^2.0.8",
"rxjs": "~6.3.3",
"socket.io": "^2.2.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
Expand All @@ -64,6 +65,7 @@
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~10.12.0",
"@types/socket.io-client": "^1.4.32",
"codelyzer": "~4.5.0",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
Expand Down
1 change: 1 addition & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const routes: Routes = [
{ path: 'comments/:id', loadChildren: './pages/comments/comments.module#CommentsPageModule', canActivate: [LoginGuard] },
{ path: 'user/:id', loadChildren: './pages/user/user.module#UserPageModule' },
{ path: 'news/:id', loadChildren: './pages/news/news.module#NewsPageModule' },
{ path: 'chat-id/:id', loadChildren: './pages/chat-id/chat-id.module#ChatIdPageModule', canActivate: [LoginGuard] },
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
Expand Down
18 changes: 18 additions & 0 deletions src/app/modal/report/report.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { IonicModule } from '@ionic/angular';

import { ReportPage } from 'src/app/modal/report/report.page';

@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
],
declarations: [ReportPage],
entryComponents: [ReportPage]
})
export class ReportPageModule {}
34 changes: 34 additions & 0 deletions src/app/modal/report/report.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-button (click)="close()">
<ion-icon slot="icon-only" name="close"></ion-icon>
</ion-button>
</ion-buttons>
<ion-title>Создание репорта</ion-title>
<ion-buttons slot="end">
<ion-button (click)="report()">
Отправить
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>

<ion-content fullpage>
<ion-item>
<ion-label position="stacked">Название</ion-label>
<ion-input minlength="8" [(ngModel)]="name" required></ion-input>
</ion-item>
<ion-item>
<ion-label position="stacked">
Описание проблемы
</ion-label>
<ion-textarea
minlength="10"
[(ngModel)]="body"
placeholder="Подробно опишите вашу проблему"
style="height: 250px;"
>
</ion-textarea>
</ion-item>
</ion-content>
Empty file.
27 changes: 27 additions & 0 deletions src/app/modal/report/report.page.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { ReportPage } from './report.page';

describe('ReportPage', () => {
let component: ReportPage;
let fixture: ComponentFixture<ReportPage>;

beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ReportPage ],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
.compileComponents();
}));

beforeEach(() => {
fixture = TestBed.createComponent(ReportPage);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
65 changes: 65 additions & 0 deletions src/app/modal/report/report.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { Component, OnInit, Input } from '@angular/core';
import { Storage } from '@ionic/storage';
import { ToastController, ModalController } from '@ionic/angular';
import { ReportService } from 'src/app/providers/report.service';
import { Firebase } from '@ionic-native/firebase/ngx';
import { Form } from '@angular/forms';

@Component({
selector: 'app-report',
templateUrl: './report.page.html',
styleUrls: ['./report.page.scss'],
})
export class ReportPage implements OnInit {
// привязка к посту, пользователю
@Input() public post_id?: string;
@Input() public user_id?: string;

public name: string;
public body: string;

public reportForm: Form;

constructor(
private modalController: ModalController,
private storage: Storage,
private toast: ToastController,
private rep: ReportService,
private firebase: Firebase
) { }

ngOnInit() {
}

public async close() {
await this.modalController.dismiss({ action: 'closed' });
}

public async report() {
const user_local = await this.storage.get('user_local');
try {
await this.rep.send({
name: this.name,
body: this.body,
post_id: this.post_id,
user_id: this.user_id,
authod_id: user_local.id || ''
});

(await this.toast.create({
message: 'Спасибо за репорт!',
duration: 5000
})).present();
this.modalController.dismiss({ action: 'sended' });
} catch (e) {
// логируем в консоль браузера
console.error(e);
// логируем в фаербейс
await this.firebase.logError(e);
(await this.toast.create({
message: 'Ошибка при отправке, попробуйте чуть позже',
duration: 5000
})).present();
}
}
}
Loading

0 comments on commit 499e54d

Please sign in to comment.