From 668062c11df0a018259833fc5d7a7e8b6c8b5bc4 Mon Sep 17 00:00:00 2001 From: Anduin Xue Date: Sat, 3 Aug 2019 00:09:30 +0800 Subject: [PATCH 01/21] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49852d26..5bb29669 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kahla", - "version": "3.6.3", + "version": "3.6.4", "description": "Kahla is a cross-platform business messaging app.", "author": "Aiursoft (https://www.aiursoft.com/)", "build": { From 477b0cbeeb7a2fb9cbe75741392f898488251b0d Mon Sep 17 00:00:00 2001 From: xxyzz Date: Sun, 4 Aug 2019 18:14:05 +0800 Subject: [PATCH 02/21] get messages when change timer --- src/app/Models/Timers.ts | 10 ++++++++++ src/app/Services/MessageService.ts | 2 ++ src/app/Services/TimerService.ts | 22 ++++------------------ 3 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 src/app/Models/Timers.ts diff --git a/src/app/Models/Timers.ts b/src/app/Models/Timers.ts new file mode 100644 index 00000000..06157d7f --- /dev/null +++ b/src/app/Models/Timers.ts @@ -0,0 +1,10 @@ +export enum Timers { + '5s' = 5, + '30s' = 30, + '1m' = 60, + '10m' = 600, + '1h' = 3600, + '1d' = 3600 * 24, + '1w' = 3600 * 24 * 7, + 'off' = Math.pow(2, 31) - 1 +} diff --git a/src/app/Services/MessageService.ts b/src/app/Services/MessageService.ts index b6afc0c3..ae92f76f 100644 --- a/src/app/Services/MessageService.ts +++ b/src/app/Services/MessageService.ts @@ -124,6 +124,8 @@ export class MessageService { this.timerService.updateDestructTime(evt.newTimer); Swal.fire('Self-destruct timer updated!', 'Your current message life time is: ' + this.timerService.destructTime, 'info'); + this.localMessages = []; + this.getMessages(0, this.conversation.id, -1, 15); } break; } diff --git a/src/app/Services/TimerService.ts b/src/app/Services/TimerService.ts index 3d1a65d5..63333c1f 100644 --- a/src/app/Services/TimerService.ts +++ b/src/app/Services/TimerService.ts @@ -1,12 +1,14 @@ import { Injectable } from '@angular/core'; import Swal from 'sweetalert2'; import { ConversationApiService } from './ConversationApiService'; +import { Timers } from '../Models/Timers'; @Injectable({ providedIn: 'root' }) export class TimerService { public destructTime = 'off'; + private formerTimer = Timers.off; constructor( private conversationApiService: ConversationApiService) {} @@ -28,7 +30,7 @@ export class TimerService { inputPlaceholder: 'Select one', showCancelButton: true }).then(selected => { - if (selected.value) { + if (selected.value && selected.value !== this.formerTimer) { this.conversationApiService.UpdateMessageLifeTime(conversationId, selected.value) .subscribe(result => { this.updateDestructTime(selected.value); @@ -50,22 +52,6 @@ export class TimerService { private getDestructTime(time: number): string { time = Number(time); - if (time === 5) { - return '5s'; - } else if (time === 30) { - return '30s'; - } else if (time === 60) { - return '1m'; - } else if (time === 600) { - return '10m'; - } else if (time === 3600) { - return '1h'; - } else if (time === 3600 * 24) { - return '1d'; - } else if (time === 3600 * 24 * 7) { - return '1w'; - } else { - return 'off'; - } + return Timers[time]; } } From df0eb32b04265559ed3957f96cc18fbf9e2471c0 Mon Sep 17 00:00:00 2001 From: Anduin Xue Date: Sun, 4 Aug 2019 22:36:47 +0800 Subject: [PATCH 03/21] Prevent the app to rotate. Prevent the app to rotate even when the user locks the screen. In this mode, if the user locks the screen, the PWA app will not rotate. But if the user did not lock it, it will rotate correctly. And this is expected. --- src/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manifest.json b/src/manifest.json index aa4afc84..2c95a494 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -23,7 +23,7 @@ "background_color": "#fff", "theme_color": "#fff", "display": "standalone", - "orientation": "any", + "orientation": "portrait", "related_applications": [{ "platform": "play", "url": "https://play.google.com/store/apps/details?id=com.aiursoft.kahla" From 9b24bb93677af6eecc7e13e1569ceb4edfeb29c8 Mon Sep 17 00:00:00 2001 From: EdgeNeko Date: Tue, 6 Aug 2019 09:41:12 +0800 Subject: [PATCH 04/21] fix: better scroll behave in discovery page close #606 --- src/app/Controllers/discover.component.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/Controllers/discover.component.ts b/src/app/Controllers/discover.component.ts index 25ada951..d4cb386b 100644 --- a/src/app/Controllers/discover.component.ts +++ b/src/app/Controllers/discover.component.ts @@ -3,6 +3,7 @@ import { FriendsApiService } from '../Services/FriendsApiService'; import { DiscoverUser } from '../Models/DiscoverUser'; import { Values } from '../values'; import Swal from 'sweetalert2'; +import { HomeService } from '../Services/HomeService'; @Component({ templateUrl: '../Views/discover.html', @@ -17,7 +18,8 @@ export class DiscoverComponent implements OnInit { public loadingImgURL = Values.loadingImgURL; constructor( - private friendsApiService: FriendsApiService) { + private friendsApiService: FriendsApiService, + private homeService: HomeService) { } public ngOnInit(): void { @@ -30,11 +32,13 @@ export class DiscoverComponent implements OnInit { users.items.forEach(item => { item.targetUser.avatarURL = Values.fileAddress + item.targetUser.headImgFileKey; }); + const top = this.homeService.contentWrapper.scrollTop; this.users = users.items; if (this.users.length < this.amount) { this.noMoreUsers = true; } this.loading = false; + setTimeout(() => this.homeService.contentWrapper.scrollTo(0, top), 0); this.amount += 15; }, () => { this.loading = false; From 822ef9b0ab85b425dbd929a4602f4259c39c7b71 Mon Sep 17 00:00:00 2001 From: Anduin Xue Date: Tue, 6 Aug 2019 18:35:32 +0800 Subject: [PATCH 05/21] Update manifest.json --- src/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/manifest.json b/src/manifest.json index 2c95a494..8dfd97a0 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -23,7 +23,7 @@ "background_color": "#fff", "theme_color": "#fff", "display": "standalone", - "orientation": "portrait", + "orientation": "portrait-primary", "related_applications": [{ "platform": "play", "url": "https://play.google.com/store/apps/details?id=com.aiursoft.kahla" From 52d1c7509199bb235df5256be0bcf260fb0cdf14 Mon Sep 17 00:00:00 2001 From: Anduin Xue Date: Tue, 6 Aug 2019 18:44:20 +0800 Subject: [PATCH 06/21] Suggest the user to download the native app. --- src/manifest.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/manifest.json b/src/manifest.json index 8dfd97a0..24c208ca 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -24,9 +24,10 @@ "theme_color": "#fff", "display": "standalone", "orientation": "portrait-primary", + "prefer_related_applications": true, "related_applications": [{ "platform": "play", - "url": "https://play.google.com/store/apps/details?id=com.aiursoft.kahla" + "id": "com.aiursoft.kahla" }], "share_target": { "action": "/share-target/", From b63f45c99d57c2e0c11e532cbf0c4383bf30e256 Mon Sep 17 00:00:00 2001 From: Anduin Xue Date: Tue, 6 Aug 2019 18:46:08 +0800 Subject: [PATCH 07/21] Use black-translucent for apple --- src/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.html b/src/index.html index 81cf51df..317adae6 100644 --- a/src/index.html +++ b/src/index.html @@ -12,7 +12,7 @@ - +