From a2d890905b55b65ae6fdf611e60cc24216939288 Mon Sep 17 00:00:00 2001 From: PanayotCankov Date: Tue, 3 Jun 2014 11:49:10 +0300 Subject: [PATCH 01/16] Added qualified names to namespaces. Added files for the namespace modules. --- text/text.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text/text.d.ts b/text/text.d.ts index a5359343c..7f6c92774 100644 --- a/text/text.d.ts +++ b/text/text.d.ts @@ -2,7 +2,7 @@ * Defines the supported character encodings. */ declare module "text" { - export module encoding { + module encoding { export var ISO_8859_1: any; export var US_ASCII: any; export var UTF_16: any; From 8440509a4826c51a6ceb4b7f0dc20a09187ce087 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Tue, 3 Jun 2014 15:11:49 +0300 Subject: [PATCH 02/16] dialogs module added with alert implementation for iOS --- BCL.csproj | 11 ++++++++ ui/dialogs/Readme.md | 1 + ui/dialogs/dialogs.android.ts | 15 +++++++++++ ui/dialogs/dialogs.d.ts | 47 +++++++++++++++++++++++++++++++++++ ui/dialogs/dialogs.ios.ts | 43 ++++++++++++++++++++++++++++++++ ui/dialogs/index.ts | 2 ++ 6 files changed, 119 insertions(+) create mode 100644 ui/dialogs/Readme.md create mode 100644 ui/dialogs/dialogs.android.ts create mode 100644 ui/dialogs/dialogs.d.ts create mode 100644 ui/dialogs/dialogs.ios.ts create mode 100644 ui/dialogs/index.ts diff --git a/BCL.csproj b/BCL.csproj index 84ea30936..127c76df3 100644 --- a/BCL.csproj +++ b/BCL.csproj @@ -216,6 +216,14 @@ + + dialogs.d.ts + + + + dialogs.d.ts + + @@ -234,6 +242,9 @@ + + + commonjs True diff --git a/ui/dialogs/Readme.md b/ui/dialogs/Readme.md new file mode 100644 index 000000000..274e534b5 --- /dev/null +++ b/ui/dialogs/Readme.md @@ -0,0 +1 @@ +Dialogs module. \ No newline at end of file diff --git a/ui/dialogs/dialogs.android.ts b/ui/dialogs/dialogs.android.ts new file mode 100644 index 000000000..3406effcb --- /dev/null +++ b/ui/dialogs/dialogs.android.ts @@ -0,0 +1,15 @@ +/** + * Android specific dialogs functions implementation. + */ + +export function alert(message: string): void { + +} + +export function confirm(message: string): void { + +} + +export function prompt(text: string, defaultText?: string): void { + +} \ No newline at end of file diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts new file mode 100644 index 000000000..f22674102 --- /dev/null +++ b/ui/dialogs/dialogs.d.ts @@ -0,0 +1,47 @@ +declare module "dialogs" { + import promises = require("promises"); + /** + * The alert() method displays an alert box with a specified message. + * @param message Specifies the text to display in the alert box. + */ + function alert(message: string): promises.Promise; + + /** + * The alert() method displays an alert box with a specified options. + * @param options Specifies the options for the alert box. + */ + function alert(options: AlertOptions): promises.Promise; + + /** + * The confirm() method displays a dialog box with a specified message, along with an OK and a Cancel button. + * @param message Specifies the text to display in the confirm box. + */ + function confirm(message: string): void; + + /** + * The prompt() method displays a dialog box that prompts the visitor for input. + * @param text The text to display in the dialog box. + * @param defaultText The default input value. + */ + function prompt(text: string, defaultText?: string): void; + + /** + * Provides options for the alert. + */ + interface AlertOptions { + /** + * Gets or sets the alert message. + */ + message: string; + + /** + * Gets or sets the alert message. + */ + title?: string; + + /** + * Gets or sets the request headers in JSON format. + */ + buttonName?: any; + } +} \ No newline at end of file diff --git a/ui/dialogs/dialogs.ios.ts b/ui/dialogs/dialogs.ios.ts new file mode 100644 index 000000000..e0c4ca353 --- /dev/null +++ b/ui/dialogs/dialogs.ios.ts @@ -0,0 +1,43 @@ +/** + * iOS specific dialogs functions implementation. + */ +import promises = require("promises"); + +export function alert(arg: any): promises.Promise { + var d = promises.defer(); + try { + var options = typeof arg === "string" ? { message: arg, title: "Alert", buttonName: "OK" } : arg + var alert = new UIKit.UIAlertView(); + alert.title = options.title; + alert.message = options.message; + alert.addButtonWithTitle(options.buttonName); + + var delegateType = Foundation.NSObject.extends({}, {}).implements({ + protocol: "UIAlertViewDelegate", + implementation: { + alertViewClickedButtonAtIndex: function (view, index) { + d.resolve(); + // Remove the local variable for the delegate. + delegate = undefined; + } + } + }); + // Assign first to local variable, otherwise it will be garbage collected since delegate is weak reference. + var delegate = new delegateType(); + alert.delegate = delegate; + + alert.show(); + } catch (ex) { + d.reject(ex); + } + + return d.promise(); +} + +export function confirm(message: string): void { + +} + +export function prompt(text: string, defaultText?: string): void { + +} \ No newline at end of file diff --git a/ui/dialogs/index.ts b/ui/dialogs/index.ts new file mode 100644 index 000000000..fac3ad1cb --- /dev/null +++ b/ui/dialogs/index.ts @@ -0,0 +1,2 @@ +declare var module, require; +module.exports = require("ui/dialogs/dialogs"); \ No newline at end of file From d2355b556ae67cea9594ea838bd2eb050cffb647 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Tue, 3 Jun 2014 15:38:19 +0300 Subject: [PATCH 03/16] confirm implemented for ios --- ui/dialogs/dialogs.d.ts | 41 ++++++++++++++++++++--- ui/dialogs/dialogs.ios.ts | 68 ++++++++++++++++++++++++++++++--------- 2 files changed, 89 insertions(+), 20 deletions(-) diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts index f22674102..d7edd24a6 100644 --- a/ui/dialogs/dialogs.d.ts +++ b/ui/dialogs/dialogs.d.ts @@ -13,10 +13,16 @@ function alert(options: AlertOptions): promises.Promise; /** - * The confirm() method displays a dialog box with a specified message, along with an OK and a Cancel button. + * The confirm() method displays a dialog box with a specified message. * @param message Specifies the text to display in the confirm box. */ - function confirm(message: string): void; + function confirm(message: string): promises.Promise; + + /** + * The confirm() method displays a dialog box with a specified message. + * @param options Specifies the options for the confirm box. + */ + function confirm(options: ConfirmOptions): promises.Promise; /** * The prompt() method displays a dialog box that prompts the visitor for input. @@ -35,13 +41,38 @@ message: string; /** - * Gets or sets the alert message. + * Gets or sets the alert title. */ title?: string; /** - * Gets or sets the request headers in JSON format. + * Gets or sets the button name. */ - buttonName?: any; + buttonName?: string; + } + + /** + * Provides options for the alert. + */ + interface ConfirmOptions { + /** + * Gets or sets the alert message. + */ + message: string; + + /** + * Gets or sets the alert title. + */ + title?: string; + + /** + * Gets or sets the OK button name. + */ + okButtonName?: string; + + /** + * Gets or sets the Cancel button name. + */ + cancelButtonName?: string; } } \ No newline at end of file diff --git a/ui/dialogs/dialogs.ios.ts b/ui/dialogs/dialogs.ios.ts index e0c4ca353..37520e1fc 100644 --- a/ui/dialogs/dialogs.ios.ts +++ b/ui/dialogs/dialogs.ios.ts @@ -3,27 +3,41 @@ */ import promises = require("promises"); +function createUIAlertView(options) { + var alert = new UIKit.UIAlertView(); + alert.title = options.title; + alert.message = options.message; + return alert; +} + +function createDelegate(callback) { + var delegateType = Foundation.NSObject.extends({}, {}).implements({ + protocol: "UIAlertViewDelegate", + implementation: { + alertViewClickedButtonAtIndex: function (view, index) { + callback(view, index); + } + } + }); + return new delegateType; +} + export function alert(arg: any): promises.Promise { var d = promises.defer(); try { var options = typeof arg === "string" ? { message: arg, title: "Alert", buttonName: "OK" } : arg - var alert = new UIKit.UIAlertView(); - alert.title = options.title; - alert.message = options.message; + + var alert = createUIAlertView(options); + alert.addButtonWithTitle(options.buttonName); - var delegateType = Foundation.NSObject.extends({}, {}).implements({ - protocol: "UIAlertViewDelegate", - implementation: { - alertViewClickedButtonAtIndex: function (view, index) { - d.resolve(); - // Remove the local variable for the delegate. - delegate = undefined; - } - } - }); // Assign first to local variable, otherwise it will be garbage collected since delegate is weak reference. - var delegate = new delegateType(); + var delegate = createDelegate(function (view, index) { + d.resolve(); + // Remove the local variable for the delegate. + delegate = undefined; + }); + alert.delegate = delegate; alert.show(); @@ -34,8 +48,32 @@ export function alert(arg: any): promises.Promise { return d.promise(); } -export function confirm(message: string): void { +export function confirm(arg: any): promises.Promise { + var d = promises.defer(); + try { + var options = typeof arg === "string" ? { message: arg, title: "Alert", okButtonName: "OK", cancelButtonName: "Cancel" } : arg + var alert = createUIAlertView(options); + + alert.addButtonWithTitle(options.okButtonName); + alert.addButtonWithTitle(options.cancelButtonName); + + // Assign first to local variable, otherwise it will be garbage collected since delegate is weak reference. + var delegate = createDelegate(function (view, index) { + d.resolve(index === 0); + // Remove the local variable for the delegate. + delegate = undefined; + }); + + alert.delegate = delegate; + + alert.show(); + + } catch (ex) { + d.reject(ex); + } + + return d.promise(); } export function prompt(text: string, defaultText?: string): void { From d01c22ff2a2be9c828095d522238ee3434566b20 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Tue, 3 Jun 2014 15:54:50 +0300 Subject: [PATCH 04/16] prompt implemented for iOS --- ui/dialogs/dialogs.d.ts | 36 +++++++++++++++++++++++------------- ui/dialogs/dialogs.ios.ts | 31 ++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 14 deletions(-) diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts index d7edd24a6..53305e0e3 100644 --- a/ui/dialogs/dialogs.d.ts +++ b/ui/dialogs/dialogs.d.ts @@ -27,14 +27,19 @@ /** * The prompt() method displays a dialog box that prompts the visitor for input. * @param text The text to display in the dialog box. - * @param defaultText The default input value. */ function prompt(text: string, defaultText?: string): void; + /** + * The prompt() method displays a dialog box that prompts the visitor for input. + * @param options The options for the dialog box. + */ + function prompt(options: PromptOptions): void; + /** * Provides options for the alert. */ - interface AlertOptions { + interface DialogOptions { /** * Gets or sets the alert message. */ @@ -44,7 +49,12 @@ * Gets or sets the alert title. */ title?: string; + } + /** + * Provides options for the alert. + */ + interface AlertOptions extends DialogOptions { /** * Gets or sets the button name. */ @@ -54,17 +64,7 @@ /** * Provides options for the alert. */ - interface ConfirmOptions { - /** - * Gets or sets the alert message. - */ - message: string; - - /** - * Gets or sets the alert title. - */ - title?: string; - + interface ConfirmOptions extends DialogOptions { /** * Gets or sets the OK button name. */ @@ -75,4 +75,14 @@ */ cancelButtonName?: string; } + + /** + * Provides options for the alert. + */ + interface PromptOptions extends ConfirmOptions { + /** + * Gets or sets the default text. + */ + defaultText?: string; + } } \ No newline at end of file diff --git a/ui/dialogs/dialogs.ios.ts b/ui/dialogs/dialogs.ios.ts index 37520e1fc..5220d0c44 100644 --- a/ui/dialogs/dialogs.ios.ts +++ b/ui/dialogs/dialogs.ios.ts @@ -76,6 +76,35 @@ export function confirm(arg: any): promises.Promise { return d.promise(); } -export function prompt(text: string, defaultText?: string): void { +export function prompt(arg: any): promises.Promise { + var d = promises.defer(); + try { + var options = typeof arg === "string" ? { message: arg, title: "Alert", okButtonName: "OK", cancelButtonName: "Cancel" } : arg + var alert = createUIAlertView(options); + alert.alertViewStyle = UIKit.UIAlertViewStyle.UIAlertViewStylePlainTextInput; + alert.addButtonWithTitle(options.okButtonName); + alert.addButtonWithTitle(options.cancelButtonName); + + var textField = alert.textFieldAtIndex(0); + textField.text = options.defaultText ? options.defaultText : ""; + + // Assign first to local variable, otherwise it will be garbage collected since delegate is weak reference. + var delegate = createDelegate(function (view, index) { + if (index === 0) { + d.resolve(textField.text); + } + // Remove the local variable for the delegate. + delegate = undefined; + }); + + alert.delegate = delegate; + + alert.show(); + + } catch (ex) { + d.reject(ex); + } + + return d.promise(); } \ No newline at end of file From 0f6ae75f56ac24dcd604af38e20aa5e452c39620 Mon Sep 17 00:00:00 2001 From: PanayotCankov Date: Tue, 3 Jun 2014 16:18:09 +0300 Subject: [PATCH 05/16] Integrated the API Reference generation in the Documentation build. --- BCL.csproj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BCL.csproj b/BCL.csproj index 127c76df3..be33b2152 100644 --- a/BCL.csproj +++ b/BCL.csproj @@ -337,7 +337,13 @@ - + + + + + + + From 676c965bb9b0f3ef3f628c2f7bd28d1f994e44a1 Mon Sep 17 00:00:00 2001 From: PanayotCankov Date: Tue, 3 Jun 2014 16:56:09 +0300 Subject: [PATCH 06/16] Integrated the documentation build in the bcl build. --- BCL.csproj | 3 +- Tests/application-tests-common.ts | 6 ++-- Tests/application-tests.android.ts | 2 +- Tests/file-system-tests.ts | 54 +++++++++++++++--------------- Tests/http-tests.ts | 14 ++++---- Tests/image-source-tests.ts | 10 +++--- Tests/local-settings-tests.ts | 20 +++++------ Tests/location-tests.ts | 16 ++++----- Tests/timer-tests.ts | 12 +++---- 9 files changed, 69 insertions(+), 68 deletions(-) diff --git a/BCL.csproj b/BCL.csproj index be33b2152..d3f461c7f 100644 --- a/BCL.csproj +++ b/BCL.csproj @@ -340,7 +340,8 @@ - + + diff --git a/Tests/application-tests-common.ts b/Tests/application-tests-common.ts index 1220938ee..9855c0253 100644 --- a/Tests/application-tests-common.ts +++ b/Tests/application-tests-common.ts @@ -1,4 +1,4 @@ -// +// // # Application // The Application module provides abstraction over the platform-specific Application implementations. // It is the main BCL module and is required for other BCL modules to work properly. @@ -9,7 +9,7 @@ import app = require("application"); // The pre-required `app` module is used throughout the following code snippets. // -// +// // ### Initialization // ``` JavaScript //// The native app instance depends on the target platform @@ -18,7 +18,7 @@ app.init(nativeAppInstance); // ``` // -// +// // ### Checking the target platform // Use the following code in case you need to check somewhere in your code the platform you are running against: // ``` JavaScript diff --git a/Tests/application-tests.android.ts b/Tests/application-tests.android.ts index b5c1f1e35..5874d0fe0 100644 --- a/Tests/application-tests.android.ts +++ b/Tests/application-tests.android.ts @@ -6,7 +6,7 @@ import commonTests = require("Tests/application-tests-common"); declare var exports; require("utils/module-merge").merge(commonTests, exports); -// +// // ### Using the Android-specific implementation // Accessing the Android-specific object instance (will be undefined if running on iOS) // ``` JavaScript diff --git a/Tests/file-system-tests.ts b/Tests/file-system-tests.ts index f51f33afe..5b9f06f2a 100644 --- a/Tests/file-system-tests.ts +++ b/Tests/file-system-tests.ts @@ -1,5 +1,5 @@  -// +// // # File System // Using the file system requires the FileSystem module. // ``` JavaScript @@ -10,12 +10,12 @@ import fs = require("file-system"); import TKUnit = require("Tests/TKUnit"); -// +// // ## Path // export var testPathNormalize = function () { - // + // // ### Normalize a Path // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -31,7 +31,7 @@ export var testPathNormalize = function () { }; export var testPathJoin = function () { - // + // // ### Path Join // Concatinate a path to a file by providing multiple path arguments. // ``` JavaScript @@ -47,7 +47,7 @@ export var testPathJoin = function () { }; export var testPathSeparator = function () { - // + // // ### Get the Path Separator // ``` JavaScript //// An OS dependant path separator, "\" or "/". @@ -61,7 +61,7 @@ export var testPathSeparator = function () { }; export var testFileFromPath = function () { - // + // // ### Get or Create a File With Path // The following example writes some text to a file created for path. // It will create a new file or overwrite an existing file. @@ -98,7 +98,7 @@ export var testFileFromPath = function () { } export var testFolderFromPath = function () { - // + // // ### Get or Create a Folder With Path // ``` JavaScript var path = fs.path.join(fs.knownFolders.documents().path, "music"); @@ -112,12 +112,12 @@ export var testFolderFromPath = function () { // } -// +// // ## Create // export var testFileWrite = function () { - // + // // ### Writing a string to a File // The following example writes some text to a file. // It will create a new file or overwrite an existing file. @@ -153,7 +153,7 @@ export var testFileWrite = function () { }; export var testGetFile = function () { - // + // // ### Get or Create a File // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -168,7 +168,7 @@ export var testGetFile = function () { } export var testGetFolder = function () { - // + // // ### Get or Create a Folder // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -182,12 +182,12 @@ export var testGetFolder = function () { // }; -// +// // ## Read // export var testFileRead = function () { - // + // // ### Reading from a File // The following example writes some text to a file and then reads it back. // ``` JavaScript @@ -230,7 +230,7 @@ export var testFileRead = function () { }; export var testGetKnownFolders = function () { - // + // // ### Getting the Known Folders // Each app has several well known folders. This is how to access them: // ``` JavaScript @@ -251,7 +251,7 @@ export var testGetKnownFolders = function () { }; export var testGetEntities = function () { - // + // // ### Getting Folder Contents // Getting all files and folders within a folder: // ``` JavaScript @@ -300,7 +300,7 @@ export var testGetEntities = function () { }; export var testEnumEntities = function () { - // + // // ### Enumerating Folder Contents // Getting all folder entities in array may be slow with large number of files. // Enumerating the folder entities would itterate the files one by one without blocking the UI. @@ -338,7 +338,7 @@ export var testEnumEntities = function () { }; export var testGetParent = function () { - // + // // ### Getting Parent Folder // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -357,7 +357,7 @@ export var testGetParent = function () { }; export var testFileNameExtension = function () { - // + // // ### Getting File Name and Extension // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -376,7 +376,7 @@ export var testFileNameExtension = function () { }; export var testFileExists = function () { - // + // // ### Checking if a File Exists // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -393,7 +393,7 @@ export var testFileExists = function () { }; export var testFolderExists = function () { - // + // // ### Checking if a Folder Exists // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -419,12 +419,12 @@ export var testContainsFile = function () { file.remove(); }; -// +// // ## Update // export var testFileRename = function () { - // + // // ### Renaming a File // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -450,7 +450,7 @@ export var testFileRename = function () { }; export var testFolderRename = function () { - // + // // ### Renaming a Folder // ``` JavaScript var folder = fs.knownFolders.documents(); @@ -475,12 +475,12 @@ export var testFolderRename = function () { // }; -// +// // ## Delete // export var testFileRemove = function () { - // + // // ### Removing a File // To 'delete', 'remove' or 'unlink' a file use the file's remove method: // ``` JavaScript @@ -504,7 +504,7 @@ export var testFileRemove = function () { }; export var testFolderRemove = function () { - // + // // ### Removing a Folder // ``` JavaScript var documents = fs.knownFolders.documents(); @@ -528,7 +528,7 @@ export var testFolderRemove = function () { } export var testFolderClear = function () { - // + // // ### Clearing the Contents of a Folder // The clear method removes all files within a folder. // ``` JavaScript diff --git a/Tests/http-tests.ts b/Tests/http-tests.ts index 82ffdf457..48da82a2e 100644 --- a/Tests/http-tests.ts +++ b/Tests/http-tests.ts @@ -2,7 +2,7 @@ import http = require("http"); require("globals"); -// +// // # Http module // ``` JavaScript // var http = require("http"); @@ -18,7 +18,7 @@ export var test_getString = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Get string from URL // ``` JavaScript http.getString("http://httpbin.org/get").then(function (r) { @@ -61,7 +61,7 @@ export var test_getJSON = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Get JSON from URL // ``` JavaScript http.getJSON("http://httpbin.org/get").then(function (r) { @@ -104,7 +104,7 @@ export var test_getImage = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Get Image from URL // ``` JavaScript http.getImage("http://www.google.com/images/errors/logo_sm_2.png").then(function (r) { @@ -161,7 +161,7 @@ export var test_request_responseStatusCodeShouldBeDefined = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Get response status code // ``` JavaScript http.request({ url: "http://httpbin.org/get", method: "GET" }).then(function (response) { @@ -187,7 +187,7 @@ export var test_request_responseHeadersShouldBeDefined = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Get response headers // ``` JavaScript http.request({ url: "http://httpbin.org/get", method: "GET" }).then(function (response) { @@ -215,7 +215,7 @@ export var test_request_responseContentShouldBeDefined = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Get response content // ``` JavaScript http.request({ url: "http://httpbin.org/get", method: "GET" }).then(function (response) { diff --git a/Tests/image-source-tests.ts b/Tests/image-source-tests.ts index afc5d080c..b85941b61 100644 --- a/Tests/image-source-tests.ts +++ b/Tests/image-source-tests.ts @@ -1,4 +1,4 @@ -// +// // # Image source // Using the image source requires the image-source module. // ``` JavaScript @@ -18,7 +18,7 @@ import app = require("application"); import TKUnit = require("Tests/TKUnit"); export var testFromResource = function () { - // + // // ### Load image using resource name // This is similar to loading Bitmap from `R.drawable.logo` on Android or calling `[UIImage imageNamed@"logo"]` on iOS // ``` JavaScript @@ -32,7 +32,7 @@ export var testFromUrl = function () { var completed; var result: imageSource.ImageSource; - // + // // ### Load image from URL // ``` JavaScript imageSource.fromUrl("http://www.google.com/images/errors/logo_sm_2.png") @@ -62,7 +62,7 @@ export var testFromUrl = function () { } export var testSaveToFile = function () { - // + // // ### Save image source to PNG or JPG file // ``` JavaScript var img = imageSource.fromResource("logo"); @@ -76,7 +76,7 @@ export var testSaveToFile = function () { } export var testFromFile = function () { - // + // // ### Load image from a local file // ``` JavaScript var folder = fs.knownFolders.documents(); diff --git a/Tests/local-settings-tests.ts b/Tests/local-settings-tests.ts index ed05dff78..50c93f268 100644 --- a/Tests/local-settings-tests.ts +++ b/Tests/local-settings-tests.ts @@ -1,4 +1,4 @@ -// +// // # Local Settings // ``` JavaScript var LocalSettings = require("local-settings"); @@ -13,7 +13,7 @@ var noStringKey: string = "noStringKey"; var noBoolKey: string = "noBoolKey"; var noNumberKey: string = "noNumberKey"; -// +// // ## Working with string, number and boolean values // @@ -22,7 +22,7 @@ export var testBoolean = function () { var boolValue = LocalSettings.getBoolean(boolKey); TKUnit.assert(false == boolValue, "Cannot set boolean to false, currently it is: " + LocalSettings.getBoolean(boolKey)); - // + // // ### Set and get boolean value and provide default value in case it is not set // ``` JavaScript LocalSettings.setBoolean("boolKey", true); @@ -35,7 +35,7 @@ export var testBoolean = function () { }; export var testString = function () { - // + // // ### Set and get string value // ``` JavaScript LocalSettings.setString("stringKey", "String value"); @@ -46,7 +46,7 @@ export var testString = function () { }; export var testNumber = function () { - // + // // ### Set and get numeric value. // We use `toFixed()` here in order to avoid floating point errors - ex: `54.321` becoming `54.320999999537`. // Beware the result of `toFixed()` is a string not a number therefore you cannot use `===` or `!==` when comparing with a number. @@ -59,7 +59,7 @@ export var testNumber = function () { }; export var testDefaults = function () { - // + // // ### Reading values that are not set before while providing default value // ``` JavaScript var defaultValue = LocalSettings.getString("noStringKey", "No string value"); @@ -70,7 +70,7 @@ export var testDefaults = function () { TKUnit.assert(true === LocalSettings.getBoolean(noBoolKey, true), "Bad default boolean value"); TKUnit.assert(123.45 === LocalSettings.getNumber(noNumberKey, 123.45), "Bad default number value"); - // + // // ### Reading values that are not set before not providing default value // ``` JavaScript var defaultValue = LocalSettings.getString("noStringKey"); @@ -83,12 +83,12 @@ export var testDefaults = function () { TKUnit.assert("undefined" === typeof LocalSettings.getNumber(noNumberKey), "Default number value is not undefined"); }; -// +// // ## Other functions // export var testHasKey = function () { - // + // // ### Checking for existence of value for key // ``` JavaScript var hasKey = LocalSettings.hasKey("noBoolKey"); @@ -105,7 +105,7 @@ export var testHasKey = function () { }; export var testRemove = function () { - // + // // ### Removing value for key // ``` JavaScript LocalSettings.remove("boolKey"); diff --git a/Tests/location-tests.ts b/Tests/location-tests.ts index be0eaf4e1..922e70b61 100644 --- a/Tests/location-tests.ts +++ b/Tests/location-tests.ts @@ -1,4 +1,4 @@ -// +// // # Location // Using the location requires the Location module. // ``` JavaScript @@ -12,12 +12,12 @@ import locationModule = require("location"); var LocationManager = locationModule.LocationManager; var Location = locationModule.Location; -// +// // ## Other functions // export var testIsEnabled = function () { - // + // // ### Test are location services available for this device // ``` JavaScript var isEnabled = LocationManager.isEnabled(); @@ -27,7 +27,7 @@ export var testIsEnabled = function () { }; export var testDistance = function () { - // + // // ### Get distance between two locations // ``` JavaScript //var Location = require("location").Location; @@ -43,14 +43,14 @@ export var testDistance = function () { TKUnit.assert((distance > 10780000) && (distance < 10860000), "invalid distance " + distance); }; -// +// // ## Getting location // export var testLocation = function () { var locationReceived; - // + // // ### Receive continuous location updates // ``` JavaScript var locationManager = new LocationManager(); @@ -83,7 +83,7 @@ export var testLocation = function () { export var testLastKnownLocation = function () { TKUnit.waitUntilReady(function () { return false; }, 1); // give it some time after the last test - // + // // ### Get last known location // ``` JavaScript var locationManager = new LocationManager(); @@ -135,7 +135,7 @@ export var testLocationOnceTimeout10000 = function () { export var testSnippet = function () { var locationReceived; - // + // // ### Get location once // if there is `options.timeout` you will receive error on timeout. If `options.timeout` is 0 then the result is the same as the result from `LocationManager.lastKnownLocation` // and there will be no wait. You can use `options.maximumAge` to specify you don't want to receive locations older than specified time in ms. diff --git a/Tests/timer-tests.ts b/Tests/timer-tests.ts index 03b665e51..9bcf4c58b 100644 --- a/Tests/timer-tests.ts +++ b/Tests/timer-tests.ts @@ -1,7 +1,7 @@ import TKUnit = require("Tests/TKUnit"); var timer = require("timer/timer"); -// +// // # Timer module // ``` JavaScript // require("globals"); @@ -30,7 +30,7 @@ export var test_setTimeout = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Evaluates an expression after 0 milliseconds. // ``` JavaScript timer.setTimeout(function () { @@ -49,7 +49,7 @@ export var test_setTimeout_callbackCalledAfterSpecifedTime = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Evaluates an expression after a specified number of milliseconds. // ``` JavaScript timer.setTimeout(function () { @@ -85,7 +85,7 @@ export var test_setTimeout_callbackShouldBeCleared = function () { var completed: boolean; var isReady = function () { return completed; } - // + // // ### Cancels the evaluation with the clearTimeout method. // ``` JavaScript var id = timer.setTimeout(function () { @@ -109,7 +109,7 @@ export var test_setInterval_callbackCalledDuringPeriod = function () { var expected = 4; var isReady = function () { return counter >= expected; } - // + // // ### Evaluates an expression each time a specified number of milliseconds has elapsed. // ``` JavaScript timer.setInterval(function () { @@ -129,7 +129,7 @@ export var test_setInterval_callbackShouldBeCleared = function () { var expected = 1; var isReady = function () { return counter == expected; } - // + // // ### Cancel the interval previously started using the setInterval method. // ``` JavaScript var id = timer.setInterval(function () { From ae7705aa131788bd9f0b180b19db18ca89aaa128 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Tue, 3 Jun 2014 17:10:00 +0300 Subject: [PATCH 07/16] initial alert dialogs implementation for Android --- ui/dialogs/dialogs.android.ts | 64 +++++++++++++++++++++++++++++++---- ui/dialogs/dialogs.d.ts | 2 +- ui/dialogs/dialogs.ios.ts | 17 +++++++--- 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/ui/dialogs/dialogs.android.ts b/ui/dialogs/dialogs.android.ts index 3406effcb..893844ae7 100644 --- a/ui/dialogs/dialogs.android.ts +++ b/ui/dialogs/dialogs.android.ts @@ -1,15 +1,67 @@ /** * Android specific dialogs functions implementation. */ +import promises = require("promises"); +import dialogs = require("ui/dialogs"); +import appmodule = require("application"); -export function alert(message: string): void { - +function createAlertDialog(options: dialogs.DialogOptions): android.app.AlertDialog.Builder { + var alert = new android.app.AlertDialog.Builder(appmodule.android.currentActivity); + alert.setTitle(options.title); + alert.setMessage(options.message); + return alert; } -export function confirm(message: string): void { - +export function alert(arg: any): promises.Promise { + var d = promises.defer(); + try { + var options = typeof arg === "string" ? { message: arg, title: "Alert", buttonName: "OK" } : arg + + var alert = createAlertDialog(options); + /* + alert.setPositiveButton(options.buttonName, new android.content.DialogInterface.OnClickListener({ + onClick: function (dialog: android.content.DialogInterface, id: number) { + dialog.cancel(); + } + })); +*/ + alert.show(); + + } catch (ex) { + d.reject(ex); + } + + return d.promise(); } -export function prompt(text: string, defaultText?: string): void { - +export function confirm(arg: any): promises.Promise { + var d = promises.defer(); + try { + var options = typeof arg === "string" ? { message: arg, title: "Alert", okButtonName: "OK", cancelButtonName: "Cancel" } : arg + + var alert = createAlertDialog(options); + + alert.show(); + + } catch (ex) { + d.reject(ex); + } + + return d.promise(); +} + +export function prompt(arg: any): promises.Promise { + var d = promises.defer(); + try { + var options = typeof arg === "string" ? { message: arg, title: "Alert", okButtonName: "OK", cancelButtonName: "Cancel" } : arg + + var alert = createAlertDialog(options); + + alert.show(); + + } catch (ex) { + d.reject(ex); + } + + return d.promise(); } \ No newline at end of file diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts index 53305e0e3..8658fcb73 100644 --- a/ui/dialogs/dialogs.d.ts +++ b/ui/dialogs/dialogs.d.ts @@ -1,4 +1,4 @@ -declare module "dialogs" { +declare module "ui/dialogs" { import promises = require("promises"); /** * The alert() method displays an alert box with a specified message. diff --git a/ui/dialogs/dialogs.ios.ts b/ui/dialogs/dialogs.ios.ts index 5220d0c44..b9d669186 100644 --- a/ui/dialogs/dialogs.ios.ts +++ b/ui/dialogs/dialogs.ios.ts @@ -2,8 +2,15 @@ * iOS specific dialogs functions implementation. */ import promises = require("promises"); +import dialogs = require("ui/dialogs"); -function createUIAlertView(options) { +var UIALERTVIEWDELEGATE = "UIAlertViewDelegate", + STRING = "string", + ALERT = "Alert", + OK = "OK", + CANCEL = "Cancel"; + +function createUIAlertView(options: dialogs.DialogOptions): UIKit.UIAlertView { var alert = new UIKit.UIAlertView(); alert.title = options.title; alert.message = options.message; @@ -12,7 +19,7 @@ function createUIAlertView(options) { function createDelegate(callback) { var delegateType = Foundation.NSObject.extends({}, {}).implements({ - protocol: "UIAlertViewDelegate", + protocol: UIALERTVIEWDELEGATE, implementation: { alertViewClickedButtonAtIndex: function (view, index) { callback(view, index); @@ -25,7 +32,7 @@ function createDelegate(callback) { export function alert(arg: any): promises.Promise { var d = promises.defer(); try { - var options = typeof arg === "string" ? { message: arg, title: "Alert", buttonName: "OK" } : arg + var options = typeof arg === STRING ? { message: arg, title: ALERT, buttonName: OK } : arg var alert = createUIAlertView(options); @@ -51,7 +58,7 @@ export function alert(arg: any): promises.Promise { export function confirm(arg: any): promises.Promise { var d = promises.defer(); try { - var options = typeof arg === "string" ? { message: arg, title: "Alert", okButtonName: "OK", cancelButtonName: "Cancel" } : arg + var options = typeof arg === STRING ? { message: arg, title: ALERT, okButtonName: OK, cancelButtonName: CANCEL } : arg var alert = createUIAlertView(options); @@ -79,7 +86,7 @@ export function confirm(arg: any): promises.Promise { export function prompt(arg: any): promises.Promise { var d = promises.defer(); try { - var options = typeof arg === "string" ? { message: arg, title: "Alert", okButtonName: "OK", cancelButtonName: "Cancel" } : arg + var options = typeof arg === STRING ? { message: arg, title: ALERT, okButtonName: OK, cancelButtonName: CANCEL } : arg var alert = createUIAlertView(options); alert.alertViewStyle = UIKit.UIAlertViewStyle.UIAlertViewStylePlainTextInput; From 5095c5a5a7d9f2cad6b44636f25d4d92af4cc7c0 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Tue, 3 Jun 2014 18:43:03 +0300 Subject: [PATCH 08/16] prompt declaration fixed --- ui/dialogs/dialogs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts index 8658fcb73..161ab8b09 100644 --- a/ui/dialogs/dialogs.d.ts +++ b/ui/dialogs/dialogs.d.ts @@ -28,13 +28,13 @@ * The prompt() method displays a dialog box that prompts the visitor for input. * @param text The text to display in the dialog box. */ - function prompt(text: string, defaultText?: string): void; + function prompt(text: string, defaultText?: string): promises.Promise; /** * The prompt() method displays a dialog box that prompts the visitor for input. * @param options The options for the dialog box. */ - function prompt(options: PromptOptions): void; + function prompt(options: PromptOptions): promises.Promise; /** * Provides options for the alert. From c419fbdba4b95e1fce334c25df38f5ff996413e0 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 4 Jun 2014 08:09:36 +0300 Subject: [PATCH 09/16] alert promise changed to promise --- ui/dialogs/dialogs.android.ts | 4 ++-- ui/dialogs/dialogs.d.ts | 4 ++-- ui/dialogs/dialogs.ios.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/dialogs/dialogs.android.ts b/ui/dialogs/dialogs.android.ts index 893844ae7..8e1b52a35 100644 --- a/ui/dialogs/dialogs.android.ts +++ b/ui/dialogs/dialogs.android.ts @@ -12,8 +12,8 @@ function createAlertDialog(options: dialogs.DialogOptions): android.app.AlertDia return alert; } -export function alert(arg: any): promises.Promise { - var d = promises.defer(); +export function alert(arg: any): promises.Promise { + var d = promises.defer(); try { var options = typeof arg === "string" ? { message: arg, title: "Alert", buttonName: "OK" } : arg diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts index 161ab8b09..cfa5bdedc 100644 --- a/ui/dialogs/dialogs.d.ts +++ b/ui/dialogs/dialogs.d.ts @@ -4,13 +4,13 @@ * The alert() method displays an alert box with a specified message. * @param message Specifies the text to display in the alert box. */ - function alert(message: string): promises.Promise; + function alert(message: string): promises.Promise; /** * The alert() method displays an alert box with a specified options. * @param options Specifies the options for the alert box. */ - function alert(options: AlertOptions): promises.Promise; + function alert(options: AlertOptions): promises.Promise; /** * The confirm() method displays a dialog box with a specified message. diff --git a/ui/dialogs/dialogs.ios.ts b/ui/dialogs/dialogs.ios.ts index b9d669186..cd68a3240 100644 --- a/ui/dialogs/dialogs.ios.ts +++ b/ui/dialogs/dialogs.ios.ts @@ -29,8 +29,8 @@ function createDelegate(callback) { return new delegateType; } -export function alert(arg: any): promises.Promise { - var d = promises.defer(); +export function alert(arg: any): promises.Promise { + var d = promises.defer(); try { var options = typeof arg === STRING ? { message: arg, title: ALERT, buttonName: OK } : arg From 0c6ef7883be241716e27df04bba049895fb6a840 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 4 Jun 2014 08:11:14 +0300 Subject: [PATCH 10/16] promt declaration fixed --- ui/dialogs/dialogs.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts index cfa5bdedc..1c6a229ef 100644 --- a/ui/dialogs/dialogs.d.ts +++ b/ui/dialogs/dialogs.d.ts @@ -28,7 +28,7 @@ * The prompt() method displays a dialog box that prompts the visitor for input. * @param text The text to display in the dialog box. */ - function prompt(text: string, defaultText?: string): promises.Promise; + function prompt(text: string): promises.Promise; /** * The prompt() method displays a dialog box that prompts the visitor for input. From e0466d3ad366b6ec322b87df040861059febcec8 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 4 Jun 2014 08:53:33 +0300 Subject: [PATCH 11/16] text argument changed to message --- ui/dialogs/dialogs.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts index 1c6a229ef..1827698d9 100644 --- a/ui/dialogs/dialogs.d.ts +++ b/ui/dialogs/dialogs.d.ts @@ -26,9 +26,9 @@ /** * The prompt() method displays a dialog box that prompts the visitor for input. - * @param text The text to display in the dialog box. + * @param message The text to display in the dialog box. */ - function prompt(text: string): promises.Promise; + function prompt(message: string): promises.Promise; /** * The prompt() method displays a dialog box that prompts the visitor for input. From abdf51415a9b1ac4c93fd6ce7ff8ae24c919f1dc Mon Sep 17 00:00:00 2001 From: PanayotCankov Date: Wed, 4 Jun 2014 10:40:21 +0300 Subject: [PATCH 12/16] Removed extra how-to links. --- BCL.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BCL.csproj b/BCL.csproj index d3f461c7f..0fb71e093 100644 --- a/BCL.csproj +++ b/BCL.csproj @@ -340,8 +340,9 @@ - + + From 14d76a8d2c142b23778a2f7136ae74c9cac61af3 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 4 Jun 2014 16:58:31 +0300 Subject: [PATCH 13/16] dialogs for android implemented --- ui/dialogs/dialogs.android.ts | 44 +++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/ui/dialogs/dialogs.android.ts b/ui/dialogs/dialogs.android.ts index 8e1b52a35..b004531e4 100644 --- a/ui/dialogs/dialogs.android.ts +++ b/ui/dialogs/dialogs.android.ts @@ -5,6 +5,11 @@ import promises = require("promises"); import dialogs = require("ui/dialogs"); import appmodule = require("application"); +var STRING = "string", + ALERT = "Alert", + OK = "OK", + CANCEL = "Cancel"; + function createAlertDialog(options: dialogs.DialogOptions): android.app.AlertDialog.Builder { var alert = new android.app.AlertDialog.Builder(appmodule.android.currentActivity); alert.setTitle(options.title); @@ -12,19 +17,39 @@ function createAlertDialog(options: dialogs.DialogOptions): android.app.AlertDia return alert; } +function addOkCancelButtonsToAlertDialog(alert: android.app.AlertDialog.Builder, options: dialogs.ConfirmOptions, + okCallback: Function, cancelCallback?: Function): void { + alert.setPositiveButton(options.okButtonName, new android.content.DialogInterface.OnClickListener({ + onClick: function (dialog: android.content.DialogInterface, id: number) { + dialog.cancel(); + okCallback(); + } + })); + + alert.setNegativeButton(options.cancelButtonName, new android.content.DialogInterface.OnClickListener({ + onClick: function (dialog: android.content.DialogInterface, id: number) { + dialog.cancel(); + if (cancelCallback) { + cancelCallback(); + } + } + })); +} + export function alert(arg: any): promises.Promise { var d = promises.defer(); try { - var options = typeof arg === "string" ? { message: arg, title: "Alert", buttonName: "OK" } : arg + var options = typeof arg === STRING ? { message: arg, title: ALERT, buttonName: OK } : arg var alert = createAlertDialog(options); - /* + alert.setPositiveButton(options.buttonName, new android.content.DialogInterface.OnClickListener({ onClick: function (dialog: android.content.DialogInterface, id: number) { dialog.cancel(); + d.resolve(); } })); -*/ + alert.show(); } catch (ex) { @@ -37,10 +62,12 @@ export function alert(arg: any): promises.Promise { export function confirm(arg: any): promises.Promise { var d = promises.defer(); try { - var options = typeof arg === "string" ? { message: arg, title: "Alert", okButtonName: "OK", cancelButtonName: "Cancel" } : arg + var options = typeof arg === STRING ? { message: arg, title: ALERT, okButtonName: OK, cancelButtonName: CANCEL } : arg var alert = createAlertDialog(options); + addOkCancelButtonsToAlertDialog(alert, options, function () { d.resolve(true); }, function () { d.resolve(false); }); + alert.show(); } catch (ex) { @@ -53,10 +80,17 @@ export function confirm(arg: any): promises.Promise { export function prompt(arg: any): promises.Promise { var d = promises.defer(); try { - var options = typeof arg === "string" ? { message: arg, title: "Alert", okButtonName: "OK", cancelButtonName: "Cancel" } : arg + var options = typeof arg === STRING ? { message: arg, title: ALERT, okButtonName: OK, cancelButtonName: CANCEL } : arg var alert = createAlertDialog(options); + var input = new android.widget.EditText(appmodule.android.context); + input.setText(options.defaultText ? options.defaultText : ""); + + alert.setView(input); + + addOkCancelButtonsToAlertDialog(alert, options, function () { d.resolve(input.getText().toString()); }); + alert.show(); } catch (ex) { From 3eea8cafe043bdcd505e867d6a3fcff2b69864a2 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 4 Jun 2014 17:09:07 +0300 Subject: [PATCH 14/16] readme updated --- ui/dialogs/Readme.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/dialogs/Readme.md b/ui/dialogs/Readme.md index 274e534b5..5365aaab4 100644 --- a/ui/dialogs/Readme.md +++ b/ui/dialogs/Readme.md @@ -1 +1,11 @@ -Dialogs module. \ No newline at end of file +Dialogs module. Examples: +```js + dialogs.alert("Test").then(function(){ dialogs.alert("Test2"); }); + dialogs.alert({message:"Test", title: "MyAlert", buttonName: "Close" }).then(function(){ dialogs.alert("Test2"); }); + + dialogs.confirm("Test?").then(function(r){ dialogs.alert("Result:" + r); }); + dialogs.confirm({message:"Confirm?", title: "MyConfirm", okButtonName: "Do it!", cancelButtonName: "Ignore it!" }).then(function(r){ dialogs.alert("Result:" + r); }); + + dialogs.prompt("Enter something!").then(function(r){ dialogs.alert("Result:" + r); }); + dialogs.prompt({message:"Enter something?", title: "MyPrompt", okButtonName: "Do it!", cancelButtonName: "Ignore it!", defaultText : "Enter your password here!" }).then(function(r){ dialogs.alert("Result:" + r); }); +``` \ No newline at end of file From 273e2d82a2ad0406125778356673d4d9e6169fa2 Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 4 Jun 2014 17:10:16 +0300 Subject: [PATCH 15/16] readme updated again --- ui/dialogs/Readme.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/dialogs/Readme.md b/ui/dialogs/Readme.md index 5365aaab4..19766516d 100644 --- a/ui/dialogs/Readme.md +++ b/ui/dialogs/Readme.md @@ -1,11 +1,15 @@ Dialogs module. Examples: ```js dialogs.alert("Test").then(function(){ dialogs.alert("Test2"); }); - dialogs.alert({message:"Test", title: "MyAlert", buttonName: "Close" }).then(function(){ dialogs.alert("Test2"); }); + dialogs.alert({message:"Test", title: "MyAlert", buttonName: "Close" }) + .then(function(){ dialogs.alert("Test2"); }); dialogs.confirm("Test?").then(function(r){ dialogs.alert("Result:" + r); }); - dialogs.confirm({message:"Confirm?", title: "MyConfirm", okButtonName: "Do it!", cancelButtonName: "Ignore it!" }).then(function(r){ dialogs.alert("Result:" + r); }); + dialogs.confirm({message:"Confirm?", title: "MyConfirm", okButtonName: "Do it!", cancelButtonName: "Ignore it!" }) + .then(function(r){ dialogs.alert("Result:" + r); }); dialogs.prompt("Enter something!").then(function(r){ dialogs.alert("Result:" + r); }); - dialogs.prompt({message:"Enter something?", title: "MyPrompt", okButtonName: "Do it!", cancelButtonName: "Ignore it!", defaultText : "Enter your password here!" }).then(function(r){ dialogs.alert("Result:" + r); }); + dialogs.prompt({message:"Enter something?", title: "MyPrompt", okButtonName: "Do it!", + cancelButtonName: "Ignore it!", defaultText : "Enter your password here!" }) + .then(function(r){ dialogs.alert("Result:" + r); }); ``` \ No newline at end of file From 5cc5c40d57ba13921cb1e740c284ae2993ea0d5d Mon Sep 17 00:00:00 2001 From: Vladimir Enchev Date: Wed, 4 Jun 2014 17:12:42 +0300 Subject: [PATCH 16/16] comments updated --- ui/dialogs/dialogs.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/dialogs/dialogs.d.ts b/ui/dialogs/dialogs.d.ts index 1827698d9..f65fc56cc 100644 --- a/ui/dialogs/dialogs.d.ts +++ b/ui/dialogs/dialogs.d.ts @@ -37,7 +37,7 @@ function prompt(options: PromptOptions): promises.Promise; /** - * Provides options for the alert. + * Provides options for the dialog. */ interface DialogOptions { /** @@ -62,7 +62,7 @@ } /** - * Provides options for the alert. + * Provides options for the confirm. */ interface ConfirmOptions extends DialogOptions { /** @@ -77,7 +77,7 @@ } /** - * Provides options for the alert. + * Provides options for the prompt. */ interface PromptOptions extends ConfirmOptions { /**