Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nativescript 6 migration #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ demo/lib
demo/platforms
demo/node_modules
node_modules
package-lock.json
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

![NativeScript image colors](https://raw.githubusercontent.com/TheOriginalJosh/nativescript-image-colors/master/screenshot.png)

This is the version migrated to Nativescript 6

## Example

Expand Down
2 changes: 1 addition & 1 deletion demo/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ purpose of the file is to pass control to the app’s first module.
import "./bundle-config";
import * as app from 'application';

app.start({ moduleName: 'main-page' });
app._start({ moduleName: 'main-page' });

/*
Do not place any code after the application has been started as it will not
Expand Down
2 changes: 1 addition & 1 deletion demo/app/main-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class mainvm extends observable.Observable {
break;
}

console.log(JSON.stringify(colors.color1));
console.log(JSON.stringify(colors.color1.hex));

this.tabView.backgroundColor = colors.color1;
this.tabView.color = colors.color2;
Expand Down
7 changes: 4 additions & 3 deletions demo/app/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"android": {
"v8Flags": "--expose_gc"
"v8Flags": "--expose_gc",
"markingMode": "none"
},
"main": "app.js",
"name": "tns-template-hello-world-ts",
"version": "3.1.1"
}
"version": "3.1.2"
}
12 changes: 6 additions & 6 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
"nativescript": {
"id": "org.nativescript.demo",
"tns-ios": {
"version": "3.1.0"
"version": "6.2.0"
},
"tns-android": {
"version": "3.1.1"
"version": "6.2.0"
}
},
"dependencies": {
"nativescript-image-colors": "file:///Users/JoshSo/Code/NativeScript/nativescript-image-colors",
"nativescript-image-colors": "file:..",
"nativescript-theme-core": "~1.0.2",
"tns-core-modules": "~3.1.0"
"tns-core-modules": "~6.2.0"
},
"devDependencies": {
"babel-traverse": "6.25.0",
"babel-types": "6.25.0",
"babylon": "6.17.4",
"lazy": "1.0.11",
"nativescript-dev-typescript": "~0.5.0",
"typescript": "~2.2.1"
"typescript": "3.4.5",
"nativescript-dev-webpack": "~1.3.0"
}
}
7 changes: 7 additions & 0 deletions demo/tsconfig.tns.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node"
}
}
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ColorPalette } from './nativescript-image-colors.common';
import { Image } from 'ui/image';
export declare class ImageColors {
static getColorPalette(image: Image): IColorPalette;
static getColorPalette(image: Image): ColorPalette;
}
3 changes: 2 additions & 1 deletion nativescript-image-colors.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Image } from 'tns-core-modules/ui/image';
import { Color } from 'tns-core-modules/color';

declare const android: any;
declare const global: any;
export class ImageColors {

public static getColorPalette(image: Image): ColorPalette {
Expand All @@ -24,7 +25,7 @@ export class ImageColors {
return returnPalette;
}

let Palette = new android.support.v7.graphics.Palette.from(bmp).generate();
let Palette = new global.androidx.palette.graphics.Palette.from(bmp).generate();
if (Palette != null) {
let vibrantSwatch = Palette.getVibrantSwatch();
let darkVibrantSwatch = Palette.getDarkVibrantSwatch();
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "nativescript-image-colors",
"version": "1.1.0",
"version": "2.0.0",
"description": "NativeScript colors from images.",
"main": "nativescript-image-colors.js",
"typings": "index.d.ts",
"nativescript": {
"platforms": {
"android": "2.2.0",
"ios": "2.2.1"
"android": "6.2.0",
"ios": "6.2.0"
}
},
"scripts": {
Expand Down Expand Up @@ -41,7 +41,7 @@
"homepage": "https://github.com/TheOriginalJosh/nativescript-image-colors",
"readmeFilename": "README.md",
"devDependencies": {
"tns-core-modules": "^3.1.0",
"tns-core-modules": "^6.2.0",
"tns-platform-declarations": "3.1.0"
},
"dependencies": {
Expand Down
6 changes: 1 addition & 5 deletions platforms/android/include.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
android {
productFlavors {
"nativescriptimagecolors" {
dimension "nativescriptimagecolors"
}
}

}
dependencies {
compile "com.android.support:palette-v7:24.1.1"
Expand Down