Skip to content

Commit a534527

Browse files
committed
MOBILE-4653 chore: Small code styling
1 parent 4220299 commit a534527

File tree

5 files changed

+23
-17
lines changed

5 files changed

+23
-17
lines changed

src/addons/blog/pages/index/index.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,12 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
363363
* @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading.
364364
* @returns Resolved when done.
365365
*/
366-
loadMore(infiniteComplete?: () => void): Promise<void> {
367-
return this.fetchEntries(false).finally(() => {
368-
infiniteComplete && infiniteComplete();
369-
});
366+
async loadMore(infiniteComplete?: () => void): Promise<void> {
367+
try {
368+
return await this.fetchEntries(false);
369+
} finally {
370+
infiniteComplete?.();
371+
}
370372
}
371373

372374
/**

src/addons/mod/forum/pages/discussion/discussion.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -333,20 +333,20 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
333333
* Runs when the page is about to leave and no longer be the active page.
334334
*/
335335
ionViewWillLeave(): void {
336-
this.syncObserver && this.syncObserver.off();
337-
this.syncManualObserver && this.syncManualObserver.off();
338-
this.ratingOfflineObserver && this.ratingOfflineObserver.off();
339-
this.ratingSyncObserver && this.ratingSyncObserver.off();
340-
this.changeDiscObserver && this.changeDiscObserver.off();
336+
this.syncObserver?.off();
337+
this.syncManualObserver?.off();
338+
this.ratingOfflineObserver?.off();
339+
this.ratingSyncObserver?.off();
340+
this.changeDiscObserver?.off();
341341
delete this.syncObserver;
342342
}
343343

344344
/**
345-
* Page destroyed.
345+
* @inheritdoc
346346
*/
347347
ngOnDestroy(): void {
348-
this.onlineObserver && this.onlineObserver.unsubscribe();
349-
this.discussions && this.discussions.destroy();
348+
this.onlineObserver?.unsubscribe();
349+
this.discussions?.destroy();
350350
}
351351

352352
/**

src/core/components/course-image/course-image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class CoreCourseImageComponent {
6666

6767
const tint = CoreColors.lighter(course.color, 50);
6868
this.element.style.setProperty('--course-color-tint', tint);
69-
} else if(course.colorNumber !== undefined) {
69+
} else if (course.colorNumber !== undefined) {
7070
this.element.classList.add('course-color-' + course.colorNumber);
7171
}
7272
}

src/core/features/settings/pages/deviceinfo/deviceinfo.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ <h1>
103103
<ion-item (longPress)="copyItemInfo($event)">
104104
<ion-label class="ion-text-wrap">
105105
<p class="item-heading">{{ 'core.settings.networkstatus' | translate}}</p>
106-
<p>{{ 'core.' + deviceInfo.networkStatus | translate }}</p>
106+
@if (deviceInfo.isOnline) {
107+
<p>{{ 'core.online' | translate }}</p>
108+
} @else {
109+
<p>{{ 'core.offline' | translate }}</p>
110+
}
107111
</ion-label>
108112
</ion-item>
109113
<ion-item (longPress)="copyItemInfo($event)">

src/core/features/settings/pages/deviceinfo/deviceinfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ interface CoreSettingsDeviceInfo {
5252
locationHref?: string;
5353
deviceType: string;
5454
screen?: string;
55-
networkStatus: string;
55+
isOnline: boolean;
5656
wifiConnection: string;
5757
cordovaVersion?: string;
5858
platform?: string;
@@ -94,7 +94,7 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
9494
versionCode: CoreConstants.CONFIG.versioncode,
9595
compilationTime: CoreConstants.BUILD.compilationTime || 0,
9696
lastCommit: CoreConstants.BUILD.lastCommitHash || '',
97-
networkStatus: CoreNetwork.isOnline() ? 'online' : 'offline',
97+
isOnline: CoreNetwork.isOnline(),
9898
wifiConnection: CoreNetwork.isWifi() ? 'yes' : 'no',
9999
localNotifAvailable: CoreLocalNotifications.isPluginAvailable() ? 'yes' : 'no',
100100
pushId: CorePushNotifications.getPushId(),
@@ -173,7 +173,7 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
173173
this.onlineObserver = CoreNetwork.onChange().subscribe(() => {
174174
// Execute the callback in the Angular zone, so change detection doesn't stop working.
175175
NgZone.run(() => {
176-
this.deviceInfo.networkStatus = CoreNetwork.isOnline() ? 'online' : 'offline';
176+
this.deviceInfo.isOnline = CoreNetwork.isOnline();
177177
});
178178
});
179179

0 commit comments

Comments
 (0)