Skip to content
Open
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
1 change: 1 addition & 0 deletions demo/app/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
2 changes: 2 additions & 0 deletions demo/app/main-page.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as observable from 'data/observable';
export declare function pageLoaded(args: observable.EventData): void;
5 changes: 5 additions & 0 deletions demo/app/main-view-model.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Observable } from 'data/observable';
export declare class HelloWorldModel extends Observable {
message: string;
constructor();
}
40 changes: 20 additions & 20 deletions lib/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ var appRoot = "../../";
* Create dev tools gradle runtime entry
*/
function writeFabricServiceGradleHook() {
console.log("Install Onesignal-build-gradle hook.");
try {
if (!fs.existsSync(path.join(appRoot, "hooks"))) {
fs.mkdirSync(path.join(appRoot, "hooks"));
}
if (!fs.existsSync(path.join(appRoot, "hooks", "after-prepare"))) {
fs.mkdirSync(path.join(appRoot, "hooks", "after-prepare"));
}
var scriptContent =
`
console.log("Install Onesignal-build-gradle hook.");
try {
if (!fs.existsSync(path.join(appRoot, "hooks"))) {
fs.mkdirSync(path.join(appRoot, "hooks"));
}
if (!fs.existsSync(path.join(appRoot, "hooks", "after-prepare"))) {
fs.mkdirSync(path.join(appRoot, "hooks", "after-prepare"));
}
var scriptContent =
`
var path = require("path");
var fs = require("fs");
module.exports = function($logger, $projectData, hookArgs) {
var platform = hookArgs.platform.toLowerCase();
var platform = (hookArgs.platform || (hookArgs.prepareData && hookArgs.prepareData.platform)).toLowerCase();

function updateAppGradleScript(file) {
var appBuildGradleContent = fs.readFileSync(file).toString();
Expand Down Expand Up @@ -102,14 +102,14 @@ module.exports = function($logger, $projectData, hookArgs) {
};

`;
console.log("Writing 'nativescript-onesignal-gradle.js' to " + appRoot + "hooks/after-prepare");
var scriptPath = path.join(appRoot, "hooks", "after-prepare", "nativescript-onesignal-gradle.js");
fs.writeFileSync(scriptPath, scriptContent);
} catch (e) {
console.log("Failed to install nativescript-onesignal-gradle hook.");
console.log(e);
throw e;
}
console.log("Writing 'nativescript-onesignal-gradle.js' to " + appRoot + "hooks/after-prepare");
var scriptPath = path.join(appRoot, "hooks", "after-prepare", "nativescript-onesignal-gradle.js");
fs.writeFileSync(scriptPath, scriptContent);
} catch (e) {
console.log("Failed to install nativescript-onesignal-gradle hook.");
console.log(e);
throw e;
}
}

writeFabricServiceGradleHook();
writeFabricServiceGradleHook();
128 changes: 128 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 53 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
{
"name": "nativescript-onesignal",
"version": "1.0.8",
"description": "A Nativescript plugin for OneSignal's Push Notifications SDK",
"main": "onesignal",
"typings": "index.d.ts",
"nativescript": {
"platforms": {
"android": "2.2.0",
"ios": "2.2.1"
}
},
"repository": {
"type": "git",
"url": "https://github.com/roblav96/nativescript-onesignal.git"
},
"keywords": [
"nativescript",
"onesignal",
"ecosystem:nativescript",
"nativescript-android",
"nativescript-ios"
],
"author": {
"name": "Rob Laverty",
"email": "roblav96@gmail.com"
},
"license": {
"type": "MIT",
"url": "https://github.com/roblav96/nativescript-onesignal/blob/master/LICENSE"
},
"bugs": {
"url": "https://github.com/roblav96/nativescript-onesignal/issues"
},
"homepage": "https://github.com/roblav96/nativescript-onesignal",
"readmeFilename": "README.md",
"scripts": {
"build": "tsc",
"demo.ios": "npm run preparedemo && cd demo && tns run ios",
"demo.android": "npm run preparedemo && cd demo && tns run android",
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-onesignal && tns plugin add .. && tns install",
"setup": "npm i && cd demo && npm i && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
"postinstall": "node postinstall-hooks.js && node lib/postinstall.js",
"preuninstall": "node preuninstall-hooks.js"
},
"devDependencies": {
"tns-core-modules": "^2.2.0",
"tns-platform-declarations": "^2.2.0",
"typescript": "^1.8.10"
},
"dependencies": {
"nativescript-hook": "^0.2.4"
}
}
"name": "nativescript-onesignal",
"version": "1.0.8",
"description": "A Nativescript plugin for OneSignal's Push Notifications SDK",
"main": "onesignal",
"typings": "index.d.ts",
"nativescript": {
"platforms": {
"android": "2.2.0",
"ios": "2.2.1"
}
},
"repository": {
"type": "git",
"url": "https://github.com/roblav96/nativescript-onesignal.git"
},
"keywords": [
"nativescript",
"onesignal",
"ecosystem:nativescript",
"nativescript-android",
"nativescript-ios"
],
"author": {
"name": "Rob Laverty",
"email": "roblav96@gmail.com"
},
"license": {
"type": "MIT",
"url": "https://github.com/roblav96/nativescript-onesignal/blob/master/LICENSE"
},
"bugs": {
"url": "https://github.com/roblav96/nativescript-onesignal/issues"
},
"homepage": "https://github.com/roblav96/nativescript-onesignal",
"readmeFilename": "README.md",
"scripts": {
"build": "tsc",
"demo.ios": "npm run preparedemo && cd demo && tns run ios",
"demo.android": "npm run preparedemo && cd demo && tns run android",
"preparedemo": "npm run build && cd demo && tns plugin remove nativescript-onesignal && tns plugin add .. && tns install",
"setup": "npm i && cd demo && npm i && cd .. && npm run build && cd demo && tns plugin add .. && cd ..",
"postinstall": "node postinstall-hooks.js && node lib/postinstall.js",
"preuninstall": "node preuninstall-hooks.js"
},
"devDependencies": {
"tns-core-modules": "^2.2.0",
"tns-platform-declarations": "^2.2.0",
"typescript": "^1.8.10"
},
"dependencies": {
"nativescript-hook": "^0.2.4"
}
}
3 changes: 3 additions & 0 deletions references.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/// <reference path="node_modules/tns-core-modules/tns-core-modules.d.ts"/>
/// <reference path="node_modules/tns-platform-declarations/android.d.ts" />
/// <reference path="node_modules/tns-platform-declarations/ios.d.ts" />
31 changes: 14 additions & 17 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"removeComments": true,
"experimentalDecorators": true,
"noEmitHelpers": true,
"noEmitOnError": false,
"declaration": true
},
"files": [
"node_modules/tns-core-modules/tns-core-modules.d.ts",
"node_modules/tns-platform-declarations/android.d.ts",
"node_modules/tns-platform-declarations/ios.d.ts",
"onesignal.android.ts",
"onesignal.ios.ts"
],
"compileOnSave": false
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"removeComments": true,
"experimentalDecorators": true,
"noEmitHelpers": true,
"noEmitOnError": false,
"declaration": true,
"rootDir": ".",
"baseUrl": ".",
"lib": ["es6", "DOM"]
},
"exclude": ["node_modules", "demo"],
"compileOnSave": false
}