Skip to content

Commit fdb8f3d

Browse files
committed
Directory fix
1 parent 8ced6e5 commit fdb8f3d

File tree

98 files changed

+825
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+825
-2
lines changed

Diff for: examples/horizon-nativescript-chat-app

-1
This file was deleted.

Diff for: examples/horizon-nativescript-chat-app/.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
node_modules
2+
hooks
3+
platforms
4+
.vscode
5+
6+
*.js
7+
*.map
8+
*.log

Diff for: examples/horizon-nativescript-chat-app/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="__PACKAGE__"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
7+
<supports-screens
8+
android:smallScreens="true"
9+
android:normalScreens="true"
10+
android:largeScreens="true"
11+
android:xlargeScreens="true"/>
12+
13+
<uses-sdk
14+
android:minSdkVersion="17"
15+
android:targetSdkVersion="__APILEVEL__"/>
16+
17+
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
18+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
19+
<uses-permission android:name="android.permission.INTERNET"/>
20+
21+
<application
22+
android:name="com.tns.NativeScriptApplication"
23+
android:allowBackup="true"
24+
android:icon="@drawable/icon"
25+
android:label="@string/app_name"
26+
android:theme="@style/AppTheme" >
27+
<activity
28+
android:name="com.tns.NativeScriptActivity"
29+
android:label="@string/title_activity_kimera"
30+
android:configChanges="keyboardHidden|orientation|screenSize">
31+
32+
<intent-filter>
33+
<action android:name="android.intent.action.MAIN" />
34+
35+
<category android:name="android.intent.category.LAUNCHER" />
36+
</intent-filter>
37+
</activity>
38+
<activity android:name="com.tns.ErrorReportActivity"/>
39+
</application>
40+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Add your native dependencies here:
2+
3+
// Uncomment to add recyclerview-v7 dependency
4+
//dependencies {
5+
// compile 'com.android.support:recyclerview-v7:+'
6+
//}
7+
8+
android {
9+
defaultConfig {
10+
generatedDensities = []
11+
}
12+
aaptOptions {
13+
additionalParameters "--no-version-vectors"
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>en</string>
7+
<key>CFBundleDisplayName</key>
8+
<string>${PRODUCT_NAME}</string>
9+
<key>CFBundleExecutable</key>
10+
<string>${EXECUTABLE_NAME}</string>
11+
<key>CFBundleIconFile</key>
12+
<string>icon.png</string>
13+
<key>CFBundleIcons</key>
14+
<dict>
15+
<key>CFBundlePrimaryIcon</key>
16+
<dict>
17+
<key>CFBundleIconFiles</key>
18+
<array>
19+
<string>icon-40</string>
20+
<string>icon-60</string>
21+
<string>icon-72</string>
22+
<string>icon-76</string>
23+
<string>Icon-Small</string>
24+
<string>Icon-Small-50</string>
25+
</array>
26+
<key>UIPrerenderedIcon</key>
27+
<false/>
28+
</dict>
29+
</dict>
30+
<key>CFBundleInfoDictionaryVersion</key>
31+
<string>6.0</string>
32+
<key>CFBundleName</key>
33+
<string>${PRODUCT_NAME}</string>
34+
<key>CFBundlePackageType</key>
35+
<string>APPL</string>
36+
<key>CFBundleShortVersionString</key>
37+
<string>1.0</string>
38+
<key>CFBundleSignature</key>
39+
<string>????</string>
40+
<key>CFBundleVersion</key>
41+
<string>1.0</string>
42+
<key>LSRequiresIPhoneOS</key>
43+
<true/>
44+
<key>UILaunchStoryboardName</key>
45+
<string>LaunchScreen</string>
46+
<key>UIRequiresFullScreen</key>
47+
<true/>
48+
<key>UIRequiredDeviceCapabilities</key>
49+
<array>
50+
<string>armv7</string>
51+
</array>
52+
<key>UISupportedInterfaceOrientations</key>
53+
<array>
54+
<string>UIInterfaceOrientationPortrait</string>
55+
<string>UIInterfaceOrientationLandscapeLeft</string>
56+
<string>UIInterfaceOrientationLandscapeRight</string>
57+
</array>
58+
<key>UISupportedInterfaceOrientations~ipad</key>
59+
<array>
60+
<string>UIInterfaceOrientationPortrait</string>
61+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
62+
<string>UIInterfaceOrientationLandscapeLeft</string>
63+
<string>UIInterfaceOrientationLandscapeRight</string>
64+
</array>
65+
</dict>
66+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// You can add custom settings here
2+
// for example you can uncomment the following line to force distribution code signing
3+
// CODE_SIGN_IDENTITY = iPhone Distribution
4+
// ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
5+
// ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Brand Assets;

Diff for: examples/horizon-nativescript-chat-app/app/app.css

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.title {
2+
font-size: 30;
3+
horizontal-align: center;
4+
margin: 20;
5+
}
6+
7+
.message {
8+
font-size: 20;
9+
color: #284848;
10+
horizontal-align: center;
11+
margin: 0 20;
12+
text-align: center;
13+
}

Diff for: examples/horizon-nativescript-chat-app/app/app.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import application = require("application");
2+
var moment = require("moment");
3+
4+
require('nativescript-websockets');
5+
6+
function fromNow(value:Date): any {
7+
if(value){
8+
return moment(value).fromNow();
9+
}
10+
}
11+
12+
application.resources['fromNow'] = fromNow;
13+
application.start({ moduleName: "main-page" });

Diff for: examples/horizon-nativescript-chat-app/app/config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let options = {
2+
SERVER_URL:'192.168.56.1:8181' //Genymotion
3+
}
4+
5+
export = options;
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { EventData } from "data/observable";
2+
import { Page } from "ui/page";
3+
import { HorizonDemo } from "./main-view-model";
4+
5+
// Event handler for Page "navigatingTo" event attached in main-page.xml
6+
export function navigatingTo(args: EventData) {
7+
// Get the event sender
8+
var page = <Page>args.object;
9+
page.bindingContext = new HorizonDemo();
10+
}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Page id="page" xmlns="http://schemas.nativescript.org/tns.xsd" navigatingTo="navigatingTo">
2+
<ActionBar title="Horizon {N} Chat">
3+
</ActionBar>
4+
<GridLayout rows="*,auto">
5+
<GridLayout>
6+
<ListView items="{{ messages }}" id="list">
7+
<ListView.itemTemplate>
8+
<GridLayout class="messages" columns="50,*,auto">
9+
<Image height="50" width="50" src="{{ avatar }}"></Image>
10+
<Label textWrap="true" verticalAlignment="center" col="1" text="{{ text }}"></Label>
11+
<Label verticalAlignment="top" horizontalAlignment="right" col="2" text="{{ timeStamp | fromNow }}"></Label>
12+
</GridLayout>
13+
</ListView.itemTemplate>
14+
</ListView>
15+
</GridLayout>
16+
17+
<GridLayout row="1" columns="*,auto">
18+
<TextField hint="Enter message ....." row="1" text="{{ newMessage }}"></TextField>
19+
<Button row="1" col="1" text="Send" tap="{{ addMessage }}"></Button>
20+
</GridLayout>
21+
22+
</GridLayout>
23+
</Page>
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
var Horizon = require('@horizon/client/dist/horizon-dev');
2+
import {Observable} from 'data/observable';
3+
import {ObservableArray} from 'data/observable-array';
4+
import frame = require("ui/frame");
5+
import {ListView} from 'ui/list-view';
6+
var config = require('./config');
7+
8+
const SERVER_URL = config.SERVER_URL;
9+
10+
export class HorizonDemo extends Observable {
11+
public messages: ObservableArray<any>;
12+
public newMessage: string;
13+
private horizon;
14+
private chat;
15+
private avatar_url = `http://api.adorable.io/avatars/50/${new Date().getMilliseconds()}.png`;
16+
17+
constructor() {
18+
super();
19+
this.messages = new ObservableArray();
20+
21+
this.horizon = new Horizon({ host: SERVER_URL });
22+
23+
this.horizon.onReady()
24+
.subscribe(status => { console.log(status.type) })
25+
26+
this.horizon.onDisconnected()
27+
.subscribe(status => { console.log(status.type) })
28+
29+
this.horizon.onSocketError()
30+
.subscribe(status => { console.log(status.type) })
31+
32+
this.chat = this.horizon('messages');
33+
34+
this.getChats().subscribe((newMessage: any) => {
35+
newMessage.map((val,index)=>{
36+
this.messages.setItem(index,val);
37+
});
38+
this.messages.reverse();
39+
});
40+
}
41+
42+
private getChats() {
43+
return this.chat
44+
.order('timeStamp', 'descending')
45+
.limit(10)
46+
.watch();
47+
}
48+
49+
public addMessage() {
50+
this.chat
51+
.store({
52+
text: this.newMessage,
53+
timeStamp: new Date(),
54+
avatar: this.avatar_url,
55+
}).subscribe((res) => {
56+
console.log(`Adding new message:`);
57+
let lv = <ListView>frame.topmost().getViewById('list');
58+
lv.scrollToIndex(this.messages.length - 1);
59+
},
60+
(error) => { console.log(error) });
61+
this.set('newMessage', '');
62+
}
63+
64+
private getStatus() {
65+
return this.horizon.status();
66+
}
67+
}
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "tns-template-hello-world-ts",
3+
"main": "app.js",
4+
"version": "2.0.0",
5+
"author": "Telerik <[email protected]>",
6+
"description": "Nativescript hello-world-ts project template",
7+
"license": "Apache-2.0",
8+
"keywords": [
9+
"telerik",
10+
"mobile",
11+
"nativescript",
12+
"{N}",
13+
"tns",
14+
"appbuilder",
15+
"template"
16+
],
17+
"repository": {
18+
"type": "git",
19+
"url": "[email protected]:NativeScript/template-hello-world-ts.git"
20+
},
21+
"bugs": {
22+
"url": "https://github.com/NativeScript/template-hello-world-ts/issues"
23+
},
24+
"homepage": "https://github.com/NativeScript/template-hello-world-ts",
25+
"android": {
26+
"v8Flags": "--expose_gc"
27+
},
28+
"devDependencies": {
29+
"nativescript-dev-typescript": "^0.3.0"
30+
}
31+
}

Diff for: examples/horizon-nativescript-chat-app/package.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"description": "NativeScript Application",
3+
"license": "SEE LICENSE IN <your-license-filename>",
4+
"readme": "NativeScript Application",
5+
"repository": "<fill-your-repository-here>",
6+
"nativescript": {
7+
"id": "org.nativescript.nativescriptchatapp",
8+
"tns-android": {
9+
"version": "2.0.0"
10+
},
11+
"tns-ios": {
12+
"version": "2.0.0"
13+
}
14+
},
15+
"dependencies": {
16+
"@horizon/client": "^1.0.1",
17+
"moment": "^2.13.0",
18+
"nativescript-websockets": "1.2.1",
19+
"tns-core-modules": "2.0.1"
20+
},
21+
"devDependencies": {
22+
"babel-traverse": "6.9.0",
23+
"babel-types": "6.9.0",
24+
"babylon": "6.8.0",
25+
"filewalker": "0.1.2",
26+
"lazy": "1.0.11",
27+
"nativescript-dev-typescript": "^0.3.0",
28+
"typescript": "^1.8.10"
29+
}
30+
}
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation.

Diff for: examples/horizon-nativescript-chat-app/tsconfig.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es5",
5+
"sourceMap": true,
6+
"experimentalDecorators": true,
7+
"emitDecoratorMetadata": true,
8+
"noEmitHelpers": true,
9+
"noEmitOnError": true
10+
},
11+
"exclude": [
12+
"node_modules",
13+
"platforms"
14+
]
15+
}

Diff for: examples/horizon-nativescript-ng2-chat-app

-1
This file was deleted.

0 commit comments

Comments
 (0)