├── src
├── platforms
│ ├── ios
│ │ └── Podfile
│ └── android
│ │ └── include.gradle
├── common.ts
├── .npmignore
├── tsconfig.json
├── package.json
├── index.d.ts
├── fancyalert.android.ts
├── fancyalert.ios.ts
└── typings
│ └── objc!SCLAlertView_Objective_C.d.ts
├── screenshots
├── alert.gif
└── alert-android.gif
├── demo
├── app
│ ├── app.css
│ ├── app.ts
│ ├── App_Resources
│ │ ├── iOS
│ │ │ ├── bell.mp3
│ │ │ ├── icon.png
│ │ │ ├── Default.png
│ │ │ ├── icon-40.png
│ │ │ ├── icon-60.png
│ │ │ ├── icon-72.png
│ │ │ ├── icon-76.png
│ │ │ ├── icon@2x.png
│ │ │ ├── switch.png
│ │ │ ├── Default@2x.png
│ │ │ ├── Icon-Small.png
│ │ │ ├── icon-40@2x.png
│ │ │ ├── icon-60@2x.png
│ │ │ ├── icon-72@2x.png
│ │ │ ├── icon-76@2x.png
│ │ │ ├── nativescript.png
│ │ │ ├── Icon-Small-50.png
│ │ │ ├── Icon-Small@2x.png
│ │ │ ├── Default-568h@2x.png
│ │ │ ├── Default-667h@2x.png
│ │ │ ├── Default-736h@3x.png
│ │ │ ├── Default-Landscape.png
│ │ │ ├── Default-Portrait.png
│ │ │ ├── Icon-Small-50@2x.png
│ │ │ ├── Default-Portrait@2x.png
│ │ │ ├── Default-Landscape@2x.png
│ │ │ ├── Default-Landscape@3x.png
│ │ │ ├── Default-Landscape-568h@2x.png
│ │ │ ├── Default-Landscape-667h@2x.png
│ │ │ └── Info.plist
│ │ └── Android
│ │ │ ├── drawable-hdpi
│ │ │ ├── icon.png
│ │ │ └── customimage.jpg
│ │ │ ├── drawable-ldpi
│ │ │ ├── icon.png
│ │ │ └── customimage.jpg
│ │ │ ├── drawable-mdpi
│ │ │ ├── icon.png
│ │ │ └── customimage.jpg
│ │ │ ├── drawable-nodpi
│ │ │ └── splashscreen.9.png
│ │ │ ├── app.gradle
│ │ │ └── AndroidManifest.xml
│ ├── vendor-platform.ios.ts
│ ├── vendor.ts
│ ├── main-page.ts
│ ├── vendor-platform.android.ts
│ ├── main-page.xml
│ ├── package.json
│ └── main-view-model.ts
├── references.d.ts
├── tsconfig.esm.json
├── package.json
├── tsconfig.json
└── webpack.config.js
├── demo-vue
├── .gitignore
├── .babelrc
├── template
│ ├── app
│ │ ├── App_Resources
│ │ │ ├── iOS
│ │ │ │ ├── Assets.xcassets
│ │ │ │ │ ├── Contents.json
│ │ │ │ │ ├── AppIcon.appiconset
│ │ │ │ │ │ ├── icon-1024.png
│ │ │ │ │ │ ├── icon-29.png
│ │ │ │ │ │ ├── icon-40.png
│ │ │ │ │ │ ├── icon-76.png
│ │ │ │ │ │ ├── icon-29@2x.png
│ │ │ │ │ │ ├── icon-29@3x.png
│ │ │ │ │ │ ├── icon-40@2x.png
│ │ │ │ │ │ ├── icon-40@3x.png
│ │ │ │ │ │ ├── icon-60@2x.png
│ │ │ │ │ │ ├── icon-60@3x.png
│ │ │ │ │ │ ├── icon-76@2x.png
│ │ │ │ │ │ ├── icon-83.5@2x.png
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ ├── LaunchImage.launchimage
│ │ │ │ │ │ ├── Default.png
│ │ │ │ │ │ ├── Default@2x.png
│ │ │ │ │ │ ├── Default-1125h.png
│ │ │ │ │ │ ├── Default-568h@2x.png
│ │ │ │ │ │ ├── Default-667h@2x.png
│ │ │ │ │ │ ├── Default-736h@3x.png
│ │ │ │ │ │ ├── Default-Portrait.png
│ │ │ │ │ │ ├── Default-Landscape-X.png
│ │ │ │ │ │ ├── Default-Landscape.png
│ │ │ │ │ │ ├── Default-Portrait@2x.png
│ │ │ │ │ │ ├── Default-Landscape@2x.png
│ │ │ │ │ │ ├── Default-Landscape@3x.png
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ ├── LaunchScreen.Center.imageset
│ │ │ │ │ │ ├── LaunchScreen-Center.png
│ │ │ │ │ │ ├── LaunchScreen-Center@2x.png
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── LaunchScreen.AspectFill.imageset
│ │ │ │ │ │ ├── LaunchScreen-AspectFill.png
│ │ │ │ │ │ ├── LaunchScreen-AspectFill@2x.png
│ │ │ │ │ │ └── Contents.json
│ │ │ │ ├── build.xcconfig
│ │ │ │ ├── Info.plist
│ │ │ │ └── LaunchScreen.storyboard
│ │ │ └── Android
│ │ │ │ ├── values-v21
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ │ ├── drawable-hdpi
│ │ │ │ ├── icon.png
│ │ │ │ ├── logo.png
│ │ │ │ └── background.png
│ │ │ │ ├── drawable-ldpi
│ │ │ │ ├── icon.png
│ │ │ │ ├── logo.png
│ │ │ │ └── background.png
│ │ │ │ ├── drawable-mdpi
│ │ │ │ ├── icon.png
│ │ │ │ ├── logo.png
│ │ │ │ └── background.png
│ │ │ │ ├── drawable-xhdpi
│ │ │ │ ├── icon.png
│ │ │ │ ├── logo.png
│ │ │ │ └── background.png
│ │ │ │ ├── drawable-xxhdpi
│ │ │ │ ├── icon.png
│ │ │ │ ├── logo.png
│ │ │ │ └── background.png
│ │ │ │ ├── drawable-xxxhdpi
│ │ │ │ ├── icon.png
│ │ │ │ ├── logo.png
│ │ │ │ └── background.png
│ │ │ │ ├── values
│ │ │ │ ├── strings.xml
│ │ │ │ ├── colors.xml
│ │ │ │ └── styles.xml
│ │ │ │ ├── app.gradle
│ │ │ │ ├── drawable-nodpi
│ │ │ │ └── splash_screen.xml
│ │ │ │ └── AndroidManifest.xml
│ │ └── package.json
│ └── package.json
├── README.md
├── src
│ └── main.js
└── package.json
├── .gitignore
├── LICENSE
└── README.md
/src/platforms/ios/Podfile:
--------------------------------------------------------------------------------
1 | pod 'SCLAlertView-Objective-C'
--------------------------------------------------------------------------------
/screenshots/alert.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/screenshots/alert.gif
--------------------------------------------------------------------------------
/demo/app/app.css:
--------------------------------------------------------------------------------
1 | Button {
2 | font-size: 20;
3 | horizontal-align: center;
4 | padding:10;
5 | text-align: center;
6 | }
7 |
--------------------------------------------------------------------------------
/demo/app/app.ts:
--------------------------------------------------------------------------------
1 | import * as application from 'tns-core-modules/application';
2 | application.start({ moduleName: 'main-page' });
3 |
--------------------------------------------------------------------------------
/screenshots/alert-android.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/screenshots/alert-android.gif
--------------------------------------------------------------------------------
/demo-vue/.gitignore:
--------------------------------------------------------------------------------
1 | # JetBrains project files
2 | .idea
3 |
4 | # NPM
5 | node_modules
6 |
7 | # NativeScript application
8 | /dist
9 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/bell.mp3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/bell.mp3
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon.png
--------------------------------------------------------------------------------
/demo-vue/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | ["env", { "cacheDirectory": true }]
4 | ],
5 | "plugins": ["transform-object-rest-spread"]
6 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon-40.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon-60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon-60.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon-72.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon-76.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/switch.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/switch.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Icon-Small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Icon-Small.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon-40@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon-60@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon-72@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon-72@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/icon-76@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/nativescript.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/nativescript.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Icon-Small-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Icon-Small-50.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Icon-Small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Icon-Small@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-568h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-667h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-736h@3x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-Landscape.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-Portrait.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Icon-Small-50@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Icon-Small-50@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/demo/references.d.ts:
--------------------------------------------------------------------------------
1 | ///
2 | ///
3 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/Android/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/Android/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/Android/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-Landscape@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-Landscape@3x.png
--------------------------------------------------------------------------------
/demo/tsconfig.esm.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig",
3 | "compilerOptions": {
4 | "module": "es2015",
5 | "moduleResolution": "node"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/values-v21/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #3d5afe
4 |
--------------------------------------------------------------------------------
/demo-vue/template/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "android": {
3 | "v8Flags": "--expose_gc"
4 | },
5 | "main": "app.js",
6 | "name": "demo-vue",
7 | "version": "1.0.0"
8 | }
9 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-Landscape-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-Landscape-568h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Default-Landscape-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/iOS/Default-Landscape-667h@2x.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-hdpi/customimage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/Android/drawable-hdpi/customimage.jpg
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-ldpi/customimage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/Android/drawable-ldpi/customimage.jpg
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-mdpi/customimage.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/Android/drawable-mdpi/customimage.jpg
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-hdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-hdpi/logo.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-ldpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-ldpi/logo.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-mdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-mdpi/logo.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xhdpi/icon.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xhdpi/logo.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xxhdpi/icon.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xxhdpi/logo.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xxxhdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xxxhdpi/icon.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xxxhdpi/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xxxhdpi/logo.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-hdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-hdpi/background.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-ldpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-ldpi/background.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-mdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-mdpi/background.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/app.gradle:
--------------------------------------------------------------------------------
1 | // Add your native dependencies here:
2 |
3 | // Uncomment to add recyclerview-v7 dependency
4 | //dependencies {
5 | // compile 'com.android.support:recyclerview-v7:+'
6 | //}
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xxhdpi/background.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-xxxhdpi/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/Android/drawable-xxxhdpi/background.png
--------------------------------------------------------------------------------
/demo/app/vendor-platform.ios.ts:
--------------------------------------------------------------------------------
1 | // There is a bug in angular: https://github.com/angular/angular-cli/pull/8589/files
2 | // Legendary stuff, its webpack plugin pretty much doesn't work with empty TypeScript files in v1.8.3
3 | void 0;
4 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png
--------------------------------------------------------------------------------
/src/platforms/android/include.gradle:
--------------------------------------------------------------------------------
1 | android {
2 |
3 | }
4 |
5 | repositories {
6 | maven {
7 | url "https://jitpack.io"
8 | }
9 | }
10 |
11 | dependencies {
12 | compile 'com.github.Rahul1d:ColorDialog:1.1.0'
13 | }
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-1125h.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-568h@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-667h@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-736h@3x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape-X.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Default-Landscape@3x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | NativeScript-Vue Application
4 | NativeScript-Vue Application
5 |
6 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/values-v21/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | NativeScript-Vue Application
4 | NativeScript-Vue Application
5 |
6 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NathanWalker/nativescript-fancyalert/HEAD/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/app.gradle:
--------------------------------------------------------------------------------
1 | // Add your native dependencies here:
2 |
3 | android {
4 | defaultConfig {
5 | generatedDensities = []
6 | applicationId = "__PACKAGE__"
7 | }
8 | aaptOptions {
9 | additionalParameters "--no-version-vectors"
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F5F5F5
4 | #757575
5 | #33B5E5
6 | #272734
7 |
--------------------------------------------------------------------------------
/src/common.ts:
--------------------------------------------------------------------------------
1 | export class TNSFancyAlertButton {
2 | public label: string;
3 | public action: Function;
4 | public applyStyle: (btn: any) => void;
5 |
6 | constructor(model?: any) {
7 | if (model) {
8 | this.label = model.label;
9 | this.action = model.action;
10 | this.applyStyle = model.applyStyle;
11 | }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/.npmignore:
--------------------------------------------------------------------------------
1 | demo/
2 | screenshots/
3 | *.png
4 | *.log
5 | *.ts
6 | !*.d.ts
7 | tsconfig.json
8 | package-lock.json
9 |
10 |
11 | node_modules/
12 |
13 | *.ts
14 | !*.d.ts
15 | *.map
16 | tsconfig.json
17 | scripts/*
18 | platforms/android/*
19 | !platforms/android/include.gradle
20 | !platforms/android/*.aar
21 | !platforms/android/*.jar
22 | references.d.ts
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/drawable-nodpi/splash_screen.xml:
--------------------------------------------------------------------------------
1 |
2 | -
3 |
4 |
5 | -
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | src/*.js
2 | src/*.js.map
3 | src/*.log
4 | src/*.d.ts
5 | !index.d.ts
6 | demo/package-lock.json
7 | demo/app/*.js
8 | demo/*.d.ts
9 | demo/lib
10 | demo/hooks
11 | demo/platforms
12 | demo/node_modules
13 | demo-vue/package-lock.json
14 | demo-vue/platforms
15 | demo-vue/node_modules
16 | src/node_modules
17 | !demo/references.d.ts
18 | !src/fancyalert.d.ts
19 | src/package-lock.json
20 |
--------------------------------------------------------------------------------
/demo/app/vendor.ts:
--------------------------------------------------------------------------------
1 | // Snapshot the ~/app.css and the theme
2 | const application = require("application");
3 | require("ui/styling/style-scope");
4 | const appCssContext = require.context("~/", false, /^\.\/app\.(css|scss|less|sass)$/);
5 | global.registerWebpackModules(appCssContext);
6 | application.loadAppCss();
7 |
8 | require("./vendor-platform");
9 |
10 | require("bundle-entry-points");
11 |
--------------------------------------------------------------------------------
/demo/app/main-page.ts:
--------------------------------------------------------------------------------
1 | import * as observable from "tns-core-modules/data/observable";
2 | import * as pages from "tns-core-modules/ui/page";
3 | import { HelloWorldModel } from "./main-view-model";
4 |
5 | // Event handler for Page "loaded" event attached in main-page.xml
6 | export function pageLoaded(args: observable.EventData) {
7 | // Get the event sender
8 | var page = args.object;
9 | page.bindingContext = new HelloWorldModel();
10 | }
11 |
--------------------------------------------------------------------------------
/demo/app/vendor-platform.android.ts:
--------------------------------------------------------------------------------
1 | require("application");
2 | if (!global["__snapshot"]) {
3 | // In case snapshot generation is enabled these modules will get into the bundle
4 | // but will not be required/evaluated.
5 | // The snapshot webpack plugin will add them to the tns-java-classes.js bundle file.
6 | // This way, they will be evaluated on app start as early as possible.
7 | require("ui/frame");
8 | require("ui/frame/activity");
9 | }
10 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-Center.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-Center@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchScreen-AspectFill.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchScreen-AspectFill@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "scale" : "3x"
16 | }
17 | ],
18 | "info" : {
19 | "version" : 1,
20 | "author" : "xcode"
21 | }
22 | }
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/build.xcconfig:
--------------------------------------------------------------------------------
1 | // You can add custom settings here
2 | // for example you can uncomment the following line to force distribution code signing
3 | // CODE_SIGN_IDENTITY = iPhone Distribution
4 | // 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
5 | // DEVELOPMENT_TEAM = YOUR_TEAM_ID;
6 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
7 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
8 |
--------------------------------------------------------------------------------
/demo-vue/template/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "demo-vue",
3 | "description": "A native application built with NativeScript-Vue",
4 | "license": "MIT",
5 | "readme": "NativeScript-Vue Application",
6 | "nativescript": {
7 | "id": "org.nativescript.demo"
8 | },
9 | "dependencies": {
10 | "nativescript-theme-core": "^1.0.4",
11 | "nativescript-vue": "^2.0.0-alpha.1",
12 | "tns-core-modules": "~4.1.0",
13 | "nativescript-fancyalert": "file:../../src"
14 | },
15 | "devDependencies": {
16 | "babel-traverse": "6.26.0",
17 | "babel-types": "6.26.0",
18 | "babylon": "6.18.0",
19 | "lazy": "1.0.11"
20 | }
21 | }
--------------------------------------------------------------------------------
/demo-vue/README.md:
--------------------------------------------------------------------------------
1 | # NativeScript-Vue Demo
2 |
3 | > Demo app for nativescript-fancyalert plugin made with NativeScript-Vue
4 |
5 | ## Usage
6 |
7 | * Install dependencies
8 |
9 | ``` bash
10 | npm install
11 | ```
12 |
13 | * Compile the `nativescript-fancyalert` plugin
14 |
15 | ``` bash
16 | npm run build.plugin
17 | ```
18 |
19 | * Run the demo:
20 |
21 | ``` bash
22 | # Build, watch for changes and debug the application
23 | npm run debug
24 | npm run debug:
25 |
26 | # Build, watch for changes and run the application
27 | npm run watch
28 | npm run watch:
29 | ```
30 |
31 | * Clean the NativeScript application instance (i.e. rm -rf dist)
32 |
33 | ``` bash
34 | npm run clean
35 | ```
36 |
--------------------------------------------------------------------------------
/src/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "commonjs",
5 | "declaration": false,
6 | "removeComments": true,
7 | "noLib": false,
8 | "emitDecoratorMetadata": true,
9 | "experimentalDecorators": true,
10 | "skipLibCheck": true,
11 | "lib": ["es5", "es6", "dom", "es2015.iterable"],
12 | "baseUrl": ".",
13 | "paths": {
14 | "*": ["./node_modules/tns-core-modules/*", "./node_modules/*"]
15 | },
16 | "sourceMap": true,
17 | "pretty": true,
18 | "allowUnreachableCode": false,
19 | "allowUnusedLabels": false,
20 | "noEmitHelpers": true,
21 | "noEmitOnError": false,
22 | "noImplicitAny": false,
23 | "noImplicitReturns": true,
24 | "noImplicitUseStrict": false,
25 | "noFallthroughCasesInSwitch": true,
26 | "typeRoots": ["./node_modules/@types", "./node_modules"],
27 | "types": []
28 | },
29 | "exclude": ["node_modules", "demo"],
30 | "compileOnSave": false
31 | }
32 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
14 |
15 |
16 |
19 |
20 |
23 |
--------------------------------------------------------------------------------
/demo/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "nativescript": {
3 | "id": "org.nativescript.demo",
4 | "tns-android": {
5 | "version": "4.2.0"
6 | },
7 | "tns-ios": {
8 | "version": "4.2.0"
9 | }
10 | },
11 | "dependencies": {
12 | "nativescript-fancyalert": "file:../src",
13 | "tns-core-modules": "^4.2.0"
14 | },
15 | "devDependencies": {
16 | "babel-traverse": "6.12.0",
17 | "babel-types": "6.11.1",
18 | "babylon": "6.8.4",
19 | "copy-webpack-plugin": "~4.0.1",
20 | "css-loader": "~0.28.7",
21 | "extract-text-webpack-plugin": "~3.0.0",
22 | "filewalker": "0.1.2",
23 | "lazy": "1.0.11",
24 | "nativescript-css-loader": "~0.26.0",
25 | "nativescript-dev-typescript": "^0.7.3",
26 | "nativescript-dev-webpack": "^0.15.1",
27 | "nativescript-worker-loader": "~0.9.1",
28 | "raw-loader": "~0.5.1",
29 | "resolve-url-loader": "~2.3.0",
30 | "tns-platform-declarations": "^4.2.0",
31 | "typescript": "~2.9.0"
32 | },
33 | "scripts": {
34 | "build.plugin": "cd ../src && npm run build"
35 | }
36 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | nativescript-fancyalert
4 | Copyright (c) 2016, Nathan Walker
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of
7 | this software and associated documentation files (the "Software"), to deal in
8 | the Software without restriction, including without limitation the rights to
9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10 | the Software, and to permit persons to whom the Software is furnished to do so,
11 | subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/demo/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "module": "commonjs",
5 | "declaration": false,
6 | "removeComments": true,
7 | "noLib": false,
8 | "emitDecoratorMetadata": true,
9 | "experimentalDecorators": true,
10 | "skipLibCheck": true,
11 | "lib": [
12 | "dom",
13 | "es6"
14 | ],
15 | "pretty": true,
16 | "allowUnreachableCode": false,
17 | "allowUnusedLabels": false,
18 | "noEmitHelpers": true,
19 | "noEmitOnError": false,
20 | "noImplicitAny": false,
21 | "noImplicitReturns": true,
22 | "noImplicitUseStrict": false,
23 | "noFallthroughCasesInSwitch": true,
24 | "typeRoots": [
25 | "./node_modules/@types",
26 | "./node_modules"
27 | ],
28 | "types": [],
29 | "baseUrl": ".",
30 | "paths": {
31 | "*": [
32 | "./node_modules/tns-core-modules/*",
33 | "./node_modules/*"
34 | ],
35 | "~/*": [
36 | "app/*"
37 | ]
38 | }
39 | },
40 | "exclude": [
41 | "node_modules",
42 | "platforms"
43 | ],
44 | "compileOnSave": false
45 | }
--------------------------------------------------------------------------------
/demo-vue/src/main.js:
--------------------------------------------------------------------------------
1 | import * as app from "tns-core-modules/application"
2 |
3 | import Vue from 'nativescript-vue'
4 | import { isIOS, isAndroid } from 'tns-core-modules/platform'
5 | import { TNSFancyAlert, TNSFancyAlertButton } from 'nativescript-fancyalert'
6 |
7 | const Page = {
8 | template: `
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | `,
18 |
19 | data() {
20 | return {
21 | }
22 | },
23 |
24 | methods: {
25 | showSuccess () {
26 | TNSFancyAlert.showSuccess(
27 | 'Success!',
28 | 'Fancy alerts are nice.',
29 | 'Yes they are!',
30 | ).then(() => {
31 | console.log('shown')
32 | }).catch((error) => {
33 | console.error(error)
34 | })
35 | },
36 | onLoaded () {
37 | if (isIOS) {
38 | TNSFancyAlert.hideAnimationType = TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToBottom
39 | }
40 | },
41 | },
42 | }
43 |
44 | // Uncommment the following to see NativeScript-Vue output logs
45 | Vue.config.silent = false
46 |
47 | new Vue({
48 | render: h => h(Page)
49 | }).$start({
50 | getRootView (vm) {
51 | return vm.$el.nativeView; // frame
52 | },
53 | })
54 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
16 |
17 |
18 |
19 |
20 |
21 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/demo/app/main-page.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/demo/app/App_Resources/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | NativeScript-Vue Application
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | ${PRODUCT_NAME}
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0.0
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIRequiresFullScreen
28 |
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/demo-vue/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "demo-vue",
3 | "version": "1.0.0",
4 | "description": "A native application built with NativeScript-Vue",
5 | "scripts": {
6 | "build.plugin": "cd ../src && npm run build",
7 | "build": "webpack --env.tnsAction build",
8 | "build:android": "npm run build -- --env.android",
9 | "build:ios": "npm run build -- --env.ios",
10 | "debug": "webpack --watch --env.tnsAction debug",
11 | "debug:android": "npm run debug -- --env.android",
12 | "debug:ios": "npm run debug -- --env.ios",
13 | "watch": "webpack --watch --env.tnsAction run",
14 | "watch:android": "npm run watch -- --env.android",
15 | "watch:ios": "npm run watch -- --env.ios",
16 | "clean": "rimraf dist"
17 | },
18 | "dependencies": {
19 | "nativescript-fancyalert": "file:../src",
20 | "nativescript-theme-core": "^1.0.4",
21 | "nativescript-vue": "^2.0.0-alpha.1",
22 | "tns-core-modules": "~4.1.1"
23 | },
24 | "devDependencies": {
25 | "babel-core": "^6.26.0",
26 | "babel-loader": "^7.1.3",
27 | "babel-plugin-transform-object-rest-spread": "^6.26.0",
28 | "babel-preset-env": "^1.6.1",
29 | "copy-webpack-plugin": "^4.4.2",
30 | "css-loader": "^0.28.10",
31 | "extract-text-webpack-plugin": "^3.0.2",
32 | "fs-extra": "^5.0.0",
33 | "nativescript-vue-externals": "^0.2.0",
34 | "nativescript-vue-loader": "^0.1.5",
35 | "nativescript-vue-target": "^0.1.0",
36 | "nativescript-vue-template-compiler": "^1.3.0",
37 | "node-sass": "^4.7.2",
38 | "ns-vue-loader": "^0.1.2",
39 | "optimize-css-assets-webpack-plugin": "^3.2.0",
40 | "rimraf": "^2.6.2",
41 | "sass-loader": "^6.0.6",
42 | "vue-template-compiler": "^2.5.13",
43 | "webpack": "^3.11.0",
44 | "webpack-synchronizable-shell-plugin": "0.0.6",
45 | "winston-color": "^1.0.0"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/Android/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
17 |
18 |
20 |
21 |
22 |
29 |
30 |
32 |
33 |
34 |
39 |
40 |
42 |
43 |
--------------------------------------------------------------------------------
/src/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nativescript-fancyalert",
3 | "version": "3.1.1",
4 | "description": "Fancy alerts for NativeScript.",
5 | "main": "fancyalert",
6 | "typings": "index.d.ts",
7 | "nativescript": {
8 | "platforms": {
9 | "ios": "4.0.1",
10 | "android": "4.1.3"
11 | }
12 | },
13 | "scripts": {
14 | "build": "tsc",
15 | "watch": "npm run build -- -w",
16 | "demo.ios": "npm run preparedemo && cd ../demo && tns run ios --emulator",
17 | "demo.android": "npm run preparedemo && cd ../demo && tns run android --emulator",
18 | "preparedemo": "npm run build && cd ../demo && tns plugin remove nativescript-fancyalert && tns plugin add ../src && tns install && npx rimraf -- package-lock.json",
19 | "setup": "npm i && cd ../demo && npm install && cd ../src && npm run build && cd ../demo && tns plugin add ../src && cd ../src",
20 | "precommit": "lint-staged"
21 | },
22 | "lint-staged": {
23 | "*.ts": [
24 | "prettier --write",
25 | "git add"
26 | ]
27 | },
28 | "repository": {
29 | "type": "git",
30 | "url": "https://github.com/NathanWalker/nativescript-fancyalert.git"
31 | },
32 | "keywords": [
33 | "NativeScript",
34 | "iOS",
35 | "Android",
36 | "alert",
37 | "dialogs"
38 | ],
39 | "author": {
40 | "name": "Nathan Walker",
41 | "email": "walkerrunpdx@gmail.com"
42 | },
43 | "contributors": [
44 | {
45 | "name": "Brad Martin",
46 | "email": "bradwaynemartin@gmail.com",
47 | "url": "https://github.com/bradmartin"
48 | }
49 | ],
50 | "bugs": {
51 | "url": "https://github.com/NathanWalker/nativescript-fancyalert/issues"
52 | },
53 | "license": "MIT",
54 | "homepage": "https://github.com/NathanWalker/nativescript-fancyalert",
55 | "readmeFilename": "README.md",
56 | "devDependencies": {
57 | "tns-core-modules": "^6.5.0",
58 | "tns-platform-declarations": "^6.5.0",
59 | "husky": "^0.14.3",
60 | "lint-staged": "^7.2.2",
61 | "prettier": "^1.14.2",
62 | "typescript": "~3.9.0"
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "29x29",
5 | "idiom" : "iphone",
6 | "filename" : "icon-29.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "29x29",
11 | "idiom" : "iphone",
12 | "filename" : "icon-29@2x.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "icon-29@3x.png",
19 | "scale" : "3x"
20 | },
21 | {
22 | "size" : "40x40",
23 | "idiom" : "iphone",
24 | "filename" : "icon-40@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "40x40",
29 | "idiom" : "iphone",
30 | "filename" : "icon-40@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "60x60",
35 | "idiom" : "iphone",
36 | "filename" : "icon-60@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "60x60",
41 | "idiom" : "iphone",
42 | "filename" : "icon-60@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "29x29",
47 | "idiom" : "ipad",
48 | "filename" : "icon-29.png",
49 | "scale" : "1x"
50 | },
51 | {
52 | "size" : "29x29",
53 | "idiom" : "ipad",
54 | "filename" : "icon-29@2x.png",
55 | "scale" : "2x"
56 | },
57 | {
58 | "size" : "40x40",
59 | "idiom" : "ipad",
60 | "filename" : "icon-40.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "40x40",
65 | "idiom" : "ipad",
66 | "filename" : "icon-40@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "76x76",
71 | "idiom" : "ipad",
72 | "filename" : "icon-76.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "76x76",
77 | "idiom" : "ipad",
78 | "filename" : "icon-76@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "83.5x83.5",
83 | "idiom" : "ipad",
84 | "filename" : "icon-83.5@2x.png",
85 | "scale" : "2x"
86 | },
87 | {
88 | "size" : "1024x1024",
89 | "idiom" : "ios-marketing",
90 | "filename" : "icon-1024.png",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/demo/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tns-template-hello-world-ts",
3 | "main": "app.js",
4 | "version": "1.6.0",
5 | "author": {
6 | "name": "Telerik",
7 | "email": "support@telerik.com"
8 | },
9 | "description": "Nativescript hello-world-ts project template",
10 | "license": "Apache-2.0",
11 | "keywords": [
12 | "telerik",
13 | "mobile",
14 | "nativescript",
15 | "{N}",
16 | "tns",
17 | "appbuilder",
18 | "template"
19 | ],
20 | "repository": {
21 | "type": "git",
22 | "url": "git+ssh://git@github.com/NativeScript/template-hello-world-ts.git"
23 | },
24 | "bugs": {
25 | "url": "https://github.com/NativeScript/template-hello-world-ts/issues"
26 | },
27 | "homepage": "https://github.com/NativeScript/template-hello-world-ts",
28 | "android": {
29 | "v8Flags": "--expose_gc"
30 | },
31 | "devDependencies": {
32 | "nativescript-dev-typescript": "^0.3.0"
33 | },
34 | "_id": "tns-template-hello-world-ts@1.6.0",
35 | "_shasum": "a567c2b9a56024818c06596dab9629d155c5b8a8",
36 | "_resolved": "https://registry.npmjs.org/tns-template-hello-world-ts/-/tns-template-hello-world-ts-1.6.0.tgz",
37 | "_from": "tns-template-hello-world-ts@latest",
38 | "scripts": {},
39 | "_npmVersion": "2.14.7",
40 | "_nodeVersion": "4.2.2",
41 | "_npmUser": {
42 | "name": "enchev",
43 | "email": "vladimir.enchev@gmail.com"
44 | },
45 | "dist": {
46 | "shasum": "a567c2b9a56024818c06596dab9629d155c5b8a8",
47 | "tarball": "http://registry.npmjs.org/tns-template-hello-world-ts/-/tns-template-hello-world-ts-1.6.0.tgz"
48 | },
49 | "maintainers": [
50 | {
51 | "name": "enchev",
52 | "email": "vladimir.enchev@gmail.com"
53 | },
54 | {
55 | "name": "erjangavalji",
56 | "email": "erjan.gavalji@gmail.com"
57 | },
58 | {
59 | "name": "fatme",
60 | "email": "hfatme@gmail.com"
61 | },
62 | {
63 | "name": "hdeshev",
64 | "email": "hristo@deshev.com"
65 | },
66 | {
67 | "name": "kerezov",
68 | "email": "d.kerezov@gmail.com"
69 | },
70 | {
71 | "name": "ligaz",
72 | "email": "stefan.dobrev@gmail.com"
73 | },
74 | {
75 | "name": "nsndeck",
76 | "email": "nedyalko.nikolov@telerik.com"
77 | },
78 | {
79 | "name": "rosen-vladimirov",
80 | "email": "rosen.vladimirov.91@gmail.com"
81 | },
82 | {
83 | "name": "sdobrev",
84 | "email": "stefan.dobrev@gmail.com"
85 | },
86 | {
87 | "name": "tailsu",
88 | "email": "tailsu@gmail.com"
89 | },
90 | {
91 | "name": "teobugslayer",
92 | "email": "teobugslayer@gmail.com"
93 | },
94 | {
95 | "name": "valio.stoychev",
96 | "email": "valio.stoychev@gmail.com"
97 | }
98 | ],
99 | "_npmOperationalInternal": {
100 | "host": "packages-5-east.internal.npmjs.com",
101 | "tmp": "tmp/tns-template-hello-world-ts-1.6.0.tgz_1455717516189_0.6427943941671401"
102 | },
103 | "directories": {},
104 | "readme": "ERROR: No README data found!"
105 | }
106 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/demo-vue/template/app/App_Resources/iOS/Assets.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "extent" : "full-screen",
5 | "idiom" : "iphone",
6 | "subtype" : "2436h",
7 | "filename" : "Default-1125h.png",
8 | "minimum-system-version" : "11.0",
9 | "orientation" : "portrait",
10 | "scale" : "3x"
11 | },
12 | {
13 | "orientation" : "landscape",
14 | "idiom" : "iphone",
15 | "extent" : "full-screen",
16 | "filename" : "Default-Landscape-X.png",
17 | "minimum-system-version" : "11.0",
18 | "subtype" : "2436h",
19 | "scale" : "3x"
20 | },
21 | {
22 | "extent" : "full-screen",
23 | "idiom" : "iphone",
24 | "subtype" : "736h",
25 | "filename" : "Default-736h@3x.png",
26 | "minimum-system-version" : "8.0",
27 | "orientation" : "portrait",
28 | "scale" : "3x"
29 | },
30 | {
31 | "extent" : "full-screen",
32 | "idiom" : "iphone",
33 | "subtype" : "736h",
34 | "filename" : "Default-Landscape@3x.png",
35 | "minimum-system-version" : "8.0",
36 | "orientation" : "landscape",
37 | "scale" : "3x"
38 | },
39 | {
40 | "extent" : "full-screen",
41 | "idiom" : "iphone",
42 | "subtype" : "667h",
43 | "filename" : "Default-667h@2x.png",
44 | "minimum-system-version" : "8.0",
45 | "orientation" : "portrait",
46 | "scale" : "2x"
47 | },
48 | {
49 | "orientation" : "portrait",
50 | "idiom" : "iphone",
51 | "filename" : "Default@2x.png",
52 | "extent" : "full-screen",
53 | "minimum-system-version" : "7.0",
54 | "scale" : "2x"
55 | },
56 | {
57 | "extent" : "full-screen",
58 | "idiom" : "iphone",
59 | "subtype" : "retina4",
60 | "filename" : "Default-568h@2x.png",
61 | "minimum-system-version" : "7.0",
62 | "orientation" : "portrait",
63 | "scale" : "2x"
64 | },
65 | {
66 | "orientation" : "portrait",
67 | "idiom" : "ipad",
68 | "filename" : "Default-Portrait.png",
69 | "extent" : "full-screen",
70 | "minimum-system-version" : "7.0",
71 | "scale" : "1x"
72 | },
73 | {
74 | "orientation" : "landscape",
75 | "idiom" : "ipad",
76 | "filename" : "Default-Landscape.png",
77 | "extent" : "full-screen",
78 | "minimum-system-version" : "7.0",
79 | "scale" : "1x"
80 | },
81 | {
82 | "orientation" : "portrait",
83 | "idiom" : "ipad",
84 | "filename" : "Default-Portrait@2x.png",
85 | "extent" : "full-screen",
86 | "minimum-system-version" : "7.0",
87 | "scale" : "2x"
88 | },
89 | {
90 | "orientation" : "landscape",
91 | "idiom" : "ipad",
92 | "filename" : "Default-Landscape@2x.png",
93 | "extent" : "full-screen",
94 | "minimum-system-version" : "7.0",
95 | "scale" : "2x"
96 | },
97 | {
98 | "orientation" : "portrait",
99 | "idiom" : "iphone",
100 | "filename" : "Default.png",
101 | "extent" : "full-screen",
102 | "scale" : "1x"
103 | },
104 | {
105 | "orientation" : "portrait",
106 | "idiom" : "iphone",
107 | "filename" : "Default@2x.png",
108 | "extent" : "full-screen",
109 | "scale" : "2x"
110 | },
111 | {
112 | "orientation" : "portrait",
113 | "idiom" : "iphone",
114 | "filename" : "Default-568h@2x.png",
115 | "extent" : "full-screen",
116 | "subtype" : "retina4",
117 | "scale" : "2x"
118 | },
119 | {
120 | "orientation" : "portrait",
121 | "idiom" : "ipad",
122 | "extent" : "to-status-bar",
123 | "scale" : "1x"
124 | },
125 | {
126 | "orientation" : "portrait",
127 | "idiom" : "ipad",
128 | "filename" : "Default-Portrait.png",
129 | "extent" : "full-screen",
130 | "scale" : "1x"
131 | },
132 | {
133 | "orientation" : "landscape",
134 | "idiom" : "ipad",
135 | "extent" : "to-status-bar",
136 | "scale" : "1x"
137 | },
138 | {
139 | "orientation" : "landscape",
140 | "idiom" : "ipad",
141 | "filename" : "Default-Landscape.png",
142 | "extent" : "full-screen",
143 | "scale" : "1x"
144 | },
145 | {
146 | "orientation" : "portrait",
147 | "idiom" : "ipad",
148 | "extent" : "to-status-bar",
149 | "scale" : "2x"
150 | },
151 | {
152 | "orientation" : "portrait",
153 | "idiom" : "ipad",
154 | "filename" : "Default-Portrait@2x.png",
155 | "extent" : "full-screen",
156 | "scale" : "2x"
157 | },
158 | {
159 | "orientation" : "landscape",
160 | "idiom" : "ipad",
161 | "extent" : "to-status-bar",
162 | "scale" : "2x"
163 | },
164 | {
165 | "orientation" : "landscape",
166 | "idiom" : "ipad",
167 | "filename" : "Default-Landscape@2x.png",
168 | "extent" : "full-screen",
169 | "scale" : "2x"
170 | }
171 | ],
172 | "info" : {
173 | "version" : 1,
174 | "author" : "xcode"
175 | }
176 | }
--------------------------------------------------------------------------------
/demo/webpack.config.js:
--------------------------------------------------------------------------------
1 | const { resolve, join } = require("path");
2 |
3 | const webpack = require("webpack");
4 | const nsWebpack = require("nativescript-dev-webpack");
5 | const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
6 | const CopyWebpackPlugin = require("copy-webpack-plugin");
7 | const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
8 | const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
9 | const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
10 |
11 | module.exports = env => {
12 | const platform = env && (env.android && "android" || env.ios && "ios");
13 | if (!platform) {
14 | throw new Error("You need to provide a target platform!");
15 | }
16 | const platforms = ["ios", "android"];
17 | const { snapshot, uglify, report } = env;
18 |
19 | const config = {
20 | context: resolve("./app"),
21 | target: nativescriptTarget,
22 | entry: {
23 | bundle: `./${nsWebpack.getEntryModule()}`,
24 | vendor: "./vendor"
25 | },
26 | output: {
27 | pathinfo: true,
28 | // Default destination inside platforms//...
29 | path: resolve(nsWebpack.getAppPath(platform)),
30 | libraryTarget: "commonjs2",
31 | filename: "[name].js",
32 | },
33 | resolve: {
34 | extensions: [".ts", ".js", ".scss", ".css"],
35 | // Resolve {N} system modules from tns-core-modules
36 | modules: [
37 | "node_modules/tns-core-modules",
38 | "node_modules",
39 | ],
40 | alias: {
41 | '~': resolve("./app")
42 | },
43 | // don't resolve symlinks to symlinked modules
44 | symlinks: false
45 | },
46 | resolveLoader: {
47 | // don't resolve symlinks to symlinked loaders
48 | symlinks: false
49 | },
50 | node: {
51 | // Disable node shims that conflict with NativeScript
52 | "http": false,
53 | "timers": false,
54 | "setImmediate": false,
55 | "fs": "empty",
56 | },
57 | module: {
58 | rules: [
59 | { test: /\.(html|xml)$/, use: "raw-loader" },
60 |
61 | {
62 | test: /\.css$/,
63 | use: { loader: "css-loader", options: { minimize: false, url: false } }
64 | },
65 |
66 | {
67 | test: /\.scss$/,
68 | use: [
69 | { loader: "css-loader", options: { minimize: false, url: false } },
70 | "sass-loader"
71 | ]
72 | },
73 |
74 | { test: /\.ts$/, use: "awesome-typescript-loader" }
75 | ]
76 | },
77 | plugins: [
78 | // Vendor libs go to the vendor.js chunk
79 | new webpack.optimize.CommonsChunkPlugin({
80 | name: ["vendor"],
81 | }),
82 | // Define useful constants like TNS_WEBPACK
83 | new webpack.DefinePlugin({
84 | "global.TNS_WEBPACK": "true",
85 | }),
86 | // Copy assets to out dir. Add your own globs as needed.
87 | new CopyWebpackPlugin([
88 | { from: "App_Resources/**" },
89 | { from: "fonts/**" },
90 | { from: "**/*.jpg" },
91 | { from: "**/*.png" },
92 | { from: "**/*.xml" },
93 | ]),
94 | // Generate a bundle starter script and activate it in package.json
95 | new nsWebpack.GenerateBundleStarterPlugin([
96 | "./vendor",
97 | "./bundle",
98 | ]),
99 | // Support for web workers since v3.2
100 | new NativeScriptWorkerPlugin(),
101 | new nsWebpack.PlatformFSPlugin({
102 | platform,
103 | platforms,
104 | // ignore: ["App_Resources"]
105 | }),
106 | // Does IPC communication with the {N} CLI to notify events when running in watch mode.
107 | new nsWebpack.WatchStateLoggerPlugin(),
108 | ],
109 | };
110 | if (report) {
111 | // Generate report files for bundles content
112 | config.plugins.push(new BundleAnalyzerPlugin({
113 | analyzerMode: "static",
114 | openAnalyzer: false,
115 | generateStatsFile: true,
116 | reportFilename: join(__dirname, "report", `report.html`),
117 | statsFilename: join(__dirname, "report", `stats.json`),
118 | }));
119 | }
120 | if (snapshot) {
121 | config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
122 | chunk: "vendor",
123 | projectRoot: __dirname,
124 | webpackConfig: config,
125 | targetArchs: ["arm", "arm64", "ia32"],
126 | tnsJavaClassesOptions: { packages: ["tns-core-modules" ] },
127 | useLibs: false
128 | }));
129 | }
130 | if (uglify) {
131 | config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true }));
132 |
133 | // Work around an Android issue by setting compress = false
134 | const compress = platform !== "android";
135 | config.plugins.push(new UglifyJsPlugin({
136 | uglifyOptions: {
137 | mangle: { reserved: nsWebpack.uglifyMangleExcludes },
138 | compress,
139 | }
140 | }));
141 | }
142 | return config;
143 | };
144 |
--------------------------------------------------------------------------------
/src/index.d.ts:
--------------------------------------------------------------------------------
1 | import { TNSFancyAlertButton } from "./common";
2 | export * from "./common";
3 | export interface IFancyAlertSupportedTypes {
4 | SUCCESS: string;
5 | ERROR: string;
6 | NOTICE: string;
7 | WARNING: string;
8 | INFO: string;
9 | EDIT: string;
10 | WAITING: string;
11 | QUESTION: string;
12 | }
13 | export interface IFancyAlertHideAnimationTypes {
14 | FadeOut: any;
15 | SlideOutToBottom: any;
16 | SlideOutToTop: any;
17 | SlideOutToLeft: any;
18 | SlideOutToRight: any;
19 | SlideOutToCenter: any;
20 | SlideOutFromCenter: any;
21 | }
22 | export interface IFancyAlertShowAnimationTypes {
23 | FadeIn: any;
24 | SlideInFromBottom: any;
25 | SlideInFromTop: any;
26 | SlideInFromLeft: any;
27 | SlideInFromRight: any;
28 | SlideInFromCenter: any;
29 | SlideInToCenter: any;
30 | }
31 | export interface IFancyAlertBackgroundTypes {
32 | Shadow: any;
33 | Blur: any;
34 | Transparent: any;
35 | }
36 | export interface IFancyAlertTextOptions {
37 | titleFont?: string;
38 | titleSize?: number;
39 | bodyFont?: string;
40 | bodySize?: number;
41 | buttonFont?: string;
42 | buttonSize?: number;
43 | // if font is set on any option just use that font for all text settings
44 | applyFontToAll?: boolean;
45 | }
46 | export declare class TNSFancyAlertButton {
47 | label: string;
48 | action: (arg?: any) => void;
49 | // this will give you the SLCButton (child of UIButton) instance that you can style however you'd like
50 | applyStyle: (btn: any) => void;
51 | constructor(model?: any);
52 | }
53 | export declare class TNSFancyAlert {
54 | static SUPPORTED_TYPES: IFancyAlertSupportedTypes;
55 | static shouldDismissOnTapOutside: boolean;
56 | static dismissCallback: () => void;
57 | static hideAnimationType: IFancyAlertHideAnimationTypes;
58 | static HIDE_ANIMATION_TYPES: IFancyAlertHideAnimationTypes;
59 | static showAnimationType: IFancyAlertShowAnimationTypes;
60 | static SHOW_ANIMATION_TYPES: IFancyAlertShowAnimationTypes;
61 | static backgroundType: IFancyAlertBackgroundTypes;
62 | static BACKGROUND_TYPES: IFancyAlertBackgroundTypes;
63 | static textDisplayOptions: IFancyAlertTextOptions;
64 | static customViewColor: string;
65 | static iconTintColor: string;
66 | static titleColor: string;
67 | static bodyTextColor: string;
68 | static tintTopCircle: boolean;
69 | static cornerRadius: number;
70 | static backgroundViewColor: string;
71 | static useLargerIcon: boolean;
72 | static soundURL: string;
73 | static showSuccess(
74 | title: string,
75 | subTitle?: string,
76 | closeBtnTitle?: string,
77 | duration?: number,
78 | width?: number,
79 | buttons?: Array
80 | ): Promise<{}>;
81 | static showError(
82 | title: string,
83 | subTitle?: string,
84 | closeBtnTitle?: string,
85 | duration?: number,
86 | width?: number,
87 | buttons?: Array
88 | ): Promise<{}>;
89 | static showNotice(
90 | title: string,
91 | subTitle?: string,
92 | closeBtnTitle?: string,
93 | duration?: number,
94 | width?: number,
95 | buttons?: Array
96 | ): Promise<{}>;
97 | static showWarning(
98 | title: string,
99 | subTitle?: string,
100 | closeBtnTitle?: string,
101 | duration?: number,
102 | width?: number,
103 | buttons?: Array
104 | ): Promise<{}>;
105 | static showInfo(
106 | title: string,
107 | subTitle?: string,
108 | closeBtnTitle?: string,
109 | duration?: number,
110 | width?: number,
111 | buttons?: Array
112 | ): Promise<{}>;
113 | static showEdit(
114 | title: string,
115 | subTitle?: string,
116 | closeBtnTitle?: string,
117 | duration?: number,
118 | width?: number,
119 | buttons?: Array
120 | ): Promise<{}>;
121 | static showWaiting(
122 | title: string,
123 | subTitle?: string,
124 | closeBtnTitle?: string,
125 | duration?: number,
126 | width?: number
127 | ): Promise<{}>;
128 | static showQuestion(
129 | title: string,
130 | subTitle?: string,
131 | closeBtnTitle?: string,
132 | duration?: number,
133 | width?: number,
134 | buttons?: Array
135 | ): Promise<{}>;
136 | static showCustomButtonTimer(
137 | buttonIndex: number,
138 | reverse?: boolean,
139 | imageName?: string,
140 | color?: string,
141 | title?: string,
142 | subTitle?: string,
143 | closeBtnTitle?: string,
144 | duration?: number,
145 | width?: number
146 | ): Promise<{}>;
147 | static showCustomImage(
148 | imageName: string,
149 | color: string,
150 | title: string,
151 | subTitle?: string,
152 | closeBtnTitle?: string,
153 | duration?: number,
154 | width?: number
155 | ): Promise<{}>;
156 | static showCustomButtons(
157 | buttons: Array,
158 | image: any,
159 | color: string,
160 | title: string,
161 | subTitle?: string,
162 | closeBtnTitle?: string,
163 | duration?: number,
164 | width?: number
165 | ): Promise<{}>;
166 | static showCustomTextAttributes(
167 | attributionBlock: Function,
168 | button: TNSFancyAlertButton,
169 | image: any,
170 | color: string,
171 | title: string,
172 | subTitle?: string,
173 | closeBtnTitle?: string,
174 | duration?: number,
175 | width?: number
176 | ): Promise<{}>;
177 | static showTextField(
178 | placeholder: string,
179 | initialValue: string,
180 | button: TNSFancyAlertButton,
181 | image: any,
182 | color: string,
183 | title: string,
184 | subTitle?: string,
185 | closeBtnTitle?: string,
186 | duration?: number,
187 | width?: number
188 | ): Promise<{}>;
189 | static showSwitch(
190 | switchLabel: string,
191 | switchColor: string,
192 | button: TNSFancyAlertButton,
193 | image: any,
194 | color: string,
195 | title: string,
196 | subTitle?: string,
197 | closeBtnTitle?: string,
198 | duration?: number,
199 | width?: number
200 | ): Promise<{}>;
201 | static showCustomView(
202 | customView: any,
203 | image?: any,
204 | color?: string,
205 | title?: string,
206 | subTitle?: string,
207 | closeBtnTitle?: string,
208 | duration?: number,
209 | width?: number
210 | ): Promise<{}>;
211 | static show(
212 | type: string,
213 | title: string,
214 | subTitle?: string,
215 | closeBtnTitle?: string,
216 | duration?: number,
217 | width?: number,
218 | buttons?: Array
219 | ): void;
220 | static showCustom(
221 | alert: any,
222 | image: any,
223 | color: string,
224 | title?: string,
225 | subTitle?: string,
226 | closeBtnTitle?: string,
227 | duration?: number
228 | ): void;
229 | static applyOptions(alert: any): void;
230 | static createAlert(width?: number): any;
231 | // Android only
232 | static showColorDialog(
233 | title: string,
234 | subTitle: string,
235 | okBtnTitle?: string,
236 | cancelBtnTitle?: string,
237 | backgroundColor?: string,
238 | titleTextColor?: string,
239 | contextTextColor?: string,
240 | contentImage?: any
241 | ): Promise;
242 | }
243 |
--------------------------------------------------------------------------------
/src/fancyalert.android.ts:
--------------------------------------------------------------------------------
1 | import * as app from "tns-core-modules/application";
2 | import { Color } from "tns-core-modules/color";
3 |
4 | export * from "./common";
5 |
6 | declare var cn: any;
7 |
8 | export enum IFancyAlertSupportedTypesAndroid {
9 | INFO = 0,
10 | HELP = 1,
11 | WRONG = 2,
12 | SUCCESS = 3,
13 | WARNING = 4,
14 | EDIT = 5
15 | }
16 |
17 | export class TNSFancyAlert {
18 | public static shouldDismissOnTapOutside: boolean = false;
19 |
20 | public static showSuccess(
21 | title: string,
22 | subTitle?: string,
23 | closeBtnTitle?: string
24 | ): Promise {
25 | return new Promise((resolve, reject) => {
26 | const alert = new cn.refactor.lib.colordialog.PromptDialog(
27 | app.android.foregroundActivity
28 | );
29 | alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
30 | alert.setDialogType(IFancyAlertSupportedTypesAndroid.SUCCESS);
31 | alert.setTitleText(title || "Success!");
32 | alert.setContentText(subTitle || "");
33 | alert.setAnimationEnable(true);
34 | alert.setPositiveListener(
35 | closeBtnTitle || "Ok",
36 | new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
37 | onClick: dialog => {
38 | dialog.dismiss();
39 | resolve();
40 | }
41 | })
42 | );
43 | alert.show();
44 | });
45 | }
46 |
47 | public static showError(
48 | title: string,
49 | subTitle?: string,
50 | closeBtnTitle?: string
51 | ): Promise {
52 | return new Promise((resolve, reject) => {
53 | const alert = new cn.refactor.lib.colordialog.PromptDialog(
54 | app.android.foregroundActivity
55 | );
56 | alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
57 | alert.setDialogType(IFancyAlertSupportedTypesAndroid.WRONG);
58 | alert.setTitleText(title || "Error!");
59 | alert.setContentText(subTitle || "");
60 | alert.setAnimationEnable(true);
61 | alert.setPositiveListener(
62 | closeBtnTitle || "Ok",
63 | new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
64 | onClick: dialog => {
65 | dialog.dismiss();
66 | resolve();
67 | }
68 | })
69 | );
70 | alert.show();
71 | });
72 | }
73 |
74 | public static showNotice(
75 | title: string,
76 | subTitle?: string,
77 | closeBtnTitle?: string
78 | ): Promise {
79 | return new Promise((resolve, reject) => {
80 | const alert = new cn.refactor.lib.colordialog.PromptDialog(
81 | app.android.foregroundActivity
82 | );
83 | alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
84 | alert.setDialogType(IFancyAlertSupportedTypesAndroid.HELP);
85 | alert.setTitleText(title || "Notice");
86 | alert.setContentText(subTitle || "");
87 | alert.setAnimationEnable(true);
88 | alert.setPositiveListener(
89 | closeBtnTitle || "Ok",
90 | new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
91 | onClick: dialog => {
92 | dialog.dismiss();
93 | resolve();
94 | }
95 | })
96 | );
97 | alert.show();
98 | });
99 | }
100 |
101 | public static showWarning(
102 | title: string,
103 | subTitle?: string,
104 | closeBtnTitle?: string
105 | ): Promise {
106 | return new Promise((resolve, reject) => {
107 | const alert = new cn.refactor.lib.colordialog.PromptDialog(
108 | app.android.foregroundActivity
109 | );
110 | alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
111 | alert.setDialogType(IFancyAlertSupportedTypesAndroid.WARNING);
112 | alert.setTitleText(title || "Warning!");
113 | alert.setContentText(subTitle || "");
114 | alert.setAnimationEnable(true);
115 | alert.setPositiveListener(
116 | closeBtnTitle || "Ok",
117 | new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
118 | onClick: dialog => {
119 | dialog.dismiss();
120 | resolve();
121 | }
122 | })
123 | );
124 | alert.show();
125 | });
126 | }
127 |
128 | public static showEdit(
129 | title: string,
130 | subTitle?: string,
131 | closeBtnTitle?: string
132 | ): Promise {
133 | return new Promise((resolve, reject) => {
134 | const alert = new cn.refactor.lib.colordialog.PromptDialog(
135 | app.android.foregroundActivity
136 | );
137 | alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
138 | alert.setDialogType(IFancyAlertSupportedTypesAndroid.EDIT); /// EDIT
139 | alert.setTitleText(title || "Edit");
140 | alert.setContentText(subTitle || "");
141 | alert.setEditTextHint(subTitle || "");
142 | alert.setAnimationEnable(true);
143 | alert.setPositiveListener(
144 | closeBtnTitle || "Ok",
145 | new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
146 | onClick: dialog => {
147 | dialog.dismiss();
148 | resolve(dialog.getEditText().getText());
149 | }
150 | })
151 | );
152 | alert.show();
153 | });
154 | }
155 |
156 | public static showInfo(
157 | title: string,
158 | subTitle?: string,
159 | closeBtnTitle?: string
160 | ): Promise {
161 | return new Promise((resolve, reject) => {
162 | const alert = new cn.refactor.lib.colordialog.PromptDialog(
163 | app.android.foregroundActivity
164 | );
165 | alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
166 | alert.setDialogType(IFancyAlertSupportedTypesAndroid.INFO); /// Info
167 | alert.setTitleText(title || "Info");
168 | alert.setContentText(subTitle || "");
169 | alert.setAnimationEnable(true);
170 | alert.setPositiveListener(
171 | closeBtnTitle || "Ok",
172 | new cn.refactor.lib.colordialog.PromptDialog.OnPositiveListener({
173 | onClick: dialog => {
174 | dialog.dismiss();
175 | resolve();
176 | }
177 | })
178 | );
179 | alert.show();
180 | });
181 | }
182 |
183 | public static showColorDialog(
184 | title: string,
185 | subTitle?: string,
186 | okBtnTitle?: string,
187 | cancelBtnTitle?: string,
188 | backgroundColor?: string,
189 | titleTextColor?: string,
190 | contextTextColor?: string,
191 | contentImage?: any
192 | ): Promise {
193 | return new Promise((resolve, reject) => {
194 | const alert = new cn.refactor.lib.colordialog.ColorDialog(
195 | app.android.foregroundActivity
196 | );
197 | // alert.setCanceledOnTouchOutside(TNSFancyAlert.shouldDismissOnTapOutside);
198 | // alert.setDialogType(IFancyAlertSupportedTypesAndroid.HELP);
199 | alert.setTitle(title || "Title");
200 | alert.setContentText(subTitle || "");
201 | if (backgroundColor) {
202 | alert.setColor(new Color(backgroundColor).android);
203 | }
204 | if (titleTextColor) {
205 | alert.setTitleTextColor(new Color(titleTextColor).android);
206 | }
207 | if (contextTextColor) {
208 | alert.setContentTextColor(new Color(contextTextColor).android);
209 | }
210 | if (contentImage) {
211 | var context = app.android.context;
212 | alert.setContentImage(context.getResources().getIdentifier(contentImage,null, context.getPackageName()));
213 | }
214 | alert.setAnimationEnable(true);
215 | alert.setPositiveListener(
216 | okBtnTitle || "Ok",
217 | new cn.refactor.lib.colordialog.ColorDialog.OnPositiveListener({
218 | onClick: dialog => {
219 | dialog.dismiss();
220 | resolve();
221 | }
222 | })
223 | );
224 | if (cancelBtnTitle) {
225 | alert.setNegativeListener(
226 | cancelBtnTitle || "Cancel",
227 | new cn.refactor.lib.colordialog.ColorDialog.OnNegativeListener({
228 | onClick: dialog => {
229 | dialog.dismiss();
230 | reject();
231 | }
232 | })
233 | );
234 | }
235 | alert.show();
236 | });
237 | }
238 | }
239 |
--------------------------------------------------------------------------------
/demo/app/main-view-model.ts:
--------------------------------------------------------------------------------
1 | import { TNSFancyAlert, TNSFancyAlertButton } from "nativescript-fancyalert";
2 | import { Color } from "tns-core-modules/color";
3 | import { Observable } from "tns-core-modules/data/observable";
4 | import { isIOS } from "tns-core-modules/platform";
5 |
6 | declare var NSMutableAttributedString: any,
7 | NSForegroundColorAttributeName: any,
8 | NSCaseInsensitiveSearch: any,
9 | NSUnderlineStyleSingle: any,
10 | UIView: any,
11 | CGRectMake: any,
12 | SCLAlertViewShowAnimation: any,
13 | SCLAlertViewHideAnimation: any,
14 | SCLAlertViewBackground: any,
15 | NSString: any,
16 | NSUnderlineStyleAttributeName: any;
17 |
18 | export class HelloWorldModel extends Observable {
19 | constructor() {
20 | super();
21 | if (isIOS) {
22 | TNSFancyAlert.hideAnimationType =
23 | TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToBottom;
24 | }
25 | }
26 |
27 | public showSuccess() {
28 | TNSFancyAlert.showSuccess(
29 | "Success!",
30 | "Fancy alerts are nice.",
31 | "Yes they are!"
32 | );
33 | }
34 |
35 | public showSuccessCustomEffects() {
36 | if (isIOS) {
37 | TNSFancyAlert.showAnimationType =
38 | TNSFancyAlert.SHOW_ANIMATION_TYPES.SlideInFromLeft;
39 | TNSFancyAlert.hideAnimationType =
40 | TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToRight;
41 | TNSFancyAlert.backgroundType = TNSFancyAlert.BACKGROUND_TYPES.Blur;
42 | TNSFancyAlert.soundURL = "bell.mp3";
43 | TNSFancyAlert.showSuccess(
44 | "Sound?",
45 | "You can use sound and customize many aspects like animation in/out, color, background style and much more.",
46 | "Amazing!"
47 | );
48 | this.reset();
49 | }
50 | }
51 |
52 | public showSuccessDelay() {
53 | TNSFancyAlert.showSuccess(
54 | "Success!",
55 | "Fancy alerts are nice. This will disappear in 5 seconds.",
56 | "Close Now!",
57 | 5
58 | );
59 | }
60 |
61 | public showError() {
62 | TNSFancyAlert.showError(
63 | "Error!",
64 | "At least it looks good :)",
65 | "Yeah it does."
66 | );
67 | }
68 |
69 | public showNotice() {
70 | TNSFancyAlert.showNotice(
71 | "Notice",
72 | `You've been officially notified that NativeScript is awesome.`,
73 | "Yeah it is!"
74 | );
75 | }
76 |
77 | public showWarning() {
78 | TNSFancyAlert.showWarning("Warning", `#nowebview here.`, "Ok, Got It!");
79 | }
80 |
81 | public showInfo() {
82 | if (isIOS) {
83 | TNSFancyAlert.showAnimationType =
84 | SCLAlertViewShowAnimation.SlideInFromBottom;
85 | TNSFancyAlert.hideAnimationType =
86 | SCLAlertViewHideAnimation.SlideOutToRight;
87 | }
88 | TNSFancyAlert.showInfo(
89 | "Info",
90 | `You can integrate any CocoaPod or Android library with NativeScript.`,
91 | "Sweet!"
92 | );
93 | if (isIOS) {
94 | this.reset();
95 | }
96 | }
97 |
98 | public showEdit() {
99 | TNSFancyAlert.showEdit(
100 | "Edit",
101 | `We could edit something but won't right now.`,
102 | "Sounds Good"
103 | );
104 | }
105 |
106 | public showWaiting() {
107 | TNSFancyAlert.showWaiting(
108 | "Waiting...",
109 | `It's like waiting for a WebView to render ;)`,
110 | "Uh yeah it is."
111 | );
112 | }
113 |
114 | public showQuestion() {
115 | TNSFancyAlert.showQuestion(
116 | "Question",
117 | `Do you like developing with NativeScript?`,
118 | "Well yes I do!"
119 | );
120 | }
121 |
122 | public showCustomImage() {
123 | TNSFancyAlert.showCustomImage(
124 | "nativescript.png",
125 | "#2B33FF",
126 | "@drawable/customimage", //Place image name without extension
127 | `Using your own images is sure nice.`,
128 | "Yes!"
129 | );
130 | }
131 |
132 | public showCustomButtonTimer() {
133 | TNSFancyAlert.showCustomButtonTimer(
134 | 0,
135 | true,
136 | undefined,
137 | undefined,
138 | "Mission Impossible",
139 | `This will self-destruct in 5 seconds.`,
140 | "Ok"
141 | );
142 | }
143 |
144 | public showCustomButtons() {
145 | let buttons = [
146 | new TNSFancyAlertButton({
147 | label: "One",
148 | action: () => {
149 | console.log("One");
150 | }
151 | }),
152 | new TNSFancyAlertButton({
153 | label: "Two",
154 | action: () => {
155 | console.log("Two");
156 | }
157 | }),
158 | new TNSFancyAlertButton({
159 | label: "Three",
160 | action: () => {
161 | console.log("Three");
162 | }
163 | }),
164 | new TNSFancyAlertButton({
165 | label: "Four",
166 | action: () => {
167 | console.log("Four");
168 | }
169 | }),
170 | new TNSFancyAlertButton({
171 | label: "Really? More?",
172 | action: () => {
173 | console.log("more");
174 | }
175 | })
176 | ];
177 | TNSFancyAlert.showCustomButtons(
178 | buttons,
179 | undefined,
180 | undefined,
181 | "Got Buttons?",
182 | `Add as many as you'd like.`,
183 | "Ok"
184 | );
185 | }
186 |
187 | public showCustomWidth() {
188 | TNSFancyAlert.showSuccess(
189 | "Success!",
190 | "This uses a custom width of 300.",
191 | `Oh that's nice.`,
192 | 0,
193 | 300
194 | );
195 | }
196 |
197 | public customText() {
198 | let textAttribution = (value: any) => {
199 | let nsString = NSString.alloc().initWithString(value);
200 | let subTitle = NSMutableAttributedString.alloc().initWithString(value);
201 |
202 | let redRange = nsString.rangeOfStringOptions(
203 | "Yep",
204 | NSCaseInsensitiveSearch
205 | );
206 | subTitle.addAttributeValueRange(
207 | NSForegroundColorAttributeName,
208 | new Color("#BC1224").ios,
209 | redRange
210 | );
211 |
212 | let greenRange = nsString.rangeOfStringOptions(
213 | "that can be done",
214 | NSCaseInsensitiveSearch
215 | );
216 | subTitle.addAttributeValueRange(
217 | NSForegroundColorAttributeName,
218 | new Color("#528100").ios,
219 | greenRange
220 | );
221 |
222 | let underline = nsString.rangeOfStringOptions(
223 | "too!",
224 | NSCaseInsensitiveSearch
225 | );
226 | subTitle.addAttributeValueRange(
227 | NSUnderlineStyleAttributeName,
228 | NSUnderlineStyleSingle,
229 | underline
230 | );
231 |
232 | return subTitle;
233 | };
234 | TNSFancyAlert.showCustomTextAttributes(
235 | textAttribution,
236 | new TNSFancyAlertButton({
237 | label: "Wow, ok.",
238 | action: (value: any) => {
239 | console.log(`Clicked ok.`);
240 | }
241 | }),
242 | undefined,
243 | undefined,
244 | "Custom text color?",
245 | `Yep, that can be done too!`,
246 | null
247 | );
248 | }
249 |
250 | public showTextField() {
251 | TNSFancyAlert.showTextField(
252 | "Enter your name",
253 | "",
254 | new TNSFancyAlertButton({
255 | label: "Save",
256 | action: (value: any) => {
257 | console.log(`User entered ${value}`);
258 | }
259 | }),
260 | undefined,
261 | undefined,
262 | "User Input?",
263 | `Yeah, sure we can.`,
264 | "Ok, lots of options."
265 | );
266 | }
267 |
268 | public showSwitch() {
269 | TNSFancyAlert.showSwitch(
270 | `Don't show again`,
271 | "#58B136",
272 | new TNSFancyAlertButton({
273 | label: "Save",
274 | action: (isSelected: boolean) => {
275 | console.log(`Don't show again was selected: ${isSelected}`);
276 | }
277 | }),
278 | "switch.png",
279 | "#B3714F",
280 | "Need a switch?",
281 | `It can be useful.`,
282 | "Got it."
283 | );
284 | }
285 |
286 | public showCustomView() {
287 | let customView = UIView.alloc().initWithFrame(CGRectMake(0, 0, 215, 80));
288 | customView.backgroundColor = new Color("#FE00FC").ios;
289 | TNSFancyAlert.showCustomView(
290 | customView,
291 | undefined,
292 | undefined,
293 | "Add any view?",
294 | `Just pass in a any UIView.`,
295 | "Nice!"
296 | );
297 | }
298 |
299 | private reset() {
300 | setTimeout(() => {
301 | TNSFancyAlert.showAnimationType = undefined;
302 | TNSFancyAlert.hideAnimationType =
303 | TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToBottom;
304 | TNSFancyAlert.backgroundType = undefined;
305 | TNSFancyAlert.soundURL = undefined;
306 | }, 1000);
307 | }
308 | }
309 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## NativeScript 7 or higher
2 |
3 | * Use `@nstudio/nativescript-fancyalert`: `~4.0.0`
4 | * [Source managed here](https://github.com/nstudio/nativescript-plugins)
5 |
6 | ## If using 6 and below, see the following:
7 |
8 | Fancy alerts for NativeScript.
9 |
10 | Based on:
11 |
12 | - iOS [SCLAlertView](https://github.com/dogo/SCLAlertView)
13 | - Android [ColorDialog](https://github.com/andyxialm/ColorDialog)
14 |
15 | # Install
16 |
17 | ### NativeScript 4x
18 |
19 | ```bash
20 | tns plugin add nativescript-fancyalert
21 | ```
22 |
23 | ### NativeScript 3x and older
24 |
25 | ```bash
26 | tns plugin add nativescript-fancyalert@1.2.0
27 | ```
28 |
29 | 
30 |
31 | 
32 |
33 | # iOS Specifications
34 |
35 | #### Usage Examples
36 |
37 | ```js
38 | import { TNSFancyAlert, TNSFancyAlertButton } from "nativescript-fancyalert";
39 |
40 | // show success
41 | TNSFancyAlert.showSuccess(
42 | "Success!",
43 | "Fancy alerts are nice.",
44 | "Yes they are!"
45 | );
46 |
47 | // set customizations
48 | TNSFancyAlert.showAnimationType =
49 | TNSFancyAlert.SHOW_ANIMATION_TYPES.SlideInFromLeft;
50 | TNSFancyAlert.hideAnimationType =
51 | TNSFancyAlert.HIDE_ANIMATION_TYPES.SlideOutToRight;
52 | TNSFancyAlert.backgroundType = TNSFancyAlert.BACKGROUND_TYPES.Blur;
53 | TNSFancyAlert.soundURL = "bell.mp3";
54 | TNSFancyAlert.showSuccess(
55 | "Sound?",
56 | "You can use sound and customize many aspects like animation in/out, color, background style and much more.",
57 | "Amazing!"
58 | );
59 |
60 | // show custom image
61 | TNSFancyAlert.showCustomImage(
62 | "nativescript.png",
63 | "#2B33FF",
64 | "Custom Image",
65 | `Using your own images is sure nice.`,
66 | "Yes!"
67 | );
68 |
69 | // show custom button timer
70 | TNSFancyAlert.showCustomButtonTimer(
71 | 0,
72 | true,
73 | undefined,
74 | undefined,
75 | "Mission Impossible",
76 | `This will self-destruct in 5 seconds.`,
77 | "Ok"
78 | );
79 |
80 | // show custom buttons
81 | let buttons = [
82 | new TNSFancyAlertButton({
83 | label: "One",
84 | action: () => {
85 | console.log("One");
86 | }
87 | }),
88 | new TNSFancyAlertButton({
89 | label: "Two",
90 | action: () => {
91 | console.log("Two");
92 | }
93 | }),
94 | new TNSFancyAlertButton({
95 | label: "Three",
96 | action: () => {
97 | console.log("Three");
98 | }
99 | }),
100 | new TNSFancyAlertButton({
101 | label: "Four",
102 | action: () => {
103 | console.log("Four");
104 | }
105 | }),
106 | new TNSFancyAlertButton({
107 | label: "Really? More?",
108 | action: () => {
109 | console.log("more");
110 | }
111 | })
112 | ];
113 | TNSFancyAlert.showCustomButtons(
114 | buttons,
115 | undefined,
116 | undefined,
117 | "Got Buttons?",
118 | `Add as many as you'd like.`,
119 | "Ok"
120 | );
121 |
122 | // show with custom width
123 | TNSFancyAlert.showSuccess(
124 | "Success!",
125 | "This uses a custom width of 300.",
126 | `Oh that's nice.`,
127 | 0,
128 | 300
129 | );
130 |
131 | // show textfield
132 | let initialValue = null;
133 | TNSFancyAlert.showTextField(
134 | "Enter your name",
135 | initialValue,
136 | new TNSFancyAlertButton({
137 | label: "Save",
138 | action: (value: any) => {
139 | console.log(`User entered ${value}`);
140 | }
141 | }),
142 | undefined,
143 | undefined,
144 | "User Input?",
145 | `Yeah, sure we can.`,
146 | "Ok, lots of options."
147 | );
148 |
149 | // show switch
150 | TNSFancyAlert.showSwitch(
151 | `Don't show again`,
152 | "#58B136",
153 | new TNSFancyAlertButton({
154 | label: "Save",
155 | action: (isSelected: boolean) => {
156 | console.log(`Don't show again was selected: ${isSelected}`);
157 | }
158 | }),
159 | "switch.png",
160 | "#B3714F",
161 | "Need a switch?",
162 | `It can be useful.`,
163 | "Got it."
164 | );
165 | ```
166 |
167 | #### TNSFancyAlert - Properties
168 |
169 | | Property | Description |
170 | | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
171 | | `TNSFancyAlert.SUPPORTED_TYPES: IFancyAlertSupportedTypes` | Different supported style types. |
172 | | `TNSFancyAlert.shouldDismissOnTapOutside: boolean` | Should dismiss when tapped outside. |
173 | | `TNSFancyAlert.dismissCallback: () => void` | Callback for when alert is dismissed. |
174 | | `TNSFancyAlert.hideAnimationType: IFancyAlertHideAnimationTypes` | Use `TNSFancyAlert.HIDE_ANIMATION_TYPES` to set. Supports: FadeOut, SlideOutToBottom, SlideOutToTop, SlideOutToLeft, SlideOutToRight, SlideOutToCenter, SlideOutFromCenter. |
175 | | `TNSFancyAlert.showAnimationType: IFancyAlertShowAnimationTypes` | Use `TNSFancyAlert.SHOW_ANIMATION_TYPES` to set. Supports: FadeIn, SlideInFromBottom, SlideInFromTop, SlideInFromLeft, SlideInFromRight, SlideInFromCenter, SlideInToCenter. |
176 | | `TNSFancyAlert.backgroundType: IFancyAlertBackgroundTypes` | Use `TNSFancyAlert.BACKGROUND_TYPES` to set. Supports: Shadow, Blur, Transparent. |
177 | | `TNSFancyAlert.customViewColor: string` | Overwrite (Buttons, top circle and borders) colors. |
178 | | `TNSFancyAlert.iconTintColor: string` | Set custom tint color for icon image. |
179 | | `TNSFancyAlert.titleColor: string` | Set custom title color. |
180 | | `TNSFancyAlert.bodyTextColor: string` | Set custom body text color. |
181 | | `TNSFancyAlert.tintTopCircle: string` | Override top circle tint color with background color |
182 | | `TNSFancyAlert.cornerRadius: number` | Set custom corner radius. |
183 | | `TNSFancyAlert.backgroundViewColor: string` | Overwrite background color |
184 | | `TNSFancyAlert.useLargerIcon: boolean` | Make the top circle icon larger |
185 | | `TNSFancyAlert.soundURL: string` | Use mp3 from App_Resources when alert shows. |
186 | | `TNSFancyAlert.textDisplayOptions: IFancyAlertTextOptions` | IOS Only. Text display options |
187 |
188 | #### TNSFancyAlert - Methods
189 |
190 | - `showSuccess(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array)`
191 | - `showError(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array)`
192 | - `showNotice(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array)`
193 | - `showWarning(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array)`
194 | - `showInfo(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array)`
195 | - `showEdit(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array)`
196 | - `showWaiting(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
197 | - `showQuestion(title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array)`
198 | - `showCustomButtonTimer(buttonIndex: number, reverse?: boolean, imageName?: string, color?: string, title?: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
199 | - `showCustomImage(imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
200 | - `showCustomButtons(buttons: Array, imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
201 | - `showCustomTextAttributes(attributionBlock: Function, button: TNSFancyAlertButton, imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
202 | - `showTextField(placeholder: string, initialValue: string, button: TNSFancyAlertButton, imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
203 | - `showSwitch(switchLabel: string, switchColor: string, button: TNSFancyAlertButton, imageName: string, color: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
204 | - `showCustomView(customView: any, imageName?: string, color?: string, title?: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number)`
205 | - `show(type: string, title: string, subTitle?: string, closeBtnTitle?: string, duration?: number, width?: number, buttons?: Array)`
206 | - `showCustom(alert: any, imageName: string, color: string, title?: string, subTitle?: string, closeBtnTitle?: string, duration?: number)`
207 | - `createAlert(width?: number)`
208 |
209 | # Android Specifications
210 |
211 | #### Usage Examples
212 |
213 | NOTE: Android supports only a subset of the iOS features, but will return a Promise on every call:
214 |
215 | ```js
216 | import { TNSFancyAlert, TNSFancyAlertButton } from "nativescript-fancyalert";
217 |
218 | // show success
219 | TNSFancyAlert.showSuccess(
220 | "Success!",
221 | "Fancy alerts are nice.",
222 | "Yes they are!"
223 | ).then(() => {
224 | /* user pressed the button */
225 | });
226 |
227 | // show error
228 | TNSFancyAlert.showError("Error!", "Something bad happened.", "Close").then(
229 | () => {
230 | /* user pressed the button */
231 | }
232 | );
233 | ```
234 |
235 | #### TNSFancyAlert - Methods
236 |
237 | - `showSuccess(title: string, subTitle?: string, closeBtnTitle?: string): Promise`
238 | - `showError(title: string, subTitle?: string, closeBtnTitle?: string): Promise`
239 | - `showNotice(title: string, subTitle?: string, closeBtnTitle?: string): Promise`
240 | - `showWarning(title: string, subTitle?: string, closeBtnTitle?: string): Promise`
241 | - `showInfo(title: string, subTitle?: string, closeBtnTitle?: string): Promise`
242 | - ```
243 | showColorDialog(
244 | title: string,
245 | subTitle?: string,
246 | okBtnTitle?: string,
247 | cancelBtnTitle?: string,
248 | backgroundColor?: string,
249 | titleTextColor?: string,
250 | contextTextColor?: string,
251 | contentImage?: any
252 | ): Promise```
253 |
254 | # TNSFancyAlertButton (iOS only)
255 |
256 | This class can be instantiated on iOS to configure buttons in the fancy alerts.
257 |
258 | ```
259 | export class TNSFancyAlertButton {
260 | public label: string;
261 | public action: Function;
262 | public applyStyle: (btn: any) => void;
263 |
264 | constructor(model?: any) {
265 | if (model) {
266 | this.label = model.label;
267 | this.action = model.action;
268 | this.applyStyle = model.applyStyle;
269 | }
270 | }
271 | }
272 | ```
273 |
274 | * `label`: display text on the button
275 | * `action`: the method to invoke when the button is tapped on
276 | * `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).
277 |
278 | Here's an example of how to setup a custom background color:
279 |
280 | ```
281 | new TNSFancyAlertButton({
282 | label: 'Ok',
283 | action: () => {
284 | // the action to take
285 | },
286 | applyStyle: (btn: UIButton) => {
287 | // we can use UIButton typing when using tns-platform-declarations
288 | // 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 :) )
289 | // refer to https://github.com/dogo/SCLAlertView/blob/develop/SCLAlertView/SCLButton.m on what properties are available to customize
290 |
291 | (btn).buttonFormatBlock = () => {
292 | // set a custom backgroundColor
293 | return new (NSDictionary as any)([new Color('#3a3939').ios], ['backgroundColor']);
294 | }
295 | }
296 | }),
297 | ```
298 |
299 | ## Why the TNS prefixed name?
300 |
301 | `TNS` stands for **T**elerik **N**ative**S**cript
302 |
303 | iOS uses classes prefixed with `NS` (stemming from the [NeXTSTEP](https://en.wikipedia.org/wiki/NeXTSTEP) days of old):
304 | https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/
305 |
306 | To avoid confusion with iOS native classes, `TNS` is used instead.
307 |
308 | ## Tutorials
309 |
310 | Need extra help getting these fancy alerts working in your application? Check out these tutorials that make use of the plugin:
311 |
312 | [Fancy Alerts in a NativeScript with Angular Application](https://www.thepolyglotdeveloper.com/2017/02/use-visually-appealing-fancy-alerts-nativescript-angular-application/)
313 |
314 | ## License
315 |
316 | MIT
317 |
--------------------------------------------------------------------------------
/src/fancyalert.ios.ts:
--------------------------------------------------------------------------------
1 | import { Color } from "tns-core-modules/color";
2 | import { TNSFancyAlertButton } from "./common";
3 | import {
4 | IFancyAlertSupportedTypes,
5 | IFancyAlertTextOptions,
6 | IFancyAlertShowAnimationTypes,
7 | IFancyAlertHideAnimationTypes,
8 | IFancyAlertBackgroundTypes
9 | } from "./";
10 |
11 | export * from "./common";
12 |
13 | export class TNSFancyAlert {
14 | public static SUPPORTED_TYPES: IFancyAlertSupportedTypes = {
15 | SUCCESS: "Success",
16 | ERROR: "Error",
17 | NOTICE: "Notice",
18 | WARNING: "Warning",
19 | INFO: "Info",
20 | EDIT: "Edit",
21 | WAITING: "Waiting",
22 | QUESTION: "Question"
23 | };
24 |
25 | //Dismiss on tap outside (Default is NO)
26 | public static shouldDismissOnTapOutside: boolean = false;
27 | public static dismissCallback: () => void;
28 |
29 | // font handling
30 | public static textDisplayOptions: IFancyAlertTextOptions;
31 |
32 | //Hide animation type (Default is FadeOut)
33 | public static hideAnimationType: IFancyAlertHideAnimationTypes;
34 |
35 | public static HIDE_ANIMATION_TYPES: IFancyAlertHideAnimationTypes = {
36 | FadeOut: SCLAlertViewHideAnimation.FadeOut,
37 | SlideOutToBottom: SCLAlertViewHideAnimation.SlideOutToBottom,
38 | SlideOutToTop: SCLAlertViewHideAnimation.SlideOutToTop,
39 | SlideOutToLeft: SCLAlertViewHideAnimation.SlideOutToLeft,
40 | SlideOutToRight: SCLAlertViewHideAnimation.SlideOutToRight,
41 | SlideOutToCenter: SCLAlertViewHideAnimation.SlideOutToCenter,
42 | SlideOutFromCenter: SCLAlertViewHideAnimation.SlideOutFromCenter
43 | };
44 |
45 | //Show animation type (Default is SlideInFromTop)
46 | public static showAnimationType: IFancyAlertShowAnimationTypes;
47 |
48 | public static SHOW_ANIMATION_TYPES: IFancyAlertShowAnimationTypes = {
49 | FadeIn: SCLAlertViewShowAnimation.FadeIn,
50 | SlideInFromBottom: SCLAlertViewShowAnimation.SlideInFromBottom,
51 | SlideInFromTop: SCLAlertViewShowAnimation.SlideInFromTop,
52 | SlideInFromLeft: SCLAlertViewShowAnimation.SlideInFromLeft,
53 | SlideInFromRight: SCLAlertViewShowAnimation.SlideInFromRight,
54 | SlideInFromCenter: SCLAlertViewShowAnimation.SlideInFromCenter,
55 | SlideInToCenter: SCLAlertViewShowAnimation.SlideInToCenter
56 | };
57 |
58 | //Set background type (Default is Shadow)
59 | public static backgroundType: IFancyAlertBackgroundTypes;
60 |
61 | public static BACKGROUND_TYPES: IFancyAlertBackgroundTypes = {
62 | Shadow: SCLAlertViewBackground.Shadow,
63 | Blur: SCLAlertViewBackground.Blur,
64 | Transparent: SCLAlertViewBackground.Transparent
65 | };
66 |
67 | //Overwrite SCLAlertView (Buttons, top circle and borders) colors
68 | public static customViewColor: string;
69 |
70 | //Set custom tint color for icon image.
71 | public static iconTintColor: string;
72 |
73 | // set custom title color
74 | public static titleColor: string;
75 |
76 | // set custom body text color
77 | public static bodyTextColor: string;
78 |
79 | //Override top circle tint color with background color
80 | public static tintTopCircle: boolean = true;
81 |
82 | //Set custom corner radius for SCLAlertView
83 | public static cornerRadius: number;
84 |
85 | //Overwrite SCLAlertView background color
86 | public static backgroundViewColor: string;
87 |
88 | //Make the top circle icon larger
89 | public static useLargerIcon: boolean = false;
90 |
91 | //Using sound
92 | public static soundURL: string;
93 |
94 | public static showSuccess(
95 | title: string,
96 | subTitle?: string,
97 | closeBtnTitle?: string,
98 | duration?: number,
99 | width?: number,
100 | buttons?: Array
101 | ) {
102 | return new Promise((resolve, reject) => {
103 | TNSFancyAlert.show(
104 | TNSFancyAlert.SUPPORTED_TYPES.SUCCESS,
105 | title || "Success!",
106 | subTitle,
107 | closeBtnTitle,
108 | duration,
109 | width,
110 | buttons
111 | );
112 | // TODO: find way to resolve only after button is tapped
113 | // right now just resolve after its shown
114 | resolve();
115 | });
116 | }
117 |
118 | public static showError(
119 | title: string,
120 | subTitle?: string,
121 | closeBtnTitle?: string,
122 | duration?: number,
123 | width?: number,
124 | buttons?: Array
125 | ) {
126 | return new Promise((resolve, reject) => {
127 | TNSFancyAlert.show(
128 | TNSFancyAlert.SUPPORTED_TYPES.ERROR,
129 | title || "Error!",
130 | subTitle,
131 | closeBtnTitle,
132 | duration,
133 | width,
134 | buttons
135 | );
136 | // TODO: find way to resolve only after button is tapped
137 | // right now just resolve after its shown
138 | resolve();
139 | });
140 | }
141 |
142 | public static showNotice(
143 | title: string,
144 | subTitle?: string,
145 | closeBtnTitle?: string,
146 | duration?: number,
147 | width?: number,
148 | buttons?: Array
149 | ) {
150 | return new Promise((resolve, reject) => {
151 | TNSFancyAlert.show(
152 | TNSFancyAlert.SUPPORTED_TYPES.NOTICE,
153 | title || "Notice",
154 | subTitle,
155 | closeBtnTitle,
156 | duration,
157 | width,
158 | buttons
159 | );
160 | // TODO: find way to resolve only after button is tapped
161 | // right now just resolve after its shown
162 | resolve();
163 | });
164 | }
165 |
166 | public static showWarning(
167 | title: string,
168 | subTitle?: string,
169 | closeBtnTitle?: string,
170 | duration?: number,
171 | width?: number,
172 | buttons?: Array
173 | ) {
174 | return new Promise((resolve, reject) => {
175 | TNSFancyAlert.show(
176 | TNSFancyAlert.SUPPORTED_TYPES.WARNING,
177 | title || "Warning!",
178 | subTitle,
179 | closeBtnTitle,
180 | duration,
181 | width,
182 | buttons
183 | );
184 | // TODO: find way to resolve only after button is tapped
185 | // right now just resolve after its shown
186 | resolve();
187 | });
188 | }
189 |
190 | public static showInfo(
191 | title: string,
192 | subTitle?: string,
193 | closeBtnTitle?: string,
194 | duration?: number,
195 | width?: number,
196 | buttons?: Array
197 | ) {
198 | return new Promise((resolve, reject) => {
199 | TNSFancyAlert.show(
200 | TNSFancyAlert.SUPPORTED_TYPES.INFO,
201 | title || "Info",
202 | subTitle,
203 | closeBtnTitle,
204 | duration,
205 | width,
206 | buttons
207 | );
208 | // TODO: find way to resolve only after button is tapped
209 | // right now just resolve after its shown
210 | resolve();
211 | });
212 | }
213 |
214 | public static showEdit(
215 | title: string,
216 | subTitle?: string,
217 | closeBtnTitle?: string,
218 | duration?: number,
219 | width?: number,
220 | buttons?: Array
221 | ) {
222 | return new Promise((resolve, reject) => {
223 | TNSFancyAlert.show(
224 | TNSFancyAlert.SUPPORTED_TYPES.EDIT,
225 | title || "Edit",
226 | subTitle,
227 | closeBtnTitle,
228 | duration,
229 | width,
230 | buttons
231 | );
232 | // TODO: find way to resolve only after button is tapped
233 | // right now just resolve after its shown
234 | resolve();
235 | });
236 | }
237 |
238 | public static showWaiting(
239 | title: string,
240 | subTitle?: string,
241 | closeBtnTitle?: string,
242 | duration?: number,
243 | width?: number
244 | ) {
245 | return new Promise((resolve, reject) => {
246 | TNSFancyAlert.show(
247 | TNSFancyAlert.SUPPORTED_TYPES.WAITING,
248 | title || "Waiting...",
249 | subTitle,
250 | closeBtnTitle,
251 | duration || 5,
252 | width
253 | );
254 | // TODO: find way to resolve only after button is tapped
255 | // right now just resolve after its shown
256 | resolve();
257 | });
258 | }
259 |
260 | public static showQuestion(
261 | title: string,
262 | subTitle?: string,
263 | closeBtnTitle?: string,
264 | duration?: number,
265 | width?: number,
266 | buttons?: Array
267 | ) {
268 | return new Promise((resolve, reject) => {
269 | TNSFancyAlert.show(
270 | TNSFancyAlert.SUPPORTED_TYPES.QUESTION,
271 | title || "Waiting...",
272 | subTitle,
273 | closeBtnTitle || "Dismiss",
274 | duration,
275 | width,
276 | buttons
277 | );
278 | // TODO: find way to resolve only after button is tapped
279 | // right now just resolve after its shown
280 | resolve();
281 | });
282 | }
283 |
284 | public static showCustomButtonTimer(
285 | buttonIndex: number,
286 | reverse?: boolean,
287 | imageName?: string,
288 | color?: string,
289 | title?: string,
290 | subTitle?: string,
291 | closeBtnTitle?: string,
292 | duration?: number,
293 | width?: number
294 | ) {
295 | return new Promise((resolve, reject) => {
296 | let alert = TNSFancyAlert.createAlert(width);
297 | TNSFancyAlert.applyTextDisplayOptions(alert);
298 |
299 | buttonIndex = buttonIndex || 0;
300 | reverse = reverse || false;
301 | title = title || "Title";
302 | alert.addTimerToButtonIndexReverse(buttonIndex, reverse);
303 | TNSFancyAlert.showCustom(
304 | alert,
305 | imageName,
306 | color,
307 | title,
308 | subTitle,
309 | closeBtnTitle || "Dismiss",
310 | duration || 5
311 | );
312 | // TODO: find way to resolve only after button is tapped
313 | // right now just resolve after its shown passing back instance to allow further control by developer
314 | resolve(alert);
315 | });
316 | }
317 |
318 | public static showCustomImage(
319 | imageName: string,
320 | color: string,
321 | title: string,
322 | subTitle?: string,
323 | closeBtnTitle?: string,
324 | duration?: number,
325 | width?: number
326 | ) {
327 | return new Promise((resolve, reject) => {
328 | let alert = TNSFancyAlert.createAlert(width);
329 | TNSFancyAlert.applyTextDisplayOptions(alert);
330 |
331 | let image = UIImage.imageNamed(imageName);
332 | alert.showCustomColorTitleSubTitleCloseButtonTitleDuration(
333 | image,
334 | new Color(color).ios,
335 | title,
336 | subTitle,
337 | closeBtnTitle || "Ok",
338 | duration || 0
339 | );
340 | // TODO: find way to resolve only after button is tapped
341 | // right now just resolve after its shown passing back instance to allow further control by developer
342 | resolve(alert);
343 | });
344 | }
345 |
346 | public static showCustomButtons(
347 | buttons: Array,
348 | image: any,
349 | color: string,
350 | title: string,
351 | subTitle?: string,
352 | closeBtnTitle?: string,
353 | duration?: number,
354 | width?: number
355 | ) {
356 | return new Promise((resolve, reject) => {
357 | let alert = TNSFancyAlert.createAlert(width);
358 | TNSFancyAlert.applyTextDisplayOptions(alert);
359 |
360 | for (let btn of buttons) {
361 | const slcBtn = alert.addButtonActionBlock(btn.label, () => {
362 | btn.action();
363 | });
364 | if (btn.applyStyle) {
365 | btn.applyStyle(slcBtn);
366 | }
367 | }
368 | TNSFancyAlert.showCustom(
369 | alert,
370 | image,
371 | color,
372 | title,
373 | subTitle,
374 | null,
375 | duration
376 | );
377 | // TODO: find way to resolve only after button is tapped
378 | // right now just resolve after its shown passing back instance to allow further control by developer
379 | resolve(alert);
380 | });
381 | }
382 |
383 | public static applyTextDisplayOptions(alert: SCLAlertView) {
384 | if (TNSFancyAlert.textDisplayOptions) {
385 | const systemFont = UIFont.systemFontOfSize(12);
386 | // get default font family name
387 | let fontFamily = systemFont.familyName;
388 | // default size
389 | let fontSize = 14;
390 |
391 | // custom font sizes
392 | const titleSize = TNSFancyAlert.textDisplayOptions.titleSize || fontSize;
393 | const bodySize = TNSFancyAlert.textDisplayOptions.bodySize || fontSize;
394 | const buttonSize =
395 | TNSFancyAlert.textDisplayOptions.buttonSize || fontSize;
396 |
397 | // if one font is specified on any option just use that for all
398 | if (TNSFancyAlert.textDisplayOptions.applyFontToAll) {
399 | if (TNSFancyAlert.textDisplayOptions.titleFont) {
400 | fontFamily = TNSFancyAlert.textDisplayOptions.titleFont;
401 | } else if (TNSFancyAlert.textDisplayOptions.bodyFont) {
402 | fontFamily = TNSFancyAlert.textDisplayOptions.bodyFont;
403 | } else if (TNSFancyAlert.textDisplayOptions.buttonFont) {
404 | fontFamily = TNSFancyAlert.textDisplayOptions.buttonFont;
405 | }
406 | }
407 |
408 | alert.setTitleFontFamilyWithSize(fontFamily, titleSize);
409 | alert.setBodyTextFontFamilyWithSize(fontFamily, bodySize);
410 | alert.setButtonsTextFontFamilyWithSize(fontFamily, buttonSize);
411 | }
412 | }
413 |
414 | public static showCustomTextAttributes(
415 | attributionBlock: (p1: string) => NSAttributedString,
416 | button: TNSFancyAlertButton,
417 | image: any,
418 | color: string,
419 | title: string,
420 | subTitle?: string,
421 | closeBtnTitle?: string,
422 | duration?: number,
423 | width?: number
424 | ) {
425 | return new Promise((resolve, reject) => {
426 | let alert = TNSFancyAlert.createAlert(width);
427 | TNSFancyAlert.applyTextDisplayOptions(alert);
428 |
429 | alert.attributedFormatBlock = attributionBlock;
430 | alert.addButtonActionBlock(button.label, () => {
431 | button.action();
432 | resolve();
433 | });
434 | TNSFancyAlert.showCustom(
435 | alert,
436 | image,
437 | color,
438 | title,
439 | subTitle,
440 | null,
441 | duration
442 | );
443 | });
444 | }
445 |
446 | public static showTextField(
447 | placeholder: string,
448 | initialValue: string,
449 | button: TNSFancyAlertButton,
450 | image: any,
451 | color: string,
452 | title: string,
453 | subTitle?: string,
454 | closeBtnTitle?: string,
455 | duration?: number,
456 | width?: number
457 | ) {
458 | return new Promise((resolve, reject) => {
459 | let alert = TNSFancyAlert.createAlert(width);
460 | TNSFancyAlert.applyTextDisplayOptions(alert);
461 |
462 | var textField = alert.addTextField(placeholder);
463 | if (initialValue) textField.text = initialValue;
464 | alert.addButtonActionBlock(button.label, () => {
465 | textField.resignFirstResponder();
466 | button.action(textField.text);
467 | resolve();
468 | });
469 | TNSFancyAlert.showCustom(
470 | alert,
471 | image,
472 | color,
473 | title,
474 | subTitle,
475 | null,
476 | duration
477 | );
478 | });
479 | }
480 |
481 | public static showSwitch(
482 | switchLabel: string,
483 | switchColor: string,
484 | button: TNSFancyAlertButton,
485 | image: any,
486 | color: string,
487 | title: string,
488 | subTitle?: string,
489 | closeBtnTitle?: string,
490 | duration?: number,
491 | width?: number
492 | ) {
493 | return new Promise((resolve, reject) => {
494 | let alert = TNSFancyAlert.createAlert(width);
495 | TNSFancyAlert.applyTextDisplayOptions(alert);
496 |
497 | var switchView = alert.addSwitchViewWithLabel(switchLabel);
498 | switchView.tintColor = new Color(switchColor).ios;
499 |
500 | alert.addButtonActionBlock(button.label, () => {
501 | button.action(switchView.selected);
502 | resolve();
503 | });
504 | TNSFancyAlert.showCustom(
505 | alert,
506 | image,
507 | color,
508 | title,
509 | subTitle,
510 | null,
511 | duration
512 | );
513 | });
514 | }
515 |
516 | public static showCustomView(
517 | customView: any,
518 | image?: any,
519 | color?: string,
520 | title?: string,
521 | subTitle?: string,
522 | closeBtnTitle?: string,
523 | duration?: number,
524 | width?: number
525 | ) {
526 | return new Promise((resolve, reject) => {
527 | let alert = TNSFancyAlert.createAlert(width);
528 | TNSFancyAlert.applyTextDisplayOptions(alert);
529 |
530 | alert.addCustomView(customView);
531 | TNSFancyAlert.showCustom(
532 | alert,
533 | image,
534 | color,
535 | title,
536 | subTitle,
537 | closeBtnTitle,
538 | duration
539 | );
540 | // TODO: find way to resolve only after button is tapped
541 | // right now just resolve after its shown passing back instance to allow further control by developer
542 | resolve(alert);
543 | });
544 | }
545 |
546 | /**
547 | * Base Method
548 | **/
549 | public static show(
550 | type: string,
551 | title: string,
552 | subTitle?: string,
553 | closeBtnTitle?: string,
554 | duration?: number,
555 | width?: number,
556 | buttons?: Array
557 | ) {
558 | let alert = TNSFancyAlert.createAlert(width);
559 | TNSFancyAlert.applyTextDisplayOptions(alert);
560 |
561 | // add custom buttons
562 | if (buttons) {
563 | for (let btn of buttons) {
564 | alert.addButtonActionBlock(btn.label, () => {
565 | btn.action();
566 | });
567 | }
568 | }
569 |
570 | // apply options to instance
571 | TNSFancyAlert.applyOptions(alert);
572 |
573 | if (typeof closeBtnTitle === "undefined") closeBtnTitle = "Ok";
574 | alert[`show${type}SubTitleCloseButtonTitleDuration`](
575 | title,
576 | subTitle,
577 | closeBtnTitle,
578 | duration || 0
579 | );
580 | }
581 |
582 | public static showCustom(
583 | alert: any,
584 | image: any,
585 | color: string,
586 | title?: string,
587 | subTitle?: string,
588 | closeBtnTitle?: string,
589 | duration?: number
590 | ) {
591 | // apply options to instance
592 | TNSFancyAlert.applyOptions(alert);
593 |
594 | if (typeof image === "undefined") image = "nativescript.png";
595 | if (typeof color === "undefined") color = "#2B33FF";
596 | if (typeof closeBtnTitle === "undefined") closeBtnTitle = "Ok";
597 |
598 | if (typeof image === "string") {
599 | image = UIImage.imageNamed(image);
600 | }
601 |
602 | alert.showCustomColorTitleSubTitleCloseButtonTitleDuration(
603 | image,
604 | new Color(color).ios,
605 | title,
606 | subTitle,
607 | closeBtnTitle,
608 | duration || 0
609 | );
610 | }
611 |
612 | /**
613 | * Alert Options
614 | */
615 | public static applyOptions(alert: any) {
616 | alert.shouldDismissOnTapOutside = TNSFancyAlert.shouldDismissOnTapOutside;
617 |
618 | if (TNSFancyAlert.hideAnimationType)
619 | alert.hideAnimationType = TNSFancyAlert.hideAnimationType;
620 |
621 | if (TNSFancyAlert.showAnimationType)
622 | alert.showAnimationType = TNSFancyAlert.showAnimationType;
623 |
624 | if (TNSFancyAlert.backgroundType)
625 | alert.backgroundType = TNSFancyAlert.backgroundType;
626 |
627 | if (TNSFancyAlert.customViewColor)
628 | alert.customViewColor = new Color(TNSFancyAlert.customViewColor).ios;
629 |
630 | if (TNSFancyAlert.iconTintColor)
631 | alert.iconTintColor = new Color(TNSFancyAlert.iconTintColor).ios;
632 |
633 | if (TNSFancyAlert.titleColor)
634 | alert.labelTitle.textColor = new Color(TNSFancyAlert.titleColor).ios;
635 |
636 | if (TNSFancyAlert.bodyTextColor)
637 | alert.viewText.textColor = new Color(TNSFancyAlert.bodyTextColor).ios;
638 |
639 | alert.tintTopCircle = TNSFancyAlert.tintTopCircle;
640 |
641 | if (TNSFancyAlert.cornerRadius)
642 | alert.cornerRadius = TNSFancyAlert.cornerRadius;
643 |
644 | if (TNSFancyAlert.backgroundViewColor)
645 | alert.backgroundViewColor = new Color(
646 | TNSFancyAlert.backgroundViewColor
647 | ).ios;
648 |
649 | alert.useLargerIcon = TNSFancyAlert.useLargerIcon;
650 |
651 | if (TNSFancyAlert.soundURL)
652 | alert.soundURL = NSURL.fileURLWithPath(
653 | `${NSBundle.mainBundle.resourcePath}/${TNSFancyAlert.soundURL}`
654 | );
655 | }
656 |
657 | /**
658 | * Alert Creator
659 | **/
660 | public static createAlert(width?: number) {
661 | let alert: SCLAlertView;
662 | if (width) {
663 | alert = SCLAlertView.alloc().initWithNewWindowWidth(width);
664 | } else {
665 | alert = SCLAlertView.alloc().initWithNewWindow();
666 | }
667 | if (TNSFancyAlert.dismissCallback) {
668 | alert.alertIsDismissed(TNSFancyAlert.dismissCallback);
669 | }
670 | return alert;
671 | }
672 | }
673 |
--------------------------------------------------------------------------------
/src/typings/objc!SCLAlertView_Objective_C.d.ts:
--------------------------------------------------------------------------------
1 | declare class SCLALertViewButtonBuilder extends SCLAlertViewBuilder__WithFluent {
2 | static alloc(): SCLALertViewButtonBuilder; // inherited from NSObject
3 |
4 | static new(): SCLALertViewButtonBuilder; // inherited from NSObject
5 |
6 | readonly actionBlock: (p1: () => void) => SCLALertViewButtonBuilder;
7 |
8 | readonly button: SCLButton;
9 |
10 | readonly selector: (p1: string) => SCLALertViewButtonBuilder;
11 |
12 | readonly target: (p1: any) => SCLALertViewButtonBuilder;
13 |
14 | readonly title: (p1: string) => SCLALertViewButtonBuilder;
15 |
16 | readonly validationBlock: (p1: () => boolean) => SCLALertViewButtonBuilder;
17 | }
18 |
19 | declare class SCLALertViewTextFieldBuilder extends SCLAlertViewBuilder__WithFluent {
20 | static alloc(): SCLALertViewTextFieldBuilder; // inherited from NSObject
21 |
22 | static new(): SCLALertViewTextFieldBuilder; // inherited from NSObject
23 |
24 | readonly textField: SCLTextView;
25 |
26 | readonly title: (p1: string) => SCLALertViewTextFieldBuilder;
27 | }
28 |
29 | declare const enum SCLActionType {
30 | None = 0,
31 |
32 | Selector = 1,
33 |
34 | Block = 2
35 | }
36 |
37 | declare class SCLAlertView extends UIViewController {
38 | static alloc(): SCLAlertView; // inherited from NSObject
39 |
40 | static new(): SCLAlertView; // inherited from NSObject
41 |
42 | activityIndicatorView: UIActivityIndicatorView;
43 |
44 | attributedFormatBlock: (p1: string) => NSAttributedString;
45 |
46 | backgroundType: SCLAlertViewBackground;
47 |
48 | backgroundViewColor: UIColor;
49 |
50 | buttonFormatBlock: () => NSDictionary;
51 |
52 | circleIconHeight: number;
53 |
54 | completeButtonFormatBlock: () => NSDictionary;
55 |
56 | cornerRadius: number;
57 |
58 | customViewColor: UIColor;
59 |
60 | extensionBounds: CGRect;
61 |
62 | forceHideBlock: () => void;
63 |
64 | hideAnimationType: SCLAlertViewHideAnimation;
65 |
66 | horizontalButtons: boolean;
67 |
68 | iconTintColor: UIColor;
69 |
70 | labelTitle: UILabel;
71 |
72 | shouldDismissOnTapOutside: boolean;
73 |
74 | showAnimationType: SCLAlertViewShowAnimation;
75 |
76 | soundURL: NSURL;
77 |
78 | statusBarHidden: boolean;
79 |
80 | statusBarStyle: UIStatusBarStyle;
81 |
82 | tintTopCircle: boolean;
83 |
84 | useLargerIcon: boolean;
85 |
86 | viewText: UITextView;
87 |
88 | constructor(o: { newWindow: void });
89 |
90 | constructor(o: { newWindowWidth: number });
91 |
92 | addButtonActionBlock(title: string, action: () => void): SCLButton;
93 |
94 | addButtonTargetSelector(
95 | title: string,
96 | target: any,
97 | selector: string
98 | ): SCLButton;
99 |
100 | addButtonValidationBlockActionBlock(
101 | title: string,
102 | validationBlock: () => boolean,
103 | action: () => void
104 | ): SCLButton;
105 |
106 | addCustomTextField(textField: UITextField): void;
107 |
108 | addCustomView(customView: UIView): UIView;
109 |
110 | addSwitchViewWithLabel(label: string): SCLSwitchView;
111 |
112 | addTextField(title: string): SCLTextView;
113 |
114 | addTimerToButtonIndexReverse(buttonIndex: number, reverse: boolean): void;
115 |
116 | alertDismissAnimationIsCompleted(
117 | dismissAnimationCompletionBlock: () => void
118 | ): void;
119 |
120 | alertIsDismissed(dismissBlock: () => void): void;
121 |
122 | alertShowAnimationIsCompleted(showAnimationCompletionBlock: () => void): void;
123 |
124 | hideView(): void;
125 |
126 | initWithNewWindow(): this;
127 |
128 | initWithNewWindowWidth(windowWidth: number): this;
129 |
130 | isVisible(): boolean;
131 |
132 | removeTopCircle(): void;
133 |
134 | setBodyTextFontFamilyWithSize(bodyTextFontFamily: string, size: number): void;
135 |
136 | setButtonsTextFontFamilyWithSize(
137 | buttonsFontFamily: string,
138 | size: number
139 | ): void;
140 |
141 | setTitleFontFamilyWithSize(titleFontFamily: string, size: number): void;
142 |
143 | showCustomColorTitleSubTitleCloseButtonTitleDuration(
144 | image: UIImage,
145 | color: UIColor,
146 | title: string,
147 | subTitle: string,
148 | closeButtonTitle: string,
149 | duration: number
150 | ): void;
151 |
152 | showCustomImageColorTitleSubTitleCloseButtonTitleDuration(
153 | vc: UIViewController,
154 | image: UIImage,
155 | color: UIColor,
156 | title: string,
157 | subTitle: string,
158 | closeButtonTitle: string,
159 | duration: number
160 | ): void;
161 |
162 | showEditSubTitleCloseButtonTitleDuration(
163 | title: string,
164 | subTitle: string,
165 | closeButtonTitle: string,
166 | duration: number
167 | ): void;
168 |
169 | showEditTitleSubTitleCloseButtonTitleDuration(
170 | vc: UIViewController,
171 | title: string,
172 | subTitle: string,
173 | closeButtonTitle: string,
174 | duration: number
175 | ): void;
176 |
177 | showErrorSubTitleCloseButtonTitleDuration(
178 | title: string,
179 | subTitle: string,
180 | closeButtonTitle: string,
181 | duration: number
182 | ): void;
183 |
184 | showErrorTitleSubTitleCloseButtonTitleDuration(
185 | vc: UIViewController,
186 | title: string,
187 | subTitle: string,
188 | closeButtonTitle: string,
189 | duration: number
190 | ): void;
191 |
192 | showInfoSubTitleCloseButtonTitleDuration(
193 | title: string,
194 | subTitle: string,
195 | closeButtonTitle: string,
196 | duration: number
197 | ): void;
198 |
199 | showInfoTitleSubTitleCloseButtonTitleDuration(
200 | vc: UIViewController,
201 | title: string,
202 | subTitle: string,
203 | closeButtonTitle: string,
204 | duration: number
205 | ): void;
206 |
207 | showNoticeSubTitleCloseButtonTitleDuration(
208 | title: string,
209 | subTitle: string,
210 | closeButtonTitle: string,
211 | duration: number
212 | ): void;
213 |
214 | showNoticeTitleSubTitleCloseButtonTitleDuration(
215 | vc: UIViewController,
216 | title: string,
217 | subTitle: string,
218 | closeButtonTitle: string,
219 | duration: number
220 | ): void;
221 |
222 | showQuestionSubTitleCloseButtonTitleDuration(
223 | title: string,
224 | subTitle: string,
225 | closeButtonTitle: string,
226 | duration: number
227 | ): void;
228 |
229 | showQuestionTitleSubTitleCloseButtonTitleDuration(
230 | vc: UIViewController,
231 | title: string,
232 | subTitle: string,
233 | closeButtonTitle: string,
234 | duration: number
235 | ): void;
236 |
237 | showSuccessSubTitleCloseButtonTitleDuration(
238 | title: string,
239 | subTitle: string,
240 | closeButtonTitle: string,
241 | duration: number
242 | ): void;
243 |
244 | showSuccessTitleSubTitleCloseButtonTitleDuration(
245 | vc: UIViewController,
246 | title: string,
247 | subTitle: string,
248 | closeButtonTitle: string,
249 | duration: number
250 | ): void;
251 |
252 | showTitleSubTitleStyleCloseButtonTitleDuration(
253 | title: string,
254 | subTitle: string,
255 | style: SCLAlertViewStyle,
256 | closeButtonTitle: string,
257 | duration: number
258 | ): void;
259 |
260 | showTitleTitleSubTitleStyleCloseButtonTitleDuration(
261 | vc: UIViewController,
262 | title: string,
263 | subTitle: string,
264 | style: SCLAlertViewStyle,
265 | closeButtonTitle: string,
266 | duration: number
267 | ): void;
268 |
269 | showWaitingSubTitleCloseButtonTitleDuration(
270 | title: string,
271 | subTitle: string,
272 | closeButtonTitle: string,
273 | duration: number
274 | ): void;
275 |
276 | showWaitingTitleSubTitleCloseButtonTitleDuration(
277 | vc: UIViewController,
278 | title: string,
279 | subTitle: string,
280 | closeButtonTitle: string,
281 | duration: number
282 | ): void;
283 |
284 | showWarningSubTitleCloseButtonTitleDuration(
285 | title: string,
286 | subTitle: string,
287 | closeButtonTitle: string,
288 | duration: number
289 | ): void;
290 |
291 | showWarningTitleSubTitleCloseButtonTitleDuration(
292 | vc: UIViewController,
293 | title: string,
294 | subTitle: string,
295 | closeButtonTitle: string,
296 | duration: number
297 | ): void;
298 | }
299 |
300 | declare const enum SCLAlertViewBackground {
301 | Shadow = 0,
302 |
303 | Blur = 1,
304 |
305 | Transparent = 2
306 | }
307 |
308 | declare class SCLAlertViewBuilder extends SCLAlertViewBuilder__WithFluent {
309 | static alloc(): SCLAlertViewBuilder; // inherited from NSObject
310 |
311 | static new(): SCLAlertViewBuilder; // inherited from NSObject
312 |
313 | activityIndicatorView: (p1: UIActivityIndicatorView) => SCLAlertViewBuilder;
314 |
315 | addButtonWithActionBlock: (p1: string, p2: () => void) => SCLAlertViewBuilder;
316 |
317 | addButtonWithBuilder: (p1: SCLALertViewButtonBuilder) => SCLAlertViewBuilder;
318 |
319 | addButtonWithTarget: (p1: string, p2: any, p3: string) => SCLAlertViewBuilder;
320 |
321 | addButtonWithValidationBlock: (
322 | p1: string,
323 | p2: () => boolean,
324 | p3: () => void
325 | ) => SCLAlertViewBuilder;
326 |
327 | addCustomTextField: (p1: UITextField) => SCLAlertViewBuilder;
328 |
329 | addCustomView: (p1: UIView) => SCLAlertViewBuilder;
330 |
331 | addSwitchViewWithLabelTitle: (p1: string) => SCLAlertViewBuilder;
332 |
333 | addTextField: (p1: string) => SCLAlertViewBuilder;
334 |
335 | addTextFieldWithBuilder: (
336 | p1: SCLALertViewTextFieldBuilder
337 | ) => SCLAlertViewBuilder;
338 |
339 | addTimerToButtonIndex: (p1: number, p2: boolean) => SCLAlertViewBuilder;
340 |
341 | alertDismissAnimationIsCompleted: (p1: () => void) => SCLAlertViewBuilder;
342 |
343 | alertIsDismissed: (p1: () => void) => SCLAlertViewBuilder;
344 |
345 | alertShowAnimationIsCompleted: (p1: () => void) => SCLAlertViewBuilder;
346 |
347 | readonly alertView: SCLAlertView;
348 |
349 | attributedFormatBlock: (
350 | p1: (p1: string) => NSAttributedString
351 | ) => SCLAlertViewBuilder;
352 |
353 | backgroundType: (p1: SCLAlertViewBackground) => SCLAlertViewBuilder;
354 |
355 | backgroundViewColor: (p1: UIColor) => SCLAlertViewBuilder;
356 |
357 | buttonFormatBlock: (p1: () => NSDictionary) => SCLAlertViewBuilder;
358 |
359 | circleIconHeight: (p1: number) => SCLAlertViewBuilder;
360 |
361 | completeButtonFormatBlock: (
362 | p1: () => NSDictionary
363 | ) => SCLAlertViewBuilder;
364 |
365 | cornerRadius: (p1: number) => SCLAlertViewBuilder;
366 |
367 | customViewColor: (p1: UIColor) => SCLAlertViewBuilder;
368 |
369 | extensionBounds: (p1: CGRect) => SCLAlertViewBuilder;
370 |
371 | forceHideBlock: (p1: () => void) => SCLAlertViewBuilder;
372 |
373 | hideAnimationType: (p1: SCLAlertViewHideAnimation) => SCLAlertViewBuilder;
374 |
375 | iconTintColor: (p1: UIColor) => SCLAlertViewBuilder;
376 |
377 | labelTitle: (p1: UILabel) => SCLAlertViewBuilder;
378 |
379 | removeTopCircle: () => SCLAlertViewBuilder;
380 |
381 | setBodyTextFontFamily: (p1: string, p2: number) => SCLAlertViewBuilder;
382 |
383 | setButtonsTextFontFamily: (p1: string, p2: number) => SCLAlertViewBuilder;
384 |
385 | setTitleFontFamily: (p1: string, p2: number) => SCLAlertViewBuilder;
386 |
387 | shouldDismissOnTapOutside: (p1: boolean) => SCLAlertViewBuilder;
388 |
389 | showAnimationType: (p1: SCLAlertViewShowAnimation) => SCLAlertViewBuilder;
390 |
391 | soundURL: (p1: NSURL) => SCLAlertViewBuilder;
392 |
393 | statusBarHidden: (p1: boolean) => SCLAlertViewBuilder;
394 |
395 | statusBarStyle: (p1: UIStatusBarStyle) => SCLAlertViewBuilder;
396 |
397 | tintTopCircle: (p1: boolean) => SCLAlertViewBuilder;
398 |
399 | useLargerIcon: (p1: boolean) => SCLAlertViewBuilder;
400 |
401 | viewText: (p1: UITextView) => SCLAlertViewBuilder;
402 |
403 | constructor(o: { newWindow: void });
404 |
405 | constructor(o: { newWindowWidth: number });
406 |
407 | initWithNewWindow(): this;
408 |
409 | initWithNewWindowWidth(width: number): this;
410 | }
411 |
412 | declare class SCLAlertViewBuilder__WithFluent extends NSObject
413 | implements SCLItemsBuilder__Protocol__Fluent {
414 | static alloc(): SCLAlertViewBuilder__WithFluent; // inherited from NSObject
415 |
416 | static new(): SCLAlertViewBuilder__WithFluent; // inherited from NSObject
417 |
418 | readonly debugDescription: string; // inherited from NSObjectProtocol
419 |
420 | readonly description: string; // inherited from NSObjectProtocol
421 |
422 | readonly hash: number; // inherited from NSObjectProtocol
423 |
424 | readonly isProxy: boolean; // inherited from NSObjectProtocol
425 |
426 | readonly superclass: typeof NSObject; // inherited from NSObjectProtocol
427 |
428 | readonly; // inherited from NSObjectProtocol
429 |
430 | class(): typeof NSObject;
431 |
432 | conformsToProtocol(aProtocol: any /* Protocol */): boolean;
433 |
434 | isEqual(object: any): boolean;
435 |
436 | isKindOfClass(aClass: typeof NSObject): boolean;
437 |
438 | isMemberOfClass(aClass: typeof NSObject): boolean;
439 |
440 | performSelector(aSelector: string): any;
441 |
442 | performSelectorWithObject(aSelector: string, object: any): any;
443 |
444 | performSelectorWithObjectWithObject(
445 | aSelector: string,
446 | object1: any,
447 | object2: any
448 | ): any;
449 |
450 | respondsToSelector(aSelector: string): boolean;
451 |
452 | retainCount(): number;
453 |
454 | self(): this;
455 |
456 | setupFluent(): void;
457 | }
458 |
459 | declare const enum SCLAlertViewHideAnimation {
460 | FadeOut = 0,
461 |
462 | SlideOutToBottom = 1,
463 |
464 | SlideOutToTop = 2,
465 |
466 | SlideOutToLeft = 3,
467 |
468 | SlideOutToRight = 4,
469 |
470 | SlideOutToCenter = 5,
471 |
472 | SlideOutFromCenter = 6,
473 |
474 | SimplyDisappear = 7
475 | }
476 |
477 | declare class SCLAlertViewResponder extends NSObject {
478 | static alloc(): SCLAlertViewResponder; // inherited from NSObject
479 |
480 | static new(): SCLAlertViewResponder; // inherited from NSObject
481 |
482 | constructor();
483 |
484 | close(): void;
485 |
486 | init(alertview: SCLAlertView): this;
487 | }
488 |
489 | declare const enum SCLAlertViewShowAnimation {
490 | FadeIn = 0,
491 |
492 | SlideInFromBottom = 1,
493 |
494 | SlideInFromTop = 2,
495 |
496 | SlideInFromLeft = 3,
497 |
498 | SlideInFromRight = 4,
499 |
500 | SlideInFromCenter = 5,
501 |
502 | SlideInToCenter = 6,
503 |
504 | SimplyAppear = 7
505 | }
506 |
507 | declare class SCLAlertViewShowBuilder extends SCLAlertViewBuilder__WithFluent {
508 | static alloc(): SCLAlertViewShowBuilder; // inherited from NSObject
509 |
510 | static new(): SCLAlertViewShowBuilder; // inherited from NSObject
511 |
512 | readonly closeButtonTitle: (p1: string) => SCLAlertViewShowBuilder;
513 |
514 | readonly color: (p1: UIColor) => SCLAlertViewShowBuilder;
515 |
516 | readonly completeText: (p1: string) => SCLAlertViewShowBuilder;
517 |
518 | readonly duration: (p1: number) => SCLAlertViewShowBuilder;
519 |
520 | readonly image: (p1: UIImage) => SCLAlertViewShowBuilder;
521 |
522 | readonly parameterCloseButtonTitle: string;
523 |
524 | readonly parameterColor: UIColor;
525 |
526 | readonly parameterCompleteText: string;
527 |
528 | readonly parameterDuration: number;
529 |
530 | readonly parameterImage: UIImage;
531 |
532 | readonly parameterStyle: SCLAlertViewStyle;
533 |
534 | readonly parameterSubTitle: string;
535 |
536 | readonly parameterTitle: string;
537 |
538 | readonly parameterViewController: UIViewController;
539 |
540 | readonly show: (p1: SCLAlertView, p2: UIViewController) => void;
541 |
542 | readonly style: (p1: SCLAlertViewStyle) => SCLAlertViewShowBuilder;
543 |
544 | readonly subTitle: (p1: string) => SCLAlertViewShowBuilder;
545 |
546 | readonly title: (p1: string) => SCLAlertViewShowBuilder;
547 |
548 | readonly viewController: (p1: UIViewController) => SCLAlertViewShowBuilder;
549 |
550 | showAlertView(alertView: SCLAlertView): void;
551 |
552 | showAlertViewOnViewController(
553 | alertView: SCLAlertView,
554 | controller: UIViewController
555 | ): void;
556 | }
557 |
558 | declare const enum SCLAlertViewStyle {
559 | Success = 0,
560 |
561 | Error = 1,
562 |
563 | Notice = 2,
564 |
565 | Warning = 3,
566 |
567 | Info = 4,
568 |
569 | Edit = 5,
570 |
571 | Waiting = 6,
572 |
573 | Question = 7,
574 |
575 | Custom = 8
576 | }
577 |
578 | declare class SCLAlertViewStyleKit extends NSObject {
579 | static alloc(): SCLAlertViewStyleKit; // inherited from NSObject
580 |
581 | static drawCheckmark(): void;
582 |
583 | static drawCross(): void;
584 |
585 | static drawEdit(): void;
586 |
587 | static drawInfo(): void;
588 |
589 | static drawNotice(): void;
590 |
591 | static drawQuestion(): void;
592 |
593 | static drawWarning(): void;
594 |
595 | static imageOfCheckmark(): UIImage;
596 |
597 | static imageOfCross(): UIImage;
598 |
599 | static imageOfEdit(): UIImage;
600 |
601 | static imageOfInfo(): UIImage;
602 |
603 | static imageOfNotice(): UIImage;
604 |
605 | static imageOfQuestion(): UIImage;
606 |
607 | static imageOfWarning(): UIImage;
608 |
609 | static new(): SCLAlertViewStyleKit; // inherited from NSObject
610 | }
611 |
612 | declare var SCLAlertView_Objective_CVersionNumber: number;
613 |
614 | declare var SCLAlertView_Objective_CVersionString: interop.Reference;
615 |
616 | declare class SCLButton extends UIButton {
617 | static alloc(): SCLButton; // inherited from NSObject
618 |
619 | static appearance(): SCLButton; // inherited from UIAppearance
620 |
621 | static appearanceForTraitCollection(trait: UITraitCollection): SCLButton; // inherited from UIAppearance
622 |
623 | static appearanceForTraitCollectionWhenContainedIn(
624 | trait: UITraitCollection,
625 | ContainerClass: typeof NSObject
626 | ): SCLButton; // inherited from UIAppearance
627 |
628 | static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(
629 | trait: UITraitCollection,
630 | containerTypes: NSArray
631 | ): SCLButton; // inherited from UIAppearance
632 |
633 | static appearanceWhenContainedIn(ContainerClass: typeof NSObject): SCLButton; // inherited from UIAppearance
634 |
635 | static appearanceWhenContainedInInstancesOfClasses(
636 | containerTypes: NSArray
637 | ): SCLButton; // inherited from UIAppearance
638 |
639 | static buttonWithType(buttonType: UIButtonType): SCLButton; // inherited from UIButton
640 |
641 | static new(): SCLButton; // inherited from NSObject
642 |
643 | actionBlock: () => void;
644 |
645 | actionType: SCLActionType;
646 |
647 | buttonFormatBlock: () => NSDictionary;
648 |
649 | completeButtonFormatBlock: () => NSDictionary;
650 |
651 | defaultBackgroundColor: UIColor;
652 |
653 | selector: string;
654 |
655 | target: any;
656 |
657 | timer: SCLTimerDisplay;
658 |
659 | validationBlock: () => boolean;
660 |
661 | constructor(o: { windowWidth: number });
662 |
663 | adjustWidthWithWindowWidthNumberOfButtons(
664 | windowWidth: number,
665 | numberOfButtons: number
666 | ): void;
667 |
668 | initWithWindowWidth(windowWidth: number): this;
669 |
670 | parseConfig(buttonConfig: NSDictionary): void;
671 | }
672 |
673 | interface SCLItemsBuilder__Protocol__Fluent extends NSObjectProtocol {
674 | setupFluent(): void;
675 | }
676 | declare var SCLItemsBuilder__Protocol__Fluent: {
677 | prototype: SCLItemsBuilder__Protocol__Fluent;
678 | };
679 |
680 | declare class SCLSwitchView extends UIView {
681 | static alloc(): SCLSwitchView; // inherited from NSObject
682 |
683 | static appearance(): SCLSwitchView; // inherited from UIAppearance
684 |
685 | static appearanceForTraitCollection(trait: UITraitCollection): SCLSwitchView; // inherited from UIAppearance
686 |
687 | static appearanceForTraitCollectionWhenContainedIn(
688 | trait: UITraitCollection,
689 | ContainerClass: typeof NSObject
690 | ): SCLSwitchView; // inherited from UIAppearance
691 |
692 | static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(
693 | trait: UITraitCollection,
694 | containerTypes: NSArray
695 | ): SCLSwitchView; // inherited from UIAppearance
696 |
697 | static appearanceWhenContainedIn(
698 | ContainerClass: typeof NSObject
699 | ): SCLSwitchView; // inherited from UIAppearance
700 |
701 | static appearanceWhenContainedInInstancesOfClasses(
702 | containerTypes: NSArray
703 | ): SCLSwitchView; // inherited from UIAppearance
704 |
705 | static new(): SCLSwitchView; // inherited from NSObject
706 |
707 | labelColor: UIColor;
708 |
709 | labelFont: UIFont;
710 |
711 | labelText: string;
712 |
713 | selected: boolean;
714 | }
715 |
716 | declare class SCLTextView extends UITextField {
717 | static alloc(): SCLTextView; // inherited from NSObject
718 |
719 | static appearance(): SCLTextView; // inherited from UIAppearance
720 |
721 | static appearanceForTraitCollection(trait: UITraitCollection): SCLTextView; // inherited from UIAppearance
722 |
723 | static appearanceForTraitCollectionWhenContainedIn(
724 | trait: UITraitCollection,
725 | ContainerClass: typeof NSObject
726 | ): SCLTextView; // inherited from UIAppearance
727 |
728 | static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(
729 | trait: UITraitCollection,
730 | containerTypes: NSArray
731 | ): SCLTextView; // inherited from UIAppearance
732 |
733 | static appearanceWhenContainedIn(
734 | ContainerClass: typeof NSObject
735 | ): SCLTextView; // inherited from UIAppearance
736 |
737 | static appearanceWhenContainedInInstancesOfClasses(
738 | containerTypes: NSArray
739 | ): SCLTextView; // inherited from UIAppearance
740 |
741 | static new(): SCLTextView; // inherited from NSObject
742 | }
743 |
744 | declare class SCLTimerDisplay extends UIView {
745 | static alloc(): SCLTimerDisplay; // inherited from NSObject
746 |
747 | static appearance(): SCLTimerDisplay; // inherited from UIAppearance
748 |
749 | static appearanceForTraitCollection(
750 | trait: UITraitCollection
751 | ): SCLTimerDisplay; // inherited from UIAppearance
752 |
753 | static appearanceForTraitCollectionWhenContainedIn(
754 | trait: UITraitCollection,
755 | ContainerClass: typeof NSObject
756 | ): SCLTimerDisplay; // inherited from UIAppearance
757 |
758 | static appearanceForTraitCollectionWhenContainedInInstancesOfClasses(
759 | trait: UITraitCollection,
760 | containerTypes: NSArray
761 | ): SCLTimerDisplay; // inherited from UIAppearance
762 |
763 | static appearanceWhenContainedIn(
764 | ContainerClass: typeof NSObject
765 | ): SCLTimerDisplay; // inherited from UIAppearance
766 |
767 | static appearanceWhenContainedInInstancesOfClasses(
768 | containerTypes: NSArray
769 | ): SCLTimerDisplay; // inherited from UIAppearance
770 |
771 | static new(): SCLTimerDisplay; // inherited from NSObject
772 |
773 | buttonIndex: number;
774 |
775 | color: UIColor;
776 |
777 | currentAngle: number;
778 |
779 | reverse: boolean;
780 |
781 | constructor(o: { origin: CGPoint; radius: number });
782 |
783 | constructor(o: { origin: CGPoint; radius: number; lineWidth: number });
784 |
785 | cancelTimer(): void;
786 |
787 | initWithOriginRadius(origin: CGPoint, r: number): this;
788 |
789 | initWithOriginRadiusLineWidth(
790 | origin: CGPoint,
791 | r: number,
792 | width: number
793 | ): this;
794 |
795 | startTimerWithTimeLimitCompleted(tl: number, completed: () => void): void;
796 |
797 | stopTimer(): void;
798 |
799 | updateFrame(size: CGSize): void;
800 | }
801 |
--------------------------------------------------------------------------------