Skip to content

Commit 0f58252

Browse files
Merge pull request #614 from NicolasConstant/develop
1.6.0 PR
2 parents c3cd6fe + 0d2ac6b commit 0f58252

32 files changed

+1710
-48
lines changed

package-lock.json

Lines changed: 1162 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sengi",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"license": "AGPL-3.0-or-later",
55
"main": "main-electron.js",
66
"description": "A multi-account desktop client for Mastodon and Pleroma",
@@ -25,13 +25,14 @@
2525
},
2626
"private": true,
2727
"dependencies": {
28-
"@angular/animations": "^7.2.7",
29-
"@angular/cdk": "^7.2.7",
28+
"@angular/animations": "^7.2.16",
29+
"@angular/cdk": "^7.3.7",
3030
"@angular/common": "^7.2.7",
3131
"@angular/compiler": "^7.2.7",
3232
"@angular/core": "^7.2.7",
3333
"@angular/forms": "^7.2.7",
3434
"@angular/http": "^7.2.7",
35+
"@angular/material": "^16.2.1",
3536
"@angular/platform-browser": "^7.2.7",
3637
"@angular/platform-browser-dynamic": "^7.2.7",
3738
"@angular/pwa": "^0.12.4",

src/app/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { HttpModule } from "@angular/http";
55
import { HttpClientModule } from '@angular/common/http';
66
import { NgModule, APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
77
import { RouterModule, Routes } from "@angular/router";
8+
import { DragDropModule } from '@angular/cdk/drag-drop';
89
// import { NgxElectronModule } from 'ngx-electron';
910

1011
import { NgxsModule } from '@ngxs/store';
@@ -177,6 +178,7 @@ const routes: Routes = [
177178
OwlDateTimeModule,
178179
OwlNativeDateTimeModule,
179180
OverlayModule,
181+
DragDropModule,
180182
// NgxElectronModule,
181183
RouterModule.forRoot(routes),
182184

src/app/components/create-status/create-status.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
6868
this.detectAutosuggestion(value);
6969
this._status = value;
7070

71+
this.languageService.autoDetectLang(value);
72+
7173
setTimeout(() => {
7274
this.autoGrow();
7375
}, 0);

src/app/components/create-status/poll-editor/poll-editor.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export class PollEditorComponent implements OnInit {
7979
}
8080

8181
private loadPollParameters(poll: Poll) {
82+
if(!this.oldPoll) return;
83+
8284
const isMulti = poll.multiple;
8385

8486
this.entries.length = 0;

src/app/components/floating-column/add-new-account/add-new-account.component.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ <h2 class="comrade__title" *ngIf="isComrade">Welcome Comrade!</h2>
1515
<button type="submit" class="form-button"
1616
title="add account"
1717
[class.comrade__button]="isComrade">
18-
<span *ngIf="!isLoading">Submit</span>
18+
19+
<span *ngIf="!isLoading && !this.isInstanceMultiAccountLoading">Submit</span>
20+
<span *ngIf="!isLoading && this.isInstanceMultiAccountLoading" class="faq__warning">See FAQ</span>
1921
<app-waiting-animation *ngIf="isLoading" class="waiting-icon"></app-waiting-animation>
2022
</button>
2123

@@ -29,5 +31,12 @@ <h2 class="comrade__title" *ngIf="isComrade">Welcome Comrade!</h2>
2931
allowfullscreen></iframe>
3032
</div>
3133

34+
<div class="faq" *ngIf="isInstanceMultiAccount">
35+
<p>
36+
FAQ<br/>
37+
<a href="https://github.com/NicolasConstant/sengi/wiki/How-to-add-multiple-accounts-from-the-same-instance" target="_blank">How to add multiple accounts from the same instance?</a>
38+
</p>
39+
</div>
40+
3241
</div>
3342
</div>

src/app/components/floating-column/add-new-account/add-new-account.component.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,21 @@ $comrade_red: #a50000;
109109
background-color: $comrade_red;
110110
background-position: 0 0;
111111
}
112+
}
113+
114+
.faq {
115+
margin: 20px 0 0 0;
116+
117+
& a {
118+
color: #ffcc00;
119+
text-decoration: underline;
120+
121+
&:hover {
122+
color: #ffe88a;
123+
}
124+
}
125+
126+
&__warning {
127+
color: #ffdc52;
128+
}
112129
}

src/app/components/floating-column/add-new-account/add-new-account.component.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import { RegisteredAppsStateModel, AppInfo, AddRegisteredApp } from '../../../st
66
import { AuthService, CurrentAuthProcess } from '../../../services/auth.service';
77
import { AppData } from '../../../services/models/mastodon.interfaces';
88
import { NotificationService } from '../../../services/notification.service';
9+
import { ToolsService } from '../../../services/tools.service';
910

1011
@Component({
1112
selector: 'app-add-new-account',
1213
templateUrl: './add-new-account.component.html',
1314
styleUrls: ['./add-new-account.component.scss']
1415
})
15-
export class AddNewAccountComponent implements OnInit {
16+
export class AddNewAccountComponent implements OnInit {
1617
private blockList = ['gab.com', 'gab.ai', 'cyzed.com'];
1718
private comradeList = ['juche.town'];
1819

@@ -24,12 +25,14 @@ export class AddNewAccountComponent implements OnInit {
2425
set setInstance(value: string) {
2526
this.instance = value.replace('http://', '').replace('https://', '').replace('/', '').toLowerCase().trim();
2627
this.checkComrad();
28+
this.checkInstanceMultiAccount(value);
2729
}
2830
get setInstance(): string {
2931
return this.instance;
3032
}
3133

3234
constructor(
35+
private readonly toolsService: ToolsService,
3336
private readonly notificationService: NotificationService,
3437
private readonly authService: AuthService,
3538
private readonly store: Store) { }
@@ -51,8 +54,27 @@ export class AddNewAccountComponent implements OnInit {
5154
this.isComrade = false;
5255
}
5356

57+
isInstanceMultiAccount: boolean;
58+
isInstanceMultiAccountLoading: boolean;
59+
checkInstanceMultiAccount(value: string) {
60+
if(value) {
61+
const instances: string[] = this.toolsService.getAllAccounts().map(x => x.instance);
62+
if(instances && instances.indexOf(value) > -1){
63+
this.isInstanceMultiAccount = true;
64+
this.isInstanceMultiAccountLoading = true;
65+
66+
setTimeout(() => {
67+
this.isInstanceMultiAccountLoading = false;
68+
}, 2000);
69+
} else {
70+
this.isInstanceMultiAccount = false;
71+
this.isInstanceMultiAccountLoading = false;
72+
}
73+
}
74+
}
75+
5476
onSubmit(): boolean {
55-
if(this.isLoading || !this.instance) return false;
77+
if(this.isLoading || !this.instance || this.isInstanceMultiAccountLoading) return false;
5678

5779
this.isLoading = true;
5880

src/app/components/floating-column/settings/settings.component.html

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,20 @@ <h4 class="panel__subtitle">Languages</h4>
6262
<a href (click)="onRemoveLang(l)" class="form-button language__entry__action sound__play">remove</a>
6363
</div>
6464
<input type="text" (input)="onSearchLang($event.target.value)" [(ngModel)]="searchLang"
65-
placeholder="Find Language" autocomplete="off" class="form-control form-control-sm language__search"/>
65+
placeholder="Find Language" autocomplete="off"
66+
class="form-control form-control-sm language__search" />
6667
<div *ngFor="let l of searchedLangs" class="language__entry">
6768
<span class="language__entry__name">{{ l.name }} ({{l.iso639}})</span>
6869
<a href (click)="onAddLang(l)" class="form-button language__entry__action sound__play">add</a>
6970
</div>
71+
72+
7073
</div>
74+
75+
<input class="sub-section__checkbox" [(ngModel)]="disableLangAutodetectEnabled"
76+
(change)="onDisableLangAutodetectChanged()" type="checkbox" name="disableLangAutodetec"
77+
value="disableLangAutodetec" id="disableLangAutodetec">
78+
<label class="noselect sub-section__label" for="disableLangAutodetec">disable language autodetection</label>
7179
</div>
7280
<h4 class="panel__subtitle">Twitter Bridge</h4>
7381
<div class="sub-section">
@@ -159,7 +167,8 @@ <h4 class="panel__subtitle">Timelines</h4>
159167

160168
<input class="sub-section__checkbox" [checked]="timeLineHeader === 6" (change)="onTimeLineHeaderChange(6)"
161169
type="radio" name="timelineheader-6" value="timelineheader-6" id="timelineheader-6">
162-
<label class="noselect sub-section__label" for="timelineheader-6">Title - Account Icon - Username - Domain Name</label>
170+
<label class="noselect sub-section__label" for="timelineheader-6">Title - Account Icon - Username - Domain
171+
Name</label>
163172
<br>
164173

165174
<span class="sub-section__title">loading behavior:</span><br />
@@ -186,7 +195,8 @@ <h4 class="panel__subtitle">Pleroma</h4>
186195
<input class="sub-section__checkbox" [(ngModel)]="autoFollowOnListEnabled"
187196
(change)="onAutoFollowOnListChanged()" type="checkbox" name="onAutoFollowOnListChanged"
188197
value="onAutoFollowOnListChanged" id="onAutoFollowOnListChanged">
189-
<label class="noselect sub-section__label" for="onAutoFollowOnListChanged">autofollow accounts when adding to list</label>
198+
<label class="noselect sub-section__label" for="onAutoFollowOnListChanged">autofollow accounts when
199+
adding to list</label>
190200
<br>
191201
</div>
192202
</div>
@@ -199,6 +209,20 @@ <h4 class="panel__subtitle">Other</h4>
199209
<label class="noselect sub-section__label" for="disableRemoteFetching">disable remote status
200210
fetching</label>
201211
<br>
212+
213+
<input class="sub-section__checkbox" [(ngModel)]="enableAltLabelEnabled"
214+
(change)="onEnableAltLabelChanged()" type="checkbox" name="enableAltLabel"
215+
value="enableAltLabel" id="enableAltLabel">
216+
<label class="noselect sub-section__label" for="enableAltLabel">enable alt label</label>
217+
<br>
218+
219+
<input class="sub-section__checkbox" [(ngModel)]="enableFreezeAvatarEnabled"
220+
(change)="onEnableFreezeAvatarChanged()" type="checkbox" name="enableFreezeAvatar"
221+
value="enableFreezeAvatar" id="enableFreezeAvatar">
222+
<label class="noselect sub-section__label" for="enableFreezeAvatar">freeze animated avatar</label>
223+
<br>
224+
225+
reorder account's icons: <a href class="toogle-lock-icon-menu" (click)="toogleLockIconMenu()"><span *ngIf="iconMenuLocked">Unlock Icons</span><span *ngIf="!iconMenuLocked">Lock Icons</span></a>
202226
</div>
203227

204228
<h4 class="panel__subtitle">About</h4>

src/app/components/floating-column/settings/settings.component.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,22 @@
153153
background-color: #32384d;
154154
}
155155
}
156+
}
157+
158+
.toogle-lock-icon-menu {
159+
display: block;
160+
padding: 3px 40px;
161+
width: 170px;
162+
163+
float: right;
164+
165+
text-align: center;
166+
167+
color: white;
168+
background-color: #1f2330;
169+
170+
&:hover {
171+
text-decoration: none;
172+
background-color: #32384d;
173+
}
156174
}

src/app/components/floating-column/settings/settings.component.ts

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export class SettingsComponent implements OnInit, OnDestroy {
2929
disableRemoteStatusFetchingEnabled: boolean;
3030
disableAvatarNotificationsEnabled: boolean;
3131
disableSoundsEnabled: boolean;
32+
disableLangAutodetectEnabled: boolean;
33+
enableAltLabelEnabled: boolean;
34+
enableFreezeAvatarEnabled: boolean;
3235
version: string;
3336

3437
hasPleromaAccount: boolean;
@@ -146,11 +149,21 @@ export class SettingsComponent implements OnInit, OnDestroy {
146149
this.twitterBridgeInstance = settings.twitterBridgeInstance;
147150

148151
this.configuredLangs = this.languageService.getConfiguredLanguages();
152+
this.disableLangAutodetectEnabled = settings.disableLangAutodetec;
153+
this.enableAltLabelEnabled = settings.enableAltLabel;
154+
this.enableFreezeAvatarEnabled = settings.enableFreezeAvatar;
149155
}
150156

151157
ngOnDestroy(): void {
152158
if(this.languageSub) this.languageSub.unsubscribe();
153-
}
159+
}
160+
161+
iconMenuLocked = true;
162+
toogleLockIconMenu(): boolean {
163+
this.navigationService.changeIconMenuState(this.iconMenuLocked);
164+
this.iconMenuLocked = ! this.iconMenuLocked;
165+
return false;
166+
}
154167

155168
onSearchLang(input: string) {
156169
this.searchedLangs = this.languageService.searchLanguage(input);
@@ -273,6 +286,27 @@ export class SettingsComponent implements OnInit, OnDestroy {
273286
return false;
274287
}
275288

289+
onEnableFreezeAvatarChanged(){
290+
this.notifyRestartNeeded();
291+
let settings = this.settingsService.getSettings();
292+
settings.enableFreezeAvatar = this.enableFreezeAvatarEnabled;
293+
this.settingsService.saveSettings(settings);
294+
}
295+
296+
onEnableAltLabelChanged(){
297+
this.notifyRestartNeeded();
298+
let settings = this.settingsService.getSettings();
299+
settings.enableAltLabel = this.enableAltLabelEnabled;
300+
this.settingsService.saveSettings(settings);
301+
}
302+
303+
onDisableLangAutodetectChanged() {
304+
this.notifyRestartNeeded();
305+
let settings = this.settingsService.getSettings();
306+
settings.disableLangAutodetec = this.disableLangAutodetectEnabled;
307+
this.settingsService.saveSettings(settings);
308+
}
309+
276310
onDisableAutofocusChanged() {
277311
this.notifyRestartNeeded();
278312
let settings = this.settingsService.getSettings();

src/app/components/left-side-bar/left-side-bar.component.html

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,36 @@
88
<fa-icon [icon]="faSearch"></fa-icon>
99
</a>
1010

11-
<div *ngFor="let account of accounts">
12-
<app-account-icon [account]="account" (toogleAccountNotify)="onToogleAccountNotify($event)"
13-
(openMenuNotify)="onOpenMenuNotify($event)">
14-
</app-account-icon>
11+
<div *ngIf="!iconMenuIsDraggable">
12+
<div *ngFor="let account of accounts">
13+
<app-account-icon [account]="account" (toogleAccountNotify)="onToogleAccountNotify($event)"
14+
(openMenuNotify)="onOpenMenuNotify($event)">
15+
</app-account-icon>
16+
</div>
1517
</div>
1618

19+
<div *ngIf="iconMenuIsDraggable" cdkDropList [cdkDropListData]="accounts" (cdkDropListDropped)="onDrop($event)">
20+
<div *ngFor="let account of accounts" cdkDrag class="draggable">
21+
<fa-icon class="draggable__icon" [icon]="faArrowsAltV"></fa-icon>
22+
<img class="draggable__avatar" src="{{ account.avatar }}" />
23+
</div>
24+
</div>
25+
26+
1727
<a class="left-bar-button left-bar-button--add left-bar-link" [ngClass]="{'no-accounts': hasAccounts === false }"
1828
href title="add new account" (click)="addNewAccount()" (contextmenu)="addNewAccount()">
1929
<fa-icon [icon]="faPlus"></fa-icon>
2030
</a>
2131

2232

23-
<a class="left-bar-button left-bar-button--scheduled left-bar-button--bottom left-bar-link" href title="scheduled statuses"
24-
*ngIf="hasAccounts && hasScheduledStatuses"
25-
(click)="openScheduledStatuses()"
33+
<a class="left-bar-button left-bar-button--scheduled left-bar-button--bottom left-bar-link" href
34+
title="scheduled statuses" *ngIf="hasAccounts && hasScheduledStatuses" (click)="openScheduledStatuses()"
2635
(contextmenu)="openScheduledStatuses()">
2736
<fa-icon [icon]="faCalendarAlt"></fa-icon>
2837
</a>
2938

30-
<a class="left-bar-button left-bar-button--cog left-bar-button--bottom left-bar-link" href title="settings" (click)="openSettings()"
31-
(contextmenu)="openSettings()">
39+
<a class="left-bar-button left-bar-button--cog left-bar-button--bottom left-bar-link" href title="settings"
40+
(click)="openSettings()" (contextmenu)="openSettings()">
3241
<fa-icon [icon]="faCog"></fa-icon>
3342
</a>
3443
</div>

0 commit comments

Comments
 (0)