Skip to content

Commit

Permalink
Merge pull request #49 from HanaDigital/version-2.0.0
Browse files Browse the repository at this point in the history
Version 2.0.1
  • Loading branch information
dr-nyt authored Nov 20, 2020
2 parents fe440c2 + ff553d6 commit 3c396c1
Show file tree
Hide file tree
Showing 14 changed files with 352 additions and 28 deletions.
14 changes: 10 additions & 4 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,16 @@ autoUpdater.on('update-not-available', (event) => {
});

autoUpdater.on('download-progress', (progressObj) => {
let log_message = "Download speed: " + progressObj.bytesPerSecond;
log_message = log_message + ' - Downloaded ' + progressObj.percent + '%';
log_message = log_message + ' (' + progressObj.transferred + "/" + progressObj.total + ')';
win.webContents.send('download_progress', log_message);
const downloadSpeed = Math.round((progressObj.bytesPerSecond / 1024) * 100) / 100;
const downloadPercentage = progressObj.percent;
const downloadTransferred = progressObj.transferred;
const downloadTotal = progressObj.total;
win.webContents.send('download_progress', {
downloadSpeed: downloadSpeed,
downloadPercentage: downloadPercentage,
downloadTransferred: downloadTransferred,
downloadTotal: downloadTotal
});
})

// Update has been downloaded
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "novelscraper",
"version": "2.0.0",
"version": "2.0.1",
"description": "App for downloading novels from pirate sites.",
"homepage": "https://github.com/HanaDigital/NovelScraper",
"author": {
Expand Down
16 changes: 15 additions & 1 deletion src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,21 @@
display: isUpdating ? 'block' : 'none'
}"
>
UPDATING
<h3>{{ updateData.downloadPercentage }}%</h3>
<div
class="updatingBar"
[ngStyle]="{
width: updateData.downloadPercentage + '%'
}"
></div>
</div>
<div class="downloadInfo">
<p>
{{ updateData.downloadSpeed }} Kb/s - ({{
updateData.downloadTransferred
}}
/ {{ updateData.downloadTotal }})
</p>
</div>
</div>
</div>
Expand Down
51 changes: 40 additions & 11 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -178,18 +178,31 @@ body {
background: white;
position: relative;

.downloadInfo {
margin-top: 0.5em;
width: 100%;
text-align: center;
}

.promptWrapper {
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
bottom: 0px;
border-radius: 5px;
padding: 10px;
box-shadow: inset 0px 0px 12px -5px rgba(0, 0, 0, 0.25);
transition: all 1s;

span {
margin-top: 1em;
}
}

.updating {
position: relative;
overflow: hidden;
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -199,21 +212,37 @@ body {
right: 0;
bottom: 0;
border-radius: 5px;
padding: 10px;
box-shadow: inset 0px 0px 12px -5px rgba(0, 0, 0, 0.25);
background: linear-gradient(
-45deg,
#74ccbc,
rgb(140, 255, 240),
#44beff,
#00a2ff
);
background-size: 400% 400%;
animation: load 5s ease infinite;
transition: all 1s;

color: white;
color: #505050;
font-weight: bolder;

h3 {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: flex;
justify-content: center;
align-items: center;
}

.updatingBar {
height: 40px;
background: linear-gradient(
-45deg,
#74ccbc,
#8cfff0,
#44beff,
#00a2ff
);
background-size: 400% 400%;
animation: load 5s ease infinite;
box-shadow: inset 0px 0px 12px -5px rgba(0, 0, 0, 0.25);
transition: all 1s;
}
}

p {
Expand Down
6 changes: 4 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export class AppComponent {

menuButtons: HTMLCollectionOf<Element> = document.getElementsByClassName("button");

updateData: any;

constructor(zone: NgZone) {
console.log('Production: ', AppConfig.production);

Expand All @@ -36,7 +38,7 @@ export class AppComponent {
});

ipcRenderer.on('download_progress', (event, arg) => {
console.log(arg);
this.updateData = arg;
});

ipcRenderer.on('update_downloaded', () => {
Expand All @@ -61,7 +63,7 @@ export class AppComponent {
}

toggleUpdatePrompt(): void {
this.isUpdate = false;
this.isUpdate = !this.isUpdate;
}

// Minimize Window
Expand Down
7 changes: 4 additions & 3 deletions src/app/pages/novel/novel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ export class NovelComponent implements OnInit {
fromHome: boolean = history.state.fromHome
fromLibrary: boolean = history.state.fromLibrary

progress: number = 0;
progress = 0;

downloadID: number;
checkDownload: NodeJS.Timeout;

showModal: boolean = false;
loading: boolean = false;
showModal = false;
loading = false;

constructor(private router: Router, public database: DatabaseService, public sourceManager: SourceManagerService) {
if (!this.source) this.source = {
Expand Down Expand Up @@ -76,6 +76,7 @@ export class NovelComponent implements OnInit {

addToLibrary(): void {
this.novel = this.database.addNovel(this.novel);
this.refresh();
}

download(): void {
Expand Down
6 changes: 3 additions & 3 deletions src/app/pages/source-page/source-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ export class SourcePageComponent implements OnInit {

ngOnInit(): void {
if (!this.source) this.source = {
name: "BoxNovel",
link: "https://boxnovel.com",
icon: "assets/img/sources/boxnovel-logo.png"
name: "NovelFull",
link: "https://novelfull.com",
icon: "assets/img/sources/novelfull-logo.png"
};

this.service = this.sourceManager.getService(this.source.name);
Expand Down
1 change: 1 addition & 0 deletions src/app/resources/sourceList.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { sourcesList } from "./types"

export const sources: sourcesList = [
{ name: "NovelFull", link: "https://novelfull.com", icon: "assets/img/sources/novelfull-logo.png" },
{ name: "BoxNovel", link: "https://boxnovel.com", icon: "assets/img/sources/boxnovel-logo.png" },
{ name: "ReadLightNovel", link: "https://www.readlightnovel.org", icon: "assets/img/sources/readlightnovel-logo.png" },
];
Expand Down
16 changes: 16 additions & 0 deletions src/app/services/sources/novelfull.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';

import { NovelfullService } from './novelfull.service';

describe('NovelfullService', () => {
let service: NovelfullService;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(NovelfullService);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
Loading

0 comments on commit 3c396c1

Please sign in to comment.