Repository: NathanWalker/nativescript-fancyalert
Branch: master
Commit: d37af03887d0
Files: 54
Total size: 113.1 KB
Directory structure:
gitextract_n3st3lve/
├── .gitignore
├── LICENSE
├── README.md
├── demo/
│ ├── app/
│ │ ├── App_Resources/
│ │ │ ├── Android/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ └── app.gradle
│ │ │ └── iOS/
│ │ │ └── Info.plist
│ │ ├── app.css
│ │ ├── app.ts
│ │ ├── main-page.ts
│ │ ├── main-page.xml
│ │ ├── main-view-model.ts
│ │ ├── package.json
│ │ ├── vendor-platform.android.ts
│ │ ├── vendor-platform.ios.ts
│ │ └── vendor.ts
│ ├── package.json
│ ├── references.d.ts
│ ├── tsconfig.esm.json
│ ├── tsconfig.json
│ └── webpack.config.js
├── demo-vue/
│ ├── .babelrc
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── src/
│ │ └── main.js
│ └── template/
│ ├── app/
│ │ ├── App_Resources/
│ │ │ ├── Android/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── app.gradle
│ │ │ │ ├── drawable-nodpi/
│ │ │ │ │ └── splash_screen.xml
│ │ │ │ ├── values/
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ └── values-v21/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── iOS/
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.launchimage/
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── LaunchScreen.AspectFill.imageset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── LaunchScreen.Center.imageset/
│ │ │ │ └── Contents.json
│ │ │ ├── Info.plist
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── build.xcconfig
│ │ └── package.json
│ └── package.json
└── src/
├── .npmignore
├── common.ts
├── fancyalert.android.ts
├── fancyalert.ios.ts
├── index.d.ts
├── package.json
├── platforms/
│ ├── android/
│ │ └── include.gradle
│ └── ios/
│ └── Podfile
├── tsconfig.json
└── typings/
└── objc!SCLAlertView_Objective_C.d.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
src/*.js
src/*.js.map
src/*.log
src/*.d.ts
!index.d.ts
demo/package-lock.json
demo/app/*.js
demo/*.d.ts
demo/lib
demo/hooks
demo/platforms
demo/node_modules
demo-vue/package-lock.json
demo-vue/platforms
demo-vue/node_modules
src/node_modules
!demo/references.d.ts
!src/fancyalert.d.ts
src/package-lock.json
================================================
FILE: LICENSE
================================================
The MIT License (MIT)
nativescript-fancyalert
Copyright (c) 2016, Nathan Walker
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
================================================
FILE: README.md
================================================
## NativeScript 7 or higher
* Use `@nstudio/nativescript-fancyalert`: `~4.0.0`
* [Source managed here](https://github.com/nstudio/nativescript-plugins)
## If using 6 and below, see the following:
Fancy alerts for NativeScript.
Based on:
- iOS [SCLAlertView](https://github.com/dogo/SCLAlertView)
- Android [ColorDialog](https://github.com/andyxialm/ColorDialog)
# Install
### NativeScript 4x
```bash
tns plugin add nativescript-fancyalert
```
### NativeScript 3x and older
```bash
tns plugin add nativescript-fancyalert@1.2.0
```


# iOS Specifications
#### Usage Examples
```js
import { TNSFancyAlert, TNSFancyAlertButton } from "nativescript-fancyalert";
// show success
TNSFancyAlert.showSuccess(
"Success!",
"Fancy alerts are nice.",
"Yes they are!"
);
// set customizations
TNSFancyAlert.showAnimationType =
TNSFancyAlert.SHOW_ANIMATION_TYPES.SlideInFromLeft;
TNSFancyAlert.hideAnimationType =
TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToRight;
TNSFancyAlert.backgroundType = TNSFancyAlert.BACKGROUND_TYPES.Blur;
TNSFancyAlert.soundURL = "bell.mp3";
TNSFancyAlert.showSuccess(
"Sound?",
"You can use sound and customize many aspects like animation in/out, color, background style and much more.",
"Amazing!"
);
// show custom image
TNSFancyAlert.showCustomImage(
"nativescript.png",
"#2B33FF",
"Custom Image",
`Using your own images is sure nice.`,
"Yes!"
);
// show custom button timer
TNSFancyAlert.showCustomButtonTimer(
0,
true,
undefined,
undefined,
"Mission Impossible",
`This will self-destruct in 5 seconds.`,
"Ok"
);
// show custom buttons
let buttons = [
new TNSFancyAlertButton({
label: "One",
action: () => {
console.log("One");
}
}),
new TNSFancyAlertButton({
label: "Two",
action: () => {
console.log("Two");
}
}),
new TNSFancyAlertButton({
label: "Three",
action: () => {
console.log("Three");
}
}),
new TNSFancyAlertButton({
label: "Four",
action: () => {
console.log("Four");
}
}),
new TNSFancyAlertButton({
label: "Really? More?",
action: () => {
console.log("more");
}
})
];
TNSFancyAlert.showCustomButtons(
buttons,
undefined,
undefined,
"Got Buttons?",
`Add as many as you'd like.`,
"Ok"
);
// show with custom width
TNSFancyAlert.showSuccess(
"Success!",
"This uses a custom width of 300.",
`Oh that's nice.`,
0,
300
);
// show textfield
let initialValue = null;
TNSFancyAlert.showTextField(
"Enter your name",
initialValue,
new TNSFancyAlertButton({
label: "Save",
action: (value: any) => {
console.log(`User entered ${value}`);
}
}),
undefined,
undefined,
"User Input?",
`Yeah, sure we can.`,
"Ok, lots of options."
);
// show switch
TNSFancyAlert.showSwitch(
`Don't show again`,
"#58B136",
new TNSFancyAlertButton({
label: "Save",
action: (isSelected: boolean) => {
console.log(`Don't show again was selected: ${isSelected}`);
}
}),
"switch.png",
"#B3714F",
"Need a switch?",
`It can be useful.`,
"Got it."
);
```
#### TNSFancyAlert - Properties
| Property | Description |
| -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `TNSFancyAlert.SUPPORTED_TYPES: IFancyAlertSupportedTypes` | Different supported style types. |
| `TNSFancyAlert.shouldDismissOnTapOutside: boolean` | Should dismiss when tapped outside. |
| `TNSFancyAlert.dismissCallback: () => void` | Callback for when alert is dismissed. |
| `TNSFancyAlert.hideAnimationType: IFancyAlertHideAnimationTypes` | Use `TNSFancyAlert.HIDE_ANIMATION_TYPES` to set. Supports: FadeOut, SlideOutToBottom, SlideOutToTop, SlideOutToLeft, SlideOutToRight, SlideOutToCenter, SlideOutFromCenter. |
| `TNSFancyAlert.showAnimationType: IFancyAlertShowAnimationTypes` | Use `TNSFancyAlert.SHOW_ANIMATION_TYPES` to set. Supports: FadeIn, SlideInFromBottom, SlideInFromTop, SlideInFromLeft, SlideInFromRight, SlideInFromCenter, SlideInToCenter. |
| `TNSFancyAlert.backgroundType: IFancyAlertBackgroundTypes` | Use `TNSFancyAlert.BACKGROUND_TYPES` to set. Supports: Shadow, Blur, Transparent. |
| `TNSFancyAlert.customViewColor: string` | Overwrite (Buttons, top circle and borders) colors. |
| `TNSFancyAlert.iconTintColor: string` | Set custom tint color for icon image. |
| `TNSFancyAlert.titleColor: string` | Set custom title color. |
| `TNSFancyAlert.bodyTextColor: string` | Set custom body text color. |
| `TNSFancyAlert.tintTopCircle: string` | Override top circle tint color with background color |
| `TNSFancyAlert.cornerRadius: number` | Set custom corner radius. |
| `TNSFancyAlert.backgroundViewColor: string` | Overwrite background color |
| `TNSFancyAlert.useLargerIcon: boolean` | Make the top circle icon larger |
| `TNSFancyAlert.soundURL: string` | Use mp3 from App_Resources when alert shows. |
| `TNSFancyAlert.textDisplayOptions: IFancyAlertTextOptions` | IOS Only. Text display options |
#### TNSFancyAlert - Methods
- `showSuccess(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array<TNSFancyAlertButton>)`
- `showError(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array<TNSFancyAlertButton>)`
- `showNotice(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array<TNSFancyAlertButton>)`
- `showWarning(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array<TNSFancyAlertButton>)`
- `showInfo(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array<TNSFancyAlertButton>)`
- `showEdit(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array<TNSFancyAlertButton>)`
- `showWaiting(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
- `showQuestion(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array<TNSFancyAlertButton>)`
- `showCustomButtonTimer(buttonIndex: number, reverse?: boolean, imageName?: string, color?: string, title?: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
- `showCustomImage(imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
- `showCustomButtons(buttons: Array<TNSFancyAlertButton>, imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
- `showCustomTextAttributes(attributionBlock: Function, button: TNSFancyAlertButton, imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
- `showTextField(placeholder: string, initialValue: string, button: TNSFancyAlertButton, imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
- `showSwitch(switchLabel: string, switchColor: string, button: TNSFancyAlertButton, imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
- `showCustomView(customView: any, imageName?: string, color?: string, title?: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
- `show(type: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array<TNSFancyAlertButton>)`
- `showCustom(alert: any, imageName: string, color: string, title?: string, subTitle?: string, closeBtnTitle?: string, duration?: number)`
- `createAlert(width?: number)`
# Android Specifications
#### Usage Examples
NOTE: Android supports only a subset of the iOS features, but will return a Promise on every call:
```js
import { TNSFancyAlert, TNSFancyAlertButton } from "nativescript-fancyalert";
// show success
TNSFancyAlert.showSuccess(
"Success!",
"Fancy alerts are nice.",
"Yes they are!"
).then(() => {
/* user pressed the button */
});
// show error
TNSFancyAlert.showError("Error!", "Something bad happened.", "Close").then(
() => {
/* user pressed the button */
}
);
```
#### TNSFancyAlert - Methods
- `showSuccess(title: string, subTitle?: string, closeBtnTitle?: string): Promise<any>`
- `showError(title: string, subTitle?: string, closeBtnTitle?: string): Promise<any>`
- `showNotice(title: string, subTitle?: string, closeBtnTitle?: string): Promise<any>`
- `showWarning(title: string, subTitle?: string, closeBtnTitle?: string): Promise<any>`
- `showInfo(title: string, subTitle?: string, closeBtnTitle?: string): Promise<any>`
- ```
showColorDialog(
title: string,
subTitle?: string,
okBtnTitle?: string,
cancelBtnTitle?: string,
backgroundColor?: string,
titleTextColor?: string,
contextTextColor?: string,
contentImage?: any
): Promise<any>```
# TNSFancyAlertButton (iOS only)
This class can be instantiated on iOS to configure buttons in the fancy alerts.
```
export class TNSFancyAlertButton {
public label: string;
public action: Function;
public applyStyle: (btn: any) => void;
constructor(model?: any) {
if (model) {
this.label = model.label;
this.action = model.action;
this.applyStyle = model.applyStyle;
}
}
}
```
* `label`: display text on the button
* `action`: the method to invoke when the button is tapped on
* `applyStyle`: a method you can configure to style the button however you'd like using iOS properties. This method will hand back an instance of `SLCButton` which inherits from `UIButton`. You can see more of what methods are available on this class [here](https://github.com/dogo/SCLAlertView/blob/develop/SCLAlertView/SCLButton.m).
Here's an example of how to setup a custom background color:
```
new TNSFancyAlertButton({
label: 'Ok',
action: () => {
// the action to take
},
applyStyle: (btn: UIButton) => {
// we can use UIButton typing when using tns-platform-declarations
// however we can cast to any since you are likely not using SLCAlertView typings (they are in this repo if you want to use them :) )
// refer to https://github.com/dogo/SCLAlertView/blob/develop/SCLAlertView/SCLButton.m on what properties are available to customize
(<any>btn).buttonFormatBlock = () => {
// set a custom backgroundColor
return new (NSDictionary as any)([new Color('#3a3939').ios], ['backgroundColor']);
}
}
}),
```
## Why the TNS prefixed name?
`TNS` stands for **T**elerik **N**ative**S**cript
iOS uses classes prefixed with `NS` (stemming from the [NeXTSTEP](https://en.wikipedia.org/wiki/NeXTSTEP) days of old):
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/
To avoid confusion with iOS native classes, `TNS` is used instead.
## Tutorials
Need extra help getting these fancy alerts working in your application? Check out these tutorials that make use of the plugin:
[Fancy Alerts in a NativeScript with Angular Application](https://www.thepolyglotdeveloper.com/2017/02/use-visually-appealing-fancy-alerts-nativescript-angular-application/)
## License
MIT
================================================
FILE: demo/app/App_Resources/Android/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="1"
android:versionName="1.0">
<supports-screens
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
<uses-sdk
android:minSdkVersion="17"
android:targetSdkVersion="__APILEVEL__"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:name="com.tns.NativeScriptApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.tns.NativeScriptActivity"
android:label="@string/title_activity_kimera"
android:configChanges="keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity"/>
</application>
</manifest>
================================================
FILE: demo/app/App_Resources/Android/app.gradle
================================================
// Add your native dependencies here:
// Uncomment to add recyclerview-v7 dependency
//dependencies {
// compile 'com.android.support:recyclerview-v7:+'
//}
================================================
FILE: demo/app/App_Resources/iOS/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
================================================
FILE: demo/app/app.css
================================================
Button {
font-size: 20;
horizontal-align: center;
padding:10;
text-align: center;
}
================================================
FILE: demo/app/app.ts
================================================
import * as application from 'tns-core-modules/application';
application.start({ moduleName: 'main-page' });
================================================
FILE: demo/app/main-page.ts
================================================
import * as observable from "tns-core-modules/data/observable";
import * as pages from "tns-core-modules/ui/page";
import { HelloWorldModel } from "./main-view-model";
// Event handler for Page "loaded" event attached in main-page.xml
export function pageLoaded(args: observable.EventData) {
// Get the event sender
var page = <pages.Page>args.object;
page.bindingContext = new HelloWorldModel();
}
================================================
FILE: demo/app/main-page.xml
================================================
<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded">
<Page.actionBar>
<ActionBar title="NativeScript Fancy Alert" icon="">
</ActionBar>
</Page.actionBar>
<ScrollView>
<StackLayout>
<Button text="Alert Success" tap="{{showSuccess}}" />
<Button text="Alert Success w/ Sound" tap="{{showSuccessCustomEffects}}" />
<Button text="Alert Error" tap="{{showError}}" />
<Button text="Alert Notice" tap="{{showNotice}}" />
<Button text="Alert Warning" tap="{{showWarning}}" />
<Button text="Alert Info" tap="{{showInfo}}" />
<Button text="Alert Edit" tap="{{showEdit}}" />
<Button text="Alert Waiting" tap="{{showWaiting}}" />
<Button text="Alert Question" tap="{{showQuestion}}" />
<Button text="Alert Custom Image" tap="{{showCustomImage}}" />
<Button text="Alert Button with Timer" tap="{{showCustomButtonTimer}}" />
<Button text="Alert Custom Buttons" tap="{{showCustomButtons}}" />
<Button text="Alert Success w/ Auto-Close Delay" tap="{{showSuccessDelay}}" />
<Button text="Alert Success Custom Width" tap="{{showCustomWidth}}" />
<Button text="Alert Text Color" tap="{{customText}}" />
<Button text="Alert Text Field" tap="{{showTextField}}" />
<Button text="Alert w/ Switch" tap="{{showSwitch}}" />
<Button text="Alert Custom View" tap="{{showCustomView}}" />
</StackLayout>
</ScrollView>
</Page>
================================================
FILE: demo/app/main-view-model.ts
================================================
import { TNSFancyAlert, TNSFancyAlertButton } from "nativescript-fancyalert";
import { Color } from "tns-core-modules/color";
import { Observable } from "tns-core-modules/data/observable";
import { isIOS } from "tns-core-modules/platform";
declare var NSMutableAttributedString: any,
NSForegroundColorAttributeName: any,
NSCaseInsensitiveSearch: any,
NSUnderlineStyleSingle: any,
UIView: any,
CGRectMake: any,
SCLAlertViewShowAnimation: any,
SCLAlertViewHideAnimation: any,
SCLAlertViewBackground: any,
NSString: any,
NSUnderlineStyleAttributeName: any;
export class HelloWorldModel extends Observable {
constructor() {
super();
if (isIOS) {
TNSFancyAlert.hideAnimationType =
TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToBottom;
}
}
public showSuccess() {
TNSFancyAlert.showSuccess(
"Success!",
"Fancy alerts are nice.",
"Yes they are!"
);
}
public showSuccessCustomEffects() {
if (isIOS) {
TNSFancyAlert.showAnimationType =
TNSFancyAlert.SHOW_ANIMATION_TYPES.SlideInFromLeft;
TNSFancyAlert.hideAnimationType =
TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToRight;
TNSFancyAlert.backgroundType = TNSFancyAlert.BACKGROUND_TYPES.Blur;
TNSFancyAlert.soundURL = "bell.mp3";
TNSFancyAlert.showSuccess(
"Sound?",
"You can use sound and customize many aspects like animation in/out, color, background style and much more.",
"Amazing!"
);
this.reset();
}
}
public showSuccessDelay() {
TNSFancyAlert.showSuccess(
"Success!",
"Fancy alerts are nice. This will disappear in 5 seconds.",
"Close Now!",
5
);
}
public showError() {
TNSFancyAlert.showError(
"Error!",
"At least it looks good :)",
"Yeah it does."
);
}
public showNotice() {
TNSFancyAlert.showNotice(
"Notice",
`You've been officially notified that NativeScript is awesome.`,
"Yeah it is!"
);
}
public showWarning() {
TNSFancyAlert.showWarning("Warning", `#nowebview here.`, "Ok, Got It!");
}
public showInfo() {
if (isIOS) {
TNSFancyAlert.showAnimationType =
SCLAlertViewShowAnimation.SlideInFromBottom;
TNSFancyAlert.hideAnimationType =
SCLAlertViewHideAnimation.SlideOutToRight;
}
TNSFancyAlert.showInfo(
"Info",
`You can integrate any CocoaPod or Android library with NativeScript.`,
"Sweet!"
);
if (isIOS) {
this.reset();
}
}
public showEdit() {
TNSFancyAlert.showEdit(
"Edit",
`We could edit something but won't right now.`,
"Sounds Good"
);
}
public showWaiting() {
TNSFancyAlert.showWaiting(
"Waiting...",
`It's like waiting for a WebView to render ;)`,
"Uh yeah it is."
);
}
public showQuestion() {
TNSFancyAlert.showQuestion(
"Question",
`Do you like developing with NativeScript?`,
"Well yes I do!"
);
}
public showCustomImage() {
TNSFancyAlert.showCustomImage(
"nativescript.png",
"#2B33FF",
"@drawable/customimage", //Place image name without extension
`Using your own images is sure nice.`,
"Yes!"
);
}
public showCustomButtonTimer() {
TNSFancyAlert.showCustomButtonTimer(
0,
true,
undefined,
undefined,
"Mission Impossible",
`This will self-destruct in 5 seconds.`,
"Ok"
);
}
public showCustomButtons() {
let buttons = [
new TNSFancyAlertButton({
label: "One",
action: () => {
console.log("One");
}
}),
new TNSFancyAlertButton({
label: "Two",
action: () => {
console.log("Two");
}
}),
new TNSFancyAlertButton({
label: "Three",
action: () => {
console.log("Three");
}
}),
new TNSFancyAlertButton({
label: "Four",
action: () => {
console.log("Four");
}
}),
new TNSFancyAlertButton({
label: "Really? More?",
action: () => {
console.log("more");
}
})
];
TNSFancyAlert.showCustomButtons(
buttons,
undefined,
undefined,
"Got Buttons?",
`Add as many as you'd like.`,
"Ok"
);
}
public showCustomWidth() {
TNSFancyAlert.showSuccess(
"Success!",
"This uses a custom width of 300.",
`Oh that's nice.`,
0,
300
);
}
public customText() {
let textAttribution = (value: any) => {
let nsString = NSString.alloc().initWithString(value);
let subTitle = NSMutableAttributedString.alloc().initWithString(value);
let redRange = nsString.rangeOfStringOptions(
"Yep",
NSCaseInsensitiveSearch
);
subTitle.addAttributeValueRange(
NSForegroundColorAttributeName,
new Color("#BC1224").ios,
redRange
);
let greenRange = nsString.rangeOfStringOptions(
"that can be done",
NSCaseInsensitiveSearch
);
subTitle.addAttributeValueRange(
NSForegroundColorAttributeName,
new Color("#528100").ios,
greenRange
);
let underline = nsString.rangeOfStringOptions(
"too!",
NSCaseInsensitiveSearch
);
subTitle.addAttributeValueRange(
NSUnderlineStyleAttributeName,
NSUnderlineStyleSingle,
underline
);
return subTitle;
};
TNSFancyAlert.showCustomTextAttributes(
textAttribution,
new TNSFancyAlertButton({
label: "Wow, ok.",
action: (value: any) => {
console.log(`Clicked ok.`);
}
}),
undefined,
undefined,
"Custom text color?",
`Yep, that can be done too!`,
null
);
}
public showTextField() {
TNSFancyAlert.showTextField(
"Enter your name",
"",
new TNSFancyAlertButton({
label: "Save",
action: (value: any) => {
console.log(`User entered ${value}`);
}
}),
undefined,
undefined,
"User Input?",
`Yeah, sure we can.`,
"Ok, lots of options."
);
}
public showSwitch() {
TNSFancyAlert.showSwitch(
`Don't show again`,
"#58B136",
new TNSFancyAlertButton({
label: "Save",
action: (isSelected: boolean) => {
console.log(`Don't show again was selected: ${isSelected}`);
}
}),
"switch.png",
"#B3714F",
"Need a switch?",
`It can be useful.`,
"Got it."
);
}
public showCustomView() {
let customView = UIView.alloc().initWithFrame(CGRectMake(0, 0, 215, 80));
customView.backgroundColor = new Color("#FE00FC").ios;
TNSFancyAlert.showCustomView(
customView,
undefined,
undefined,
"Add any view?",
`Just pass in a any UIView.`,
"Nice!"
);
}
private reset() {
setTimeout(() => {
TNSFancyAlert.showAnimationType = undefined;
TNSFancyAlert.hideAnimationType =
TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToBottom;
TNSFancyAlert.backgroundType = undefined;
TNSFancyAlert.soundURL = undefined;
}, 1000);
}
}
================================================
FILE: demo/app/package.json
================================================
{
"name": "tns-template-hello-world-ts",
"main": "app.js",
"version": "1.6.0",
"author": {
"name": "Telerik",
"email": "support@telerik.com"
},
"description": "Nativescript hello-world-ts project template",
"license": "Apache-2.0",
"keywords": [
"telerik",
"mobile",
"nativescript",
"{N}",
"tns",
"appbuilder",
"template"
],
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/NativeScript/template-hello-world-ts.git"
},
"bugs": {
"url": "https://github.com/NativeScript/template-hello-world-ts/issues"
},
"homepage": "https://github.com/NativeScript/template-hello-world-ts",
"android": {
"v8Flags": "--expose_gc"
},
"devDependencies": {
"nativescript-dev-typescript": "^0.3.0"
},
"_id": "tns-template-hello-world-ts@1.6.0",
"_shasum": "a567c2b9a56024818c06596dab9629d155c5b8a8",
"_resolved": "https://registry.npmjs.org/tns-template-hello-world-ts/-/tns-template-hello-world-ts-1.6.0.tgz",
"_from": "tns-template-hello-world-ts@latest",
"scripts": {},
"_npmVersion": "2.14.7",
"_nodeVersion": "4.2.2",
"_npmUser": {
"name": "enchev",
"email": "vladimir.enchev@gmail.com"
},
"dist": {
"shasum": "a567c2b9a56024818c06596dab9629d155c5b8a8",
"tarball": "http://registry.npmjs.org/tns-template-hello-world-ts/-/tns-template-hello-world-ts-1.6.0.tgz"
},
"maintainers": [
{
"name": "enchev",
"email": "vladimir.enchev@gmail.com"
},
{
"name": "erjangavalji",
"email": "erjan.gavalji@gmail.com"
},
{
"name": "fatme",
"email": "hfatme@gmail.com"
},
{
"name": "hdeshev",
"email": "hristo@deshev.com"
},
{
"name": "kerezov",
"email": "d.kerezov@gmail.com"
},
{
"name": "ligaz",
"email": "stefan.dobrev@gmail.com"
},
{
"name": "nsndeck",
"email": "nedyalko.nikolov@telerik.com"
},
{
"name": "rosen-vladimirov",
"email": "rosen.vladimirov.91@gmail.com"
},
{
"name": "sdobrev",
"email": "stefan.dobrev@gmail.com"
},
{
"name": "tailsu",
"email": "tailsu@gmail.com"
},
{
"name": "teobugslayer",
"email": "teobugslayer@gmail.com"
},
{
"name": "valio.stoychev",
"email": "valio.stoychev@gmail.com"
}
],
"_npmOperationalInternal": {
"host": "packages-5-east.internal.npmjs.com",
"tmp": "tmp/tns-template-hello-world-ts-1.6.0.tgz_1455717516189_0.6427943941671401"
},
"directories": {},
"readme": "ERROR: No README data found!"
}
================================================
FILE: demo/app/vendor-platform.android.ts
================================================
require("application");
if (!global["__snapshot"]) {
// In case snapshot generation is enabled these modules will get into the bundle
// but will not be required/evaluated.
// The snapshot webpack plugin will add them to the tns-java-classes.js bundle file.
// This way, they will be evaluated on app start as early as possible.
require("ui/frame");
require("ui/frame/activity");
}
================================================
FILE: demo/app/vendor-platform.ios.ts
================================================
// There is a bug in angular: https://github.com/angular/angular-cli/pull/8589/files
// Legendary stuff, its webpack plugin pretty much doesn't work with empty TypeScript files in v1.8.3
void 0;
================================================
FILE: demo/app/vendor.ts
================================================
// Snapshot the ~/app.css and the theme
const application = require("application");
require("ui/styling/style-scope");
const appCssContext = require.context("~/", false, /^\.\/app\.(css|scss|less|sass)$/);
global.registerWebpackModules(appCssContext);
application.loadAppCss();
require("./vendor-platform");
require("bundle-entry-points");
================================================
FILE: demo/package.json
================================================
{
"nativescript": {
"id": "org.nativescript.demo",
"tns-android": {
"version": "4.2.0"
},
"tns-ios": {
"version": "4.2.0"
}
},
"dependencies": {
"nativescript-fancyalert": "file:../src",
"tns-core-modules": "^4.2.0"
},
"devDependencies": {
"babel-traverse": "6.12.0",
"babel-types": "6.11.1",
"babylon": "6.8.4",
"copy-webpack-plugin": "~4.0.1",
"css-loader": "~0.28.7",
"extract-text-webpack-plugin": "~3.0.0",
"filewalker": "0.1.2",
"lazy": "1.0.11",
"nativescript-css-loader": "~0.26.0",
"nativescript-dev-typescript": "^0.7.3",
"nativescript-dev-webpack": "^0.15.1",
"nativescript-worker-loader": "~0.9.1",
"raw-loader": "~0.5.1",
"resolve-url-loader": "~2.3.0",
"tns-platform-declarations": "^4.2.0",
"typescript": "~2.9.0"
},
"scripts": {
"build.plugin": "cd ../src && npm run build"
}
}
================================================
FILE: demo/references.d.ts
================================================
/// <reference path="./node_modules/tns-core-modules/tns-core-modules.d.ts" />
/// <reference path="./node_modules/typescript/lib/lib.d.ts" />
================================================
FILE: demo/tsconfig.esm.json
================================================
{
"extends": "./tsconfig",
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node"
}
}
================================================
FILE: demo/tsconfig.json
================================================
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"lib": [
"dom",
"es6"
],
"pretty": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noEmitHelpers": true,
"noEmitOnError": false,
"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"typeRoots": [
"./node_modules/@types",
"./node_modules"
],
"types": [],
"baseUrl": ".",
"paths": {
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
],
"~/*": [
"app/*"
]
}
},
"exclude": [
"node_modules",
"platforms"
],
"compileOnSave": false
}
================================================
FILE: demo/webpack.config.js
================================================
const { resolve, join } = require("path");
const webpack = require("webpack");
const nsWebpack = require("nativescript-dev-webpack");
const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
module.exports = env => {
const platform = env && (env.android && "android" || env.ios && "ios");
if (!platform) {
throw new Error("You need to provide a target platform!");
}
const platforms = ["ios", "android"];
const { snapshot, uglify, report } = env;
const config = {
context: resolve("./app"),
target: nativescriptTarget,
entry: {
bundle: `./${nsWebpack.getEntryModule()}`,
vendor: "./vendor"
},
output: {
pathinfo: true,
// Default destination inside platforms/<platform>/...
path: resolve(nsWebpack.getAppPath(platform)),
libraryTarget: "commonjs2",
filename: "[name].js",
},
resolve: {
extensions: [".ts", ".js", ".scss", ".css"],
// Resolve {N} system modules from tns-core-modules
modules: [
"node_modules/tns-core-modules",
"node_modules",
],
alias: {
'~': resolve("./app")
},
// don't resolve symlinks to symlinked modules
symlinks: false
},
resolveLoader: {
// don't resolve symlinks to symlinked loaders
symlinks: false
},
node: {
// Disable node shims that conflict with NativeScript
"http": false,
"timers": false,
"setImmediate": false,
"fs": "empty",
},
module: {
rules: [
{ test: /\.(html|xml)$/, use: "raw-loader" },
{
test: /\.css$/,
use: { loader: "css-loader", options: { minimize: false, url: false } }
},
{
test: /\.scss$/,
use: [
{ loader: "css-loader", options: { minimize: false, url: false } },
"sass-loader"
]
},
{ test: /\.ts$/, use: "awesome-typescript-loader" }
]
},
plugins: [
// Vendor libs go to the vendor.js chunk
new webpack.optimize.CommonsChunkPlugin({
name: ["vendor"],
}),
// Define useful constants like TNS_WEBPACK
new webpack.DefinePlugin({
"global.TNS_WEBPACK": "true",
}),
// Copy assets to out dir. Add your own globs as needed.
new CopyWebpackPlugin([
{ from: "App_Resources/**" },
{ from: "fonts/**" },
{ from: "**/*.jpg" },
{ from: "**/*.png" },
{ from: "**/*.xml" },
]),
// Generate a bundle starter script and activate it in package.json
new nsWebpack.GenerateBundleStarterPlugin([
"./vendor",
"./bundle",
]),
// Support for web workers since v3.2
new NativeScriptWorkerPlugin(),
new nsWebpack.PlatformFSPlugin({
platform,
platforms,
// ignore: ["App_Resources"]
}),
// Does IPC communication with the {N} CLI to notify events when running in watch mode.
new nsWebpack.WatchStateLoggerPlugin(),
],
};
if (report) {
// Generate report files for bundles content
config.plugins.push(new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: false,
generateStatsFile: true,
reportFilename: join(__dirname, "report", `report.html`),
statsFilename: join(__dirname, "report", `stats.json`),
}));
}
if (snapshot) {
config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
chunk: "vendor",
projectRoot: __dirname,
webpackConfig: config,
targetArchs: ["arm", "arm64", "ia32"],
tnsJavaClassesOptions: { packages: ["tns-core-modules" ] },
useLibs: false
}));
}
if (uglify) {
config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true }));
// Work around an Android issue by setting compress = false
const compress = platform !== "android";
config.plugins.push(new UglifyJsPlugin({
uglifyOptions: {
mangle: { reserved: nsWebpack.uglifyMangleExcludes },
compress,
}
}));
}
return config;
};
================================================
FILE: demo-vue/.babelrc
================================================
{
"presets": [
["env", { "cacheDirectory": true }]
],
"plugins": ["transform-object-rest-spread"]
}
================================================
FILE: demo-vue/.gitignore
================================================
# JetBrains project files
.idea
# NPM
node_modules
# NativeScript application
/dist
================================================
FILE: demo-vue/README.md
================================================
# NativeScript-Vue Demo
> Demo app for nativescript-fancyalert plugin made with NativeScript-Vue
## Usage
* Install dependencies
``` bash
npm install
```
* Compile the `nativescript-fancyalert` plugin
``` bash
npm run build.plugin
```
* Run the demo:
``` bash
# Build, watch for changes and debug the application
npm run debug
npm run debug:<platform>
# Build, watch for changes and run the application
npm run watch
npm run watch:<platform>
```
* Clean the NativeScript application instance (i.e. rm -rf dist)
``` bash
npm run clean
```
================================================
FILE: demo-vue/package.json
================================================
{
"name": "demo-vue",
"version": "1.0.0",
"description": "A native application built with NativeScript-Vue",
"scripts": {
"build.plugin": "cd ../src && npm run build",
"build": "webpack --env.tnsAction build",
"build:android": "npm run build -- --env.android",
"build:ios": "npm run build -- --env.ios",
"debug": "webpack --watch --env.tnsAction debug",
"debug:android": "npm run debug -- --env.android",
"debug:ios": "npm run debug -- --env.ios",
"watch": "webpack --watch --env.tnsAction run",
"watch:android": "npm run watch -- --env.android",
"watch:ios": "npm run watch -- --env.ios",
"clean": "rimraf dist"
},
"dependencies": {
"nativescript-fancyalert": "file:../src",
"nativescript-theme-core": "^1.0.4",
"nativescript-vue": "^2.0.0-alpha.1",
"tns-core-modules": "~4.1.1"
},
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.3",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"copy-webpack-plugin": "^4.4.2",
"css-loader": "^0.28.10",
"extract-text-webpack-plugin": "^3.0.2",
"fs-extra": "^5.0.0",
"nativescript-vue-externals": "^0.2.0",
"nativescript-vue-loader": "^0.1.5",
"nativescript-vue-target": "^0.1.0",
"nativescript-vue-template-compiler": "^1.3.0",
"node-sass": "^4.7.2",
"ns-vue-loader": "^0.1.2",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"rimraf": "^2.6.2",
"sass-loader": "^6.0.6",
"vue-template-compiler": "^2.5.13",
"webpack": "^3.11.0",
"webpack-synchronizable-shell-plugin": "0.0.6",
"winston-color": "^1.0.0"
}
}
================================================
FILE: demo-vue/src/main.js
================================================
import * as app from "tns-core-modules/application"
import Vue from 'nativescript-vue'
import { isIOS, isAndroid } from 'tns-core-modules/platform'
import { TNSFancyAlert, TNSFancyAlertButton } from 'nativescript-fancyalert'
const Page = {
template: `
<Frame>
<Page @loaded="onLoaded">
<ActionBar title="Fancy Alerts Demo" />
<StackLayout>
<Button text="Alert Success" @tap="showSuccess" />
</StackLayout>
</Page>
</Frame>
`,
data() {
return {
}
},
methods: {
showSuccess () {
TNSFancyAlert.showSuccess(
'Success!',
'Fancy alerts are nice.',
'Yes they are!',
).then(() => {
console.log('shown')
}).catch((error) => {
console.error(error)
})
},
onLoaded () {
if (isIOS) {
TNSFancyAlert.hideAnimationType = TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToBottom
}
},
},
}
// Uncommment the following to see NativeScript-Vue output logs
Vue.config.silent = false
new Vue({
render: h => h(Page)
}).$start({
getRootView (vm) {
return vm.$el.nativeView; // frame
},
})
================================================
FILE: demo-vue/template/app/App_Resources/Android/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android" package="__PACKAGE__" android:versionCode="10000" android:versionName="1.0.0">
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="__APILEVEL__" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application android:name="com.tns.NativeScriptApplication" android:allowBackup="true" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppTheme">
<activity android:name="com.tns.NativeScriptActivity" android:label="@string/title_activity_kimera" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@style/LaunchScreenTheme">
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.tns.ErrorReportActivity" />
</application>
</manifest>
================================================
FILE: demo-vue/template/app/App_Resources/Android/app.gradle
================================================
// Add your native dependencies here:
android {
defaultConfig {
generatedDensities = []
applicationId = "__PACKAGE__"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
}
================================================
FILE: demo-vue/template/app/App_Resources/Android/drawable-nodpi/splash_screen.xml
================================================
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="fill">
<item>
<bitmap android:gravity="fill" android:src="@drawable/background" />
</item>
<item>
<bitmap android:gravity="center" android:src="@drawable/logo" />
</item>
</layer-list>
================================================
FILE: demo-vue/template/app/App_Resources/Android/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ns_primary">#F5F5F5</color>
<color name="ns_primaryDark">#757575</color>
<color name="ns_accent">#33B5E5</color>
<color name="ns_blue">#272734</color>
</resources>
================================================
FILE: demo-vue/template/app/App_Resources/Android/values/strings.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">NativeScript-Vue Application</string>
<string name="title_activity_kimera">NativeScript-Vue Application</string>
</resources>
================================================
FILE: demo-vue/template/app/App_Resources/Android/values/styles.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- theme to use FOR launch screen-->
<style name="LaunchScreenThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
<item name="colorPrimary">@color/ns_primary</item>
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
<item name="colorAccent">@color/ns_accent</item>
<item name="android:windowBackground">@drawable/splash_screen</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowTranslucentStatus">true</item>
</style>
<style name="LaunchScreenTheme" parent="LaunchScreenThemeBase">
</style>
<!-- theme to use AFTER launch screen is loaded-->
<style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
<item name="colorPrimary">@color/ns_primary</item>
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
<item name="colorAccent">@color/ns_accent</item>
</style>
<style name="AppTheme" parent="AppThemeBase">
</style>
<!-- theme for actioon-bar -->
<style name="NativeScriptToolbarStyleBase" parent="Widget.AppCompat.Toolbar">
<item name="android:background">@color/ns_primary</item>
<item name="theme">@style/ThemeOverlay.AppCompat.ActionBar</item>
<item name="popupTheme">@style/ThemeOverlay.AppCompat</item>
</style>
<style name="NativeScriptToolbarStyle" parent="NativeScriptToolbarStyleBase">
</style>
</resources>
================================================
FILE: demo-vue/template/app/App_Resources/Android/values-v21/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ns_accent">#3d5afe</color>
</resources>
================================================
FILE: demo-vue/template/app/App_Resources/Android/values-v21/strings.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">NativeScript-Vue Application</string>
<string name="title_activity_kimera">NativeScript-Vue Application</string>
</resources>
================================================
FILE: demo-vue/template/app/App_Resources/Android/values-v21/styles.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Application theme -->
<style name="AppTheme" parent="AppThemeBase">
<item name="android:datePickerStyle">@style/SpinnerDatePicker</item>
<item name="android:timePickerStyle">@style/SpinnerTimePicker</item>
</style>
<!-- Default style for DatePicker - in spinner mode -->
<style name="SpinnerDatePicker" parent="android:Widget.Material.Light.DatePicker">
<item name="android:datePickerMode">spinner</item>
</style>
<!-- Default style for TimePicker - in spinner mode -->
<style name="SpinnerTimePicker" parent="android:Widget.Material.Light.TimePicker">
<item name="android:timePickerMode">spinner</item>
</style>
<style name="NativeScriptToolbarStyle" parent="NativeScriptToolbarStyleBase">
<item name="android:elevation">4dp</item>
</style>
</resources>
================================================
FILE: demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
================================================
{
"images" : [
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "icon-29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "icon-40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "icon-60@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "icon-40.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "icon-76.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "icon-76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "icon-83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "icon-1024.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: demo-vue/template/app/App_Resources/iOS/Assets.xcassets/Contents.json
================================================
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json
================================================
{
"images" : [
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "2436h",
"filename" : "Default-1125h.png",
"minimum-system-version" : "11.0",
"orientation" : "portrait",
"scale" : "3x"
},
{
"orientation" : "landscape",
"idiom" : "iphone",
"extent" : "full-screen",
"filename" : "Default-Landscape-X.png",
"minimum-system-version" : "11.0",
"subtype" : "2436h",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "Default-736h@3x.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "Default-Landscape@3x.png",
"minimum-system-version" : "8.0",
"orientation" : "landscape",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "Default-667h@2x.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "Default@2x.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"filename" : "Default-568h@2x.png",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"filename" : "Default-Portrait.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"filename" : "Default-Landscape.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"filename" : "Default-Portrait@2x.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"filename" : "Default-Landscape@2x.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "Default.png",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "Default@2x.png",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "Default-568h@2x.png",
"extent" : "full-screen",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"filename" : "Default-Portrait.png",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"filename" : "Default-Landscape.png",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"filename" : "Default-Portrait@2x.png",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"filename" : "Default-Landscape@2x.png",
"extent" : "full-screen",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchScreen-AspectFill.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchScreen-AspectFill@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json
================================================
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchScreen-Center.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchScreen-Center@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
================================================
FILE: demo-vue/template/app/App_Resources/iOS/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>NativeScript-Vue Application</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiresFullScreen</key>
<true/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
================================================
FILE: demo-vue/template/app/App_Resources/iOS/LaunchScreen.storyboard
================================================
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchScreen.AspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="wtH-rr-YfP">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
</imageView>
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchScreen.Center" translatesAutoresizingMaskIntoConstraints="NO" id="s1z-aa-wYv">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
</imageView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="xb3-aO-Qok" firstAttribute="top" secondItem="wtH-rr-YfP" secondAttribute="bottom" id="5FO-pR-qKb"/>
<constraint firstItem="wtH-rr-YfP" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="Awn-b8-xf1"/>
<constraint firstItem="s1z-aa-wYv" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="CiP-yX-1sg"/>
<constraint firstAttribute="trailing" secondItem="wtH-rr-YfP" secondAttribute="trailing" id="RXg-rW-UK8"/>
<constraint firstItem="s1z-aa-wYv" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="agC-wa-3bd"/>
<constraint firstItem="wtH-rr-YfP" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="cch-8E-tYu"/>
<constraint firstItem="xb3-aO-Qok" firstAttribute="top" secondItem="s1z-aa-wYv" secondAttribute="bottom" id="fNc-Ro-KaG"/>
<constraint firstAttribute="trailing" secondItem="s1z-aa-wYv" secondAttribute="trailing" id="qoI-OC-Zk7"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="510" y="238"/>
</scene>
</scenes>
<resources>
<image name="LaunchScreen.AspectFill" width="768" height="1024"/>
<image name="LaunchScreen.Center" width="40" height="40"/>
</resources>
</document>
================================================
FILE: demo-vue/template/app/App_Resources/iOS/build.xcconfig
================================================
// You can add custom settings here
// for example you can uncomment the following line to force distribution code signing
// CODE_SIGN_IDENTITY = iPhone Distribution
// To build for device with Xcode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
// DEVELOPMENT_TEAM = YOUR_TEAM_ID;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
================================================
FILE: demo-vue/template/app/package.json
================================================
{
"android": {
"v8Flags": "--expose_gc"
},
"main": "app.js",
"name": "demo-vue",
"version": "1.0.0"
}
================================================
FILE: demo-vue/template/package.json
================================================
{
"name": "demo-vue",
"description": "A native application built with NativeScript-Vue",
"license": "MIT",
"readme": "NativeScript-Vue Application",
"nativescript": {
"id": "org.nativescript.demo"
},
"dependencies": {
"nativescript-theme-core": "^1.0.4",
"nativescript-vue": "^2.0.0-alpha.1",
"tns-core-modules": "~4.1.0",
"nativescript-fancyalert": "file:../../src"
},
"devDependencies": {
"babel-traverse": "6.26.0",
"babel-types": "6.26.0",
"babylon": "6.18.0",
"lazy": "1.0.11"
}
}
================================================
FILE: src/.npmignore
================================================
demo/
screenshots/
*.png
*.log
*.ts
!*.d.ts
tsconfig.json
package-lock.json
node_modules/
*.ts
!*.d.ts
*.map
tsconfig.json
scripts/*
platforms/android/*
!platforms/android/include.gradle
!platforms/android/*.aar
!platforms/android/*.jar
references.d.ts
================================================
FILE: src/common.ts
================================================
export class TNSFancyAlertButton {
public label: string;
public action: Function;
public applyStyle: (btn: any) => void;
constructor(model?: any) {
if (model) {
this.label = model.label;
this.action = model.action;
this.applyStyle = model.applyStyle;
}
}
}
================================================
FILE: src/fancyalert.android.ts
================================================
import * as app from "tns-core-modules/application";
import { Color } from "tns-core-modules/color";
export * from "./common";
declare var cn: any;
export enum IFancyAlertSupportedTypesAndroid {
INFO = 0,
HELP = 1,
WRONG = 2,
SUCCESS = 3,
WARNING = 4,
EDIT = 5
}
export class TNSFancyAlert {
public static shouldDismissOnTapOutside: boolean = false;
public static showSuccess(
title: string,
subTitle?: string,
closeBtnTitle?: string
): Promise<any> {
return new Promise((resolve, reject) => {
const alert = new cn.refactor.lib.colordialog.PromptDialog(
app.android.foregroundActivity
);
alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
alert.setDialogType(IFancyAlertSupportedTypesAndroid.SUCCESS);
alert.setTitleText(title || "Success!");
alert.setContentText(subTitle || "");
alert.setAnimationEnable(true);
alert.setPositiveListener(
closeBtnTitle || "Ok",
new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
onClick: dialog => {
dialog.dismiss();
resolve();
}
})
);
alert.show();
});
}
public static showError(
title: string,
subTitle?: string,
closeBtnTitle?: string
): Promise<any> {
return new Promise((resolve, reject) => {
const alert = new cn.refactor.lib.colordialog.PromptDialog(
app.android.foregroundActivity
);
alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
alert.setDialogType(IFancyAlertSupportedTypesAndroid.WRONG);
alert.setTitleText(title || "Error!");
alert.setContentText(subTitle || "");
alert.setAnimationEnable(true);
alert.setPositiveListener(
closeBtnTitle || "Ok",
new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
onClick: dialog => {
dialog.dismiss();
resolve();
}
})
);
alert.show();
});
}
public static showNotice(
title: string,
subTitle?: string,
closeBtnTitle?: string
): Promise<any> {
return new Promise((resolve, reject) => {
const alert = new cn.refactor.lib.colordialog.PromptDialog(
app.android.foregroundActivity
);
alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
alert.setDialogType(IFancyAlertSupportedTypesAndroid.HELP);
alert.setTitleText(title || "Notice");
alert.setContentText(subTitle || "");
alert.setAnimationEnable(true);
alert.setPositiveListener(
closeBtnTitle || "Ok",
new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
onClick: dialog => {
dialog.dismiss();
resolve();
}
})
);
alert.show();
});
}
public static showWarning(
title: string,
subTitle?: string,
closeBtnTitle?: string
): Promise<any> {
return new Promise((resolve, reject) => {
const alert = new cn.refactor.lib.colordialog.PromptDialog(
app.android.foregroundActivity
);
alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
alert.setDialogType(IFancyAlertSupportedTypesAndroid.WARNING);
alert.setTitleText(title || "Warning!");
alert.setContentText(subTitle || "");
alert.setAnimationEnable(true);
alert.setPositiveListener(
closeBtnTitle || "Ok",
new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
onClick: dialog => {
dialog.dismiss();
resolve();
}
})
);
alert.show();
});
}
public static showEdit(
title: string,
subTitle?: string,
closeBtnTitle?: string
): Promise<any> {
return new Promise((resolve, reject) => {
const alert = new cn.refactor.lib.colordialog.PromptDialog(
app.android.foregroundActivity
);
alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
alert.setDialogType(IFancyAlertSupportedTypesAndroid.EDIT); /// EDIT
alert.setTitleText(title || "Edit");
alert.setContentText(subTitle || "");
alert.setEditTextHint(subTitle || "");
alert.setAnimationEnable(true);
alert.setPositiveListener(
closeBtnTitle || "Ok",
new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
onClick: dialog => {
dialog.dismiss();
resolve(dialog.getEditText().getText());
}
})
);
alert.show();
});
}
public static showInfo(
title: string,
subTitle?: string,
closeBtnTitle?: string
): Promise<any> {
return new Promise((resolve, reject) => {
const alert = new cn.refactor.lib.colordialog.PromptDialog(
app.android.foregroundActivity
);
alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
alert.setDialogType(IFancyAlertSupportedTypesAndroid.INFO); /// Info
alert.setTitleText(title || "Info");
alert.setContentText(subTitle || "");
alert.setAnimationEnable(true);
alert.setPositiveListener(
closeBtnTitle || "Ok",
new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
onClick: dialog => {
dialog.dismiss();
resolve();
}
})
);
alert.show();
});
}
public static showColorDialog(
title: string,
subTitle?: string,
okBtnTitle?: string,
cancelBtnTitle?: string,
backgroundColor?: string,
titleTextColor?: string,
contextTextColor?: string,
contentImage?: any
): Promise<any> {
return new Promise((resolve, reject) => {
const alert = new cn.refactor.lib.colordialog.ColorDialog(
app.android.foregroundActivity
);
// alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
// alert.setDialogType(IFancyAlertSupportedTypesAndroid.HELP);
alert.setTitle(title || "Title");
alert.setContentText(subTitle || "");
if (backgroundColor) {
alert.setColor(new Color(backgroundColor).android);
}
if (titleTextColor) {
alert.setTitleTextColor(new Color(titleTextColor).android);
}
if (contextTextColor) {
alert.setContentTextColor(new Color(contextTextColor).android);
}
if (contentImage) {
var context = app.android.context;
alert.setContentImage(context.getResources().getIdentifier(contentImage,null, context.getPackageName()));
}
alert.setAnimationEnable(true);
alert.setPositiveListener(
okBtnTitle || "Ok",
new cn.refactor.lib.colordialog.ColorDialog.OnPositiveListener({
onClick: dialog => {
dialog.dismiss();
resolve();
}
})
);
if (cancelBtnTitle) {
alert.setNegativeListener(
cancelBtnTitle || "Cancel",
new cn.refactor.lib.colordialog.ColorDialog.OnNegativeListener({
onClick: dialog => {
dialog.dismiss();
reject();
}
})
);
}
alert.show();
});
}
}
================================================
FILE: src/fancyalert.ios.ts
================================================
import { Color } from "tns-core-modules/color";
import { TNSFancyAlertButton } from "./common";
import {
IFancyAlertSupportedTypes,
IFancyAlertTextOptions,
IFancyAlertShowAnimationTypes,
IFancyAlertHideAnimationTypes,
IFancyAlertBackgroundTypes
} from "./";
export * from "./common";
export class TNSFancyAlert {
public static SUPPORTED_TYPES: IFancyAlertSupportedTypes = {
SUCCESS: "Success",
ERROR: "Error",
NOTICE: "Notice",
WARNING: "Warning",
INFO: "Info",
EDIT: "Edit",
WAITING: "Waiting",
QUESTION: "Question"
};
//Dismiss on tap outside (Default is NO)
public static shouldDismissOnTapOutside: boolean = false;
public static dismissCallback: () => void;
// font handling
public static textDisplayOptions: IFancyAlertTextOptions;
//Hide animation type (Default is FadeOut)
public static hideAnimationType: IFancyAlertHideAnimationTypes;
public static HIDE_ANIMATION_TYPES: IFancyAlertHideAnimationTypes = {
FadeOut: SCLAlertViewHideAnimation.FadeOut,
SlideOutToBottom: SCLAlertViewHideAnimation.SlideOutToBottom,
SlideOutToTop: SCLAlertViewHideAnimation.SlideOutToTop,
SlideOutToLeft: SCLAlertViewHideAnimation.SlideOutToLeft,
SlideOutToRight: SCLAlertViewHideAnimation.SlideOutToRight,
SlideOutToCenter: SCLAlertViewHideAnimation.SlideOutToCenter,
SlideOutFromCenter: SCLAlertViewHideAnimation.SlideOutFromCenter
};
//Show animation type (Default is SlideInFromTop)
public static showAnimationType: IFancyAlertShowAnimationTypes;
public static SHOW_ANIMATION_TYPES: IFancyAlertShowAnimationTypes = {
FadeIn: SCLAlertViewShowAnimation.FadeIn,
SlideInFromBottom: SCLAlertViewShowAnimation.SlideInFromBottom,
SlideInFromTop: SCLAlertViewShowAnimation.SlideInFromTop,
SlideInFromLeft: SCLAlertViewShowAnimation.SlideInFromLeft,
SlideInFromRight: SCLAlertViewShowAnimation.SlideInFromRight,
SlideInFromCenter: SCLAlertViewShowAnimation.SlideInFromCenter,
SlideInToCenter: SCLAlertViewShowAnimation.SlideInToCenter
};
//Set background type (Default is Shadow)
public static backgroundType: IFancyAlertBackgroundTypes;
public static BACKGROUND_TYPES: IFancyAlertBackgroundTypes = {
Shadow: SCLAlertViewBackground.Shadow,
Blur: SCLAlertViewBackground.Blur,
Transparent: SCLAlertViewBackground.Transparent
};
//Overwrite SCLAlertView (Buttons, top circle and borders) colors
public static customViewColor: string;
//Set custom tint color for icon image.
public static iconTintColor: string;
// set custom title color
public static titleColor: string;
// set custom body text color
public static bodyTextColor: string;
//Override top circle tint color with background color
public static tintTopCircle: boolean = true;
//Set custom corner radius for SCLAlertView
public static cornerRadius: number;
//Overwrite SCLAlertView background color
public static backgroundViewColor: string;
//Make the top circle icon larger
public static useLargerIcon: boolean = false;
//Using sound
public static soundURL: string;
public static showSuccess(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
) {
return new Promise((resolve, reject) => {
TNSFancyAlert.show(
TNSFancyAlert.SUPPORTED_TYPES.SUCCESS,
title || "Success!",
subTitle,
closeBtnTitle,
duration,
width,
buttons
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown
resolve();
});
}
public static showError(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
) {
return new Promise((resolve, reject) => {
TNSFancyAlert.show(
TNSFancyAlert.SUPPORTED_TYPES.ERROR,
title || "Error!",
subTitle,
closeBtnTitle,
duration,
width,
buttons
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown
resolve();
});
}
public static showNotice(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
) {
return new Promise((resolve, reject) => {
TNSFancyAlert.show(
TNSFancyAlert.SUPPORTED_TYPES.NOTICE,
title || "Notice",
subTitle,
closeBtnTitle,
duration,
width,
buttons
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown
resolve();
});
}
public static showWarning(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
) {
return new Promise((resolve, reject) => {
TNSFancyAlert.show(
TNSFancyAlert.SUPPORTED_TYPES.WARNING,
title || "Warning!",
subTitle,
closeBtnTitle,
duration,
width,
buttons
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown
resolve();
});
}
public static showInfo(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
) {
return new Promise((resolve, reject) => {
TNSFancyAlert.show(
TNSFancyAlert.SUPPORTED_TYPES.INFO,
title || "Info",
subTitle,
closeBtnTitle,
duration,
width,
buttons
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown
resolve();
});
}
public static showEdit(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
) {
return new Promise((resolve, reject) => {
TNSFancyAlert.show(
TNSFancyAlert.SUPPORTED_TYPES.EDIT,
title || "Edit",
subTitle,
closeBtnTitle,
duration,
width,
buttons
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown
resolve();
});
}
public static showWaiting(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
) {
return new Promise((resolve, reject) => {
TNSFancyAlert.show(
TNSFancyAlert.SUPPORTED_TYPES.WAITING,
title || "Waiting...",
subTitle,
closeBtnTitle,
duration || 5,
width
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown
resolve();
});
}
public static showQuestion(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
) {
return new Promise((resolve, reject) => {
TNSFancyAlert.show(
TNSFancyAlert.SUPPORTED_TYPES.QUESTION,
title || "Waiting...",
subTitle,
closeBtnTitle || "Dismiss",
duration,
width,
buttons
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown
resolve();
});
}
public static showCustomButtonTimer(
buttonIndex: number,
reverse?: boolean,
imageName?: string,
color?: string,
title?: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
) {
return new Promise((resolve, reject) => {
let alert = TNSFancyAlert.createAlert(width);
TNSFancyAlert.applyTextDisplayOptions(alert);
buttonIndex = buttonIndex || 0;
reverse = reverse || false;
title = title || "Title";
alert.addTimerToButtonIndexReverse(buttonIndex, reverse);
TNSFancyAlert.showCustom(
alert,
imageName,
color,
title,
subTitle,
closeBtnTitle || "Dismiss",
duration || 5
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown passing back instance to allow further control by developer
resolve(alert);
});
}
public static showCustomImage(
imageName: string,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
) {
return new Promise((resolve, reject) => {
let alert = TNSFancyAlert.createAlert(width);
TNSFancyAlert.applyTextDisplayOptions(alert);
let image = UIImage.imageNamed(imageName);
alert.showCustomColorTitleSubTitleCloseButtonTitleDuration(
image,
new Color(color).ios,
title,
subTitle,
closeBtnTitle || "Ok",
duration || 0
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown passing back instance to allow further control by developer
resolve(alert);
});
}
public static showCustomButtons(
buttons: Array<TNSFancyAlertButton>,
image: any,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
) {
return new Promise((resolve, reject) => {
let alert = TNSFancyAlert.createAlert(width);
TNSFancyAlert.applyTextDisplayOptions(alert);
for (let btn of buttons) {
const slcBtn = alert.addButtonActionBlock(btn.label, () => {
btn.action();
});
if (btn.applyStyle) {
btn.applyStyle(slcBtn);
}
}
TNSFancyAlert.showCustom(
alert,
image,
color,
title,
subTitle,
null,
duration
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown passing back instance to allow further control by developer
resolve(alert);
});
}
public static applyTextDisplayOptions(alert: SCLAlertView) {
if (TNSFancyAlert.textDisplayOptions) {
const systemFont = UIFont.systemFontOfSize(12);
// get default font family name
let fontFamily = systemFont.familyName;
// default size
let fontSize = 14;
// custom font sizes
const titleSize = TNSFancyAlert.textDisplayOptions.titleSize || fontSize;
const bodySize = TNSFancyAlert.textDisplayOptions.bodySize || fontSize;
const buttonSize =
TNSFancyAlert.textDisplayOptions.buttonSize || fontSize;
// if one font is specified on any option just use that for all
if (TNSFancyAlert.textDisplayOptions.applyFontToAll) {
if (TNSFancyAlert.textDisplayOptions.titleFont) {
fontFamily = TNSFancyAlert.textDisplayOptions.titleFont;
} else if (TNSFancyAlert.textDisplayOptions.bodyFont) {
fontFamily = TNSFancyAlert.textDisplayOptions.bodyFont;
} else if (TNSFancyAlert.textDisplayOptions.buttonFont) {
fontFamily = TNSFancyAlert.textDisplayOptions.buttonFont;
}
}
alert.setTitleFontFamilyWithSize(fontFamily, titleSize);
alert.setBodyTextFontFamilyWithSize(fontFamily, bodySize);
alert.setButtonsTextFontFamilyWithSize(fontFamily, buttonSize);
}
}
public static showCustomTextAttributes(
attributionBlock: (p1: string) => NSAttributedString,
button: TNSFancyAlertButton,
image: any,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
) {
return new Promise((resolve, reject) => {
let alert = TNSFancyAlert.createAlert(width);
TNSFancyAlert.applyTextDisplayOptions(alert);
alert.attributedFormatBlock = attributionBlock;
alert.addButtonActionBlock(button.label, () => {
button.action();
resolve();
});
TNSFancyAlert.showCustom(
alert,
image,
color,
title,
subTitle,
null,
duration
);
});
}
public static showTextField(
placeholder: string,
initialValue: string,
button: TNSFancyAlertButton,
image: any,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
) {
return new Promise((resolve, reject) => {
let alert = TNSFancyAlert.createAlert(width);
TNSFancyAlert.applyTextDisplayOptions(alert);
var textField = alert.addTextField(placeholder);
if (initialValue) textField.text = initialValue;
alert.addButtonActionBlock(button.label, () => {
textField.resignFirstResponder();
button.action(textField.text);
resolve();
});
TNSFancyAlert.showCustom(
alert,
image,
color,
title,
subTitle,
null,
duration
);
});
}
public static showSwitch(
switchLabel: string,
switchColor: string,
button: TNSFancyAlertButton,
image: any,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
) {
return new Promise((resolve, reject) => {
let alert = TNSFancyAlert.createAlert(width);
TNSFancyAlert.applyTextDisplayOptions(alert);
var switchView = alert.addSwitchViewWithLabel(switchLabel);
switchView.tintColor = new Color(switchColor).ios;
alert.addButtonActionBlock(button.label, () => {
button.action(switchView.selected);
resolve();
});
TNSFancyAlert.showCustom(
alert,
image,
color,
title,
subTitle,
null,
duration
);
});
}
public static showCustomView(
customView: any,
image?: any,
color?: string,
title?: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
) {
return new Promise((resolve, reject) => {
let alert = TNSFancyAlert.createAlert(width);
TNSFancyAlert.applyTextDisplayOptions(alert);
alert.addCustomView(customView);
TNSFancyAlert.showCustom(
alert,
image,
color,
title,
subTitle,
closeBtnTitle,
duration
);
// TODO: find way to resolve only after button is tapped
// right now just resolve after its shown passing back instance to allow further control by developer
resolve(alert);
});
}
/**
* Base Method
**/
public static show(
type: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
) {
let alert = TNSFancyAlert.createAlert(width);
TNSFancyAlert.applyTextDisplayOptions(alert);
// add custom buttons
if (buttons) {
for (let btn of buttons) {
alert.addButtonActionBlock(btn.label, () => {
btn.action();
});
}
}
// apply options to instance
TNSFancyAlert.applyOptions(alert);
if (typeof closeBtnTitle === "undefined") closeBtnTitle = "Ok";
alert[`show${type}SubTitleCloseButtonTitleDuration`](
title,
subTitle,
closeBtnTitle,
duration || 0
);
}
public static showCustom(
alert: any,
image: any,
color: string,
title?: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number
) {
// apply options to instance
TNSFancyAlert.applyOptions(alert);
if (typeof image === "undefined") image = "nativescript.png";
if (typeof color === "undefined") color = "#2B33FF";
if (typeof closeBtnTitle === "undefined") closeBtnTitle = "Ok";
if (typeof image === "string") {
image = UIImage.imageNamed(image);
}
alert.showCustomColorTitleSubTitleCloseButtonTitleDuration(
image,
new Color(color).ios,
title,
subTitle,
closeBtnTitle,
duration || 0
);
}
/**
* Alert Options
*/
public static applyOptions(alert: any) {
alert.shouldDismissOnTapOutside = TNSFancyAlert.shouldDismissOnTapOutside;
if (TNSFancyAlert.hideAnimationType)
alert.hideAnimationType = TNSFancyAlert.hideAnimationType;
if (TNSFancyAlert.showAnimationType)
alert.showAnimationType = TNSFancyAlert.showAnimationType;
if (TNSFancyAlert.backgroundType)
alert.backgroundType = TNSFancyAlert.backgroundType;
if (TNSFancyAlert.customViewColor)
alert.customViewColor = new Color(TNSFancyAlert.customViewColor).ios;
if (TNSFancyAlert.iconTintColor)
alert.iconTintColor = new Color(TNSFancyAlert.iconTintColor).ios;
if (TNSFancyAlert.titleColor)
alert.labelTitle.textColor = new Color(TNSFancyAlert.titleColor).ios;
if (TNSFancyAlert.bodyTextColor)
alert.viewText.textColor = new Color(TNSFancyAlert.bodyTextColor).ios;
alert.tintTopCircle = TNSFancyAlert.tintTopCircle;
if (TNSFancyAlert.cornerRadius)
alert.cornerRadius = TNSFancyAlert.cornerRadius;
if (TNSFancyAlert.backgroundViewColor)
alert.backgroundViewColor = new Color(
TNSFancyAlert.backgroundViewColor
).ios;
alert.useLargerIcon = TNSFancyAlert.useLargerIcon;
if (TNSFancyAlert.soundURL)
alert.soundURL = NSURL.fileURLWithPath(
`${NSBundle.mainBundle.resourcePath}/${TNSFancyAlert.soundURL}`
);
}
/**
* Alert Creator
**/
public static createAlert(width?: number) {
let alert: SCLAlertView;
if (width) {
alert = SCLAlertView.alloc().initWithNewWindowWidth(width);
} else {
alert = SCLAlertView.alloc().initWithNewWindow();
}
if (TNSFancyAlert.dismissCallback) {
alert.alertIsDismissed(TNSFancyAlert.dismissCallback);
}
return alert;
}
}
================================================
FILE: src/index.d.ts
================================================
import { TNSFancyAlertButton } from "./common";
export * from "./common";
export interface IFancyAlertSupportedTypes {
SUCCESS: string;
ERROR: string;
NOTICE: string;
WARNING: string;
INFO: string;
EDIT: string;
WAITING: string;
QUESTION: string;
}
export interface IFancyAlertHideAnimationTypes {
FadeOut: any;
SlideOutToBottom: any;
SlideOutToTop: any;
SlideOutToLeft: any;
SlideOutToRight: any;
SlideOutToCenter: any;
SlideOutFromCenter: any;
}
export interface IFancyAlertShowAnimationTypes {
FadeIn: any;
SlideInFromBottom: any;
SlideInFromTop: any;
SlideInFromLeft: any;
SlideInFromRight: any;
SlideInFromCenter: any;
SlideInToCenter: any;
}
export interface IFancyAlertBackgroundTypes {
Shadow: any;
Blur: any;
Transparent: any;
}
export interface IFancyAlertTextOptions {
titleFont?: string;
titleSize?: number;
bodyFont?: string;
bodySize?: number;
buttonFont?: string;
buttonSize?: number;
// if font is set on any option just use that font for all text settings
applyFontToAll?: boolean;
}
export declare class TNSFancyAlertButton {
label: string;
action: (arg?: any) => void;
// this will give you the SLCButton (child of UIButton) instance that you can style however you'd like
applyStyle: (btn: any) => void;
constructor(model?: any);
}
export declare class TNSFancyAlert {
static SUPPORTED_TYPES: IFancyAlertSupportedTypes;
static shouldDismissOnTapOutside: boolean;
static dismissCallback: () => void;
static hideAnimationType: IFancyAlertHideAnimationTypes;
static HIDE_ANIMATION_TYPES: IFancyAlertHideAnimationTypes;
static showAnimationType: IFancyAlertShowAnimationTypes;
static SHOW_ANIMATION_TYPES: IFancyAlertShowAnimationTypes;
static backgroundType: IFancyAlertBackgroundTypes;
static BACKGROUND_TYPES: IFancyAlertBackgroundTypes;
static textDisplayOptions: IFancyAlertTextOptions;
static customViewColor: string;
static iconTintColor: string;
static titleColor: string;
static bodyTextColor: string;
static tintTopCircle: boolean;
static cornerRadius: number;
static backgroundViewColor: string;
static useLargerIcon: boolean;
static soundURL: string;
static showSuccess(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
): Promise<{}>;
static showError(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
): Promise<{}>;
static showNotice(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
): Promise<{}>;
static showWarning(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
): Promise<{}>;
static showInfo(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
): Promise<{}>;
static showEdit(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
): Promise<{}>;
static showWaiting(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
): Promise<{}>;
static showQuestion(
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
): Promise<{}>;
static showCustomButtonTimer(
buttonIndex: number,
reverse?: boolean,
imageName?: string,
color?: string,
title?: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
): Promise<{}>;
static showCustomImage(
imageName: string,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
): Promise<{}>;
static showCustomButtons(
buttons: Array<TNSFancyAlertButton>,
image: any,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
): Promise<{}>;
static showCustomTextAttributes(
attributionBlock: Function,
button: TNSFancyAlertButton,
image: any,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
): Promise<{}>;
static showTextField(
placeholder: string,
initialValue: string,
button: TNSFancyAlertButton,
image: any,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
): Promise<{}>;
static showSwitch(
switchLabel: string,
switchColor: string,
button: TNSFancyAlertButton,
image: any,
color: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
): Promise<{}>;
static showCustomView(
customView: any,
image?: any,
color?: string,
title?: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number
): Promise<{}>;
static show(
type: string,
title: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number,
width?: number,
buttons?: Array<TNSFancyAlertButton>
): void;
static showCustom(
alert: any,
image: any,
color: string,
title?: string,
subTitle?: string,
closeBtnTitle?: string,
duration?: number
): void;
static applyOptions(alert: any): void;
static createAlert(width?: number): any;
// Android only
static showColorDialog(
title: string,
subTitle: string,
okBtnTitle?: string,
cancelBtnTitle?: string,
backgroundColor?: string,
titleTextColor?: string,
contextTextColor?: string,
contentImage?: any
): Promise<any>;
}
================================================
FILE: src/package.json
================================================
{
"name": "nativescript-fancyalert",
"version": "3.1.1",
"description": "Fancy alerts for NativeScript.",
"main": "fancyalert",
"typings": "index.d.ts",
"nativescript": {
"platforms": {
"ios": "4.0.1",
"android": "4.1.3"
}
},
"scripts": {
"build": "tsc",
"watch": "npm run build -- -w",
"demo.ios": "npm run preparedemo && cd ../demo && tns run ios --emulator",
"demo.android": "npm run preparedemo && cd ../demo && tns run android --emulator",
"preparedemo": "npm run build && cd ../demo && tns plugin remove nativescript-fancyalert && tns plugin add ../src && tns install && npx rimraf -- package-lock.json",
"setup": "npm i && cd ../demo && npm install && cd ../src && npm run build && cd ../demo && tns plugin add ../src && cd ../src",
"precommit": "lint-staged"
},
"lint-staged": {
"*.ts": [
"prettier --write",
"git add"
]
},
"repository": {
"type": "git",
"url": "https://github.com/NathanWalker/nativescript-fancyalert.git"
},
"keywords": [
"NativeScript",
"iOS",
"Android",
"alert",
"dialogs"
],
"author": {
"name": "Nathan Walker",
"email": "walkerrunpdx@gmail.com"
},
"contributors": [
{
"name": "Brad Martin",
"email": "bradwaynemartin@gmail.com",
"url": "https://github.com/bradmartin"
}
],
"bugs": {
"url": "https://github.com/NathanWalker/nativescript-fancyalert/issues"
},
"license": "MIT",
"homepage": "https://github.com/NathanWalker/nativescript-fancyalert",
"readmeFilename": "README.md",
"devDependencies": {
"tns-core-modules": "^6.5.0",
"tns-platform-declarations": "^6.5.0",
"husky": "^0.14.3",
"lint-staged": "^7.2.2",
"prettier": "^1.14.2",
"typescript": "~3.9.0"
}
}
================================================
FILE: src/platforms/android/include.gradle
================================================
android {
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.Rahul1d:ColorDialog:1.1.0'
}
================================================
FILE: src/platforms/ios/Podfile
================================================
pod 'SCLAlertView-Objective-C'
================================================
FILE: src/tsconfig.json
================================================
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"declaration": false,
"removeComments": true,
"noLib": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"skipLibCheck": true,
"lib": ["es5", "es6", "dom", "es2015.iterable"],
"baseUrl": ".",
"paths": {
"*": ["./node_modules/tns-core-modules/*", "./node_modules/*"]
},
"sourceMap": true,
"pretty": true,
"allowUnreachableCode": false,
"allowUnusedLabels": false,
"noEmitHelpers": true,
"noEmitOnError": false,
"noImplicitAny": false,
"noImplicitReturns": true,
"noImplicitUseStrict": false,
"noFallthroughCasesInSwitch": true,
"typeRoots": ["./node_modules/@types", "./node_modules"],
"types": []
},
"exclude": ["node_modules", "demo"],
"compileOnSave": false
}
================================================
FILE: src/typings/objc!SCLAlertView_Objective_C.d.ts
================================================
declare class SCLALertViewButtonBuilder extends SCLAlertViewBuilder__WithFluent {
static alloc(): SCLALertViewButtonBuilder; // inherited from NSObject
static new(): SCLALertViewButtonBuilder; // inherited from NSObject
readonly actionBlock: (p1: () => void) => SCLALertViewButtonBuilder;
readonly button: SCLButton;
readonly selector: (p1: string) => SCLALertViewButtonBuilder;
readonly target: (p1: any) => SCLALertViewButtonBuilder;
readonly title: (p1: string) => SCLALertViewButtonBuilder;
readonly validationBlock: (p1: () => boolean) => SCLALertViewButtonBuilder;
}
declare class SCLALertViewTextFieldBuilder extends SCLAlertViewBuilder__WithFluent {
static alloc(): SCLALertViewTextFieldBuilder; // inherited from NSObject
static new(): SCLALertViewTextFieldBuilder; // inherited from NSObject
readonly textField: SCLTextView;
readonly title: (p1: string) => SCLALertViewTextFieldBuilder;
}
declare const enum SCLActionType {
None = 0,
Selector = 1,
Block = 2
}
declare class SCLAlertView extends UIViewController {
static alloc(): SCLAlertView; // inherited from NSObject
static new(): SCLAlertView; // inherited from NSObject
activityIndicatorView: UIActivityIndicatorView;
attributedFormatBlock: (p1: string) => NSAttributedString;
backgroundType: SCLAlertViewBackground;
backgroundViewColor: UIColor;
buttonFormatBlock: () => NSDictionary<any, any>;
circleIconHeight: number;
completeButtonFormatBlock: () => NSDictionary<any, any>;
cornerRadius: number;
customViewColor: UIColor;
extensionBounds: CGRect;
forceHideBlock: () => void;
hideAnimationType: SCLAlertViewHideAnimation;
horizontalButtons: boolean;
iconTintColor: UIColor;
labelTitle: UILabel;
shouldDismissOnTapOutside: boolean;
showAnimationType: SCLAlertViewShowAnimation;
soundURL: NSURL;
statusBarHidden: boolean;
statusBarStyle: UIStatusBarStyle;
tintTopCircle: boolean;
useLargerIcon: boolean;
viewText: UITextView;
constructor(o: { newWindow: void });
constructor(o: { newWindowWidth: number });
addButtonActionBlock(title: string, action: () => void): SCLButton;
addButtonTargetSelector(
title: string,
target: any,
selector: string
): SCLButton;
addButtonValidationBlockActionBlock(
title: string,
validationBlock: () => boolean,
action: () => void
): SCLButton;
addCustomTextField(textField: UITextField): void;
addCustomView(customView: UIView): UIView;
addSwitchViewWithLabel(label: string): SCLSwitchView;
addTextField(title: string): SCLTextView;
addTimerToButtonIndexReverse(buttonIndex: number, reverse: boolean): void;
alertDismissAnimationIsCompleted(
dismissAnimationCompletionBlock: () => void
): void;
alertIsDismissed(dismissBlock: () => void): void;
alertShowAnimationIsCompleted(showAnimationCompletionBlock: () => void): void;
hideView(): void;
initWithNewWindow(): this;
initWithNewWindowWidth(windowWidth: number): this;
isVisible(): boolean;
removeTopCircle(): void;
setBodyTextFontFamilyWithSize(bodyTextFontFamily: string, size: number): void;
setButtonsTextFontFamilyWithSize(
buttonsFontFamily: string,
size: number
): void;
setTitleFontFamilyWithSize(titleFontFamily: string, size: number): void;
showCustomColorTitleSubTitleCloseButtonTitleDuration(
image: UIImage,
color: UIColor,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showCustomImageColorTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
image: UIImage,
color: UIColor,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showEditSubTitleCloseButtonTitleDuration(
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showEditTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showErrorSubTitleCloseButtonTitleDuration(
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showErrorTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showInfoSubTitleCloseButtonTitleDuration(
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showInfoTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showNoticeSubTitleCloseButtonTitleDuration(
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showNoticeTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showQuestionSubTitleCloseButtonTitleDuration(
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showQuestionTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showSuccessSubTitleCloseButtonTitleDuration(
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showSuccessTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showTitleSubTitleStyleCloseButtonTitleDuration(
title: string,
subTitle: string,
style: SCLAlertViewStyle,
closeButtonTitle: string,
duration: number
): void;
showTitleTitleSubTitleStyleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
style: SCLAlertViewStyle,
closeButtonTitle: string,
duration: number
): void;
showWaitingSubTitleCloseButtonTitleDuration(
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showWaitingTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showWarningSubTitleCloseButtonTitleDuration(
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
showWarningTitleSubTitleCloseButtonTitleDuration(
vc: UIViewController,
title: string,
subTitle: string,
closeButtonTitle: string,
duration: number
): void;
}
declare const enum SCLAlertViewBackground {
Shadow = 0,
Blur = 1,
Transparent = 2
}
declare class SCLAlertViewBuilder extends SCLAlertViewBuilder__WithFluent {
static alloc(): SCLAlertViewBuilder; // inherited from NSObject
static new(): SCLAlertViewBuilder; // inherited from NSObject
activityIndicatorView: (p1: UIActivityIndicatorView) => SCLAlertViewBuilder;
addButtonWithActionBlock: (p1: string, p2: () => void) => SCLAlertViewBuilder;
addButtonWithBuilder: (p1: SCLALertViewButtonBuilder) => SCLAlertViewBuilder;
addButtonWithTarget: (p1: string, p2: any, p3: string) => SCLAlertViewBuilder;
addButtonWithValidationBlock: (
p1: string,
p2: () => boolean,
p3: () => void
) => SCLAlertViewBuilder;
addCustomTextField: (p1: UITextField) => SCLAlertViewBuilder;
addCustomView: (p1: UIView) => SCLAlertViewBuilder;
addSwitchViewWithLabelTitle: (p1: string) => SCLAlertViewBuilder;
addTextField: (p1: string) => SCLAlertViewBuilder;
addTextFieldWithBuilder: (
p1: SCLALertViewTextFieldBuilder
) => SCLAlertViewBuilder;
addTimerToButtonIndex: (p1: number, p2: boolean) => SCLAlertViewBuilder;
alertDismissAnimationIsCompleted: (p1: () => void) => SCLAlertViewBuilder;
alertIsDismissed: (p1: () => void) => SCLAlertViewBuilder;
alertShowAnimationIsCompleted: (p1: () => void) => SCLAlertViewBuilder;
readonly alertView: SCLAlertView;
attributedFormatBlock: (
p1: (p1: string) => NSAttributedString
) => SCLAlertViewBuilder;
backgroundType: (p1: SCLAlertViewBackground) => SCLAlertViewBuilder;
backgroundViewColor: (p1: UIColor) => SCLAlertViewBuilder;
buttonFormatBlock: (p1: () => NSDictionary<any, any>) => SCLAlertViewBuilder;
circleIconHeight: (p1: number) => SCLAlertViewBuilder;
completeButtonFormatBlock: (
p1: () => NSDictionary<any, any>
) => SCLAlertViewBuilder;
cornerRadius: (p1: number) => SCLAlertViewBuilder;
customViewColor: (p1: UIColor) => SCLAlertViewBuilder;
extensionBounds: (p1: CGRect) => SCLAlertViewBuilder;
forceHideBlock: (p1: () => void) => SCLAlertViewBuilder;
hideAnimationType: (p1: SCLAlertViewHideAnimation) => SCLAlertViewBuilder;
iconTintColor: (p1: UIColor) => SCLAlertViewBuilder;
labelTitle: (p1: UILabel) => SCLAlertViewBuilder;
removeTopCircle: () => SCLAlertViewBuilder;
setBodyTextFontFamily: (p1: string, p2: number) => SCLAlertViewBuilder;
setButtonsTextFontFamily: (p1: string, p2: number) => SCLAlertViewBuilder;
setTitleFontFamily: (p1: string, p2: number) => SCLAlertViewBuilder;
shouldDismissOnTapOutside: (p1: boolean) => SCLAlertViewBuilder;
showAnimationType: (p1: SCLAlertViewShowAnimation) => SCLAlertViewBuilder;
soundURL: (p1: NSURL) => SCLAlertViewBuilder;
statusBarHidden: (p1: boolean) => SCLAlertViewBuilder;
statusBarStyle: (p1: UIStatusBarStyle) => SCLAlertViewBuilder;
tintTopCircle: (p1: boolean) => SCLAlertViewBuilder;
useLargerIcon: (p1: boolean) => SCLAlertViewBuilder;
viewText: (p1: UITextView) => SCLAlertViewBuilder;
constructor(o: { newWindow: void });
constructor(o: { newWindowWidth: number });
initWithNewWindow(): this;
initWithNewWindowWidth(width: number): this;
}
declare class SCLAlertViewBuilder__WithFluent extends NSObject
implements SCLItemsBuilder__Protocol__Fluent {
static alloc(): SCLAlertViewBuilder__WithFluent; // inherited from NSObject
static new(): SCLAlertViewBuilder__WithFluent; // inherited from NSObject
readonly debugDescription: string; // inherited from NSObjectProtocol
readonly description: string; // inherited from NSObjectProtocol
readonly hash: number; // inherited from NSObjectProtocol
readonly isProxy: boolean; // inherited from NSObjectProtocol
readonly superclass: typeof NSObject; // inherited from NSObjectProtocol
readonly; // inherited from NSObjectProtocol
class(): typeof NSObject;
conformsToProtocol(aProtocol: any /* Protocol */): boolean;
isEqual(object: any): boolean;
isKindOfClass(aClass: typeof NSObject): boolean;
isMemberOfClass(aClass: typeof NSObject): boolean;
performSelector(aSelector: string): any;
performSelectorWithObject(aSelector: string, object: any): any;
performSelectorWithObjectWithObject(
aSelector: string,
object1: any,
object2: any
): any;
respondsToSelector(aSelector: string): boolean;
retainCount(): number;
self(): this;
setupFluent(): void;
}
declare const enum SCLAlertViewHideAnimation {
FadeOut = 0,
SlideOutToBottom = 1,
SlideOutToTop = 2,
SlideOutToLeft = 3,
SlideOutToRight = 4,
SlideOutToCenter = 5,
SlideOutFromCenter = 6,
SimplyDisappear = 7
}
declare class SCLAlertViewResponder extends NSObject {
static alloc(): SCLAlertViewResponder; // inherited from NSObject
static new(): SCLAlertViewResponder; // inherited from NSObject
constructor();
close(): void;
init(alertview: SCLAlertView): this;
}
declare const enum SCLAlertViewShowAnimation {
FadeIn = 0,
SlideInFromBottom = 1,
SlideInFromTop = 2,
SlideInFromLeft = 3,
SlideInFromRight = 4,
SlideInFromCenter = 5,
SlideInToCenter = 6,
SimplyAppear = 7
}
declare class SCLAlertViewShowBuilder extends SCLAlertViewBuilder__WithFluent {
static alloc(): SCLAlertViewShowBuilder; // inherited from NSObject
static new(): SCLAlertViewShowBuilder; // inherited from NSObject
readonly closeButtonTitle: (p1: string) => SCLAlertViewShowBuilder;
readonly color: (p1: UIColor) => SCLAlertViewShowBuilder;
readonly completeText: (p1: string) => SCLAlertViewShowBuilder;
readonly duration: (p1: number) => SCLAlertViewShowBuilder;
readonly image: (p1: UIImage) => SCLAlertViewShowBuilder;
readonly parameterCloseButtonTitle: string;
readonly parameterColor: UIColor;
readonly parameterCompleteText: string;
readonly parameterDuration: number;
readonly parameterImage: UIImage;
readonly parameterStyle: SCLAlertViewStyle;
readonly parameterSubTitle: string;
readonly parameterTitle: string;
readonly parameterViewController: UIViewController;
readonly show: (p1: SCLAlertView, p2: UIViewController) => void;
readonly style: (p1: SCLAlertViewStyle) => SCLAlertViewShowBuilder;
readonly subTitle: (p1: string) => SCLAlertViewShowBuilder;
readonly title: (p1: string) => SCLAlertViewShowBuilder;
readonly viewController: (p1: UIViewController) => SCLAlertViewShowBuilder;
showAlertView(alertView: SCLAlertView): void;
showAlertViewOnViewController(
alertView: SCLAlertView,
controller: UIViewController
): void;
}
declare const enum SCLAlertViewStyle {
Success = 0,
Error = 1,
Notice = 2,
Warning = 3,
Info = 4,
Edit = 5,
Waiting = 6,
Question = 7,
Custom = 8
}
declare class SCLAlertViewStyleKit extends NSObject {
static alloc(): SCLAlertViewStyleKit; // inherited from NSObject
static drawCheckmark(): void;
static drawCross(): void;
static drawEdit(): void;
static drawInfo(): void;
static drawNotice(): void;
static drawQuestion(): void;
static drawWarning(): void;
static imageOfCheckmark(): UIImage;
static imageOfCross(): UIImage;
static imageOfEdit(): UIImage;
static imageOfInfo(): UIImage;
static imageOfNotice(): UIImage;
static imageOfQuestion(): UIImage;
static imageOfWarning(): UIImage;
static new(): SCLAlertViewStyleKit; // inherited from NSObject
}
declare var SCLAlertView_Objective_CVersionNumber: number;
declare var SCLAlertView_Objective_CVersionString: interop.Reference<number>;
declare class SCLButton extends UIButton {
static alloc(): SCLButton; // inherited from NSObject
static appearance(): SCLButton; // inherited from UIAppearance
static appearanceForTraitCollection(trait: UITraitCollection): SCLButton; // inherited from UIAppearance
static appearanceForTraitCollectionWhenContainedIn(
trait: UITraitCollection,
ContainerClass: typeof NSObject
): SCLButton; // inherited from UIAppearance
static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(
trait: UITraitCollection,
containerTypes: NSArray<typeof NSObject>
): SCLButton; // inherited from UIAppearance
static appearanceWhenContainedIn(ContainerClass: typeof NSObject): SCLButton; // inherited from UIAppearance
static appearanceWhenContainedInInstancesOfClasses(
containerTypes: NSArray<typeof NSObject>
): SCLButton; // inherited from UIAppearance
static buttonWithType(buttonType: UIButtonType): SCLButton; // inherited from UIButton
static new(): SCLButton; // inherited from NSObject
actionBlock: () => void;
actionType: SCLActionType;
buttonFormatBlock: () => NSDictionary<any, any>;
completeButtonFormatBlock: () => NSDictionary<any, any>;
defaultBackgroundColor: UIColor;
selector: string;
target: any;
timer: SCLTimerDisplay;
validationBlock: () => boolean;
constructor(o: { windowWidth: number });
adjustWidthWithWindowWidthNumberOfButtons(
windowWidth: number,
numberOfButtons: number
): void;
initWithWindowWidth(windowWidth: number): this;
parseConfig(buttonConfig: NSDictionary<any, any>): void;
}
interface SCLItemsBuilder__Protocol__Fluent extends NSObjectProtocol {
setupFluent(): void;
}
declare var SCLItemsBuilder__Protocol__Fluent: {
prototype: SCLItemsBuilder__Protocol__Fluent;
};
declare class SCLSwitchView extends UIView {
static alloc(): SCLSwitchView; // inherited from NSObject
static appearance(): SCLSwitchView; // inherited from UIAppearance
static appearanceForTraitCollection(trait: UITraitCollection): SCLSwitchView; // inherited from UIAppearance
static appearanceForTraitCollectionWhenContainedIn(
trait: UITraitCollection,
ContainerClass: typeof NSObject
): SCLSwitchView; // inherited from UIAppearance
static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(
trait: UITraitCollection,
containerTypes: NSArray<typeof NSObject>
): SCLSwitchView; // inherited from UIAppearance
static appearanceWhenContainedIn(
ContainerClass: typeof NSObject
): SCLSwitchView; // inherited from UIAppearance
static appearanceWhenContainedInInstancesOfClasses(
containerTypes: NSArray<typeof NSObject>
): SCLSwitchView; // inherited from UIAppearance
static new(): SCLSwitchView; // inherited from NSObject
labelColor: UIColor;
labelFont: UIFont;
labelText: string;
selected: boolean;
}
declare class SCLTextView extends UITextField {
static alloc(): SCLTextView; // inherited from NSObject
static appearance(): SCLTextView; // inherited from UIAppearance
static appearanceForTraitCollection(trait: UITraitCollection): SCLTextView; // inherited from UIAppearance
static appearanceForTraitCollectionWhenContainedIn(
trait: UITraitCollection,
ContainerClass: typeof NSObject
): SCLTextView; // inherited from UIAppearance
static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(
trait: UITraitCollection,
containerTypes: NSArray<typeof NSObject>
): SCLTextView; // inherited from UIAppearance
static appearanceWhenContainedIn(
ContainerClass: typeof NSObject
): SCLTextView; // inherited from UIAppearance
static appearanceWhenContainedInInstancesOfClasses(
containerTypes: NSArray<typeof NSObject>
): SCLTextView; // inherited from UIAppearance
static new(): SCLTextView; // inherited from NSObject
}
declare class SCLTimerDisplay extends UIView {
static alloc(): SCLTimerDisplay; // inherited from NSObject
static appearance(): SCLTimerDisplay; // inherited from UIAppearance
static appearanceForTraitCollection(
trait: UITraitCollection
): SCLTimerDisplay; // inherited from UIAppearance
static appearanceForTraitCollectionWhenContainedIn(
trait: UITraitCollection,
ContainerClass: typeof NSObject
): SCLTimerDisplay; // inherited from UIAppearance
static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(
trait: UITraitCollection,
containerTypes: NSArray<typeof NSObject>
): SCLTimerDisplay; // inherited from UIAppearance
static appearanceWhenContainedIn(
ContainerClass: typeof NSObject
): SCLTimerDisplay; // inherited from UIAppearance
static appearanceWhenContainedInInstancesOfClasses(
containerTypes: NSArray<typeof NSObject>
): SCLTimerDisplay; // inherited from UIAppearance
static new(): SCLTimerDisplay; // inherited from NSObject
buttonIndex: number;
color: UIColor;
currentAngle: number;
reverse: boolean;
constructor(o: { origin: CGPoint; radius: number });
constructor(o: { origin: CGPoint; radius: number; lineWidth: number });
cancelTimer(): void;
initWithOriginRadius(origin: CGPoint, r: number): this;
initWithOriginRadiusLineWidth(
origin: CGPoint,
r: number,
width: number
): this;
startTimerWithTimeLimitCompleted(tl: number, completed: () => void): void;
stopTimer(): void;
updateFrame(size: CGSize): void;
}
gitextract_n3st3lve/
├── .gitignore
├── LICENSE
├── README.md
├── demo/
│ ├── app/
│ │ ├── App_Resources/
│ │ │ ├── Android/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ └── app.gradle
│ │ │ └── iOS/
│ │ │ └── Info.plist
│ │ ├── app.css
│ │ ├── app.ts
│ │ ├── main-page.ts
│ │ ├── main-page.xml
│ │ ├── main-view-model.ts
│ │ ├── package.json
│ │ ├── vendor-platform.android.ts
│ │ ├── vendor-platform.ios.ts
│ │ └── vendor.ts
│ ├── package.json
│ ├── references.d.ts
│ ├── tsconfig.esm.json
│ ├── tsconfig.json
│ └── webpack.config.js
├── demo-vue/
│ ├── .babelrc
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── src/
│ │ └── main.js
│ └── template/
│ ├── app/
│ │ ├── App_Resources/
│ │ │ ├── Android/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── app.gradle
│ │ │ │ ├── drawable-nodpi/
│ │ │ │ │ └── splash_screen.xml
│ │ │ │ ├── values/
│ │ │ │ │ ├── colors.xml
│ │ │ │ │ ├── strings.xml
│ │ │ │ │ └── styles.xml
│ │ │ │ └── values-v21/
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ └── iOS/
│ │ │ ├── Assets.xcassets/
│ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Contents.json
│ │ │ │ ├── LaunchImage.launchimage/
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── LaunchScreen.AspectFill.imageset/
│ │ │ │ │ └── Contents.json
│ │ │ │ └── LaunchScreen.Center.imageset/
│ │ │ │ └── Contents.json
│ │ │ ├── Info.plist
│ │ │ ├── LaunchScreen.storyboard
│ │ │ └── build.xcconfig
│ │ └── package.json
│ └── package.json
└── src/
├── .npmignore
├── common.ts
├── fancyalert.android.ts
├── fancyalert.ios.ts
├── index.d.ts
├── package.json
├── platforms/
│ ├── android/
│ │ └── include.gradle
│ └── ios/
│ └── Podfile
├── tsconfig.json
└── typings/
└── objc!SCLAlertView_Objective_C.d.ts
SYMBOL INDEX (83 symbols across 8 files)
FILE: demo-vue/src/main.js
method data (line 19) | data() {
method showSuccess (line 25) | showSuccess () {
method onLoaded (line 36) | onLoaded () {
method getRootView (line 50) | getRootView (vm) {
FILE: demo/app/main-page.ts
function pageLoaded (line 6) | function pageLoaded(args: observable.EventData) {
FILE: demo/app/main-view-model.ts
class HelloWorldModel (line 18) | class HelloWorldModel extends Observable {
method constructor (line 19) | constructor() {
method showSuccess (line 27) | public showSuccess() {
method showSuccessCustomEffects (line 35) | public showSuccessCustomEffects() {
method showSuccessDelay (line 52) | public showSuccessDelay() {
method showError (line 61) | public showError() {
method showNotice (line 69) | public showNotice() {
method showWarning (line 77) | public showWarning() {
method showInfo (line 81) | public showInfo() {
method showEdit (line 98) | public showEdit() {
method showWaiting (line 106) | public showWaiting() {
method showQuestion (line 114) | public showQuestion() {
method showCustomImage (line 122) | public showCustomImage() {
method showCustomButtonTimer (line 132) | public showCustomButtonTimer() {
method showCustomButtons (line 144) | public showCustomButtons() {
method showCustomWidth (line 187) | public showCustomWidth() {
method customText (line 197) | public customText() {
method showTextField (line 250) | public showTextField() {
method showSwitch (line 268) | public showSwitch() {
method showCustomView (line 286) | public showCustomView() {
method reset (line 299) | private reset() {
FILE: src/common.ts
class TNSFancyAlertButton (line 1) | class TNSFancyAlertButton {
method constructor (line 6) | constructor(model?: any) {
FILE: src/fancyalert.android.ts
type IFancyAlertSupportedTypesAndroid (line 8) | enum IFancyAlertSupportedTypesAndroid {
class TNSFancyAlert (line 17) | class TNSFancyAlert {
method showSuccess (line 20) | public static showSuccess(
method showError (line 47) | public static showError(
method showNotice (line 74) | public static showNotice(
method showWarning (line 101) | public static showWarning(
method showEdit (line 128) | public static showEdit(
method showInfo (line 156) | public static showInfo(
method showColorDialog (line 183) | public static showColorDialog(
FILE: src/fancyalert.ios.ts
class TNSFancyAlert (line 13) | class TNSFancyAlert {
method showSuccess (line 94) | public static showSuccess(
method showError (line 118) | public static showError(
method showNotice (line 142) | public static showNotice(
method showWarning (line 166) | public static showWarning(
method showInfo (line 190) | public static showInfo(
method showEdit (line 214) | public static showEdit(
method showWaiting (line 238) | public static showWaiting(
method showQuestion (line 260) | public static showQuestion(
method showCustomButtonTimer (line 284) | public static showCustomButtonTimer(
method showCustomImage (line 318) | public static showCustomImage(
method showCustomButtons (line 346) | public static showCustomButtons(
method applyTextDisplayOptions (line 383) | public static applyTextDisplayOptions(alert: SCLAlertView) {
method showCustomTextAttributes (line 414) | public static showCustomTextAttributes(
method showTextField (line 446) | public static showTextField(
method showSwitch (line 481) | public static showSwitch(
method showCustomView (line 516) | public static showCustomView(
method show (line 549) | public static show(
method showCustom (line 582) | public static showCustom(
method applyOptions (line 615) | public static applyOptions(alert: any) {
method createAlert (line 660) | public static createAlert(width?: number) {
FILE: src/index.d.ts
type IFancyAlertSupportedTypes (line 3) | interface IFancyAlertSupportedTypes {
type IFancyAlertHideAnimationTypes (line 13) | interface IFancyAlertHideAnimationTypes {
type IFancyAlertShowAnimationTypes (line 22) | interface IFancyAlertShowAnimationTypes {
type IFancyAlertBackgroundTypes (line 31) | interface IFancyAlertBackgroundTypes {
type IFancyAlertTextOptions (line 36) | interface IFancyAlertTextOptions {
class TNSFancyAlertButton (line 46) | class TNSFancyAlertButton {
class TNSFancyAlert (line 53) | class TNSFancyAlert {
FILE: src/typings/objc!SCLAlertView_Objective_C.d.ts
class SCLALertViewButtonBuilder (line 1) | class SCLALertViewButtonBuilder extends SCLAlertViewBuilder__WithFluent {
class SCLALertViewTextFieldBuilder (line 19) | class SCLALertViewTextFieldBuilder extends SCLAlertViewBuilder__WithFlue...
type SCLActionType (line 29) | const enum SCLActionType {
class SCLAlertView (line 37) | class SCLAlertView extends UIViewController {
type SCLAlertViewBackground (line 300) | const enum SCLAlertViewBackground {
class SCLAlertViewBuilder (line 308) | class SCLAlertViewBuilder extends SCLAlertViewBuilder__WithFluent {
class SCLAlertViewBuilder__WithFluent (line 412) | class SCLAlertViewBuilder__WithFluent extends NSObject
type SCLAlertViewHideAnimation (line 459) | const enum SCLAlertViewHideAnimation {
class SCLAlertViewResponder (line 477) | class SCLAlertViewResponder extends NSObject {
type SCLAlertViewShowAnimation (line 489) | const enum SCLAlertViewShowAnimation {
class SCLAlertViewShowBuilder (line 507) | class SCLAlertViewShowBuilder extends SCLAlertViewBuilder__WithFluent {
type SCLAlertViewStyle (line 558) | const enum SCLAlertViewStyle {
class SCLAlertViewStyleKit (line 578) | class SCLAlertViewStyleKit extends NSObject {
class SCLButton (line 616) | class SCLButton extends UIButton {
type SCLItemsBuilder__Protocol__Fluent (line 673) | interface SCLItemsBuilder__Protocol__Fluent extends NSObjectProtocol {
class SCLSwitchView (line 680) | class SCLSwitchView extends UIView {
class SCLTextView (line 716) | class SCLTextView extends UITextField {
class SCLTimerDisplay (line 744) | class SCLTimerDisplay extends UIView {
Condensed preview — 54 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (126K chars).
[
{
"path": ".gitignore",
"chars": 307,
"preview": "src/*.js\nsrc/*.js.map\nsrc/*.log\nsrc/*.d.ts\n!index.d.ts\ndemo/package-lock.json\ndemo/app/*.js\ndemo/*.d.ts\ndemo/lib\ndemo/ho"
},
{
"path": "LICENSE",
"chars": 1104,
"preview": "The MIT License (MIT)\n\nnativescript-fancyalert\nCopyright (c) 2016, Nathan Walker\n\nPermission is hereby granted, free of "
},
{
"path": "README.md",
"chars": 13892,
"preview": "## NativeScript 7 or higher\n\n* Use `@nstudio/nativescript-fancyalert`: `~4.0.0`\n* [Source managed here](https://github.c"
},
{
"path": "demo/app/App_Resources/Android/AndroidManifest.xml",
"chars": 1263,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n\tpackage=\"__"
},
{
"path": "demo/app/App_Resources/Android/app.gradle",
"chars": 157,
"preview": "// Add your native dependencies here:\n\n// Uncomment to add recyclerview-v7 dependency\n//dependencies {\n//\tcompile 'com.a"
},
{
"path": "demo/app/App_Resources/iOS/Info.plist",
"chars": 1429,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "demo/app/app.css",
"chars": 93,
"preview": "Button {\n font-size: 20;\n horizontal-align: center;\n padding:10;\n text-align: center;\n}\n"
},
{
"path": "demo/app/app.ts",
"chars": 110,
"preview": "import * as application from 'tns-core-modules/application';\napplication.start({ moduleName: 'main-page' });\n"
},
{
"path": "demo/app/main-page.ts",
"chars": 406,
"preview": "import * as observable from \"tns-core-modules/data/observable\";\nimport * as pages from \"tns-core-modules/ui/page\";\nimpor"
},
{
"path": "demo/app/main-page.xml",
"chars": 1462,
"preview": "<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\" loaded=\"pageLoaded\">\n <Page.actionBar>\n <ActionBar title=\"Na"
},
{
"path": "demo/app/main-view-model.ts",
"chars": 7316,
"preview": "import { TNSFancyAlert, TNSFancyAlertButton } from \"nativescript-fancyalert\";\nimport { Color } from \"tns-core-modules/co"
},
{
"path": "demo/app/package.json",
"chars": 2613,
"preview": "{\n \"name\": \"tns-template-hello-world-ts\",\n \"main\": \"app.js\",\n \"version\": \"1.6.0\",\n \"author\": {\n \"name\": \"Telerik\""
},
{
"path": "demo/app/vendor-platform.android.ts",
"chars": 406,
"preview": "require(\"application\");\nif (!global[\"__snapshot\"]) {\n // In case snapshot generation is enabled these modules will ge"
},
{
"path": "demo/app/vendor-platform.ios.ts",
"chars": 195,
"preview": "// There is a bug in angular: https://github.com/angular/angular-cli/pull/8589/files\n// Legendary stuff, its webpack plu"
},
{
"path": "demo/app/vendor.ts",
"chars": 342,
"preview": "// Snapshot the ~/app.css and the theme\nconst application = require(\"application\");\nrequire(\"ui/styling/style-scope\");\nc"
},
{
"path": "demo/package.json",
"chars": 917,
"preview": "{\n \"nativescript\": {\n \"id\": \"org.nativescript.demo\",\n \"tns-android\": {\n \"version\": \"4.2.0\"\n },\n \"tns-i"
},
{
"path": "demo/references.d.ts",
"chars": 143,
"preview": "/// <reference path=\"./node_modules/tns-core-modules/tns-core-modules.d.ts\" />\n/// <reference path=\"./node_modules/types"
},
{
"path": "demo/tsconfig.esm.json",
"chars": 127,
"preview": "{\n \"extends\": \"./tsconfig\",\n \"compilerOptions\": {\n \"module\": \"es2015\",\n \"moduleResolution\": \"node\"\n "
},
{
"path": "demo/tsconfig.json",
"chars": 1111,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"es5\",\n \"module\": \"commonjs\",\n \"declaration\": false,\n "
},
{
"path": "demo/webpack.config.js",
"chars": 5116,
"preview": "const { resolve, join } = require(\"path\");\n\nconst webpack = require(\"webpack\");\nconst nsWebpack = require(\"nativescript"
},
{
"path": "demo-vue/.babelrc",
"chars": 109,
"preview": "{\n \"presets\": [\n [\"env\", { \"cacheDirectory\": true }]\n ],\n \"plugins\": [\"transform-object-rest-spread\"]\n}"
},
{
"path": "demo-vue/.gitignore",
"chars": 86,
"preview": "# JetBrains project files\n.idea\n\n# NPM\nnode_modules\n\n# NativeScript application\n/dist\n"
},
{
"path": "demo-vue/README.md",
"chars": 549,
"preview": "# NativeScript-Vue Demo\n\n> Demo app for nativescript-fancyalert plugin made with NativeScript-Vue\n\n## Usage\n\n* Install d"
},
{
"path": "demo-vue/package.json",
"chars": 1666,
"preview": "{\n \"name\": \"demo-vue\",\n \"version\": \"1.0.0\",\n \"description\": \"A native application built with NativeScript-Vue\",\n \"sc"
},
{
"path": "demo-vue/src/main.js",
"chars": 1134,
"preview": "import * as app from \"tns-core-modules/application\"\n\nimport Vue from 'nativescript-vue'\nimport { isIOS, isAndroid } from"
},
{
"path": "demo-vue/template/app/App_Resources/Android/AndroidManifest.xml",
"chars": 1454,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest\n xmlns:android=\"http://schemas.android.com/apk/res/android\" package="
},
{
"path": "demo-vue/template/app/App_Resources/Android/app.gradle",
"chars": 212,
"preview": "// Add your native dependencies here:\n\nandroid {\n defaultConfig { \n generatedDensities = []\n applicationId = \"__"
},
{
"path": "demo-vue/template/app/App_Resources/Android/drawable-nodpi/splash_screen.xml",
"chars": 304,
"preview": "<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\" android:gravity=\"fill\">\n <item>\n <bitma"
},
{
"path": "demo-vue/template/app/App_Resources/Android/values/colors.xml",
"chars": 237,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"ns_primary\">#F5F5F5</color>\n\t<color name=\"ns_primary"
},
{
"path": "demo-vue/template/app/App_Resources/Android/values/strings.xml",
"chars": 209,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <string name=\"app_name\">NativeScript-Vue Application</string>\n "
},
{
"path": "demo-vue/template/app/App_Resources/Android/values/styles.xml",
"chars": 1721,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources xmlns:android=\"http://schemas.android.com/apk/res/android\">\n\n <!-- "
},
{
"path": "demo-vue/template/app/App_Resources/Android/values-v21/colors.xml",
"chars": 104,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\t<color name=\"ns_accent\">#3d5afe</color>\n</resources>"
},
{
"path": "demo-vue/template/app/App_Resources/Android/values-v21/strings.xml",
"chars": 209,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <string name=\"app_name\">NativeScript-Vue Application</string>\n "
},
{
"path": "demo-vue/template/app/App_Resources/Android/values-v21/styles.xml",
"chars": 898,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n\n <!-- Application theme -->\n <style name=\"AppTheme\" parent=\"Ap"
},
{
"path": "demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json",
"chars": 1887,
"preview": "{\n \"images\" : [\n {\n \"size\" : \"29x29\",\n \"idiom\" : \"iphone\",\n \"filename\" : \"icon-29.png\",\n \"scale\""
},
{
"path": "demo-vue/template/app/App_Resources/iOS/Assets.xcassets/Contents.json",
"chars": 62,
"preview": "{\n \"info\" : {\n \"version\" : 1,\n \"author\" : \"xcode\"\n }\n}"
},
{
"path": "demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json",
"chars": 4246,
"preview": "{\n \"images\" : [\n {\n \"extent\" : \"full-screen\",\n \"idiom\" : \"iphone\",\n \"subtype\" : \"2436h\",\n \"filen"
},
{
"path": "demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json",
"chars": 373,
"preview": "{\n \"images\" : [\n {\n \"idiom\" : \"universal\",\n \"filename\" : \"LaunchScreen-AspectFill.png\",\n \"scale\" : \"1"
},
{
"path": "demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json",
"chars": 365,
"preview": "{\n \"images\" : [\n {\n \"idiom\" : \"universal\",\n \"filename\" : \"LaunchScreen-Center.png\",\n \"scale\" : \"1x\"\n "
},
{
"path": "demo-vue/template/app/App_Resources/iOS/Info.plist",
"chars": 1488,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "demo-vue/template/app/App_Resources/iOS/LaunchScreen.storyboard",
"chars": 3933,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard"
},
{
"path": "demo-vue/template/app/App_Resources/iOS/build.xcconfig",
"chars": 504,
"preview": "// You can add custom settings here\n// for example you can uncomment the following line to force distribution code signi"
},
{
"path": "demo-vue/template/app/package.json",
"chars": 116,
"preview": "{\n \"android\": {\n \"v8Flags\": \"--expose_gc\"\n },\n \"main\": \"app.js\",\n \"name\": \"demo-vue\",\n \"version\": \"1.0.0\"\n}\n"
},
{
"path": "demo-vue/template/package.json",
"chars": 541,
"preview": "{\n \"name\": \"demo-vue\",\n \"description\": \"A native application built with NativeScript-Vue\",\n \"license\": \"MIT\",\n \"read"
},
{
"path": "src/.npmignore",
"chars": 255,
"preview": "demo/\nscreenshots/\n*.png\n*.log\n*.ts\n!*.d.ts\ntsconfig.json\npackage-lock.json\n\n\nnode_modules/\n\n*.ts\n!*.d.ts\n*.map\ntsconfig"
},
{
"path": "src/common.ts",
"chars": 294,
"preview": "export class TNSFancyAlertButton {\n public label: string;\n public action: Function;\n public applyStyle: (btn: any) =>"
},
{
"path": "src/fancyalert.android.ts",
"chars": 7280,
"preview": "import * as app from \"tns-core-modules/application\";\nimport { Color } from \"tns-core-modules/color\";\n\nexport * from \"./c"
},
{
"path": "src/fancyalert.ios.ts",
"chars": 18248,
"preview": "import { Color } from \"tns-core-modules/color\";\nimport { TNSFancyAlertButton } from \"./common\";\nimport {\n IFancyAlertSu"
},
{
"path": "src/index.d.ts",
"chars": 6133,
"preview": "import { TNSFancyAlertButton } from \"./common\";\nexport * from \"./common\";\nexport interface IFancyAlertSupportedTypes {\n "
},
{
"path": "src/package.json",
"chars": 1804,
"preview": "{\n \"name\": \"nativescript-fancyalert\",\n \"version\": \"3.1.1\",\n \"description\": \"Fancy alerts for NativeScript.\",\n \"main\""
},
{
"path": "src/platforms/android/include.gradle",
"chars": 152,
"preview": "android {\n \n}\n\nrepositories {\n maven {\n url \"https://jitpack.io\"\n }\n}\n\ndependencies {\n compile 'com.git"
},
{
"path": "src/platforms/ios/Podfile",
"chars": 30,
"preview": "pod 'SCLAlertView-Objective-C'"
},
{
"path": "src/tsconfig.json",
"chars": 854,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"es5\",\n \"module\": \"commonjs\",\n \"declaration\": false,\n \"removeComments\": "
},
{
"path": "src/typings/objc!SCLAlertView_Objective_C.d.ts",
"chars": 19821,
"preview": "declare class SCLALertViewButtonBuilder extends SCLAlertViewBuilder__WithFluent {\n static alloc(): SCLALertViewButtonBu"
}
]
About this extraction
This page contains the full source code of the NathanWalker/nativescript-fancyalert GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 54 files (113.1 KB), approximately 31.2k tokens, and a symbol index with 83 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.