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

Commit

Permalink
refactor: removed Telerik Analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
NickIliev committed May 30, 2018
1 parent f53077e commit b2df4c2
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 131 deletions.
12 changes: 3 additions & 9 deletions README.md
Expand Up @@ -8,7 +8,7 @@ You will find here the most common mobile use cases implemented - Data visualiza
![](https://d2odgkulk9w7if.cloudfront.net/images/default-source/default-album/01-2-home-wrapview.png?sfvrsn=0)
![](https://d2odgkulk9w7if.cloudfront.net/images/default-source/default-album/03-1-layouts-ios.png?sfvrsn=0)

The application also serves as a demo for the paid UI components created by Telerik called "[UI for NativeScript](https://www.npmjs.com/package/nativescript-telerik-ui)".
The application also serves as a demo for the paid UI components created by Telerik called "[UI for NativeScript](https://docs.telerik.com/devtools/nativescript-ui/introduction)".

You can use the application to see NativeScript in action, but also as a learning purpose since the entire source code is available in this repo.

Expand Down Expand Up @@ -37,17 +37,11 @@ For more news about NativeScript, please [follow our Twitter account](http://twi
![](https://ga-beacon.appspot.com/UA-111455-24/nativescript/marketplace-demo?pixel)


# Enable Analytics
Analytics is set in place but requires an API key to be enabled.
Just place an `"analyticsAppId": "****************"` key in the `app/package.json`.
For more information check the plugin in npmjs.com: https://www.npmjs.com/package/nativescript-telerik-analytics

# Performance

Start for latest version published on GooglePlay and AppStore.

## App Size
Android APK: 27.8 MB
Android APK: ~27.8 MB

## First start
Android (Nexus5): 2.8s
Android (Nexus 5x): ~1.4s
51 changes: 0 additions & 51 deletions app/common/analytics.ts

This file was deleted.

2 changes: 1 addition & 1 deletion app/common/firebase.ts
@@ -1,7 +1,7 @@
import * as application from "application";
import * as utils from "utils/utils";
import * as dialogs from "ui/dialogs";
import {isAndroid, isIOS} from "platform";
import { isAndroid, isIOS } from "platform";
import * as settings from "application-settings";
import { Observable } from "data/observable";
import * as navigator from "../common/navigator";
Expand Down
5 changes: 1 addition & 4 deletions app/common/navigator.ts
Expand Up @@ -5,14 +5,11 @@ import * as frame from "ui/frame";
import * as viewModule from "ui/core/view";
import * as platform from "platform";
import * as prof from "../common/profiling";
import * as analytics from "./analytics";
import * as utils from "utils/utils";
import { isIOS, isAndroid } from "platform";

function traceNavigateTo(to: string, context?: string): string {
var eventText = "Navigate to: " + to + (context ? " (" + context + ")" : "");
console.log("Track: " + eventText);
analytics.trackEvent(eventText);
var eventText = "Navigate to: " + to + (context ? " (" + context + ")" : ""); // this can be used for analytics
return to;
}

Expand Down
2 changes: 0 additions & 2 deletions app/examples/conference-agenda/conference-view-model.ts
Expand Up @@ -78,8 +78,6 @@ var allSessions: Array<Session> = [
new Session("Using Kendo UI in SharePoint/Office 365",
new Date(2015, 5, 5, 10, 45), new Date(2015, 5, 5, 11, 30), "room 2", false),

new Session("Improving Applications with Telerik Analytics",
new Date(2015, 5, 5, 11, 45), new Date(2015, 5, 5, 12, 30), "room 1", true),
new Session("Building Offline Ready Mobile Apps",
new Date(2015, 5, 5, 11, 45), new Date(2015, 5, 5, 12, 30), "room 2", false),

Expand Down
5 changes: 1 addition & 4 deletions app/package.json
Expand Up @@ -24,8 +24,5 @@
"bugs": {
"url": "https://github.com/NativeScript/template-hello-world/issues"
},
"homepage": "https://github.com/NativeScript/template-hello-world",
"analyticsAppId": "8j1r6y3d6fnd5yeo",
"analyticsProductKeyAndroid": "8c086e8562544cc9b378eb4b0505da4a",
"_test_analyticsProductKeyAndroid": "ce16628c49a54cd69bcd606ccc1db42e"
"homepage": "https://github.com/NativeScript/template-hello-world"
}
109 changes: 51 additions & 58 deletions app/views/main-page/main-page.tsx
Expand Up @@ -11,7 +11,6 @@ import * as prof from "../../common/profiling";
import { Color } from "color";
import { View } from "ui/core/view";
import { grayTouch } from "../../common/effects";
import { trackEvent } from "../../common/analytics";
import * as platform from "platform";
import { Image } from "ui/image";
import { Label } from "ui/label";
Expand All @@ -36,11 +35,6 @@ export function onLoaded(args) {
createExamplesContent(page);
(page as any).canEnter = true;
}, 3500);

if (!(page as any).introStarted) {
trackEvent("main-page: play intro");
(page as any).introStarted = true;
}
}

export function onNavigatingTo(args: observable.EventData) {
Expand Down Expand Up @@ -117,7 +111,6 @@ export function enter(args, event) {
if ((page as any).entered) {
return;
}
trackEvent(event);
(page as any).entered = true;
let content = page.getViewById<View>("content");
content.isEnabled = true;
Expand All @@ -140,7 +133,7 @@ function startExamplesAnimation(page: Page) {
let timeout = 1000;
setTimeout(() => (page as any).introPlayed = true, timeout);
let classSetterFactory = (child, className) => () => child.className = className;

for (let i = 0, length = examplesList.getChildrenCount(); i < length; i++) {
let child = examplesList.getChildAt(i);
setTimeout(classSetterFactory(child, odd ? "example-odd-enter" : "example-even-enter"), timeout);
Expand Down Expand Up @@ -171,15 +164,15 @@ function showActionBar(page: Page) {

function createExamplesContent(page: Page) {
const itemsLayout = <WrapLayout id="examples-wrap-layout"
horizontalAlignment="left"
itemWidth={isAndroid ? "{{ (screenWidth - 20) / 2 }}" : "{{ (screenWidth - 13) / 2 }}"}
itemHeight={isAndroid ? "{{ (screenWidth - 20) * 0.5 + 50 }}" : "{{ (screenWidth - 13) * 0.5 + 50 }}"} />
horizontalAlignment="left"
itemWidth={isAndroid ? "{{ (screenWidth - 20) / 2 }}" : "{{ (screenWidth - 13) / 2 }}"}
itemHeight={isAndroid ? "{{ (screenWidth - 20) * 0.5 + 50 }}" : "{{ (screenWidth - 13) * 0.5 + 50 }}"} />

const itemTemplate = () => <GridLayout class="example-intro" margin="6" rows="* 54" backgroundColor="white" touch="tileTouch" onTap={navigateToExample} automationText="{{ title }}">
<Image src="{{ image }}" stretch="aspectFill" loadMode="async" />
<Label row="1" textWrap="true" horizontalAlignment="center" verticalAlignment="center" text="{{ title }}" class="example-label" />
<Image src="res://ic_new" visibility="{{ isNew ? 'visible' : 'collapsed' }}" stretch="none" class="example-new" loadMode="async" />
</GridLayout>;
<Image src="{{ image }}" stretch="aspectFill" loadMode="async" />
<Label row="1" textWrap="true" horizontalAlignment="center" verticalAlignment="center" text="{{ title }}" class="example-label" />
<Image src="res://ic_new" visibility="{{ isNew ? 'visible' : 'collapsed' }}" stretch="none" class="example-new" loadMode="async" />
</GridLayout>;

const examples = <GridLayout class="page-content" margin={isAndroid ? "74 0 0 0" : "0"}>
<ScrollView id="content" opacity={0}>
Expand All @@ -205,49 +198,49 @@ function createDrawerContent(args) {
export const createPage = () => {
const mainContent = <GridLayout id="content-root">
<GridLayout id="intro-elements" onTap={enter}>
<GridLayout id="intro-background" class="intro-background-intro" originY="0"/>
<GridLayout id="intro-background" class="intro-background-intro" originY="0" />

<GridLayout id="intro-logo-bg" class="intro-logo-bg-intro" backgroundColor="#3C5AFD" width="93" height="93" horizontalAlignment="center" verticalAlignment="center" borderRadius="20" />
<GridLayout id="intro-logo-n" class="intro-logo-n-intro" backgroundImage="res://logo_blue_bg" width="93" height="93" horizontalAlignment="center" verticalAlignment="center" />
<GridLayout id="intro-logo-ns" class="intro-logo-ns-intro" backgroundImage="res://logo_text" width="199" height="31" horizontalAlignment="center" verticalAlignment="center" margin="160 0 0 0" />

<Label id="intro-text-one"
class="intro-text-one-intro"
text="Build truly&#xA;native apps with&#xA;JavaScript"
fontSize="37"
horizontalAlignment="center"
verticalAlignment="center"
textWrap="true"
color="white"
textAlignment="center" />
class="intro-text-one-intro"
text="Build truly&#xA;native apps with&#xA;JavaScript"
fontSize="37"
horizontalAlignment="center"
verticalAlignment="center"
textWrap="true"
color="white"
textAlignment="center" />
<Label id="intro-text-two"
class="intro-text-two-intro"
text="Develop native cross platform&#xA;apps from a single code base"
fontSize="19"
horizontalAlignment="center"
verticalAlignment="center"
textWrap="true"
color="#8DA1AB"
textAlignment="center" />
class="intro-text-two-intro"
text="Develop native cross platform&#xA;apps from a single code base"
fontSize="19"
horizontalAlignment="center"
verticalAlignment="center"
textWrap="true"
color="#8DA1AB"
textAlignment="center" />

<Button id="intro-get-started"
class="intro-get-started-intro"
text="GET STARTED"
backgroundColor="#1DBE67"
color="white"
borderRadius="25"
height="50"
width="234"
fontSize="18"
tap={tapGetStarted}/>
class="intro-get-started-intro"
text="GET STARTED"
backgroundColor="#1DBE67"
color="white"
borderRadius="25"
height="50"
width="234"
fontSize="18"
tap={tapGetStarted} />
<Label id="intro-version"
class="intro-version-intro"
text="version 4.0.0"
fontSize="14"
horizontalAlignment="center"
verticalAlignment="center"
color="white"
textAlignment="center" />
class="intro-version-intro"
text="version 4.0.0"
fontSize="14"
horizontalAlignment="center"
verticalAlignment="center"
color="white"
textAlignment="center" />
</GridLayout>
</GridLayout>;

Expand All @@ -265,7 +258,7 @@ export const createPage = () => {
<GridLayout>
<Image id="actionbar-logo" src="res://logo_main" stretch="none" width="130" height="32" margin="6 0 0 0" />
</GridLayout>
</ActionBar>;
</ActionBar>;
actionBar.actionItems.addItem(<ActionItem id="actionbar-menu" position="left" automationText="SidebarMenu">
<Image src="{{ firebase.hasUnreadNews, firebase.hasUnreadNews ? 'res://ic_menu_main_new' : 'res://ic_menu_main' }}" width="22" height="22" margin="0, 8, 0, -8" />
</ActionItem>);
Expand All @@ -275,21 +268,21 @@ export const createPage = () => {
const drawerContent = <GridLayout margin={isAndroid ? "74 0 0 0" : "0"} />;

const page = <Page
class="qsf-page"
onNavigatingTo={onNavigatingTo}
onLoaded={onLoaded}
backgroundSpanUnderStatusBar="true"
actionBarHidden={isIOS}
onTap={tapPage}
actionBar={actionBar}>
class="qsf-page"
onNavigatingTo={onNavigatingTo}
onLoaded={onLoaded}
backgroundSpanUnderStatusBar="true"
actionBarHidden={isIOS}
onTap={tapPage}
actionBar={actionBar}>
<RadSideDrawer id="side-drawer"
margin={isAndroid ? "-74 0 0 0" : "0"}
mainContent={mainContent}
drawerContent={drawerContent}
showOverNavigation={true}
drawerSize={260}
onDrawerOpening={createDrawerContent}
drawerPan={createDrawerContent}/>
drawerPan={createDrawerContent} />
</Page>;

return page;
Expand Down
2 changes: 1 addition & 1 deletion app/views/side-drawer-content/side-drawer-content.xml
Expand Up @@ -5,7 +5,7 @@
<Button text="Home" tap="tapHome" class="drawer-button" />
<Button text="About" tap="tapAbout" class="drawer-button" />

<GridLayout class="drawer-news-link" tap="tapWhatIsNew">
<GridLayout class="drawer-news-link" tap="tapWhatIsNew" visibility="{{ firebase.hasUnreadNews, (firebase && firebase.hasUnreadNews) ? 'visible' : 'collapse' }}">
<GridLayout class="drawer-news-icon">
<Image src="res://ic_notification" opacity="{{ firebase.hasUnreadNews, (firebase && firebase.hasUnreadNews) ? 1 : 0 }}" width="10" height="10" horizontalAlignment="left" />
<Label text="What's new" class="drawer-news-label" margin="0 18" />
Expand Down
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -13,7 +13,6 @@
"nativescript-fresco": "~3.0.7",
"nativescript-iqkeyboardmanager": "~1.3.0",
"nativescript-plugin-firebase": "^6.0.2",
"nativescript-telerik-analytics": "~1.0.8",
"nativescript-tsx": "0.0.7",
"nativescript-ui-chart": "~3.6.1",
"nativescript-ui-dataform": "~3.6.0",
Expand Down

0 comments on commit b2df4c2

Please sign in to comment.