Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ionic serve -- --proxy-config proxy.conf.json

RSS local feeds:
```
http://localhost:8100/polygon/rss/index.xml
http://localhost:8100/polygon/feed/
http://localhost:8100/verge/rss/index.xml
```

Expand Down Expand Up @@ -81,7 +81,7 @@ ionic cap open ios
```text
https://derme.coffee/index.xml
https://news.ycombinator.com/rss
https://www.polygon.com/rss/index.xml
https://www.polygon.com/feed/
https://www.theverge.com/rss/index.xml
https://feeds.megaphone.fm/vergecast
```
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ android {
applicationId "com.frostcube.justrss"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 31
versionName "3.2.0"
versionCode 32
versionName "3.3.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.2.0;
MARKETING_VERSION = 3.3.1;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = com.frostcube.justrss;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -376,7 +376,7 @@
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.productivity";
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 3.2.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.frostcube.justrss;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "just-rss",
"version": "3.2.0",
"version": "3.3.1",
"author": "FrostCube",
"homepage": "https://frostcube.com/",
"scripts": {
Expand Down
64 changes: 64 additions & 0 deletions src/app/discover/discover.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<ion-header [translucent]="true">
<ion-toolbar color="primary">
<ion-title>
Discover
</ion-title>
<ion-buttons collapse="true" slot="end">
<ion-button slot="end" (click)="forceRefresh()">
<ion-icon color="medium" name="refresh-outline"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>

<ion-content [fullscreen]="true" class="ion-padding">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">Discover</ion-title>
<ion-buttons collapse="true" slot="end">
<ion-button slot="end" (click)="forceRefresh()">
<ion-icon color="medium" name="refresh-outline"></ion-icon>
</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>

<ion-list>
@for (section of sections; track section.download_url) {

<ion-list-header>
<ion-label>{{ section.name.split('.')[0] }}</ion-label>
@if (selectedSection === section) {
<ion-button (click)="unselectSection()" [disabled]="loadingFeeds">
<ion-icon name="chevron-up-outline"></ion-icon>
</ion-button>
} @else {
<ion-button (click)="selectSection(section)" [disabled]="loadingFeeds">
<ion-icon name="chevron-down-outline"></ion-icon>
</ion-button>
}
</ion-list-header>

@if (selectedSection === section) {
<div class="feeds-header">
<div *ngIf="loadingFeeds">Loading suggestions...</div>
<ion-spinner *ngIf="loadingFeeds" name="dots"></ion-spinner>
</div>
@for (feed of suggestedFeeds; track feed.xmlUrl) {
<ion-item>
<ion-label>
<h3>{{ feed.title || feed.text }}</h3>
<p>{{ feed.description }}</p>
</ion-label>
<ion-button slot="end" (click)="addFeed(feed)" [disabled]="isInSources(feed) || addingMap[feed.xmlUrl]">
<ion-spinner *ngIf="addingMap[feed.xmlUrl]" name="dots"></ion-spinner>
<ion-icon *ngIf="!isInSources(feed) && !addingMap[feed.xmlUrl]" name="add-outline"></ion-icon>
<ion-icon *ngIf="isInSources(feed) && !addingMap[feed.xmlUrl]" name="checkmark-outline"></ion-icon>
</ion-button>
</ion-item>
}
}
}
</ion-list>

</ion-content>
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { IonicModule } from '@ionic/angular';

import { SuggestedComponent } from './suggested.component';
import { DiscoverPage } from './discover.page';

describe('SuggestedComponent', () => {
let component: SuggestedComponent;
let fixture: ComponentFixture<SuggestedComponent>;
let component: DiscoverPage;
let fixture: ComponentFixture<DiscoverPage>;

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ SuggestedComponent ],
declarations: [ DiscoverPage ],
imports: [IonicModule.forRoot()]
}).compileComponents();

fixture = TestBed.createComponent(SuggestedComponent);
fixture = TestBed.createComponent(DiscoverPage);
component = fixture.componentInstance;
fixture.detectChanges();
}));
Expand Down
110 changes: 110 additions & 0 deletions src/app/discover/discover.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import { NgIf } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { IonButton, IonButtons, IonCheckbox, IonContent, IonHeader, IonIcon, IonItem, IonLabel, IonList, IonListHeader, IonSpinner, IonTitle, IonToolbar } from '@ionic/angular/standalone';
import { addIcons } from 'ionicons';
import { addOutline, checkmarkOutline, chevronDownOutline, chevronUpOutline, refreshOutline } from 'ionicons/icons';
import { IOPMLItem } from '../lib/types';
import { DiscoverService } from '../services/discover.service';
import { SourcesService } from '../services/sources.service';

@Component({
selector: 'app-discover',
templateUrl: './discover.page.html',
styleUrls: ['./discover.page.scss'],
standalone: true,
imports: [FormsModule, NgIf, IonContent, IonList, IonListHeader, IonItem, IonLabel, IonCheckbox, IonButton, IonSpinner, IonHeader, IonToolbar, IonTitle, IonButtons, IonIcon]
})
export class DiscoverPage implements OnInit {

// Available OPML discovery sections from the GitHub repo
public sections: Array<{ name: string; download_url: string }> = [];
// Currently loaded feeds from the selected section
public suggestedFeeds: IOPMLItem[] = [];
public loadingSections = false;
public loadingFeeds = false;
// Currently selected section (for feed refresh)
public selectedSection?: { name: string; download_url: string };
// Map of feed URL -> adding in progress
public addingMap: Record<string, boolean> = {};

constructor(public sourcesService: SourcesService, private discoverService: DiscoverService) {
addIcons({ addOutline, checkmarkOutline, chevronDownOutline, chevronUpOutline, refreshOutline, });
}

async ngOnInit() {
this.loadingSections = true;
this.sections = await this.discoverService.listOpmlFiles();
this.loadingSections = false;
}

async selectSection(section: { name: string; download_url: string }) {
this.loadingFeeds = true;
this.selectedSection = section;
this.suggestedFeeds = await this.discoverService.fetchOpmlItems(section.download_url);
this.loadingFeeds = false;
}

unselectSection() {
this.selectedSection = undefined;
this.suggestedFeeds = [];
}

// Button will force both sections to refresh
public async forceRefresh() {
this.refreshSections();
this.refreshSelectedSection();
}

// Force refresh the list of sections (bypass cache)
public async refreshSections() {
this.loadingSections = true;
this.sections = await this.discoverService.listOpmlFiles(true);
this.loadingSections = false;
}

// Force refresh the currently selected section's feeds (bypass cache)
public async refreshSelectedSection() {
if (!this.selectedSection) return;
this.loadingFeeds = true;
this.suggestedFeeds = await this.discoverService.fetchOpmlItems(this.selectedSection.download_url, true);
this.loadingFeeds = false;
}

// Expose a property to check if any feed is selected; avoid complex/sensitive template expressions
public get anySelected(): boolean {
return Array.isArray(this.suggestedFeeds) && this.suggestedFeeds.some(f => !!f && f.selected === true);
}

addFeeds() {
for (const feed of this.suggestedFeeds) {
if (feed.selected) this.sourcesService.addSourceFromUrl(feed.xmlUrl);
}
}

/**
* Return true if the given OPML feed is already present in SourcesService list.
*/
public isInSources(feed: IOPMLItem): boolean {
if (!feed || !feed.xmlUrl) return false;
const sources = this.sourcesService.getSources() || [];
return sources.some(s => s.url === feed.xmlUrl);
}

/**
* Add a single feed if it's not already added. Shows spinner while adding.
*/
public async addFeed(feed: IOPMLItem) {
if (!feed || !feed.xmlUrl) return;
if (this.isInSources(feed)) return;

this.addingMap[feed.xmlUrl] = true;
try {
await this.sourcesService.addSourceFromUrl(feed.xmlUrl);
} catch (e) {
console.error('[DiscoverPage] Error adding feed', e);
}
this.addingMap[feed.xmlUrl] = false;
}

}
8 changes: 8 additions & 0 deletions src/app/lib/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface IOPMLItem {
text: string,
title: string,
description: string,
xmlUrl: string,
type: string,
selected: boolean
}
16 changes: 16 additions & 0 deletions src/app/services/discover.service.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';

import { DiscoverService } from './discover.service';

describe('DiscoverService', () => {
let service: DiscoverService;

beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(DiscoverService);
});

it('should be created', () => {
expect(service).toBeTruthy();
});
});
Loading