mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-10-09 11:12:48 +00:00
refactor: apply Angular 20 inject rules
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {
|
||||
SCAcademicEvent,
|
||||
SCArticle,
|
||||
@@ -395,7 +395,9 @@ export class SampleThings {
|
||||
*/
|
||||
http: HttpClient;
|
||||
|
||||
constructor(http: HttpClient) {
|
||||
constructor() {
|
||||
const http = inject(HttpClient);
|
||||
|
||||
this.http = http;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {HttpRequest, HttpHandler, HttpEvent, HttpInterceptor, HttpErrorResponse} from '@angular/common/http';
|
||||
import {Observable, throwError} from 'rxjs';
|
||||
import {NGXLogger} from 'ngx-logger';
|
||||
@@ -21,7 +21,7 @@ import {catchError} from 'rxjs/operators';
|
||||
|
||||
@Injectable()
|
||||
export class ServiceHandlerInterceptor implements HttpInterceptor {
|
||||
constructor(private readonly logger: NGXLogger) {}
|
||||
private readonly logger = inject(NGXLogger);
|
||||
|
||||
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
|
||||
return next.handle(request).pipe(
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {AfterContentInit, Component, NgZone} from '@angular/core';
|
||||
import {AfterContentInit, Component, NgZone, inject} from '@angular/core';
|
||||
import {Router} from '@angular/router';
|
||||
import {App, URLOpenListenerEvent} from '@capacitor/app';
|
||||
import {Platform, ToastController} from '@ionic/angular/standalone';
|
||||
@@ -35,6 +35,24 @@ import {SplashScreen} from '@capacitor/splash-screen';
|
||||
standalone: false,
|
||||
})
|
||||
export class AppComponent implements AfterContentInit {
|
||||
private readonly platform = inject(Platform);
|
||||
|
||||
private readonly settingsProvider = inject(SettingsProvider);
|
||||
|
||||
private readonly inAppReviewProvider = inject(InAppReviewProvider);
|
||||
|
||||
private readonly router = inject(Router);
|
||||
|
||||
private readonly zone = inject(NgZone);
|
||||
|
||||
private readonly authHelper = inject(AuthHelperService);
|
||||
|
||||
private readonly toastController = inject(ToastController);
|
||||
|
||||
private readonly scheduleSyncService = inject(ScheduleSyncService);
|
||||
|
||||
private readonly versionService = inject(AppVersionService);
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@@ -54,17 +72,7 @@ export class AppComponent implements AfterContentInit {
|
||||
*/
|
||||
ommitedEventSources = ['ion-input', 'ion-searchbar'];
|
||||
|
||||
constructor(
|
||||
private readonly platform: Platform,
|
||||
private readonly settingsProvider: SettingsProvider,
|
||||
private readonly inAppReviewProvider: InAppReviewProvider,
|
||||
private readonly router: Router,
|
||||
private readonly zone: NgZone,
|
||||
private readonly authHelper: AuthHelperService,
|
||||
private readonly toastController: ToastController,
|
||||
private readonly scheduleSyncService: ScheduleSyncService,
|
||||
private readonly versionService: AppVersionService,
|
||||
) {
|
||||
constructor() {
|
||||
void this.initializeApp();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import {CommonModule, LocationStrategy, PathLocationStrategy, registerLocaleData} from '@angular/common';
|
||||
import {HTTP_INTERCEPTORS, HttpClient, provideHttpClient, withInterceptorsFromDi} from '@angular/common/http';
|
||||
import localeDe from '@angular/common/locales/de';
|
||||
import {APP_INITIALIZER, NgModule} from '@angular/core';
|
||||
import {APP_INITIALIZER, NgModule, inject} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {RouteReuseStrategy} from '@angular/router';
|
||||
import {IonicRouteStrategy, Platform, provideIonicAngular, IonApp} from '@ionic/angular/standalone';
|
||||
@@ -216,5 +216,5 @@ export function createTranslateLoader(http: HttpClient) {
|
||||
],
|
||||
})
|
||||
export class AppModule {
|
||||
constructor(public debugDataCollectorService: DebugDataCollectorService) {}
|
||||
debugDataCollectorService = inject(DebugDataCollectorService);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Component, OnInit, inject} from '@angular/core';
|
||||
import {ModalController} from '@ionic/angular/standalone';
|
||||
import {AboutLicenseModalComponent} from './about-license-modal.component';
|
||||
import licensesFile from 'src/assets/about/licenses.json';
|
||||
@@ -35,9 +35,9 @@ export interface License {
|
||||
standalone: false,
|
||||
})
|
||||
export class AboutLicensesComponent implements OnInit {
|
||||
licenses: License[];
|
||||
private modalController = inject(ModalController);
|
||||
|
||||
constructor(private modalController: ModalController) {}
|
||||
licenses: License[];
|
||||
|
||||
ngOnInit() {
|
||||
this.licenses = this.loadLicenses();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Component, OnInit, inject} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {SCAboutPage, SCAppConfiguration} from '@openstapps/core';
|
||||
import {ConfigProvider} from '../../config/config.provider';
|
||||
@@ -28,6 +28,10 @@ import {Capacitor} from '@capacitor/core';
|
||||
standalone: false,
|
||||
})
|
||||
export class AboutPageComponent implements OnInit {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
private readonly configProvider = inject(ConfigProvider);
|
||||
|
||||
content: SCAboutPage;
|
||||
|
||||
name = config.appName;
|
||||
@@ -36,11 +40,6 @@ export class AboutPageComponent implements OnInit {
|
||||
|
||||
version: string;
|
||||
|
||||
constructor(
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly configProvider: ConfigProvider,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
const route = this.route.snapshot.url.map(it => it.path).join('/');
|
||||
this.content =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {StorageProvider} from '../storage/storage.provider';
|
||||
import {ConfigProvider} from '../config/config.provider';
|
||||
import {ModalController} from '@ionic/angular/standalone';
|
||||
@@ -12,11 +12,11 @@ export const RELEASE_NOTES_SHOWN_KEY = 'release_notes_shown';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class AppVersionService {
|
||||
constructor(
|
||||
private storage: StorageProvider,
|
||||
private config: ConfigProvider,
|
||||
private modalController: ModalController,
|
||||
) {}
|
||||
private storage = inject(StorageProvider);
|
||||
|
||||
private config = inject(ConfigProvider);
|
||||
|
||||
private modalController = inject(ModalController);
|
||||
|
||||
/**
|
||||
* Get the latest release notes that have not been presented yet
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, Input, inject} from '@angular/core';
|
||||
import {SCAppVersionInfo} from '@openstapps/core';
|
||||
import {MarkdownModule} from 'ngx-markdown';
|
||||
import {ThingTranslateModule} from '../../translation/thing-translate.module';
|
||||
@@ -31,7 +31,7 @@ import {UtilModule} from '../../util/util.module';
|
||||
],
|
||||
})
|
||||
export class ReleaseNotesComponent {
|
||||
@Input() versionInfos: SCAppVersionInfo[];
|
||||
readonly modalController = inject(ModalController);
|
||||
|
||||
constructor(readonly modalController: ModalController) {}
|
||||
@Input() versionInfos: SCAppVersionInfo[];
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {ConfigProvider} from '../config/config.provider';
|
||||
import {SCAssessment, SCUuid} from '@openstapps/core';
|
||||
import {DefaultAuthService} from '../auth/default-auth.service';
|
||||
@@ -51,6 +51,12 @@ export function toAssessmentMap(data: SCAssessment[]): Record<SCUuid, SCAssessme
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AssessmentsProvider {
|
||||
readonly configProvider = inject(ConfigProvider);
|
||||
|
||||
readonly defaultAuth = inject(DefaultAuthService);
|
||||
|
||||
readonly http = inject(HttpClient);
|
||||
|
||||
assessmentPath = 'assessments';
|
||||
|
||||
// usually this wouldn't be necessary, but the assessment service
|
||||
@@ -64,12 +70,6 @@ export class AssessmentsProvider {
|
||||
// 15 minutes
|
||||
cacheMaxAge = 15 * 60 * 1000;
|
||||
|
||||
constructor(
|
||||
readonly configProvider: ConfigProvider,
|
||||
readonly defaultAuth: DefaultAuthService,
|
||||
readonly http: HttpClient,
|
||||
) {}
|
||||
|
||||
async getAssessment(uid: SCUuid, accessToken?: string | null, forceFetch = false): Promise<SCAssessment> {
|
||||
await this.getAssessments(accessToken, forceFetch);
|
||||
|
||||
|
||||
@@ -29,15 +29,17 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class AssessmentsDetailComponent implements OnInit {
|
||||
destroy$ = inject(DestroyRef);
|
||||
readonly route = inject(ActivatedRoute);
|
||||
|
||||
constructor(
|
||||
readonly route: ActivatedRoute,
|
||||
readonly assessmentsProvider: AssessmentsProvider,
|
||||
readonly dataRoutingService: DataRoutingService,
|
||||
readonly navController: NavController,
|
||||
readonly activatedRoute: ActivatedRoute,
|
||||
) {}
|
||||
readonly assessmentsProvider = inject(AssessmentsProvider);
|
||||
|
||||
readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
readonly navController = inject(NavController);
|
||||
|
||||
readonly activatedRoute = inject(ActivatedRoute);
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
@Input() dataPathAutoRouting = true;
|
||||
|
||||
|
||||
+6
-6
@@ -26,6 +26,12 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class AssessmentsSimpleDataListComponent implements OnInit {
|
||||
readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
readonly router = inject(Router);
|
||||
|
||||
readonly activatedRoute = inject(ActivatedRoute);
|
||||
|
||||
/**
|
||||
* All SCThings to display
|
||||
*/
|
||||
@@ -47,12 +53,6 @@ export class AssessmentsSimpleDataListComponent implements OnInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
readonly dataRoutingService: DataRoutingService,
|
||||
readonly router: Router,
|
||||
readonly activatedRoute: ActivatedRoute,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.dataRoutingService
|
||||
.itemSelectListener()
|
||||
|
||||
@@ -32,6 +32,18 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class AssessmentsPageComponent implements OnInit, AfterViewInit {
|
||||
readonly logger = inject(NGXLogger);
|
||||
|
||||
readonly assessmentsProvider = inject(AssessmentsProvider);
|
||||
|
||||
readonly dataProvider = inject(DataProvider);
|
||||
|
||||
readonly activatedRoute = inject(ActivatedRoute);
|
||||
|
||||
readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
readonly router = inject(Router);
|
||||
|
||||
assessments: Promise<
|
||||
Record<
|
||||
string,
|
||||
@@ -50,15 +62,6 @@ export class AssessmentsPageComponent implements OnInit, AfterViewInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
readonly logger: NGXLogger,
|
||||
readonly assessmentsProvider: AssessmentsProvider,
|
||||
readonly dataProvider: DataProvider,
|
||||
readonly activatedRoute: ActivatedRoute,
|
||||
readonly dataRoutingService: DataRoutingService,
|
||||
readonly router: Router,
|
||||
) {}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.segmentView.value = this.sharedAxisChoreographer.currentValue;
|
||||
}
|
||||
|
||||
+10
-7
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {NavController} from '@ionic/angular/standalone';
|
||||
import {Router} from '@angular/router';
|
||||
import {AuthActions, IAuthAction} from 'ionic-appauth';
|
||||
@@ -27,12 +27,15 @@ import {DefaultAuthService} from '../../default-auth.service';
|
||||
standalone: false,
|
||||
})
|
||||
export class AuthCallbackPageComponent {
|
||||
constructor(
|
||||
private navCtrl: NavController,
|
||||
private router: Router,
|
||||
private authHelper: AuthHelperService,
|
||||
private auth: DefaultAuthService,
|
||||
) {
|
||||
private navCtrl = inject(NavController);
|
||||
|
||||
private router = inject(Router);
|
||||
|
||||
private authHelper = inject(AuthHelperService);
|
||||
|
||||
private auth = inject(DefaultAuthService);
|
||||
|
||||
constructor() {
|
||||
const events: Observable<IAuthAction> = this.auth.events$;
|
||||
|
||||
events.pipe(takeUntilDestroyed()).subscribe((action: IAuthAction) => this.postCallback(action));
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {CanActivate, NavigationExtras, Router, RouterStateSnapshot} from '@angular/router';
|
||||
import {ActivatedProtectedRouteSnapshot} from './protected.routes';
|
||||
import {AuthHelperService} from './auth-helper.service';
|
||||
@@ -22,10 +22,9 @@ import {AuthHelperService} from './auth-helper.service';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AuthGuardService implements CanActivate {
|
||||
constructor(
|
||||
private authHelper: AuthHelperService,
|
||||
private router: Router,
|
||||
) {}
|
||||
private authHelper = inject(AuthHelperService);
|
||||
|
||||
private router = inject(Router);
|
||||
|
||||
public async canActivate(route: ActivatedProtectedRouteSnapshot, _state: RouterStateSnapshot) {
|
||||
if (route.queryParamMap.get('token')) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {AuthActions, IAuthAction} from 'ionic-appauth';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
import {JSONPath} from 'jsonpath-plus';
|
||||
@@ -35,16 +35,21 @@ const AUTH_ORIGIN_PATH = 'stapps.auth.origin_path';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class AuthHelperService {
|
||||
private translateService = inject(TranslateService);
|
||||
|
||||
private configProvider = inject(ConfigProvider);
|
||||
|
||||
private storageProvider = inject(StorageProvider);
|
||||
|
||||
private defaultAuth = inject(DefaultAuthService);
|
||||
|
||||
private browser = inject(SimpleBrowser);
|
||||
|
||||
private alertController = inject(AlertController);
|
||||
|
||||
userConfigurationMap: SCUserConfigurationMap;
|
||||
|
||||
constructor(
|
||||
private translateService: TranslateService,
|
||||
private configProvider: ConfigProvider,
|
||||
private storageProvider: StorageProvider,
|
||||
private defaultAuth: DefaultAuthService,
|
||||
private browser: SimpleBrowser,
|
||||
private alertController: AlertController,
|
||||
) {
|
||||
constructor() {
|
||||
this.userConfigurationMap =
|
||||
(
|
||||
this.configProvider.getAnyValue('auth') as {
|
||||
|
||||
@@ -26,7 +26,7 @@ import {AuthActionBuilder, Browser, DefaultBrowser, EndSessionHandler, UserInfoH
|
||||
import {ConfigProvider} from '../config/config.provider';
|
||||
import {SCAuthorizationProvider} from '@openstapps/core';
|
||||
import {getClientConfig, getEndpointsConfig} from './auth.provider.methods';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {AuthService} from './auth.service';
|
||||
|
||||
const TOKEN_RESPONSE_KEY = 'token_response';
|
||||
@@ -35,6 +35,14 @@ const TOKEN_RESPONSE_KEY = 'token_response';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DefaultAuthService extends AuthService {
|
||||
protected browser: Browser;
|
||||
|
||||
protected storage: StorageBackend;
|
||||
|
||||
protected requestor: Requestor;
|
||||
|
||||
private readonly configProvider = inject(ConfigProvider);
|
||||
|
||||
public localConfiguration: AuthorizationServiceConfiguration;
|
||||
|
||||
protected tokenHandler: TokenRequestHandler;
|
||||
@@ -45,13 +53,16 @@ export class DefaultAuthService extends AuthService {
|
||||
|
||||
protected endSessionHandler: EndSessionHandler;
|
||||
|
||||
constructor(
|
||||
protected browser: Browser = new DefaultBrowser(),
|
||||
protected storage: StorageBackend = new LocalStorageBackend(),
|
||||
protected requestor: Requestor = new JQueryRequestor(),
|
||||
private readonly configProvider: ConfigProvider,
|
||||
) {
|
||||
constructor() {
|
||||
const browser = inject(Browser) ?? new DefaultBrowser();
|
||||
const storage = inject(StorageBackend) ?? new LocalStorageBackend();
|
||||
const requestor = inject(Requestor) ?? new JQueryRequestor();
|
||||
|
||||
super(browser, storage, requestor);
|
||||
|
||||
this.browser = browser;
|
||||
this.storage = storage;
|
||||
this.requestor = requestor;
|
||||
}
|
||||
|
||||
get configuration(): Promise<AuthorizationServiceConfiguration> {
|
||||
|
||||
@@ -13,11 +13,10 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {Platform} from '@ionic/angular/standalone';
|
||||
import {CapacitorRequestor} from '../capacitor-requestor';
|
||||
import {NgHttpService} from '../ng-http.service';
|
||||
|
||||
export const httpFactory = (platform: Platform, httpClient: HttpClient) => {
|
||||
return platform.is('capacitor') ? new CapacitorRequestor() : new NgHttpService(httpClient);
|
||||
export const httpFactory = (platform: Platform) => {
|
||||
return platform.is('capacitor') ? new CapacitorRequestor() : new NgHttpService();
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {Requestor} from '@openid/appauth';
|
||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
||||
import {XhrSettings} from 'ionic-appauth/lib/cordova';
|
||||
@@ -23,7 +23,7 @@ import {firstValueFrom, Observable} from 'rxjs';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class NgHttpService implements Requestor {
|
||||
constructor(private http: HttpClient) {}
|
||||
private http = inject(HttpClient);
|
||||
|
||||
public async xhr<T>(settings: XhrSettings): Promise<T> {
|
||||
if (!settings.method) {
|
||||
|
||||
@@ -40,16 +40,19 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
|
||||
@Injectable()
|
||||
export class ScheduleSyncService {
|
||||
destroy$ = inject(DestroyRef);
|
||||
private scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
constructor(
|
||||
private scheduleProvider: ScheduleProvider,
|
||||
private storageProvider: StorageProvider,
|
||||
private translator: ThingTranslateService,
|
||||
private dateFormatPipe: DateFormatPipe,
|
||||
private durationFormatPipe: DurationPipe,
|
||||
private calendar: CalendarService,
|
||||
) {}
|
||||
private storageProvider = inject(StorageProvider);
|
||||
|
||||
private translator = inject(ThingTranslateService);
|
||||
|
||||
private dateFormatPipe = inject(DateFormatPipe);
|
||||
|
||||
private durationFormatPipe = inject(DurationPipe);
|
||||
|
||||
private calendar = inject(CalendarService);
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
init() {
|
||||
this.scheduleProvider.uuids$
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, Input, OnInit, inject} from '@angular/core';
|
||||
import {
|
||||
getICalExport,
|
||||
getNativeCalendarExport,
|
||||
@@ -45,6 +45,12 @@ interface ICalInfo {
|
||||
standalone: false,
|
||||
})
|
||||
export class AddEventReviewModalComponent implements OnInit {
|
||||
readonly calendarService = inject(CalendarService);
|
||||
|
||||
readonly translator = inject(ThingTranslateService);
|
||||
|
||||
readonly translateService = inject(TranslateService);
|
||||
|
||||
moment = moment;
|
||||
|
||||
@Input() dismissAction: () => void;
|
||||
@@ -57,12 +63,6 @@ export class AddEventReviewModalComponent implements OnInit {
|
||||
|
||||
isWeb = true;
|
||||
|
||||
constructor(
|
||||
readonly calendarService: CalendarService,
|
||||
readonly translator: ThingTranslateService,
|
||||
readonly translateService: TranslateService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
Device.getInfo().then(it => {
|
||||
this.isWeb = it.platform === 'web';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
import {Calendar} from '@awesome-cordova-plugins/calendar/ngx';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {ICalEvent} from './ical/ical';
|
||||
import moment, {duration, Moment, unitOfTime} from 'moment';
|
||||
import {Dialog} from '@capacitor/dialog';
|
||||
@@ -31,6 +31,10 @@ const RECURRENCE_PATTERNS: Partial<Record<unitOfTime.Diff, string | undefined>>
|
||||
|
||||
@Injectable()
|
||||
export class CalendarService {
|
||||
readonly calendar = inject(Calendar);
|
||||
|
||||
private readonly configProvider = inject(ConfigProvider);
|
||||
|
||||
goToDate = new Subject<number>();
|
||||
|
||||
goToDateClicked = this.goToDate.asObservable();
|
||||
@@ -38,10 +42,7 @@ export class CalendarService {
|
||||
calendarName = 'StApps';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
constructor(
|
||||
readonly calendar: Calendar,
|
||||
private readonly configProvider: ConfigProvider,
|
||||
) {
|
||||
constructor() {
|
||||
this.calendarName = (this.configProvider.getValue('name') as string) ?? 'StApps';
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ export type DateSeriesRelevantData = Pick<SCDateSeries, DateSeriesRelevantKeys>;
|
||||
*/
|
||||
@Injectable()
|
||||
export class ScheduleProvider implements OnDestroy {
|
||||
private readonly dataProvider = inject(DataProvider);
|
||||
|
||||
// tslint:disable:prefer-function-over-method
|
||||
|
||||
private static partialEventsStorageKey = 'schedule::partial_events';
|
||||
@@ -76,7 +78,7 @@ export class ScheduleProvider implements OnDestroy {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(private readonly dataProvider: DataProvider) {
|
||||
constructor() {
|
||||
window.addEventListener('storage', this.storageListener);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Component, OnInit, inject} from '@angular/core';
|
||||
import {Router, ActivatedRoute} from '@angular/router';
|
||||
import {SCCatalog, SCSemester} from '@openstapps/core';
|
||||
import moment from 'moment';
|
||||
@@ -29,6 +29,18 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class CatalogComponent implements OnInit {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
private readonly catalogProvider = inject(CatalogProvider);
|
||||
|
||||
private readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
private readonly logger = inject(NGXLogger);
|
||||
|
||||
protected router = inject(Router);
|
||||
|
||||
location = inject(Location);
|
||||
|
||||
/**
|
||||
* SCSemester to show
|
||||
*/
|
||||
@@ -54,14 +66,7 @@ export class CatalogComponent implements OnInit {
|
||||
*/
|
||||
superCatalog: SCCatalog;
|
||||
|
||||
constructor(
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly catalogProvider: CatalogProvider,
|
||||
private readonly dataRoutingService: DataRoutingService,
|
||||
private readonly logger: NGXLogger,
|
||||
protected router: Router,
|
||||
public location: Location,
|
||||
) {
|
||||
constructor() {
|
||||
this.dataRoutingService
|
||||
.itemSelectListener()
|
||||
.pipe(takeUntilDestroyed())
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {
|
||||
SCCatalogWithoutReferences,
|
||||
SCSearchFilter,
|
||||
@@ -28,7 +28,7 @@ import {DataProvider} from '../data/data.provider';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CatalogProvider {
|
||||
constructor(private readonly dataProvider: DataProvider) {}
|
||||
private readonly dataProvider = inject(DataProvider);
|
||||
|
||||
/**
|
||||
* Get news messages
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {Client} from '@openstapps/api';
|
||||
import {SCAppConfiguration, SCIndexResponse} from '@openstapps/core';
|
||||
import {CORE_VERSION} from '@openstapps/core';
|
||||
@@ -44,6 +44,12 @@ export const STORAGE_KEY_CONFIG = 'stapps.config';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ConfigProvider {
|
||||
private readonly storageProvider = inject(StorageProvider);
|
||||
|
||||
private readonly logger = inject(NGXLogger);
|
||||
|
||||
private readonly internetConnectionService = inject(InternetConnectionService);
|
||||
|
||||
/**
|
||||
* Api client
|
||||
*/
|
||||
@@ -66,16 +72,10 @@ export class ConfigProvider {
|
||||
|
||||
/**
|
||||
* Constructor, initialise api client
|
||||
* @param storageProvider StorageProvider to load persistent configuration
|
||||
* @param swHttpClient Api client
|
||||
* @param logger An angular logger
|
||||
*/
|
||||
constructor(
|
||||
private readonly storageProvider: StorageProvider,
|
||||
swHttpClient: StAppsWebHttpClient,
|
||||
private readonly logger: NGXLogger,
|
||||
private readonly internetConnectionService: InternetConnectionService,
|
||||
) {
|
||||
constructor() {
|
||||
const swHttpClient = inject(StAppsWebHttpClient);
|
||||
|
||||
console.log('config init');
|
||||
this.client = new Client(swHttpClient, environment.backend_url, environment.backend_version);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,20 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
private readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
private scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
protected router = inject(Router);
|
||||
|
||||
location = inject(Location);
|
||||
|
||||
private animationControl = inject(AnimationController);
|
||||
|
||||
private breakpointObserver = inject(BreakpointObserver);
|
||||
|
||||
private zone = inject(NgZone);
|
||||
|
||||
@ViewChild('toolbar', {read: ElementRef}) toolbarRef: ElementRef;
|
||||
|
||||
@ViewChild('schedule', {read: ElementRef}) scheduleRef: ElementRef;
|
||||
@@ -61,15 +75,7 @@ export class DashboardComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
private readonly dataRoutingService: DataRoutingService,
|
||||
private scheduleProvider: ScheduleProvider,
|
||||
protected router: Router,
|
||||
public location: Location,
|
||||
private animationControl: AnimationController,
|
||||
private breakpointObserver: BreakpointObserver,
|
||||
private zone: NgZone,
|
||||
) {
|
||||
constructor() {
|
||||
this.dataRoutingService
|
||||
.itemSelectListener()
|
||||
.pipe(takeUntilDestroyed())
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {
|
||||
SCBooleanFilterArguments,
|
||||
SCMessage,
|
||||
@@ -28,7 +28,9 @@ import {DataProvider} from '../data/data.provider';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DashboardProvider {
|
||||
constructor(private readonly dataProvider: DataProvider) {}
|
||||
private readonly dataProvider = inject(DataProvider);
|
||||
|
||||
constructor() {}
|
||||
|
||||
/**
|
||||
* Get news messages
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
|
||||
import {filter, map} from 'rxjs/operators';
|
||||
import {FavoritesService} from '../../../favorites/favorites.service';
|
||||
import {fadeAnimation} from '../../fade.animation';
|
||||
@@ -30,10 +30,10 @@ import {isMensaThing} from '../../mensa-filters';
|
||||
standalone: false,
|
||||
})
|
||||
export class FavoritesSectionComponent {
|
||||
private favoritesService = inject(FavoritesService);
|
||||
|
||||
items = this.favoritesService.favoriteThings$.pipe(
|
||||
map(favorites => favorites.filter(it => !isMensaThing(it))),
|
||||
filter(favorites => favorites.length > 0),
|
||||
);
|
||||
|
||||
constructor(private favoritesService: FavoritesService) {}
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, Input, inject} from '@angular/core';
|
||||
import {SCDish, SCPlace, SCThings} from '@openstapps/core';
|
||||
import {PlaceMensaService} from '../../../data/types/place/special/mensa/place-mensa-service';
|
||||
import {fadeAnimation} from '../../fade.animation';
|
||||
@@ -30,6 +30,8 @@ import {isToday} from 'date-fns';
|
||||
standalone: false,
|
||||
})
|
||||
export class MensaSectionContentComponent {
|
||||
private readonly mensaService = inject(PlaceMensaService);
|
||||
|
||||
/**
|
||||
* Map of dishes for each day
|
||||
*/
|
||||
@@ -42,6 +44,4 @@ export class MensaSectionContentComponent {
|
||||
return closestDayWithDishes ? it[closestDayWithDishes] : [];
|
||||
});
|
||||
}
|
||||
|
||||
constructor(private readonly mensaService: PlaceMensaService) {}
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {FavoritesService} from '../../../favorites/favorites.service';
|
||||
import {fadeAnimation} from '../../fade.animation';
|
||||
@@ -30,7 +30,7 @@ import {isMensaThing} from '../../mensa-filters';
|
||||
standalone: false,
|
||||
})
|
||||
export class MensaSectionComponent {
|
||||
items = this.favoritesService.favoriteThings$.pipe(map(favorites => favorites.filter(isMensaThing)));
|
||||
protected favoritesService = inject(FavoritesService);
|
||||
|
||||
constructor(protected favoritesService: FavoritesService) {}
|
||||
items = this.favoritesService.favoriteThings$.pipe(map(favorites => favorites.filter(isMensaThing)));
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
|
||||
import {NewsProvider} from '../../../news/news.provider';
|
||||
import {fadeAnimation} from '../../fade.animation';
|
||||
|
||||
@@ -28,10 +28,10 @@ import {fadeAnimation} from '../../fade.animation';
|
||||
standalone: false,
|
||||
})
|
||||
export class NewsSectionComponent {
|
||||
readonly newsProvider = inject(NewsProvider);
|
||||
|
||||
news = this.newsProvider
|
||||
.getCurrentFilters()
|
||||
// eslint-disable-next-line unicorn/prefer-top-level-await,unicorn/consistent-function-scoping
|
||||
.then(filters => this.newsProvider.getList(5, 0, filters));
|
||||
|
||||
constructor(readonly newsProvider: NewsProvider) {}
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {AnimationController} from '@ionic/angular/standalone';
|
||||
import {homePageSearchTransition} from './search-route-transition';
|
||||
|
||||
@@ -26,7 +26,7 @@ import {homePageSearchTransition} from './search-route-transition';
|
||||
standalone: false,
|
||||
})
|
||||
export class SearchSectionComponent {
|
||||
routeTransition = homePageSearchTransition(this.animationController);
|
||||
private animationController = inject(AnimationController);
|
||||
|
||||
constructor(private animationController: AnimationController) {}
|
||||
routeTransition = homePageSearchTransition(this.animationController);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,14 @@ import {MaterialSymbol} from 'material-symbols';
|
||||
standalone: false,
|
||||
})
|
||||
export class AddEventActionChipComponent {
|
||||
readonly dataProvider = inject(CoordinatedSearchProvider);
|
||||
|
||||
readonly modalController = inject(ModalController);
|
||||
|
||||
readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
readonly routerOutlet = inject(IonRouterOutlet);
|
||||
|
||||
/**
|
||||
* Associated date series
|
||||
*/
|
||||
@@ -94,13 +102,6 @@ export class AddEventActionChipComponent {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
readonly dataProvider: CoordinatedSearchProvider,
|
||||
readonly modalController: ModalController,
|
||||
readonly scheduleProvider: ScheduleProvider,
|
||||
readonly routerOutlet: IonRouterOutlet,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Apply state
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
||||
import {ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, inject} from '@angular/core';
|
||||
import {ModalController} from '@ionic/angular/standalone';
|
||||
import {SCDateSeries} from '@openstapps/core';
|
||||
import {
|
||||
@@ -41,6 +41,14 @@ import {SelectionValue, TreeNode} from './tree-node';
|
||||
standalone: false,
|
||||
})
|
||||
export class EditEventSelectionComponent implements OnInit {
|
||||
readonly ref = inject(ChangeDetectorRef);
|
||||
|
||||
readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
readonly calendar = inject(CalendarService);
|
||||
|
||||
readonly modalController = inject(ModalController);
|
||||
|
||||
/**
|
||||
* The item the action belongs to
|
||||
*/
|
||||
@@ -59,13 +67,6 @@ export class EditEventSelectionComponent implements OnInit {
|
||||
@Output()
|
||||
modified = new EventEmitter();
|
||||
|
||||
constructor(
|
||||
readonly ref: ChangeDetectorRef,
|
||||
readonly scheduleProvider: ScheduleProvider,
|
||||
readonly calendar: CalendarService,
|
||||
readonly modalController: ModalController,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.partialDateSeries = this.scheduleProvider.partialEvents$.value;
|
||||
this.reset();
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {SCSearchRequest, SCSearchResponse} from '@openstapps/core';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {DataProvider} from './data.provider';
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,7 @@ interface OngoingQuery {
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class CoordinatedSearchProvider {
|
||||
constructor(readonly dataProvider: DataProvider) {}
|
||||
readonly dataProvider = inject(DataProvider);
|
||||
|
||||
/**
|
||||
* Queue of ongoing queries
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {Client} from '@openstapps/api';
|
||||
import {
|
||||
SCFacet,
|
||||
@@ -141,12 +141,10 @@ export class DataProvider {
|
||||
return facet;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO
|
||||
* @param stAppsWebHttpClient TODO
|
||||
* @param storageProvider TODO
|
||||
*/
|
||||
constructor(stAppsWebHttpClient: StAppsWebHttpClient, storageProvider: StorageProvider) {
|
||||
constructor() {
|
||||
const stAppsWebHttpClient = inject(StAppsWebHttpClient);
|
||||
const storageProvider = inject(StorageProvider);
|
||||
|
||||
this.client = new Client(stAppsWebHttpClient, this.backendUrl, this.appVersion);
|
||||
this.storageProvider = storageProvider;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {SCFeedbackRequestMetaData} from '@openstapps/core';
|
||||
import {Platform} from '@ionic/angular/standalone';
|
||||
import {DataProvider} from './data.provider';
|
||||
@@ -23,6 +23,14 @@ import {SettingsProvider} from '../settings/settings.provider';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class DebugDataCollectorService {
|
||||
private platform = inject(Platform);
|
||||
|
||||
private dataProvider = inject(DataProvider);
|
||||
|
||||
private router = inject(Router);
|
||||
|
||||
private settingsProvider = inject(SettingsProvider);
|
||||
|
||||
/**
|
||||
* Previously visited route
|
||||
*/
|
||||
@@ -33,12 +41,9 @@ export class DebugDataCollectorService {
|
||||
*/
|
||||
currentRoute: string;
|
||||
|
||||
constructor(
|
||||
private platform: Platform,
|
||||
private dataProvider: DataProvider,
|
||||
private router: Router,
|
||||
private settingsProvider: SettingsProvider,
|
||||
) {
|
||||
constructor() {
|
||||
const router = this.router;
|
||||
|
||||
this.currentRoute = this.router.url;
|
||||
router.events.subscribe(event => {
|
||||
if (event instanceof NavigationEnd) {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input, TemplateRef} from '@angular/core';
|
||||
import {Component, Input, TemplateRef, inject} from '@angular/core';
|
||||
import {SCThings} from '@openstapps/core';
|
||||
import {DataListContext} from '../list/data-list.component';
|
||||
import {ModalController} from '@ionic/angular/standalone';
|
||||
@@ -27,6 +27,8 @@ import {ModalController} from '@ionic/angular/standalone';
|
||||
standalone: false,
|
||||
})
|
||||
export class DataDetailContentComponent {
|
||||
readonly modalController = inject(ModalController);
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@@ -37,6 +39,4 @@ export class DataDetailContentComponent {
|
||||
@Input() openAsModal = false;
|
||||
|
||||
@Input() showModalHeader = false;
|
||||
|
||||
constructor(readonly modalController: ModalController) {}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,16 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, ContentChild, EventEmitter, Input, OnInit, Output, TemplateRef} from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
ContentChild,
|
||||
EventEmitter,
|
||||
Input,
|
||||
OnInit,
|
||||
Output,
|
||||
TemplateRef,
|
||||
inject,
|
||||
} from '@angular/core';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {ModalController} from '@ionic/angular/standalone';
|
||||
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
|
||||
@@ -39,6 +48,14 @@ export interface ExternalDataLoadEvent {
|
||||
standalone: false,
|
||||
})
|
||||
export class DataDetailComponent implements OnInit {
|
||||
protected readonly route = inject(ActivatedRoute);
|
||||
|
||||
private readonly dataProvider = inject(DataProvider);
|
||||
|
||||
private readonly favoritesService = inject(FavoritesService);
|
||||
|
||||
readonly modalController = inject(ModalController);
|
||||
|
||||
/**
|
||||
* The associated item
|
||||
*
|
||||
@@ -87,14 +104,10 @@ export class DataDetailComponent implements OnInit {
|
||||
return (thing as SCSaveableThing).data !== undefined;
|
||||
}
|
||||
|
||||
constructor(
|
||||
protected readonly route: ActivatedRoute,
|
||||
router: Router,
|
||||
private readonly dataProvider: DataProvider,
|
||||
private readonly favoritesService: FavoritesService,
|
||||
readonly modalController: ModalController,
|
||||
translateService: TranslateService,
|
||||
) {
|
||||
constructor() {
|
||||
const router = inject(Router);
|
||||
const translateService = inject(TranslateService);
|
||||
|
||||
this.inputItem = router.currentNavigation()?.extras.state?.item;
|
||||
if (!this.inputItem?.origin) {
|
||||
// We received a ThingWithoutReferences.
|
||||
|
||||
@@ -29,6 +29,14 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class DataPathComponent implements OnInit {
|
||||
readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
readonly navController = inject(NavController);
|
||||
|
||||
readonly routeStack = inject(RoutingStackService);
|
||||
|
||||
readonly dataProvider = inject(DataProvider);
|
||||
|
||||
path: Promise<SCThingWithoutReferences[]>;
|
||||
|
||||
$width: Observable<number>;
|
||||
@@ -66,13 +74,6 @@ export class DataPathComponent implements OnInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
readonly dataRoutingService: DataRoutingService,
|
||||
readonly navController: NavController,
|
||||
readonly routeStack: RoutingStackService,
|
||||
readonly dataProvider: DataProvider,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.$width = fromEvent(window, 'resize').pipe(
|
||||
map(() => window.innerWidth),
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Component, Input, inject} from '@angular/core';
|
||||
import {Browser} from '@capacitor/browser';
|
||||
import {Capacitor} from '@capacitor/core';
|
||||
import {SimpleBrowser} from '../../../util/browser.factory';
|
||||
|
||||
@Component({
|
||||
selector: 'stapps-external-link',
|
||||
@@ -24,6 +25,8 @@ import {Capacitor} from '@capacitor/core';
|
||||
standalone: false,
|
||||
})
|
||||
export class ExternalLinkComponent {
|
||||
private browser = inject(SimpleBrowser);
|
||||
|
||||
@Input() link: string;
|
||||
|
||||
@Input() text: string;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, Input, inject} from '@angular/core';
|
||||
import {SCIndexableThings} from '@openstapps/core';
|
||||
import {FavoritesService} from '../../favorites/favorites.service';
|
||||
import {Observable} from 'rxjs';
|
||||
@@ -29,6 +29,8 @@ import {map, take} from 'rxjs/operators';
|
||||
standalone: false,
|
||||
})
|
||||
export class FavoriteButtonComponent {
|
||||
private favoritesService = inject(FavoritesService);
|
||||
|
||||
/**
|
||||
* Item getter
|
||||
*/
|
||||
@@ -58,8 +60,6 @@ export class FavoriteButtonComponent {
|
||||
*/
|
||||
isFavorite$: Observable<boolean>;
|
||||
|
||||
constructor(private favoritesService: FavoritesService) {}
|
||||
|
||||
/**
|
||||
* Add or remove the thing from favorites (depending on its current status)
|
||||
* @param event A click event
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Component, Input, inject} from '@angular/core';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCThingThatCanBeOfferedAvailability,
|
||||
@@ -27,6 +27,8 @@ import {SettingsProvider} from '../../settings/settings.provider';
|
||||
standalone: false,
|
||||
})
|
||||
export class OffersInListComponent {
|
||||
readonly settingsProvider = inject(SettingsProvider);
|
||||
|
||||
@Input() set offers(it: Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>) {
|
||||
this._offers = it;
|
||||
this.price = it[0].prices?.default;
|
||||
@@ -44,6 +46,4 @@ export class OffersInListComponent {
|
||||
availability: SCThingThatCanBeOfferedAvailability;
|
||||
|
||||
_offers: Array<SCThingThatCanBeOfferedOffer<SCAcademicPriceGroup>>;
|
||||
|
||||
constructor(readonly settingsProvider: SettingsProvider) {}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component, ElementRef, HostListener, Input} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, ElementRef, HostListener, Input, inject} from '@angular/core';
|
||||
import {SCDish, SCRatingRequest} from '@openstapps/core';
|
||||
import {RatingProvider} from '../rating.provider';
|
||||
import {ratingAnimation} from './rating.animation';
|
||||
@@ -29,6 +29,10 @@ import {catchError, map} from 'rxjs/operators';
|
||||
standalone: false,
|
||||
})
|
||||
export class StappsRatingComponent {
|
||||
readonly elementRef = inject(ElementRef);
|
||||
|
||||
readonly ratingProvider = inject(RatingProvider);
|
||||
|
||||
performRating = new BehaviorSubject(false);
|
||||
|
||||
userRating = new BehaviorSubject<number | undefined>(undefined);
|
||||
@@ -52,11 +56,6 @@ export class StappsRatingComponent {
|
||||
this.dish.next(value);
|
||||
}
|
||||
|
||||
constructor(
|
||||
readonly elementRef: ElementRef,
|
||||
readonly ratingProvider: RatingProvider,
|
||||
) {}
|
||||
|
||||
@HostListener('document:mousedown', ['$event'])
|
||||
clickOutside(event: MouseEvent) {
|
||||
if (this.userRating.value) return;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Component, Input, inject} from '@angular/core';
|
||||
import {ToastController} from '@ionic/angular/standalone';
|
||||
import {environment} from '../../../../environments/environment';
|
||||
|
||||
@@ -9,14 +9,14 @@ import {environment} from '../../../../environments/environment';
|
||||
standalone: false,
|
||||
})
|
||||
export class ShareButtonComponent {
|
||||
readonly toastController = inject(ToastController);
|
||||
|
||||
canShare = false;
|
||||
|
||||
@Input({required: true}) title: string;
|
||||
|
||||
@Input() url: string;
|
||||
|
||||
constructor(readonly toastController: ToastController) {}
|
||||
|
||||
share(): boolean {
|
||||
const url = this.url ?? new URL(window.location.pathname, `https://${environment.app_host}`);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ComponentRef, Directive, Input, Type, ViewContainerRef} from '@angular/core';
|
||||
import {ComponentRef, Directive, Input, Type, ViewContainerRef, inject} from '@angular/core';
|
||||
import {SCThings, SCThingType} from '@openstapps/core';
|
||||
import {CatalogListItemComponent} from '../types/catalog/catalog-list-item.component';
|
||||
import {DateSeriesListItemComponent} from '../types/date-series/date-series-list-item.component';
|
||||
@@ -56,12 +56,12 @@ const DataListItemIndex: Partial<Record<SCThingType, Type<DataListItem>>> = {
|
||||
standalone: false,
|
||||
})
|
||||
export class DataListItemHostDirective {
|
||||
readonly viewContainerRef = inject(ViewContainerRef);
|
||||
|
||||
private type?: Type<DataListItem>;
|
||||
|
||||
private component?: ComponentRef<DataListItem>;
|
||||
|
||||
constructor(readonly viewContainerRef: ViewContainerRef) {}
|
||||
|
||||
@Input() set dataListItemHost(value: SCThings | undefined) {
|
||||
if (!value) {
|
||||
this.viewContainerRef.clear();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, ContentChild, HostBinding, Input, TemplateRef} from '@angular/core';
|
||||
import {Component, ContentChild, HostBinding, Input, TemplateRef, inject} from '@angular/core';
|
||||
import {SCThings} from '@openstapps/core';
|
||||
import {DataRoutingService} from '../data-routing.service';
|
||||
import {DataListContext} from './data-list.component';
|
||||
@@ -27,6 +27,8 @@ import {DataListContext} from './data-list.component';
|
||||
standalone: false,
|
||||
})
|
||||
export class DataListItemComponent {
|
||||
private readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
/**
|
||||
* Whether the list item should show a thumbnail
|
||||
*/
|
||||
@@ -55,8 +57,6 @@ export class DataListItemComponent {
|
||||
return this.appearance === 'square';
|
||||
}
|
||||
|
||||
constructor(private readonly dataRoutingService: DataRoutingService) {}
|
||||
|
||||
/**
|
||||
* Emit event that an item was selected
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {PositionService} from '../../map/position.service';
|
||||
import {Geolocation} from '@capacitor/geolocation';
|
||||
import {BehaviorSubject, catchError} from 'rxjs';
|
||||
@@ -68,7 +68,10 @@ export class FoodDataListComponent {
|
||||
type: 'boolean',
|
||||
};
|
||||
|
||||
constructor(positionService: PositionService, contextMenuService: ContextMenuService) {
|
||||
constructor() {
|
||||
const positionService = inject(PositionService);
|
||||
const contextMenuService = inject(ContextMenuService);
|
||||
|
||||
positionService
|
||||
.watchCurrentLocation({enableHighAccuracy: false, maximumAge: 1000})
|
||||
.pipe(
|
||||
|
||||
@@ -31,7 +31,6 @@ import {SettingsProvider} from '../../settings/settings.provider';
|
||||
import {DataRoutingService} from '../data-routing.service';
|
||||
import {DataProvider} from '../data.provider';
|
||||
import {PositionService} from '../../map/position.service';
|
||||
import {ConfigProvider} from '../../config/config.provider';
|
||||
import {searchPageSwitchAnimation} from './search-page-switch-animation';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {ContextMenuModalComponent} from '../../menu/context/context-menu-modal.component';
|
||||
@@ -48,6 +47,28 @@ import {enterAnimation, leaveAnimation} from '../../menu/context/context-menu-mo
|
||||
standalone: false,
|
||||
})
|
||||
export class SearchPageComponent implements OnInit {
|
||||
protected readonly alertController = inject(AlertController);
|
||||
|
||||
protected dataProvider = inject(DataProvider);
|
||||
|
||||
protected readonly contextMenuService = inject(ContextMenuService);
|
||||
|
||||
protected readonly settingsProvider = inject(SettingsProvider);
|
||||
|
||||
protected readonly logger = inject(NGXLogger);
|
||||
|
||||
protected dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
protected router = inject(Router);
|
||||
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
|
||||
protected positionService = inject(PositionService);
|
||||
|
||||
protected animationController = inject(AnimationController);
|
||||
|
||||
protected modalController = inject(ModalController);
|
||||
|
||||
@Input() title = 'search.title';
|
||||
|
||||
@Input() placeholder = 'search.search_bar.placeholder';
|
||||
@@ -144,31 +165,10 @@ export class SearchPageComponent implements OnInit {
|
||||
|
||||
/**
|
||||
* Injects the providers and creates subscriptions
|
||||
* @param alertController AlertController
|
||||
* @param dataProvider DataProvider
|
||||
* @param contextMenuService ContextMenuService
|
||||
* @param settingsProvider SettingsProvider
|
||||
* @param logger An angular logger
|
||||
* @param dataRoutingService DataRoutingService
|
||||
* @param router Router
|
||||
* @param route ActivatedRoute
|
||||
* @param positionService PositionService
|
||||
* @param configProvider ConfigProvider
|
||||
*/
|
||||
constructor(
|
||||
protected readonly alertController: AlertController,
|
||||
protected dataProvider: DataProvider,
|
||||
protected readonly contextMenuService: ContextMenuService,
|
||||
protected readonly settingsProvider: SettingsProvider,
|
||||
protected readonly logger: NGXLogger,
|
||||
protected dataRoutingService: DataRoutingService,
|
||||
protected router: Router,
|
||||
private readonly route: ActivatedRoute,
|
||||
protected positionService: PositionService,
|
||||
private readonly configProvider: ConfigProvider,
|
||||
protected animationController: AnimationController,
|
||||
protected modalController: ModalController,
|
||||
) {
|
||||
constructor() {
|
||||
const animationController = this.animationController;
|
||||
|
||||
this.routeAnimation = searchPageSwitchAnimation(animationController);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,10 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class SimpleDataListComponent implements OnInit {
|
||||
protected router = inject(Router);
|
||||
|
||||
private readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
@Input() items?: Promise<SCThings[] | undefined>;
|
||||
|
||||
/**
|
||||
@@ -54,11 +58,6 @@ export class SimpleDataListComponent implements OnInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
protected router: Router,
|
||||
private readonly dataRoutingService: DataRoutingService,
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
if (!this.autoRouting) return;
|
||||
this.dataRoutingService
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {
|
||||
SCAcademicPriceGroup,
|
||||
SCDish,
|
||||
@@ -39,6 +39,10 @@ interface RatingStorage {
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class RatingProvider {
|
||||
private readonly storageProvider = inject(StorageProvider);
|
||||
|
||||
private readonly settingsProvider = inject(SettingsProvider);
|
||||
|
||||
private readonly client: Client;
|
||||
|
||||
private readonly backendUrl = environment.backend_url;
|
||||
@@ -49,11 +53,9 @@ export class RatingProvider {
|
||||
|
||||
private readonly storageKey = 'rating.rated_uuids';
|
||||
|
||||
constructor(
|
||||
stAppsWebHttpClient: StAppsWebHttpClient,
|
||||
private readonly storageProvider: StorageProvider,
|
||||
private readonly settingsProvider: SettingsProvider,
|
||||
) {
|
||||
constructor() {
|
||||
const stAppsWebHttpClient = inject(StAppsWebHttpClient);
|
||||
|
||||
this.client = new Client(stAppsWebHttpClient, this.backendUrl, this.appVersion);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {HttpClient, HttpResponse} from '@angular/common/http';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {HttpClientInterface, HttpClientRequest} from '@openstapps/api';
|
||||
import {map, retry} from 'rxjs/operators';
|
||||
import {lastValueFrom, Observable} from 'rxjs';
|
||||
@@ -32,13 +32,9 @@ type HttpRequestParameters<T extends ReturnType<HttpRequestFunctions>> = Paramet
|
||||
*/
|
||||
@Injectable()
|
||||
export class StAppsWebHttpClient implements HttpClientInterface {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
constructor(
|
||||
private readonly http: HttpClient,
|
||||
private readonly connectionService: InternetConnectionService,
|
||||
) {}
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
private readonly connectionService = inject(InternetConnectionService);
|
||||
|
||||
/**
|
||||
* Make a request
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, Input, OnInit, inject} from '@angular/core';
|
||||
import {SCCatalog, SCThings} from '@openstapps/core';
|
||||
import {DataProvider} from '../../data.provider';
|
||||
|
||||
@@ -23,6 +23,8 @@ import {DataProvider} from '../../data.provider';
|
||||
standalone: false,
|
||||
})
|
||||
export class CatalogDetailContentComponent implements OnInit {
|
||||
private dataProvider = inject(DataProvider);
|
||||
|
||||
/**
|
||||
* SCCatalog to display
|
||||
*/
|
||||
@@ -30,8 +32,6 @@ export class CatalogDetailContentComponent implements OnInit {
|
||||
|
||||
items: Promise<SCThings[]>;
|
||||
|
||||
constructor(private dataProvider: DataProvider) {}
|
||||
|
||||
async ngOnInit() {
|
||||
this.items = this.dataProvider
|
||||
.search({
|
||||
|
||||
+7
-6
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, Input, OnInit, inject} from '@angular/core';
|
||||
import {SCDateSeries} from '@openstapps/core';
|
||||
import {ScheduleProvider, toDateSeriesRelevantData} from '../../../calendar/schedule.provider';
|
||||
import {Observable} from 'rxjs';
|
||||
@@ -28,15 +28,16 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class DateSeriesDetailContentComponent implements OnInit {
|
||||
readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
@Input() item: SCDateSeries;
|
||||
|
||||
isInCalendar: Observable<boolean>;
|
||||
|
||||
constructor(
|
||||
readonly scheduleProvider: ScheduleProvider,
|
||||
dataRoutingService: DataRoutingService,
|
||||
router: Router,
|
||||
) {
|
||||
constructor() {
|
||||
const dataRoutingService = inject(DataRoutingService);
|
||||
const router = inject(Router);
|
||||
|
||||
dataRoutingService
|
||||
.itemSelectListener()
|
||||
.pipe(takeUntilDestroyed())
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Component, Input, inject} from '@angular/core';
|
||||
import {SCMessage} from '@openstapps/core';
|
||||
import {SimpleBrowser} from '../../../../util/browser.factory';
|
||||
|
||||
@@ -26,7 +26,7 @@ import {SimpleBrowser} from '../../../../util/browser.factory';
|
||||
standalone: false,
|
||||
})
|
||||
export class MessageDetailContentComponent {
|
||||
constructor(private browser: SimpleBrowser) {}
|
||||
private browser = inject(SimpleBrowser);
|
||||
|
||||
/**
|
||||
* TODO
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Component, Input, inject} from '@angular/core';
|
||||
import {
|
||||
SCContactPoint,
|
||||
SCContactPointWithoutReferences,
|
||||
@@ -28,6 +28,8 @@ import {DataProvider} from '../../data.provider';
|
||||
standalone: false,
|
||||
})
|
||||
export class PersonDetailContentComponent {
|
||||
private readonly dataProvider = inject(DataProvider);
|
||||
|
||||
private _item: SCPerson;
|
||||
|
||||
contactPoints: Array<SCContactPoint | SCContactPointWithoutReferences>;
|
||||
@@ -46,8 +48,6 @@ export class PersonDetailContentComponent {
|
||||
}
|
||||
}
|
||||
|
||||
constructor(private readonly dataProvider: DataProvider) {}
|
||||
|
||||
async getContactPoints(workLocations: SCContactPointWithoutReferences[]): Promise<SCContactPoint[]> {
|
||||
const query: {[uid in SCUuid]: SCSearchQuery} = {};
|
||||
workLocations.map(workLocation => {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, Input, OnInit, inject} from '@angular/core';
|
||||
import {SCBuilding, SCFloor, SCPointOfInterest, SCRoom, SCThings, SCPlace} from '@openstapps/core';
|
||||
import {DataProvider} from '../../data.provider';
|
||||
import {hasValidLocation, isSCFloor} from './place-types';
|
||||
@@ -55,7 +55,10 @@ export class PlaceDetailContentComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
constructor(dataRoutingService: DataRoutingService, router: Router) {
|
||||
constructor() {
|
||||
const dataRoutingService = inject(DataRoutingService);
|
||||
const router = inject(Router);
|
||||
|
||||
dataRoutingService
|
||||
.itemSelectListener()
|
||||
.pipe(takeUntilDestroyed())
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, Input, inject} from '@angular/core';
|
||||
import {PositionService} from '../../../map/position.service';
|
||||
import {filter, Observable} from 'rxjs';
|
||||
import {hasValidLocation, isSCFloor, PlaceTypes, PlaceTypesWithDistance} from './place-types';
|
||||
@@ -31,6 +31,8 @@ import {trigger, transition, style, animate} from '@angular/animations';
|
||||
standalone: false,
|
||||
})
|
||||
export class PlaceListItemComponent {
|
||||
private positionService = inject(PositionService);
|
||||
|
||||
_item: PlaceTypesWithDistance;
|
||||
|
||||
/**
|
||||
@@ -56,6 +58,4 @@ export class PlaceListItemComponent {
|
||||
* Distance in meters
|
||||
*/
|
||||
distance?: Observable<number | undefined>;
|
||||
|
||||
constructor(private positionService: PositionService) {}
|
||||
}
|
||||
|
||||
+8
-7
@@ -32,6 +32,14 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class PlaceMensaDetailComponent implements AfterViewInit {
|
||||
private readonly mensaService = inject(PlaceMensaService);
|
||||
|
||||
protected router = inject(Router);
|
||||
|
||||
readonly routerOutlet = inject(IonRouterOutlet);
|
||||
|
||||
private readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
/**
|
||||
* Map of dishes for each day
|
||||
*/
|
||||
@@ -55,13 +63,6 @@ export class PlaceMensaDetailComponent implements AfterViewInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
private readonly mensaService: PlaceMensaService,
|
||||
protected router: Router,
|
||||
readonly routerOutlet: IonRouterOutlet,
|
||||
private readonly dataRoutingService: DataRoutingService,
|
||||
) {}
|
||||
|
||||
ngAfterViewInit() {
|
||||
if (!this.openAsModal) {
|
||||
this.dataRoutingService
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {SCDish, SCISO8601Date, SCPlace, SCSearchQuery, SCThingType} from '@openstapps/core';
|
||||
import {DataProvider} from '../../../../data.provider';
|
||||
import {mapValues} from '@openstapps/collection-utils';
|
||||
@@ -23,10 +23,9 @@ import {addDays, startOfHour} from 'date-fns';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class PlaceMensaService {
|
||||
constructor(
|
||||
private dataProvider: DataProvider,
|
||||
readonly settingsProvider: SettingsProvider,
|
||||
) {}
|
||||
private dataProvider = inject(DataProvider);
|
||||
|
||||
readonly settingsProvider = inject(SettingsProvider);
|
||||
|
||||
/**
|
||||
* Fetches all dishes for this building
|
||||
|
||||
@@ -12,20 +12,12 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {AlertController, AnimationController, ModalController} from '@ionic/angular/standalone';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {NGXLogger} from 'ngx-logger';
|
||||
import {Component, OnInit, inject} from '@angular/core';
|
||||
import {debounceTime, distinctUntilChanged, startWith, take} from 'rxjs/operators';
|
||||
import {combineLatest} from 'rxjs';
|
||||
import {FavoritesService} from './favorites.service';
|
||||
import {DataRoutingService} from '../data/data-routing.service';
|
||||
import {ContextMenuService} from '../menu/context/context-menu.service';
|
||||
import {SearchPageComponent} from '../data/list/search-page.component';
|
||||
import {DataProvider} from '../data/data.provider';
|
||||
import {SettingsProvider} from '../settings/settings.provider';
|
||||
import {PositionService} from '../map/position.service';
|
||||
import {ConfigProvider} from '../config/config.provider';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
|
||||
/**
|
||||
@@ -38,39 +30,14 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class FavoritesPageComponent extends SearchPageComponent implements OnInit {
|
||||
private favoritesService = inject(FavoritesService);
|
||||
|
||||
title = 'favorites.page.TITLE';
|
||||
|
||||
showNavigation = false;
|
||||
|
||||
constructor(
|
||||
alertController: AlertController,
|
||||
dataProvider: DataProvider,
|
||||
contextMenuService: ContextMenuService,
|
||||
settingsProvider: SettingsProvider,
|
||||
logger: NGXLogger,
|
||||
dataRoutingService: DataRoutingService,
|
||||
router: Router,
|
||||
route: ActivatedRoute,
|
||||
positionService: PositionService,
|
||||
private favoritesService: FavoritesService,
|
||||
configProvider: ConfigProvider,
|
||||
animationController: AnimationController,
|
||||
modalController: ModalController,
|
||||
) {
|
||||
super(
|
||||
alertController,
|
||||
dataProvider,
|
||||
contextMenuService,
|
||||
settingsProvider,
|
||||
logger,
|
||||
dataRoutingService,
|
||||
router,
|
||||
route,
|
||||
positionService,
|
||||
configProvider,
|
||||
animationController,
|
||||
modalController,
|
||||
);
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {
|
||||
SCFacet,
|
||||
SCFavorite,
|
||||
@@ -41,6 +41,12 @@ import {debounceTime, map} from 'rxjs/operators';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class FavoritesService {
|
||||
private storageProvider = inject(StorageProvider);
|
||||
|
||||
private readonly translate = inject(TranslateService);
|
||||
|
||||
private readonly thingTranslate = inject(ThingTranslateService);
|
||||
|
||||
/**
|
||||
* Translation pipe
|
||||
*/
|
||||
@@ -119,12 +125,8 @@ export class FavoritesService {
|
||||
*/
|
||||
private _storagePrefix = 'stapps.favorites';
|
||||
|
||||
constructor(
|
||||
private storageProvider: StorageProvider,
|
||||
private readonly translate: TranslateService,
|
||||
private readonly thingTranslate: ThingTranslateService,
|
||||
) {
|
||||
this.thingTranslatePipe = new ThingTranslatePipe(this.translate, this.thingTranslate);
|
||||
constructor() {
|
||||
this.thingTranslatePipe = new ThingTranslatePipe();
|
||||
void this.emitAll();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {
|
||||
SCFeedbackRequest,
|
||||
SCFeedbackRequestMetaData,
|
||||
@@ -32,19 +32,21 @@ import {TranslateService} from '@ngx-translate/core';
|
||||
standalone: false,
|
||||
})
|
||||
export class FeedbackPageComponent {
|
||||
private readonly dataProvider = inject(DataProvider);
|
||||
|
||||
private readonly debugDataCollector = inject(DebugDataCollectorService);
|
||||
|
||||
private readonly toastController = inject(ToastController);
|
||||
|
||||
private readonly alertController = inject(AlertController);
|
||||
|
||||
private readonly translateService = inject(TranslateService);
|
||||
|
||||
/**
|
||||
* Minimum allowed size of the feedback message
|
||||
*/
|
||||
MINIMUM_MESSAGE_SIZE = 15;
|
||||
|
||||
constructor(
|
||||
private readonly dataProvider: DataProvider,
|
||||
private readonly debugDataCollector: DebugDataCollectorService,
|
||||
private readonly toastController: ToastController,
|
||||
private readonly alertController: AlertController,
|
||||
private readonly translateService: TranslateService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Sender of the feedback message
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import {Pipe, PipeTransform, inject} from '@angular/core';
|
||||
import {MapService} from '@maplibre/ngx-maplibre-gl';
|
||||
import {Feature, Point} from 'geojson';
|
||||
import {MapGeoJSONFeature, type GeoJSONSource} from 'maplibre-gl';
|
||||
@@ -11,6 +11,8 @@ import {SCFeatureProperties} from './feature-collection.pipe';
|
||||
pure: true,
|
||||
})
|
||||
export class MglClusterLeavesPipe implements PipeTransform {
|
||||
private mapService = inject(MapService);
|
||||
|
||||
source = new ReplaySubject<string>(1);
|
||||
|
||||
feature = new ReplaySubject<MapGeoJSONFeature>(1);
|
||||
@@ -33,8 +35,6 @@ export class MglClusterLeavesPipe implements PipeTransform {
|
||||
),
|
||||
);
|
||||
|
||||
constructor(private mapService: MapService) {}
|
||||
|
||||
transform(
|
||||
source: string,
|
||||
feature: MapGeoJSONFeature,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import {AsyncPipe} from '@angular/common';
|
||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
|
||||
import {IonFabButton} from '@ionic/angular/standalone';
|
||||
import {MapService} from '@maplibre/ngx-maplibre-gl';
|
||||
import {MapEventType} from 'maplibre-gl';
|
||||
@@ -13,6 +13,8 @@ import {map, mergeMap, fromEventPattern, merge} from 'rxjs';
|
||||
imports: [AsyncPipe, IonFabButton],
|
||||
})
|
||||
export class CompassControlComponent {
|
||||
readonly mapService = inject(MapService);
|
||||
|
||||
transform = this.mapService.mapCreated$.pipe(
|
||||
mergeMap(() =>
|
||||
merge(
|
||||
@@ -26,12 +28,10 @@ export class CompassControlComponent {
|
||||
),
|
||||
),
|
||||
),
|
||||
map(event => {
|
||||
map(_event => {
|
||||
// const pitch = event.target.transform.pitch;
|
||||
// const bearing = event.target.transform.bearing;
|
||||
// return `rotateX(${pitch}deg) rotateZ(${bearing}deg)`;
|
||||
}),
|
||||
);
|
||||
|
||||
constructor(readonly mapService: MapService) {}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
Input,
|
||||
OnDestroy,
|
||||
ViewChild,
|
||||
inject,
|
||||
} from '@angular/core';
|
||||
import {IonFabButton} from '@ionic/angular/standalone';
|
||||
import {MapService} from '@maplibre/ngx-maplibre-gl';
|
||||
@@ -54,6 +55,8 @@ class CustomGeolocateControl extends GeolocateControl {
|
||||
imports: [AsyncPipe, IonIconDirective, IonFabButton],
|
||||
})
|
||||
export class GeolocateControlComponent implements AfterContentInit, OnDestroy {
|
||||
private mapService = inject(MapService);
|
||||
|
||||
@Input() position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
||||
|
||||
@Input() positionOptions?: PositionOptions;
|
||||
@@ -70,8 +73,6 @@ export class GeolocateControlComponent implements AfterContentInit, OnDestroy {
|
||||
|
||||
control: CustomGeolocateControl;
|
||||
|
||||
constructor(private mapService: MapService) {}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.control = new CustomGeolocateControl(this.content.nativeElement, this.watchState, {
|
||||
positionOptions: this.positionOptions,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ChangeDetectionStrategy, Component, Input, Optional} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, Input, inject} from '@angular/core';
|
||||
import {GeoJSONSourceComponent, LayerComponent, MapService} from '@maplibre/ngx-maplibre-gl';
|
||||
import {FeatureCollection, Polygon} from 'geojson';
|
||||
import {SCFeatureProperties} from '../feature-collection.pipe';
|
||||
@@ -28,6 +28,12 @@ function getCssVariable(color: string) {
|
||||
imports: [GeoJSONSourceComponent, LayerComponent, AsyncPipe],
|
||||
})
|
||||
export class BuildingMarkersComponent {
|
||||
readonly dataProvider = inject(MapDataProvider, {optional: true});
|
||||
|
||||
readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
readonly mapService = inject(MapService);
|
||||
|
||||
accentColor = getCssVariable('--ion-color-primary');
|
||||
|
||||
haloColor = fromEvent<MediaQueryListEvent>(
|
||||
@@ -64,12 +70,6 @@ export class BuildingMarkersComponent {
|
||||
|
||||
@Input({required: true}) data: FeatureCollection<Polygon, SCFeatureProperties>;
|
||||
|
||||
constructor(
|
||||
@Optional() readonly dataProvider: MapDataProvider | null,
|
||||
readonly dataRoutingService: DataRoutingService,
|
||||
readonly mapService: MapService,
|
||||
) {}
|
||||
|
||||
async featureClick(event: MapLayerMouseEvent) {
|
||||
if (this.dataProvider === null) return;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ChangeDetectionStrategy, Component, HostBinding, Input, OnInit, Optional} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, HostBinding, Input, OnInit, inject} from '@angular/core';
|
||||
import {MapIconDirective} from '../map-icon.directive';
|
||||
import {Feature, Point} from 'geojson';
|
||||
import {SCFeatureProperties} from '../feature-collection.pipe';
|
||||
@@ -16,17 +16,16 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
|
||||
imports: [IonIconDirective, MapIconDirective, AddWordBreakOpportunitiesPipe, IonLabel, IonButton],
|
||||
})
|
||||
export class PoiMarkerComponent implements OnInit {
|
||||
readonly dataProvider = inject(MapDataProvider, {optional: true});
|
||||
|
||||
readonly dataRoutingService = inject(DataRoutingService);
|
||||
|
||||
@Input({required: true}) feature: Feature<Point, SCFeatureProperties>;
|
||||
|
||||
@HostBinding('disabled') disabled = this.dataProvider === null;
|
||||
|
||||
fontSize = 0;
|
||||
|
||||
constructor(
|
||||
@Optional() readonly dataProvider: MapDataProvider | null,
|
||||
readonly dataRoutingService: DataRoutingService,
|
||||
) {}
|
||||
|
||||
async featureClick() {
|
||||
if (this.dataProvider === null) return;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Directive, HostListener, Input} from '@angular/core';
|
||||
import {Directive, HostListener, Input, inject} from '@angular/core';
|
||||
import {SCPlaceWithoutReferences, SCThings, SCThingWithoutReferences} from '@openstapps/core';
|
||||
import {Device} from '@capacitor/device';
|
||||
import {ActionSheetController, ActionSheetOptions, ToastController} from '@ionic/angular/standalone';
|
||||
@@ -20,17 +20,19 @@ import {PositionService} from './position.service';
|
||||
standalone: true,
|
||||
})
|
||||
export class GeoNavigationDirective {
|
||||
private actionSheetController = inject(ActionSheetController);
|
||||
|
||||
private translateService = inject(TranslateService);
|
||||
|
||||
private thingTranslate = inject(ThingTranslateService);
|
||||
|
||||
private toastController = inject(ToastController);
|
||||
|
||||
private positionService = inject(PositionService);
|
||||
|
||||
@Input({required: true}) geoNavigation: SCThingWithoutReferences &
|
||||
Pick<SCPlaceWithoutReferences, 'geo' | 'address'>;
|
||||
|
||||
constructor(
|
||||
private actionSheetController: ActionSheetController,
|
||||
private translateService: TranslateService,
|
||||
private thingTranslate: ThingTranslateService,
|
||||
private toastController: ToastController,
|
||||
private positionService: PositionService,
|
||||
) {}
|
||||
|
||||
@HostListener('click', ['$event'])
|
||||
async presentActionSheet(event: Event) {
|
||||
event.stopPropagation();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
|
||||
import {LngLatBoundsLike, MapLibreEvent} from 'maplibre-gl';
|
||||
import {ControlComponent, MapComponent, ScaleControlDirective} from '@maplibre/ngx-maplibre-gl';
|
||||
import {TranslateModule} from '@ngx-translate/core';
|
||||
@@ -71,6 +71,10 @@ import {GeolocateControlComponent} from './controls/geolocate-control.component'
|
||||
],
|
||||
})
|
||||
export class MapPageComponent {
|
||||
readonly dataProvider = inject(MapDataProvider);
|
||||
|
||||
readonly activatedRoute = inject(ActivatedRoute);
|
||||
|
||||
forcedFilter: SCSearchFilter = {
|
||||
type: 'boolean',
|
||||
arguments: {
|
||||
@@ -119,11 +123,6 @@ export class MapPageComponent {
|
||||
filter(uid => uid !== undefined),
|
||||
);
|
||||
|
||||
constructor(
|
||||
readonly dataProvider: MapDataProvider,
|
||||
readonly activatedRoute: ActivatedRoute,
|
||||
) {}
|
||||
|
||||
mapMove(event: MapLibreEvent) {
|
||||
const bounds = event.target.getBounds();
|
||||
this.dataProvider.currentBounds.next([
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {AfterViewInit, Directive, Host, HostBinding, HostListener, ViewContainerRef} from '@angular/core';
|
||||
import {AfterViewInit, Directive, HostBinding, HostListener, ViewContainerRef, inject} from '@angular/core';
|
||||
import {MapComponent} from '@maplibre/ngx-maplibre-gl';
|
||||
|
||||
/**
|
||||
@@ -10,15 +10,14 @@ import {MapComponent} from '@maplibre/ngx-maplibre-gl';
|
||||
standalone: true,
|
||||
})
|
||||
export class MapSizeFixDirective implements AfterViewInit {
|
||||
private map = inject(MapComponent, {host: true});
|
||||
|
||||
private viewContainerRef = inject(ViewContainerRef);
|
||||
|
||||
private animation: Animation;
|
||||
|
||||
@HostBinding('class.ready') ready = false;
|
||||
|
||||
constructor(
|
||||
@Host() private map: MapComponent,
|
||||
private viewContainerRef: ViewContainerRef,
|
||||
) {}
|
||||
|
||||
@HostListener('mapLoad')
|
||||
mapLoad() {
|
||||
this.map.mapInstance.resize();
|
||||
|
||||
@@ -18,7 +18,7 @@ import {ContextMenuService} from './context-menu.service';
|
||||
import {FilterContext, FilterFacet, SortContext, SortContextOption} from './context-type.js';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {ModalController} from '@ionic/angular/standalone';
|
||||
import {Component, Input, OnInit, OnDestroy} from '@angular/core';
|
||||
import {Component, Input, OnInit, OnDestroy, inject} from '@angular/core';
|
||||
import {Subject, takeUntil} from 'rxjs';
|
||||
|
||||
@Component({
|
||||
@@ -27,6 +27,10 @@ import {Subject, takeUntil} from 'rxjs';
|
||||
standalone: false,
|
||||
})
|
||||
export class ContextMenuModalComponent implements OnInit, OnDestroy {
|
||||
private translateService = inject(TranslateService);
|
||||
|
||||
private readonly modalController = inject(ModalController);
|
||||
|
||||
@Input() contextMenuService: ContextMenuService;
|
||||
|
||||
compactFilterOptionCount = 5;
|
||||
@@ -44,10 +48,7 @@ export class ContextMenuModalComponent implements OnInit, OnDestroy {
|
||||
// Using a subject to manage subscriptions for clean-up
|
||||
private readonly destroy$ = new Subject<void>();
|
||||
|
||||
constructor(
|
||||
private translateService: TranslateService,
|
||||
private readonly modalController: ModalController,
|
||||
) {
|
||||
constructor() {
|
||||
this.language = this.translateService.currentLang as keyof SCTranslations<SCLanguage>;
|
||||
this.translator = new SCThingTranslator(this.language);
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {
|
||||
SCFacet,
|
||||
SCSearchFilter,
|
||||
@@ -32,6 +32,10 @@ import {transformFacets} from './facet-filter';
|
||||
*/
|
||||
@Injectable()
|
||||
export class ContextMenuService {
|
||||
private readonly translate = inject(TranslateService);
|
||||
|
||||
private readonly thingTranslate = inject(ThingTranslateService);
|
||||
|
||||
/**
|
||||
* Local filter context object
|
||||
*/
|
||||
@@ -82,11 +86,6 @@ export class ContextMenuService {
|
||||
*/
|
||||
sortQueryChanged$ = this.sortQuery.asObservable();
|
||||
|
||||
constructor(
|
||||
private readonly translate: TranslateService,
|
||||
private readonly thingTranslate: ThingTranslateService,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Returns SCSearchFilter if filterContext value is set, undefined otherwise
|
||||
* @param filterContext FilterContext to build SCSearchFilter from
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Component, OnInit, inject} from '@angular/core';
|
||||
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
|
||||
import {
|
||||
SCAppConfigurationMenuCategory,
|
||||
@@ -38,6 +38,14 @@ import {BreakpointObserver} from '@angular/cdk/layout';
|
||||
standalone: false,
|
||||
})
|
||||
export class NavigationComponent implements OnInit {
|
||||
translateService = inject(TranslateService);
|
||||
|
||||
private navigationService = inject(NavigationService);
|
||||
|
||||
private settingsProvider = inject(SettingsProvider);
|
||||
|
||||
private responsive = inject(BreakpointObserver);
|
||||
|
||||
showTabbar = true;
|
||||
|
||||
/**
|
||||
@@ -60,12 +68,9 @@ export class NavigationComponent implements OnInit {
|
||||
*/
|
||||
translator: SCThingTranslator;
|
||||
|
||||
constructor(
|
||||
public translateService: TranslateService,
|
||||
private navigationService: NavigationService,
|
||||
private settingsProvider: SettingsProvider,
|
||||
private responsive: BreakpointObserver,
|
||||
) {
|
||||
constructor() {
|
||||
const translateService = this.translateService;
|
||||
|
||||
translateService.onLangChange.subscribe((event: LangChangeEvent) => {
|
||||
this.language = event.lang as keyof SCTranslations<SCLanguage>;
|
||||
this.translator = new SCThingTranslator(this.language);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {SCAppConfigurationMenuCategory} from '@openstapps/core';
|
||||
import {ConfigProvider} from '../../config/config.provider';
|
||||
import {NGXLogger} from 'ngx-logger';
|
||||
@@ -22,10 +22,9 @@ import {NGXLogger} from 'ngx-logger';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class NavigationService {
|
||||
constructor(
|
||||
private configProvider: ConfigProvider,
|
||||
private logger: NGXLogger,
|
||||
) {}
|
||||
private configProvider = inject(ConfigProvider);
|
||||
|
||||
private logger = inject(NGXLogger);
|
||||
|
||||
async getMenu() {
|
||||
let menu: SCAppConfigurationMenuCategory[] = [];
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, ElementRef, HostBinding, ViewChild} from '@angular/core';
|
||||
import {Component, ElementRef, HostBinding, ViewChild, inject} from '@angular/core';
|
||||
import {InternetConnectionService} from '../../../util/internet-connection.service';
|
||||
import {Router} from '@angular/router';
|
||||
import {NGXLogger} from 'ngx-logger';
|
||||
@@ -25,17 +25,19 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class OfflineNoticeComponent {
|
||||
readonly offlineProvider = inject(InternetConnectionService);
|
||||
|
||||
readonly router = inject(Router);
|
||||
|
||||
readonly logger = inject(NGXLogger);
|
||||
|
||||
@HostBinding('class.is-offline') isOffline = false;
|
||||
|
||||
@HostBinding('class.has-error') hasError = false;
|
||||
|
||||
@ViewChild('spinIcon', {read: ElementRef}) spinIcon: ElementRef;
|
||||
|
||||
constructor(
|
||||
readonly offlineProvider: InternetConnectionService,
|
||||
readonly router: Router,
|
||||
readonly logger: NGXLogger,
|
||||
) {
|
||||
constructor() {
|
||||
this.offlineProvider.offline$.pipe(takeUntilDestroyed()).subscribe(isOffline => {
|
||||
this.isOffline = isOffline;
|
||||
});
|
||||
|
||||
@@ -23,6 +23,16 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class RootLinkDirective implements OnInit {
|
||||
private element = inject(ElementRef);
|
||||
|
||||
private renderer = inject(Renderer2);
|
||||
|
||||
private navController = inject(NavController);
|
||||
|
||||
private router = inject(Router);
|
||||
|
||||
private animationController = inject(AnimationController);
|
||||
|
||||
@Input() rootLink: string;
|
||||
|
||||
@Input() redirectedFrom: string;
|
||||
@@ -33,14 +43,6 @@ export class RootLinkDirective implements OnInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
private element: ElementRef,
|
||||
private renderer: Renderer2,
|
||||
private navController: NavController,
|
||||
private router: Router,
|
||||
private animationController: AnimationController,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
const animation = tabsTransition(this.animationController);
|
||||
this.renderer.setAttribute(this.element.nativeElement, 'button', '');
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Component} from '@angular/core';
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {NavigationEnd, Router} from '@angular/router';
|
||||
import {
|
||||
SCAppConfigurationMenuCategory,
|
||||
@@ -32,6 +32,14 @@ import {NGXLogger} from 'ngx-logger';
|
||||
standalone: false,
|
||||
})
|
||||
export class TabsComponent {
|
||||
private readonly configProvider = inject(ConfigProvider);
|
||||
|
||||
translateService = inject(TranslateService);
|
||||
|
||||
private readonly logger = inject(NGXLogger);
|
||||
|
||||
private readonly router = inject(Router);
|
||||
|
||||
/**
|
||||
* Possible languages to be used for translation
|
||||
*/
|
||||
@@ -52,12 +60,10 @@ export class TabsComponent {
|
||||
*/
|
||||
selectedTab: string;
|
||||
|
||||
constructor(
|
||||
private readonly configProvider: ConfigProvider,
|
||||
public translateService: TranslateService,
|
||||
private readonly logger: NGXLogger,
|
||||
private readonly router: Router,
|
||||
) {
|
||||
constructor() {
|
||||
const translateService = this.translateService;
|
||||
const router = this.router;
|
||||
|
||||
this.language = this.translateService.currentLang as keyof SCTranslations<SCLanguage>;
|
||||
this.translator = new SCThingTranslator(this.language);
|
||||
void this.loadMenuEntries();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {
|
||||
SCBooleanFilterArguments,
|
||||
SCMessage,
|
||||
@@ -37,10 +37,9 @@ import {SettingsProvider} from '../settings/settings.provider';
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class NewsProvider {
|
||||
constructor(
|
||||
private dataProvider: DataProvider,
|
||||
private settingsProvider: SettingsProvider,
|
||||
) {}
|
||||
private dataProvider = inject(DataProvider);
|
||||
|
||||
private settingsProvider = inject(SettingsProvider);
|
||||
|
||||
async getCurrentSettings(): Promise<SCSetting[]> {
|
||||
const settings: SCSetting[] = [];
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Component, OnInit, inject} from '@angular/core';
|
||||
import {IonRefresher} from '@ionic/angular/standalone';
|
||||
import {SCMessage, SCSearchFilter, SCSearchValueFilter, SCSetting} from '@openstapps/core';
|
||||
import {NewsProvider} from '../news.provider';
|
||||
@@ -27,6 +27,8 @@ import {NewsProvider} from '../news.provider';
|
||||
standalone: false,
|
||||
})
|
||||
export class NewsPageComponent implements OnInit {
|
||||
private newsProvider = inject(NewsProvider);
|
||||
|
||||
/**
|
||||
* Thing counter to start query the next page from
|
||||
*/
|
||||
@@ -62,8 +64,6 @@ export class NewsPageComponent implements OnInit {
|
||||
*/
|
||||
filters: SCSearchFilter[];
|
||||
|
||||
constructor(private newsProvider: NewsProvider) {}
|
||||
|
||||
/**
|
||||
* Fetch news from the backend
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ChangeDetectionStrategy, Component, ElementRef, Input} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, ElementRef, Input, inject} from '@angular/core';
|
||||
import {SCIdCard} from '@openstapps/core';
|
||||
import {ThingTranslateModule} from '../../translation/thing-translate.module';
|
||||
import {AsyncPipe, TitleCasePipe} from '@angular/common';
|
||||
@@ -25,13 +25,13 @@ import {iosDuration, iosEasing, mdDuration, mdEasing} from 'src/app/animation/ea
|
||||
],
|
||||
})
|
||||
export class IdCardComponent {
|
||||
@Input({required: true}) item: SCIdCard;
|
||||
private modalController = inject(ModalController);
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private animationController: AnimationController,
|
||||
private elementRef: ElementRef,
|
||||
) {}
|
||||
private animationController = inject(AnimationController);
|
||||
|
||||
private elementRef = inject(ElementRef);
|
||||
|
||||
@Input({required: true}) item: SCIdCard;
|
||||
|
||||
async presentFullscreen() {
|
||||
const top = await this.modalController.getTop();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectionStrategy, Component} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, inject} from '@angular/core';
|
||||
import {IdCardsProvider} from './id-cards.provider';
|
||||
import {SCIdCard} from '@openstapps/core';
|
||||
import {AsyncPipe} from '@angular/common';
|
||||
@@ -32,7 +32,7 @@ import {IonIconDirective} from 'src/app/util/ion-icon/ion-icon.directive';
|
||||
imports: [AsyncPipe, ThingTranslateModule, UtilModule, IdCardComponent, TranslateModule, IonIconDirective],
|
||||
})
|
||||
export class IdCardsComponent {
|
||||
idCards: Observable<SCIdCard[]> = this.idCardsProvider.getIdCards();
|
||||
readonly idCardsProvider = inject(IdCardsProvider);
|
||||
|
||||
constructor(readonly idCardsProvider: IdCardsProvider) {}
|
||||
idCards: Observable<SCIdCard[]> = this.idCardsProvider.getIdCards();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {SCIdCard, SCThingOriginType, SCThingType, SCUserConfiguration} from '@openstapps/core';
|
||||
import {from, of, Observable} from 'rxjs';
|
||||
import {AuthHelperService} from '../auth/auth-helper.service';
|
||||
@@ -9,12 +9,13 @@ import {EncryptedStorageProvider} from '../storage/encrypted-storage.provider';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class IdCardsProvider {
|
||||
constructor(
|
||||
private authHelper: AuthHelperService,
|
||||
private config: ConfigProvider,
|
||||
private httpClient: HttpClient,
|
||||
private encryptedStorageProvider: EncryptedStorageProvider,
|
||||
) {}
|
||||
private authHelper = inject(AuthHelperService);
|
||||
|
||||
private config = inject(ConfigProvider);
|
||||
|
||||
private httpClient = inject(HttpClient);
|
||||
|
||||
private encryptedStorageProvider = inject(EncryptedStorageProvider);
|
||||
|
||||
getIdCards(): Observable<SCIdCard[]> {
|
||||
const feature = this.config.config.app.features.extern?.['idCards'];
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('IdCards', () => {
|
||||
});
|
||||
|
||||
it('should emit undefined if not logged in', async () => {
|
||||
const provider = new IdCardsProvider(authHelper, configProvider, httpClient, encryptedStorageProvider);
|
||||
const provider = new IdCardsProvider();
|
||||
expect(await firstValueFrom(provider.getIdCards())).toEqual([]);
|
||||
expect(authHelper.getProvider).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@@ -44,7 +44,7 @@ describe('IdCards', () => {
|
||||
fakeAuth.isLoggedIn$.next(true);
|
||||
httpClient.get = jasmine.createSpy().and.returnValue(of(['abc']));
|
||||
fakeAuth.getValidToken = jasmine.createSpy().and.resolveTo({accessToken: 'fake-token'});
|
||||
const provider = new IdCardsProvider(authHelper, configProvider, httpClient, encryptedStorageProvider);
|
||||
const provider = new IdCardsProvider();
|
||||
expect(await firstValueFrom(provider.getIdCards())).toEqual(['abc' as never]);
|
||||
expect(authHelper.getProvider).toHaveBeenCalledTimes(1);
|
||||
// eslint-disable-next-line unicorn/no-null
|
||||
@@ -57,7 +57,7 @@ describe('IdCards', () => {
|
||||
});
|
||||
|
||||
it('should react to logins', async () => {
|
||||
const provider = new IdCardsProvider(authHelper, configProvider, httpClient, encryptedStorageProvider);
|
||||
const provider = new IdCardsProvider();
|
||||
const observable = provider.getIdCards();
|
||||
expect(await firstValueFrom(observable)).toEqual([]);
|
||||
httpClient.get = jasmine.createSpy().and.returnValue(of(['abc']));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core';
|
||||
import {ChangeDetectionStrategy, Component, Input, inject} from '@angular/core';
|
||||
import {mergeMap, ReplaySubject} from 'rxjs';
|
||||
import {map} from 'rxjs/operators';
|
||||
import {SCDateSeries, SCISO8601Date} from '@openstapps/core';
|
||||
@@ -49,6 +49,8 @@ function groupDays(dateSeries: SCDateSeries[], visibleDays: number): MyCoursesGr
|
||||
standalone: false,
|
||||
})
|
||||
export class MyCoursesComponent {
|
||||
private scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
/**
|
||||
* The number of days from today to display
|
||||
*/
|
||||
@@ -66,6 +68,4 @@ export class MyCoursesComponent {
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
constructor(private scheduleProvider: ScheduleProvider) {}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component} from '@angular/core';
|
||||
import {Component, inject} from '@angular/core';
|
||||
import {AuthHelperService} from '../../auth/auth-helper.service';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import {ScheduleProvider} from '../../calendar/schedule.provider';
|
||||
@@ -25,13 +25,13 @@ import {profilePageSections} from '../../../../config/profile-page-sections';
|
||||
standalone: false,
|
||||
})
|
||||
export class ProfilePageComponent {
|
||||
sections = profilePageSections;
|
||||
readonly authHelper = inject(AuthHelperService);
|
||||
|
||||
constructor(
|
||||
readonly authHelper: AuthHelperService,
|
||||
readonly activatedRoute: ActivatedRoute,
|
||||
readonly scheduleProvider: ScheduleProvider,
|
||||
) {}
|
||||
readonly activatedRoute = inject(ActivatedRoute);
|
||||
|
||||
readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
sections = profilePageSections;
|
||||
|
||||
async signIn() {
|
||||
const originPath = this.activatedRoute.snapshot.queryParamMap.get('origin_path');
|
||||
|
||||
@@ -13,13 +13,10 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import moment from 'moment';
|
||||
import {materialFade, materialManualFade, materialSharedAxisX} from '../../../animation/material-motion';
|
||||
import {ScheduleResponsiveBreakpoint} from './schema/schema';
|
||||
import {ScheduleProvider} from '../../calendar/schedule.provider';
|
||||
import {CalendarComponent} from './components/calendar.component';
|
||||
import {CalendarService} from '../../calendar/calendar.service';
|
||||
import {InfiniteSwiperComponent} from './grid/infinite-swiper.component';
|
||||
import {IonContent} from '@ionic/angular/standalone';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
@@ -56,12 +53,8 @@ export class CalendarViewComponent extends CalendarComponent implements OnInit,
|
||||
*/
|
||||
moment = moment;
|
||||
|
||||
constructor(
|
||||
activatedRoute: ActivatedRoute,
|
||||
calendarService: CalendarService,
|
||||
scheduleProvider: ScheduleProvider,
|
||||
) {
|
||||
super(activatedRoute, calendarService, scheduleProvider);
|
||||
constructor() {
|
||||
super();
|
||||
// This could be done directly on the properties too instead of
|
||||
// here in the constructor, but because of TSLint member ordering,
|
||||
// some properties wouldn't be initialized, and if you disable
|
||||
|
||||
@@ -37,6 +37,12 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
standalone: false,
|
||||
})
|
||||
export class CalendarComponent implements OnInit {
|
||||
protected readonly activatedRoute = inject(ActivatedRoute);
|
||||
|
||||
protected readonly calendarService = inject(CalendarService);
|
||||
|
||||
protected readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
/**
|
||||
* The day that the schedule started out on
|
||||
*/
|
||||
@@ -103,12 +109,6 @@ export class CalendarComponent implements OnInit {
|
||||
|
||||
destroy$ = inject(DestroyRef);
|
||||
|
||||
constructor(
|
||||
protected readonly activatedRoute: ActivatedRoute,
|
||||
protected readonly calendarService: CalendarService,
|
||||
protected readonly scheduleProvider: ScheduleProvider,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
let dayString: string | number | null = this.activatedRoute.snapshot.paramMap.get('date');
|
||||
if (dayString == undefined || dayString === 'now') {
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input, OnInit} from '@angular/core';
|
||||
import {Component, Input, OnInit, inject} from '@angular/core';
|
||||
import moment from 'moment';
|
||||
import {ScheduleProvider} from '../../../calendar/schedule.provider';
|
||||
import {ScheduleEvent} from '../schema/schema';
|
||||
@@ -27,6 +27,8 @@ import {ScheduleEvent} from '../schema/schema';
|
||||
standalone: false,
|
||||
})
|
||||
export class ScheduleCardComponent implements OnInit {
|
||||
private readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
cardColor = {
|
||||
isExercise: false,
|
||||
isLecture: false,
|
||||
@@ -73,8 +75,6 @@ export class ScheduleCardComponent implements OnInit {
|
||||
*/
|
||||
title: string;
|
||||
|
||||
constructor(private readonly scheduleProvider: ScheduleProvider) {}
|
||||
|
||||
/**
|
||||
* Initializer
|
||||
*/
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, HostListener, Input, OnInit} from '@angular/core';
|
||||
import {Component, HostListener, Input, OnInit, inject} from '@angular/core';
|
||||
import moment from 'moment';
|
||||
import {Range, ScheduleEvent, ScheduleResponsiveBreakpoint} from '../schema/schema';
|
||||
import {ScheduleProvider} from '../../../calendar/schedule.provider';
|
||||
@@ -28,6 +28,8 @@ import {groupRangeOverlaps} from './range-overlap';
|
||||
standalone: false,
|
||||
})
|
||||
export class ScheduleDayComponent implements OnInit {
|
||||
protected readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
@Input() day: moment.Moment;
|
||||
|
||||
@Input() hoursRange: Range<number>;
|
||||
@@ -59,8 +61,6 @@ export class ScheduleDayComponent implements OnInit {
|
||||
|
||||
dateFormat = 'dd';
|
||||
|
||||
constructor(protected readonly scheduleProvider: ScheduleProvider) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.determineDateFormat();
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {AfterViewInit, Component, HostListener, Input, OnInit, ViewChild} from '@angular/core';
|
||||
import {AfterViewInit, Component, HostListener, Input, OnInit, ViewChild, inject} from '@angular/core';
|
||||
import {Location} from '@angular/common';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {AnimationController, IonRouterOutlet} from '@ionic/angular/standalone';
|
||||
@@ -57,6 +57,18 @@ const responsiveConfig: ScheduleResponsiveBreakpoint[] = [
|
||||
standalone: false,
|
||||
})
|
||||
export class SchedulePageComponent implements OnInit, AfterViewInit {
|
||||
private readonly activatedRoute = inject(ActivatedRoute);
|
||||
|
||||
private calendarService = inject(CalendarService);
|
||||
|
||||
readonly routerOutlet = inject(IonRouterOutlet);
|
||||
|
||||
private router = inject(Router);
|
||||
|
||||
private animationController = inject(AnimationController);
|
||||
|
||||
private location = inject(Location);
|
||||
|
||||
/**
|
||||
* Current width of the window
|
||||
*/
|
||||
@@ -108,15 +120,6 @@ export class SchedulePageComponent implements OnInit, AfterViewInit {
|
||||
return responsiveConfig.find(value => width < value.until) ?? responsiveConfig.at(-1)!;
|
||||
}
|
||||
|
||||
constructor(
|
||||
private readonly activatedRoute: ActivatedRoute,
|
||||
private calendarService: CalendarService,
|
||||
readonly routerOutlet: IonRouterOutlet,
|
||||
private router: Router,
|
||||
private animationController: AnimationController,
|
||||
private location: Location,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.onInit();
|
||||
}
|
||||
|
||||
@@ -47,6 +47,8 @@ export interface ScheduleSingleEvent {
|
||||
standalone: false,
|
||||
})
|
||||
export class ScheduleSingleEventsComponent implements OnInit {
|
||||
protected readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
/**
|
||||
* The events to display
|
||||
*/
|
||||
@@ -100,8 +102,6 @@ export class ScheduleSingleEventsComponent implements OnInit {
|
||||
.map(([_, value]) => value);
|
||||
}
|
||||
|
||||
constructor(protected readonly scheduleProvider: ScheduleProvider) {}
|
||||
|
||||
/**
|
||||
* Fetch date series items
|
||||
*/
|
||||
|
||||
@@ -13,13 +13,10 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core';
|
||||
import {ActivatedRoute} from '@angular/router';
|
||||
import moment, {Moment} from 'moment';
|
||||
import {materialFade, materialManualFade, materialSharedAxisX} from '../../../animation/material-motion';
|
||||
import {ScheduleProvider} from '../../calendar/schedule.provider';
|
||||
import {SCISO8601Date, SCUuid} from '@openstapps/core';
|
||||
import {ScheduleEvent, ScheduleResponsiveBreakpoint} from './schema/schema';
|
||||
import {CalendarService} from '../../calendar/calendar.service';
|
||||
import {CalendarComponent} from './components/calendar.component';
|
||||
import {IonContent, IonDatetime} from '@ionic/angular/standalone';
|
||||
import {SwiperComponent} from 'swiper/angular';
|
||||
@@ -84,12 +81,8 @@ export class ScheduleViewComponent extends CalendarComponent implements OnInit,
|
||||
(_, i) => moment().startOf('week').add(i, 'days'),
|
||||
);
|
||||
|
||||
constructor(
|
||||
activatedRoute: ActivatedRoute,
|
||||
calendarService: CalendarService,
|
||||
scheduleProvider: ScheduleProvider,
|
||||
) {
|
||||
super(activatedRoute, calendarService, scheduleProvider);
|
||||
constructor() {
|
||||
super();
|
||||
const hoursAmount = this.hoursRange.to - this.hoursRange.from + 1;
|
||||
this.hours = [...Array.from({length: hoursAmount}).keys()];
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {InAppReview} from '@capacitor-community/in-app-review';
|
||||
import {StorageProvider} from '../../storage/storage.provider';
|
||||
|
||||
@@ -15,12 +15,14 @@ export type IN_APP_REVIEW_KEYS = typeof IN_APP_REVIEW_SESSIONS_KEY | typeof IN_A
|
||||
*/
|
||||
@Injectable()
|
||||
export class InAppReviewProvider {
|
||||
private readonly storageProvider = inject(StorageProvider);
|
||||
|
||||
requestReview: () => Promise<void>;
|
||||
|
||||
/**
|
||||
* @param storageProvider TODO
|
||||
*
|
||||
*/
|
||||
constructor(private readonly storageProvider: StorageProvider) {
|
||||
constructor() {
|
||||
this.requestReview = InAppReview.requestReview;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Component, Input, inject} from '@angular/core';
|
||||
import {AlertController} from '@ionic/angular/standalone';
|
||||
import {LangChangeEvent, TranslateService} from '@ngx-translate/core';
|
||||
import {SCLanguageCode, SCSetting, SCSettingValue, SCSettingValues} from '@openstapps/core';
|
||||
@@ -28,6 +28,12 @@ import {SettingsProvider} from '../settings.provider';
|
||||
standalone: false,
|
||||
})
|
||||
export class SettingsItemComponent {
|
||||
private readonly alertCtrl = inject(AlertController);
|
||||
|
||||
private readonly translateService = inject(TranslateService);
|
||||
|
||||
private readonly settingsProvider = inject(SettingsProvider);
|
||||
|
||||
/**
|
||||
* If set the setting will be shown as compact view
|
||||
*/
|
||||
@@ -45,15 +51,10 @@ export class SettingsItemComponent {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param alertCtrl AlertController
|
||||
* @param translateService TranslateService
|
||||
* @param settingsProvider SettingProvider
|
||||
*/
|
||||
constructor(
|
||||
private readonly alertCtrl: AlertController,
|
||||
private readonly translateService: TranslateService,
|
||||
private readonly settingsProvider: SettingsProvider,
|
||||
) {
|
||||
constructor() {
|
||||
const translateService = this.translateService;
|
||||
|
||||
translateService.onLangChange.subscribe((_event: LangChangeEvent) => {
|
||||
this.isVisible = false;
|
||||
// TODO: Issue #53 check workaround for selected 'select option' not updating translation
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {Component, OnInit, inject} from '@angular/core';
|
||||
import {AddEventReviewModalComponent} from '../../calendar/add-event-review-modal.component';
|
||||
import {ModalController} from '@ionic/angular/standalone';
|
||||
import {ScheduleProvider} from '../../calendar/schedule.provider';
|
||||
@@ -43,22 +43,26 @@ import {
|
||||
standalone: false,
|
||||
})
|
||||
export class CalendarSyncSettingsComponent implements OnInit {
|
||||
readonly modalController = inject(ModalController);
|
||||
|
||||
readonly scheduleProvider = inject(ScheduleProvider);
|
||||
|
||||
readonly translator = inject(TranslateService);
|
||||
|
||||
readonly thingTranslator = inject(ThingTranslateService);
|
||||
|
||||
readonly storageProvider = inject(StorageProvider);
|
||||
|
||||
readonly scheduleSyncService = inject(ScheduleSyncService);
|
||||
|
||||
readonly calendarService = inject(CalendarService);
|
||||
|
||||
isWeb = true;
|
||||
|
||||
syncEnabled = false;
|
||||
|
||||
notificationsEnabled = false;
|
||||
|
||||
constructor(
|
||||
readonly modalController: ModalController,
|
||||
readonly scheduleProvider: ScheduleProvider,
|
||||
readonly translator: TranslateService,
|
||||
readonly thingTranslator: ThingTranslateService,
|
||||
readonly storageProvider: StorageProvider,
|
||||
readonly scheduleSyncService: ScheduleSyncService,
|
||||
readonly calendarService: CalendarService,
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
Device.getInfo().then(it => {
|
||||
this.isWeb = it.platform === 'web';
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {ChangeDetectorRef, Component, OnInit} from '@angular/core';
|
||||
import {ChangeDetectorRef, Component, OnInit, inject} from '@angular/core';
|
||||
import {AlertController, ToastController} from '@ionic/angular/standalone';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
import {SCSettingMeta} from '@openstapps/core';
|
||||
@@ -28,6 +28,16 @@ import {SettingsCache, SettingsProvider} from '../settings.provider';
|
||||
standalone: false,
|
||||
})
|
||||
export class SettingsPageComponent implements OnInit {
|
||||
private readonly alertController = inject(AlertController);
|
||||
|
||||
private readonly settingsProvider = inject(SettingsProvider);
|
||||
|
||||
private readonly toastController = inject(ToastController);
|
||||
|
||||
private readonly translateService = inject(TranslateService);
|
||||
|
||||
private readonly changeDetectorRef = inject(ChangeDetectorRef);
|
||||
|
||||
/**
|
||||
* Order of the categories
|
||||
*/
|
||||
@@ -50,19 +60,8 @@ export class SettingsPageComponent implements OnInit {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param alertController AlertController
|
||||
* @param settingsProvider SettingsProvider
|
||||
* @param toastController ToastController
|
||||
* @param translateService TranslateService
|
||||
* @param changeDetectorRef ChangeDetectorRef
|
||||
*/
|
||||
constructor(
|
||||
private readonly alertController: AlertController,
|
||||
private readonly settingsProvider: SettingsProvider,
|
||||
private readonly toastController: ToastController,
|
||||
private readonly translateService: TranslateService,
|
||||
private readonly changeDetectorRef: ChangeDetectorRef,
|
||||
) {
|
||||
constructor() {
|
||||
this.settingsCache = {};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import {Pipe, PipeTransform, inject} from '@angular/core';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
import {SCSetting} from '@openstapps/core';
|
||||
import {ThingTranslatePipe} from '../../translation/thing-translate.pipe';
|
||||
@@ -28,13 +28,12 @@ import {ThingTranslateService} from '../../translation/thing-translate.service';
|
||||
standalone: false,
|
||||
})
|
||||
export class SettingTranslatePipe implements PipeTransform {
|
||||
constructor(
|
||||
private readonly translate: TranslateService,
|
||||
private readonly thingTranslate: ThingTranslateService,
|
||||
) {}
|
||||
private readonly translate = inject(TranslateService);
|
||||
|
||||
private readonly thingTranslate = inject(ThingTranslateService);
|
||||
|
||||
transform(setting: SCSetting): string | undefined {
|
||||
const thingTranslatePipe = new ThingTranslatePipe(this.translate, this.thingTranslate);
|
||||
const thingTranslatePipe = new ThingTranslatePipe();
|
||||
const translatedSettingValues = thingTranslatePipe.transform('values', setting);
|
||||
|
||||
return translatedSettingValues
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {SCSetting, SCSettingValue, SCSettingValues} from '@openstapps/core';
|
||||
import deepMerge from 'deepmerge';
|
||||
import {Subject} from 'rxjs';
|
||||
@@ -91,6 +91,10 @@ export interface SettingsAction {
|
||||
*/
|
||||
@Injectable()
|
||||
export class SettingsProvider {
|
||||
private readonly storage = inject(StorageProvider);
|
||||
|
||||
private readonly configProvider = inject(ConfigProvider);
|
||||
|
||||
/**
|
||||
* Source of settings actions
|
||||
*/
|
||||
@@ -192,15 +196,7 @@ export class SettingsProvider {
|
||||
return isValueValid;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param storage TODO
|
||||
* @param configProvider TODO
|
||||
*/
|
||||
constructor(
|
||||
private readonly storage: StorageProvider,
|
||||
private readonly configProvider: ConfigProvider,
|
||||
) {
|
||||
constructor() {
|
||||
this.categoriesOrder = [];
|
||||
this.settingsCache = {};
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, inject} from '@angular/core';
|
||||
import {StorageProvider} from './storage.provider';
|
||||
import {Capacitor} from '@capacitor/core';
|
||||
import {SecureStoragePlugin} from 'capacitor-secure-storage-plugin';
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class EncryptedStorageProvider {
|
||||
constructor(private storageProvider: StorageProvider) {}
|
||||
private storageProvider = inject(StorageProvider);
|
||||
|
||||
/**
|
||||
* Retrieve a large value from an encrypted storage
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user