Skip to content
This repository was archived by the owner on Aug 4, 2023. It is now read-only.

Commit b0b8f25

Browse files
committed
Add icons and some final touches on the what-is-new page
1 parent 90367c0 commit b0b8f25

22 files changed

+15
-13
lines changed

FIREBASE.ms

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Updating the news in firebase manually:
22
Update the firebase-database.json with the added articles and "import" in firebase.
33

4-
Sending push notifications:
4+
Sending push notifications from the firebase console:
55
Make sure to set:
66
- Message text: the message text
77
- Message label: message title displayed in firebase
@@ -10,5 +10,6 @@ In the Advanced:
1010
- In custom data add the fields:
1111
- inAppTitle: repeat the "Title"
1212
- inAppBody: repeat the "Message text"
13-
- url: link to the page to be opened on tap
13+
- url: link to the page to be opened on tap (best matched with the news article)
14+
- id: the id of the news
1415

Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
1.15 KB
Loading
1.45 KB
Loading
1.85 KB
Loading
571 Bytes
Loading
825 Bytes
Loading
1.02 KB
Loading

app/common/firebase.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class ViewModel extends Observable {
9696
}
9797

9898
updateNews(updates: FirebaseArticle[]) {
99-
this.news = updates.map(fb => new Article(fb));
99+
this.news = updates.filter(fb => !!fb).map(fb => new Article(fb));
100100
this.updateHasNews();
101101
this.updateHasUnreadNews();
102102
this.notifyPropertyChange("news", this.news);
@@ -163,6 +163,7 @@ function firebaseInit() {
163163
console.log(JSON.stringify(message));
164164

165165
let url = (<any>message).url;
166+
let id = (<any>message).id;
166167
if (url) {
167168
if (message.foreground) {
168169
dialogs.confirm({
@@ -173,7 +174,10 @@ function firebaseInit() {
173174
}).then(result => {
174175
if (result) {
175176
utils.openUrl(url);
176-
// TODO: Mark as read!!!
177+
if (id) {
178+
markAsRead(id);
179+
viewModel.news.filter(a => a.id === a.id).forEach(a => a.isRead = true);
180+
}
177181
navigator.navigateToWhatIsNew();
178182
}
179183
});

app/views/main-page/main-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { LayoutBase } from "ui/layouts/layout-base";
1919
import { RadSideDrawer } from "nativescript-telerik-ui-pro/sidedrawer";
2020
import {onAfterIntro} from "../../common/firebase";
2121

22-
export function pageLoaded(args){
22+
export function pageLoaded(args) {
2323
prof.stop("main-page");
2424
let page = <pages.Page>(<View>args.object).page;
2525
setTimeout(() => (<any>page).canEnter = true, 3500);

app/views/main-page/main-page.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,13 @@
2121
<sdp:DrawerPage.actionBar>
2222
<ActionBar automationText="ActionBar" android:opacity="0">
2323
<android>
24-
<NavigationButton icon="{{ firebase.hasUnreadNews ? 'res://ic_new' : 'res://ic_menu_main' }}" tap="showSlideout" automationText="SidebarMenu" />
24+
<NavigationButton icon="{{ firebase.hasUnreadNews ? 'res://ic_menu_main_new' : 'res://ic_menu_main' }}" tap="showSlideout" automationText="SidebarMenu" />
2525
</android>
26-
<!--<iOS>
27-
<NavigationButton icon="res://ic_back" />
28-
</iOS>-->
2926
<ActionBar.actionItems>
3027
<iOS>
3128
<ActionItem id="actionbar-menu" ios.position="left" tap="showSlideout" automationText="SidebarMenu">
3229
<ActionItem.actionView>
33-
<Image src="{{ firebase.hasUnreadNews, firebase.hasUnreadNews ? 'res://ic_new' : 'res://ic_menu_main' }}" width="22" height="22" margin="0, 8, 0, -8" />
30+
<Image src="{{ firebase.hasUnreadNews, firebase.hasUnreadNews ? 'res://ic_menu_main_new' : 'res://ic_menu_main' }}" width="22" height="22" margin="0, 8, 0, -8" />
3431
</ActionItem.actionView>
3532
</ActionItem>
3633
</iOS>

app/views/side-drawer-content/side-drawer-content.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
<GridLayout class="drawer-news-link" tap="tapWhatIsNew">
99
<GridLayout class="drawer-news-icon">
10-
<Image src="res://ic_outside_link" visibility="{{ firebase.hasUnreadNews, firebase.hasUnreadNews ? 'visible' : 'collapse' }}" width="22" height="22" horizontalAlignment="left" />
11-
<Label text="What's new" class="drawer-news-label" margin="0 22" />
10+
<Image src="res://ic_notification" visibility="{{ firebase.hasUnreadNews, firebase.hasUnreadNews ? 'visible' : 'collapse' }}" width="10" height="10" horizontalAlignment="left" />
11+
<Label text="What's new" class="drawer-news-label" margin="0 18" />
1212
</GridLayout>
1313
</GridLayout>
1414

app/views/what-is-new.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818
</ListView.itemTemplate>
1919
</ListView>
2020
<!-- New line char: &#xA; -->
21-
<Label visibility="{{ hasNews ? 'collapse' : 'visible' }}" text="Stay tuned for the latest NativeScript news here!" class="empty-placeholder" />
21+
<Label visibility="{{ hasNews ? 'collapse' : 'visible' }}" text="You need an internet access to see what's new." class="empty-placeholder" />
2222
</GridLayout>
2323
</Page>

0 commit comments

Comments
 (0)