-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matt Green
authored and
Matt Green
committed
Jan 17, 2016
1 parent
6347e32
commit 9bdcf7f
Showing
14 changed files
with
276 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "0.1.0", | ||
"command": "tsc", | ||
"isShellCommand": true, | ||
// Show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
"args": [], | ||
// use the standard tsc problem matcher to find compile problems | ||
// in the output. | ||
"problemMatcher": "$tsc" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import frame = require("ui/frame"); | ||
import application = require("application"); | ||
|
||
if(application.android) { | ||
application.onLaunch = function (intent) { | ||
console.log("onLaunch"); | ||
|
||
application.android.onActivityStarted = function (activity) { | ||
console.log("onStarted"); | ||
var window = activity.getWindow(); | ||
if (window) { | ||
window.setBackgroundDrawable(null); | ||
} | ||
} | ||
} | ||
} | ||
|
||
if (application.ios) { | ||
application.on("launch", args => { | ||
// TODO: It would be nice if this was ios-specific property on the action bar and static property on application.ios. | ||
//UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.UIStatusBarStyleLightContent; | ||
setTimeout(() => { | ||
//UIApplication.sharedApplication().keyWindow.backgroundColor = UIColor.blackColor(); | ||
}, 1); | ||
}); | ||
} | ||
|
||
application.mainModule = "pages/startPage"; | ||
// application.mainModule = "profile-main"; | ||
application.start(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {Observable} from "data/observable" | ||
// var observable = require("data/observable"); | ||
// var HelloWorldModel = (function (_super) { | ||
// __extends(HelloWorldModel, _super); | ||
// function HelloWorldModel() { | ||
// _super.call(this); | ||
// this.counter = 42; | ||
// this.set("message", this.counter + " taps left"); | ||
// } | ||
// HelloWorldModel.prototype.tapAction = function () { | ||
// this.counter--; | ||
// if (this.counter <= 0) { | ||
// this.set("message", "Hoorraaay! You unlocked the NativeScript clicker achievement!"); | ||
// } | ||
// else { | ||
// this.set("message", this.counter + " taps left"); | ||
// } | ||
// }; | ||
// return HelloWorldModel; | ||
// })(observable.Observable); | ||
// exports.HelloWorldModel = HelloWorldModel; | ||
// exports.mainViewModel = new HelloWorldModel(); | ||
|
||
export class MainPageViewModel extends Observable | ||
{ | ||
constructor() | ||
{ | ||
super(); | ||
} | ||
|
||
public tapAction() | ||
{ | ||
this.set | ||
} | ||
} | ||
|
||
//var vmModule = require("./main-view-model"); | ||
function pageLoaded(args) { | ||
var page = args.object; | ||
var vm = new MainPageViewModel(); | ||
page.bindingContext =vm; | ||
} | ||
exports.pageLoaded = pageLoaded; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
var path = require("path"); | ||
var fs = require("fs"); | ||
|
||
module.exports = function (grunt) { | ||
grunt.loadNpmTasks('grunt-ts'); | ||
grunt.loadNpmTasks('grunt-contrib-copy'); | ||
grunt.loadNpmTasks('grunt-contrib-clean'); | ||
grunt.loadNpmTasks('grunt-shell'); | ||
|
||
var nsDistPath = process.env.NSDIST || './deps/NativeScript/bin/dist'; | ||
|
||
var androidAvd = grunt.option('avd') || "nexus" | ||
var genyDevice = grunt.option('geny') || "nexus7" | ||
var iOSDevice = grunt.option('device') || "iPhone-6" | ||
var androidPlatfrom = "platforms/android/"; | ||
|
||
var hasAndroidPlatform = false; | ||
try { | ||
hasAndroidPlatform = fs.statSync(androidPlatfrom) && fs.statSync(androidPlatfrom).isDirectory(); | ||
} | ||
catch (e) { | ||
// ... | ||
} | ||
|
||
grunt.initConfig({ | ||
ts: { | ||
build: { | ||
tsconfig: './app/tsconfig.json', | ||
options: { | ||
fast: "never", | ||
compiler: "node_modules/typescript/bin/tsc" | ||
}, | ||
}, | ||
}, | ||
copy: { | ||
widgets: { | ||
src: "widgets.jar", | ||
dest: path.join(androidPlatfrom, "libs") + "/", | ||
cwd: "deps/android-widgets", | ||
expand: true | ||
}, | ||
localInstallModules: { | ||
src: "<%= nsPackagePath %>", | ||
dest: "deps/tns-core-modules.tgz" | ||
} | ||
}, | ||
clean: { | ||
app: { | ||
cwd: 'app', | ||
expand: true, | ||
src: [ | ||
'**/*.js', | ||
'**/*.map', | ||
] | ||
}, | ||
nodeModulesGz: { | ||
// HACK: Work around a {N} CLI bug that prevents you from using | ||
// NPM packages containing *.gz files. | ||
// https://github.com/NativeScript/nativescript-cli/issues/393 | ||
expand: true, | ||
cwd: './node_modules', | ||
src: [ | ||
'**/*.gz', | ||
] | ||
}, | ||
}, | ||
shell: { | ||
depNSInit: { | ||
command: [ | ||
'npm install', | ||
'grunt --no-runtslint', | ||
].join('&&'), | ||
options: { | ||
execOptions: { | ||
cwd: 'deps/NativeScript', | ||
} | ||
} | ||
}, | ||
localInstallModules: { | ||
command: "npm install 'deps/tns-core-modules.tgz'" | ||
}, | ||
emulateGeny: { | ||
command: "tns emulate android --geny '" + genyDevice + "'" | ||
}, | ||
emulateAndroid: { | ||
command: "tns emulate android --avd '" + androidAvd + "'" | ||
}, | ||
emulateIOS: { | ||
command: "tns emulate ios --device '" + iOSDevice + "'" | ||
}, | ||
removeAndroid: { | ||
command: "tns platform remove android" | ||
}, | ||
addAndroid: { | ||
command: "tns platform add android" | ||
} | ||
} | ||
}); | ||
|
||
grunt.registerTask("updateModules", [ | ||
"getNSPackage", | ||
"copy:localInstallModules", | ||
"shell:localInstallModules", | ||
]); | ||
|
||
grunt.registerTask("getNSPackage", function () { | ||
var packageFiles = grunt.file.expand({ | ||
cwd: nsDistPath | ||
}, [ | ||
'tns-core-modules*.tgz' | ||
]); | ||
var nsPackagePath = path.join(nsDistPath, packageFiles[0]); | ||
grunt.config('nsPackagePath', nsPackagePath); | ||
}); | ||
|
||
grunt.registerTask("app", [ | ||
"ts:build", | ||
]); | ||
|
||
// Copy custom version of widgets.jar to be up to date | ||
grunt.registerTask("fix-android-widgets", hasAndroidPlatform ? ["copy:widgets"] : []) | ||
grunt.registerTask("prepare", [ | ||
"shell:depNSInit", | ||
"updateModules", | ||
"clean:nodeModulesGz", | ||
"fix-android-widgets" | ||
]); | ||
|
||
grunt.registerTask("app-full", [ | ||
"clean:app", | ||
"app", | ||
]); | ||
|
||
grunt.registerTask("refresh-android", ["shell:removeAndroid", "shell:addAndroid", "fix-android-widgets"]) | ||
grunt.registerTask("run-android", ["app", "shell:emulateAndroid"]) | ||
grunt.registerTask("run-ios", ["app", "shell:emulateIOS"]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("nativescript-dev-typescript/lib/before-prepare.js"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require("nativescript-dev-typescript/lib/watch.js"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" /> Needed for autocompletion and compilation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "es5", | ||
"inlineSourceMap": true, | ||
"experimentalDecorators": true, | ||
"noEmitHelpers": true | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"platforms" | ||
] | ||
} |