Skip to content

Commit

Permalink
MOBILE-4653 chore: Small code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Jan 29, 2025
1 parent 7c8871c commit 105458a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
10 changes: 6 additions & 4 deletions src/addons/blog/pages/index/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,12 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy {
* @param infiniteComplete Infinite scroll complete function. Only used from core-infinite-loading.
* @returns Resolved when done.
*/
loadMore(infiniteComplete?: () => void): Promise<void> {
return this.fetchEntries(false).finally(() => {
infiniteComplete && infiniteComplete();
});
async loadMore(infiniteComplete?: () => void): Promise<void> {
try {
return await this.fetchEntries(false);
} finally {
infiniteComplete?.();
}
}

/**
Expand Down
16 changes: 8 additions & 8 deletions src/addons/mod/forum/pages/discussion/discussion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,20 @@ export class AddonModForumDiscussionPage implements OnInit, AfterViewInit, OnDes
* Runs when the page is about to leave and no longer be the active page.
*/
ionViewWillLeave(): void {
this.syncObserver && this.syncObserver.off();
this.syncManualObserver && this.syncManualObserver.off();
this.ratingOfflineObserver && this.ratingOfflineObserver.off();
this.ratingSyncObserver && this.ratingSyncObserver.off();
this.changeDiscObserver && this.changeDiscObserver.off();
this.syncObserver?.off();
this.syncManualObserver?.off();
this.ratingOfflineObserver?.off();
this.ratingSyncObserver?.off();
this.changeDiscObserver?.off();
delete this.syncObserver;
}

/**
* Page destroyed.
* @inheritdoc
*/
ngOnDestroy(): void {
this.onlineObserver && this.onlineObserver.unsubscribe();
this.discussions && this.discussions.destroy();
this.onlineObserver?.unsubscribe();
this.discussions?.destroy();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/components/course-image/course-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class CoreCourseImageComponent {

const tint = CoreColors.lighter(course.color, 50);
this.element.style.setProperty('--course-color-tint', tint);
} else if(course.colorNumber !== undefined) {
} else if (course.colorNumber !== undefined) {
this.element.classList.add('course-color-' + course.colorNumber);
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/core/features/settings/pages/deviceinfo/deviceinfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ <h1>
<ion-item (longPress)="copyItemInfo($event)">
<ion-label class="ion-text-wrap">
<p class="item-heading">{{ 'core.settings.networkstatus' | translate}}</p>
<p>{{ 'core.' + deviceInfo.networkStatus | translate }}</p>
@if (deviceInfo.isOnline) {
<p>{{ 'core.online' | translate }}</p>
} @else {
<p>{{ 'core.offline' | translate }}</p>
}
</ion-label>
</ion-item>
<ion-item (longPress)="copyItemInfo($event)">
Expand Down
6 changes: 3 additions & 3 deletions src/core/features/settings/pages/deviceinfo/deviceinfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ interface CoreSettingsDeviceInfo {
locationHref?: string;
deviceType: string;
screen?: string;
networkStatus: string;
isOnline: boolean;
wifiConnection: string;
cordovaVersion?: string;
platform?: string;
Expand Down Expand Up @@ -93,7 +93,7 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
versionCode: CoreConstants.CONFIG.versioncode,
compilationTime: CoreConstants.BUILD.compilationTime || 0,
lastCommit: CoreConstants.BUILD.lastCommitHash || '',
networkStatus: CoreNetwork.isOnline() ? 'online' : 'offline',
isOnline: CoreNetwork.isOnline(),
wifiConnection: CoreNetwork.isWifi() ? 'yes' : 'no',
localNotifAvailable: CoreLocalNotifications.isPluginAvailable() ? 'yes' : 'no',
pushId: CorePushNotifications.getPushId(),
Expand Down Expand Up @@ -172,7 +172,7 @@ export class CoreSettingsDeviceInfoPage implements OnDestroy {
this.onlineObserver = CoreNetwork.onChange().subscribe(() => {
// Execute the callback in the Angular zone, so change detection doesn't stop working.
NgZone.run(() => {
this.deviceInfo.networkStatus = CoreNetwork.isOnline() ? 'online' : 'offline';
this.deviceInfo.isOnline = CoreNetwork.isOnline();
});
});

Expand Down

0 comments on commit 105458a

Please sign in to comment.