Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public showCustomButtons() {
let buttons = [
new TNSFancyAlertButton({
label: "One",
action: () => {
console.log("One");
}
}),
new TNSFancyAlertButton({
label: "Two",
action: () => {
console.log("Two");
}
}),
new TNSFancyAlertButton({
label: "Three",
action: () => {
console.log("Three");
}
}),
new TNSFancyAlertButton({
label: "Four",
action: () => {
console.log("Four");
}
let underline = nsString.rangeOfStringOptions(
"too!",
NSCaseInsensitiveSearch
);
subTitle.addAttributeValueRange(
NSUnderlineStyleAttributeName,
NSUnderlineStyleSingle,
underline
);
return subTitle;
};
TNSFancyAlert.showCustomTextAttributes(
textAttribution,
new TNSFancyAlertButton({
label: "Wow, ok.",
action: (value: any) => {
console.log(`Clicked ok.`);
}
}),
undefined,
undefined,
"Custom text color?",
`Yep, that can be done too!`,
null
);
}
public showTextField() {
TNSFancyAlert.showTextField(
"Enter your name",
"",
new TNSFancyAlertButton({
label: "Save",
action: (value: any) => {
console.log(`User entered ${value}`);
}
}),
undefined,
undefined,
"User Input?",
`Yeah, sure we can.`,
"Ok, lots of options."
);
}
public showSwitch() {
TNSFancyAlert.showSwitch(
`Don't show again`,
"#58B136",
new TNSFancyAlertButton({
label: "Save",
action: (isSelected: boolean) => {
console.log(`Don't show again was selected: ${isSelected}`);
}
}),
"switch.png",
"#B3714F",
"Need a switch?",
`It can be useful.`,
"Got it."
);
}