{"id":13749650,"url":"https://github.com/caffeinalab/ti.passcode","last_synced_at":"2025-12-25T07:52:41.818Z","repository":{"id":18697420,"uuid":"21907517","full_name":"caffeinalab/ti.passcode","owner":"caffeinalab","description":"Alloy+Titanium widget for an identical iPhone lock screen with passcode.","archived":false,"fork":false,"pushed_at":"2016-07-21T12:53:47.000Z","size":22,"stargazers_count":23,"open_issues_count":1,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-16T00:32:57.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caffeinalab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-16T15:58:34.000Z","updated_at":"2022-06-10T23:15:59.000Z","dependencies_parsed_at":"2022-08-05T01:00:59.249Z","dependency_job_id":null,"html_url":"https://github.com/caffeinalab/ti.passcode","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caffeinalab%2Fti.passcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caffeinalab%2Fti.passcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caffeinalab%2Fti.passcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caffeinalab%2Fti.passcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caffeinalab","download_url":"https://codeload.github.com/caffeinalab/ti.passcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253252016,"owners_count":21878618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T07:01:08.761Z","updated_at":"2025-12-25T07:52:41.747Z","avatar_url":"https://github.com/caffeinalab.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Ti.Passcode\n\n### com.caffeinalab.titanium.passcode\n\nAlloy Titanium widget for an **identical** iPhone lock screen with passcode.\n\n![image](http://cl.ly/image/3r2y2y1b3n3G/lock.gif)\n\n## Installation\n\n#### Via Gittio (Stable)\n\n```\ngittio install com.caffeinalab.titanium.passcode\n```\n\n#### Via Github\n\nDownload the latest release, and add in your config.json, under dependencies:\n\n```json\n\"dependencies\": {\n    \"com.caffeinalab.titanium.passcode\": \"*\"\n}\n```\n\n#### Usage in Alloy Views\n\n```xml\n\u003cWidget id=\"PassCodeWidget\" src=\"com.caffeinalab.titanium.passcode\" code=\"42424\" /\u003e\n```\n\n```javascript\n\n// Set the success callback\n$.PassCodeWidget.setOnSuccess(function() {\n\talert(\"Yeah!\")\n});\n\n$.PassCodeWidget.setOnError(function(times) {\n\tif (times \u003e 4) {\n\t\talert(\"Shame on you!\");\n\t}\n});\n```\n\n#### Usage in Controllers\n\n```javascript\n\nvar $window = Ti.UI.createWindow({\n\tbackgroundColor: '#0000'\n});\n\nvar $pc = Alloy.createWidget('com.caffeinalab.titanium.passcode', { code: \"1234\" });\n\n$pc.setOnSuccess(function() {\n\t$window.close();\n\t// Do the next private things\n});\n\n$pc.setOnError(function(times) {\n\tif (times \u003e 4) {\n\t\talert(\"Shame on you!\");\n\t}\n});\n\n$window.add($pc.getView());\n$window.open();\n```\n\n##### Prompt mode\n\nYou can use the widget to prompt the user for a new code. Just call:\n\n```javascript\n$.PassCodeWidget.setPromptMode(5);\n$.PassCodeWidget.setOnPromptSuccess(function(newCode) {\n\tconsole.log(\"The new code is\" + newCode);\n});\n```\n\nThis ask to the user for a new code of `5` chars.\n\n### API\n\n#### `setCode(code: String)`\n\nSet a new code\n\n#### `setPromptMode(length: Number)`\n\nSet the **prompt mode**, that doesn't check for a code but prompt the user to enter a code.\n\nThe `length` argument represents the code length.\n\n#### `setOnSuccess(cb: Function)`\n\nDefine the callback to invoke when the user inserts the correct code.\n\n#### `setOnError(cb: Function)`\n\nDefine the callback to invoke when the user inserts the wrong code.\n\nThe first argument of the `onError` callback represents the times that the user has typed the wrong code.\n\n#### `setOnSuccessPrompt(cb: Function)`\n\nDefine the callback to invoke when at the end of the *prompt mode*.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaffeinalab%2Fti.passcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaffeinalab%2Fti.passcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaffeinalab%2Fti.passcode/lists"}