Skip to content

Commit

Permalink
PER-9422
Browse files Browse the repository at this point in the history
Renamed the files from banner to mobile-banner for less confusion.
  • Loading branch information
crisnicandrei committed Feb 6, 2024
1 parent 73cf25e commit 033d39e
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/app/auth/components/auth/auth.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</a>
</div>
</div>
<pr-banner></pr-banner>
<pr-mobile-banner></pr-mobile-banner>
<pr-announcement></pr-announcement>
<pr-android-app-notify></pr-android-app-notify>
<pr-prompt></pr-prompt>
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/components/main/main.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<router-outlet name="dialog"></router-outlet>
</div>
</div>
<pr-banner></pr-banner>
<pr-mobile-banner></pr-mobile-banner>
<pr-upload-progress></pr-upload-progress>
<pr-dialog-root></pr-dialog-root>
<pr-folder-picker></pr-folder-picker>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
<ng-template #loading>
<div class="loading">Loading...</div>
</ng-template>
<pr-banner></pr-banner>
<pr-mobile-banner></pr-mobile-banner>
<pr-prompt></pr-prompt>
<pr-dialog-root></pr-dialog-root>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import { SharedModule } from '@shared/shared.module';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { Shallow } from 'shallow-render';
import { BannerService } from '@shared/services/banner/banner.service';
import { BannerComponent } from './banner.component';
import { MobileBannerService } from '@shared/services/mobile-banner/mobile-banner.service';
import { MobileBannerComponent } from './mobile-banner.component';

const mockBannerService = {
get isIos() {
Expand All @@ -21,12 +21,12 @@ const mockBannerService = {
hideBanner() {},
};

describe('BannerComponent', () => {
let shallow: Shallow<BannerComponent>;
describe('MobileBannerComponent', () => {
let shallow: Shallow<MobileBannerComponent>;

beforeEach(() => {
shallow = new Shallow(BannerComponent, SharedModule)
.mock(BannerService, mockBannerService)
shallow = new Shallow(MobileBannerComponent, SharedModule)
.mock(MobileBannerService, mockBannerService)
.dontMock(NoopAnimationsModule)
.import(NoopAnimationsModule);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
import { PromptService } from '@shared/services/prompt/prompt.service';
import { ngIfSlideUpAnimation } from '@shared/animations';
import { Component } from '@angular/core';
import { BannerService } from '@shared/services/banner/banner.service';
import { MobileBannerService } from '@shared/services/mobile-banner/mobile-banner.service';

@Component({
selector: 'pr-banner',
templateUrl: './banner.component.html',
styleUrls: ['./banner.component.scss'],
selector: 'pr-mobile-banner',
templateUrl: './mobile-banner.component.html',
styleUrls: ['./mobile-banner.component.scss'],
animations: [ngIfSlideUpAnimation],
})
export class BannerComponent {
export class MobileBannerComponent {
public url = '';
constructor(
public bannerService: BannerService,
public bannerService: MobileBannerService,
private prompt: PromptService
) {
this.url = this.bannerService.isIos
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
/* @format */
import { DeviceService } from '@shared/services/device/device.service';
import { CoreModule } from '@core/core.module';
import { Shallow } from 'shallow-render';
import { BannerService } from './banner.service';
import { MobileBannerService } from './mobile-banner.service';

const mockAndroidDeviceService = {
isAndroid: () => true,
Expand All @@ -15,11 +14,11 @@ const mockIosDeviceService = {
};

describe('BannerService', () => {
let shallow: Shallow<BannerService>;
let shallow: Shallow<MobileBannerService>;

describe('when on an Android device', () => {
beforeEach(() => {
shallow = new Shallow(BannerService, CoreModule).mock(
shallow = new Shallow(MobileBannerService, CoreModule).mock(
DeviceService,
mockAndroidDeviceService
);
Expand All @@ -36,7 +35,7 @@ describe('BannerService', () => {

describe('when on an iOS device', () => {
beforeEach(() => {
shallow = new Shallow(BannerService, CoreModule).mock(
shallow = new Shallow(MobileBannerService, CoreModule).mock(
DeviceService,
mockIosDeviceService
);
Expand All @@ -46,7 +45,7 @@ describe('BannerService', () => {
const { instance } = await shallow.createService();

expect(instance.isVisible).toBeTrue();

expect(instance.isIos).toBeTrue();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class BannerService {
export class MobileBannerService {
private _isVisible = false;
private _appStoreUrl =
'https://apps.apple.com/app/permanent-archive/id1571883070' as const;
private _playStoreUrl =
'https://play.google.com/store/apps/details?id=org.permanent.PermanentArchive' as const;
private readonly _appStoreUrl =
'https://apps.apple.com/app/permanent-archive/id1571883070';
private readonly _playStoreUrl =
'https://play.google.com/store/apps/details?id=org.permanent.PermanentArchive';

private _isIos = false;

Expand Down
6 changes: 3 additions & 3 deletions src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import { PrependProtocolPipe } from './pipes/prepend-protocol.pipe';
import { SwitcherComponent } from './components/switcher/switcher.component';
import { GetAltTextPipe } from './pipes/get-alt-text.pipe';
import { AccessRolePipe } from './pipes/access-role.pipe';
import { BannerComponent } from './components/banner/banner.component';
import { MobileBannerComponent } from './components/mobile-banner/mobile-banner.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -134,7 +134,7 @@ import { BannerComponent } from './components/banner/banner.component';
SwitcherComponent,
GetAltTextPipe,
AccessRolePipe,
BannerComponent,
MobileBannerComponent,
],
declarations: [
ThumbnailComponent,
Expand Down Expand Up @@ -183,7 +183,7 @@ import { BannerComponent } from './components/banner/banner.component';
SwitcherComponent,
GetAltTextPipe,
AccessRolePipe,
BannerComponent,
MobileBannerComponent,
],
providers: [PublicLinkPipe, PublicRoutePipe, PrLocationPipe, DatePipe],
})
Expand Down

0 comments on commit 033d39e

Please sign in to comment.