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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ First, import the plugin into your provider/component, and, since the plugin ret

```javascript
import { Zeroconf } from 'nativescript-zeroconf';
import { Observable, PropertyChangeData } from 'tns-core-modules/data/observable';
import { Observable, PropertyChangeData } from '@nativescript/core';
```

Then, instantiate a Zeroconf and define the event listeners:
Expand Down
2 changes: 1 addition & 1 deletion demo-angular/src/app/zeroconf/zeroconf.provider.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { EventEmitter, Injectable } from '@angular/core';
import { Observable, PropertyChangeData } from 'tns-core-modules/data/observable';
import { Observable, PropertyChangeData } from '@nativescript/core';

import { Zeroconf } from 'nativescript-zeroconf';

Expand Down
14,376 changes: 14,319 additions & 57 deletions publish/package-lock.json

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion publish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"version": "1.0.0",
"description": "Publish helper",
"devDependencies": {
"@nativescript/core": "~7.0.0",
"@nativescript/types": "~7.0.0",
"@nativescript/webpack": "^4.0.1",
"ncp": "^2.0.0",
"rimraf": "^2.5.0"
"rimraf": "^2.5.0",
"typescript": "^3.9.7"
}
}
7,009 changes: 6,772 additions & 237 deletions src/package-lock.json

Large diffs are not rendered by default.

170 changes: 97 additions & 73 deletions src/package.json
Original file line number Diff line number Diff line change
@@ -1,78 +1,102 @@
{
"_from": "nativescript-zeroconf@^1.0.4",
"_id": "nativescript-zeroconf@1.0.4",
"_inBundle": false,
"_integrity": "sha512-2GsbmT9oYzspHM0WbXZeemfi8bJxcSg8JSnfQMnFgvO2WMv3h7gwGh/cspKNxkcPwDxYQbkVIm9atIm2nNwD4Q==",
"_location": "/nativescript-zeroconf",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "nativescript-zeroconf@^1.0.4",
"name": "nativescript-zeroconf",
"version": "1.0.4",
"description": "Zeroconf/Bonjour implementation for NativeScript",
"main": "zeroconf",
"repository": {
"type": "git",
"url": "git+https://github.com/abhayastudios/nativescript-zeroconf.git"
"escapedName": "nativescript-zeroconf",
"rawSpec": "^1.0.4",
"saveSpec": null,
"fetchSpec": "^1.0.4"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/nativescript-zeroconf/-/nativescript-zeroconf-1.0.4.tgz",
"_shasum": "6668644a912dfb4dbe6069028330c84e264f125a",
"_spec": "nativescript-zeroconf@^1.0.4",
"_where": "/Users/mattgilpin/Documents/work/visitor-android",
"author": {
"name": "Jonathan Salomon",
"email": "mail2joni@gmail.com"
},
"bootstrapper": "nativescript-plugin-seed",
"bugs": {
"url": "https://github.com/abhayastudios/nativescript-zeroconf/issues"
},
"bundleDependencies": false,
"dependencies": {
"async": "^2.6.0"
},
"deprecated": false,
"description": "Zeroconf/Bonjour implementation for NativeScript",
"devDependencies": {
"prompt": "^1.0.0",
"rimraf": "^2.5.0",
"tns-core-modules": "^3.1.0",
"tns-platform-declarations": "^3.1.0",
"tslint": "^5.0.0",
"typescript": "~2.3.0"
},
"homepage": "https://github.com/abhayastudios/nativescript-zeroconf",
"keywords": [
"NativeScript",
"JavaScript",
"Android",
"iOS",
"Zeroconf",
"Zero-conf",
"Zero Conf",
"Bonjour",
"mDNS",
"Ahavi"
],
"license": "MIT",
"main": "zeroconf",
"name": "nativescript-zeroconf",
"nativescript": {
"platforms": {
"android": "3.0.0",
"ios": "3.0.0"
},
"typings": "index.d.ts",
"nativescript": {
"platforms": {
"android": "3.0.0",
"ios": "3.0.0"
},
"plugin": {
"nan": "true",
"pan": "true",
"core3": "true",
"webpack": "true",
"wrapper": "false",
"category": "Processing"
},
"demong": "/demo-angular"
"plugin": {
"nan": "true",
"pan": "true",
"core3": "true",
"webpack": "true",
"wrapper": "false",
"category": "Processing"
},
"scripts": {
"tsc": "tsc -skipLibCheck",
"build": "npm i && tsc",
"postclone": "npm i && node scripts/postclone.js && cd ../demo-angular && npm i && cd ../src && npm run plugin.link",
"test.android": "npm i && npm run tsc && npm run tslint && cd ../demo-angular && tns build android && tns test android --justlaunch",
"test.ios": "npm i && npm run tsc && npm run tslint && cd ../demo-angular && tns build ios && tns test ios --justlaunch",
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\"",
"plugin.link": "npm link && cd ../demo-angular && npm link nativescript-zeroconf && cd ../src",
"plugin.tscwatch": "npm run tsc -- -w",
"demo.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios --syncAllFiles",
"demo.ios.debug": "npm i && npm run tsc && cd ../demo-angular && tns debug ios --syncAllFiles --inspector",
"demo.android": "npm i && npm run tsc && cd ../demo-angular && tns run android --syncAllFiles",
"demo.android.debug": "npm i && npm run tsc && cd ../demo-angular && tns debug android --syncAllFiles",
"demo.reset": "cd ../demo-angular && rimraf platforms",
"plugin.prepare": "npm run tsc && cd ../demo-angular && tns plugin remove nativescript-zeroconf && tns plugin add ../src",
"clean": "cd ../demo-angular && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.link",
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'"
},
"keywords": [
"NativeScript",
"JavaScript",
"Android",
"iOS",
"Zeroconf",
"Zero-conf",
"Zero Conf",
"Bonjour",
"mDNS",
"Ahavi"
],
"author": {
"name": "Jonathan Salomon",
"email": "mail2joni@gmail.com"
},
"bugs": {
"url": "https://github.com/abhayastudios/nativescript-zeroconf/issues"
},
"license": "MIT",
"homepage": "https://github.com/abhayastudios/nativescript-zeroconf",
"readmeFilename": "README.md",
"devDependencies": {
"tns-core-modules": "^3.1.0",
"tns-platform-declarations": "^3.1.0",
"typescript": "~2.3.0",
"prompt": "^1.0.0",
"rimraf": "^2.5.0",
"tslint": "^5.0.0"
},
"dependencies": {
"async": "^2.6.0"
},
"bootstrapper": "nativescript-plugin-seed"
"demong": "/demo-angular"
},
"repository": {
"type": "git",
"url": "git+https://github.com/abhayastudios/nativescript-zeroconf.git"
},
"scripts": {
"build": "npm i && tsc",
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**'",
"clean": "cd ../demo-angular && rimraf hooks node_modules platforms && cd ../src && rimraf node_modules && npm run plugin.link",
"demo.android": "npm i && npm run tsc && cd ../demo-angular && tns run android --syncAllFiles",
"demo.android.debug": "npm i && npm run tsc && cd ../demo-angular && tns debug android --syncAllFiles",
"demo.ios": "npm i && npm run tsc && cd ../demo-angular && tns run ios --syncAllFiles",
"demo.ios.debug": "npm i && npm run tsc && cd ../demo-angular && tns debug ios --syncAllFiles --inspector",
"demo.reset": "cd ../demo-angular && rimraf platforms",
"plugin.link": "npm link && cd ../demo-angular && npm link nativescript-zeroconf && cd ../src",
"plugin.prepare": "npm run tsc && cd ../demo-angular && tns plugin remove nativescript-zeroconf && tns plugin add ../src",
"plugin.tscwatch": "npm run tsc -- -w",
"postclone": "npm i && node scripts/postclone.js && cd ../demo-angular && npm i && cd ../src && npm run plugin.link",
"test.android": "npm i && npm run tsc && npm run tslint && cd ../demo-angular && tns build android && tns test android --justlaunch",
"test.ios": "npm i && npm run tsc && npm run tslint && cd ../demo-angular && tns build ios && tns test ios --justlaunch",
"tsc": "tsc -skipLibCheck",
"tslint": "cd .. && tslint \"**/*.ts\" --config tslint.json --exclude \"**/node_modules/**\""
},
"typings": "index.d.ts",
"version": "1.0.4"
}
3 changes: 1 addition & 2 deletions src/references.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />
/// <reference path="./node_modules/@nativescript/types/index.d.ts" />
11 changes: 8 additions & 3 deletions src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"target": "ES2017",
"module": "esnext",
"moduleResolution": "node",
"declaration": true,
"removeComments": true,
"noLib": false,
Expand All @@ -17,7 +18,11 @@
"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"plugins": [{
"transform": "@nativescript/webpack/transformers/ns-transform-native-classes",
"type": "raw"
}]
},
"exclude": [
"node_modules"
Expand Down
2 changes: 0 additions & 2 deletions src/zeroconf.android.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { ZeroconfService, Common } from './zeroconf.common';
import { Observable } from "tns-core-modules/data/observable";

import * as async from 'async';

// declare var appModule:any;

export class Zeroconf extends Common {
private nativeApp:android.app.Application;
private context:any; //android.content.Context;
Expand Down
2 changes: 1 addition & 1 deletion src/zeroconf.common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Observable, EventData } from 'tns-core-modules/data/observable';
import { Observable, EventData } from '@nativescript/core';

export class Common extends Observable {
protected serviceType:string;
Expand Down
8 changes: 4 additions & 4 deletions src/zeroconf.ios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as utils from 'tns-core-modules/utils/utils';
import {Utils} from '@nativescript/core';
import { ZeroconfService, Common } from './zeroconf.common';

/*
Expand Down Expand Up @@ -117,7 +117,7 @@ export class Zeroconf extends Common {
*/
private extractAddressesFromNSNetService(socketsData:NSArray<NSData>) : any {
let addresses:Array<any> = [];
let _socketsData:Array<any> = utils.ios.collections.nsArrayToJSArray(socketsData);
let _socketsData:Array<any> = Utils.ios.collections.nsArrayToJSArray(socketsData);

for (let socketData of _socketsData) {
let socket_address = new interop.Reference(sockaddr_in, socketData.bytes).value;
Expand Down Expand Up @@ -150,7 +150,7 @@ export class Zeroconf extends Common {
}

/* Define NSNetServiceBrowserDelegate implementation class */

@NativeClass()
class MyNSNetServiceBrowserDelegate extends NSObject implements NSNetServiceBrowserDelegate {
public static ObjCProtocols = [NSNetServiceBrowserDelegate];

Expand Down Expand Up @@ -205,7 +205,7 @@ class MyNSNetServiceBrowserDelegate extends NSObject implements NSNetServiceBrow
}

/* Define NSNetServiceDelegate implementation class for resolving host/port once service was discovered */

@NativeClass()
class MyNSNetServiceDelegate extends NSObject implements NSNetServiceDelegate {
public static ObjCProtocols = [NSNetServiceDelegate];

Expand Down