{"id":13749651,"url":"https://github.com/caffeinalab/ti.notifications","last_synced_at":"2025-12-25T07:53:07.907Z","repository":{"id":153210664,"uuid":"20520760","full_name":"caffeinalab/ti.notifications","owner":"caffeinalab","description":"Useful Titanium+Alloy widget to handle notifications messages when app is in foreground.","archived":false,"fork":false,"pushed_at":"2016-11-23T21:33:43.000Z","size":76,"stargazers_count":82,"open_issues_count":3,"forks_count":20,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-11-16T00:32:58.652Z","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":"mit","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":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-06-05T10:18:35.000Z","updated_at":"2024-03-04T02:56:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"9cd09ea7-9edd-4d34-bf4e-25beb5330653","html_url":"https://github.com/caffeinalab/ti.notifications","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caffeinalab%2Fti.notifications","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caffeinalab%2Fti.notifications/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caffeinalab%2Fti.notifications/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caffeinalab%2Fti.notifications/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caffeinalab","download_url":"https://codeload.github.com/caffeinalab/ti.notifications/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253252022,"owners_count":21878620,"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.832Z","updated_at":"2025-12-25T07:53:07.867Z","avatar_url":"https://github.com/caffeinalab.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Ti.Notifications\n\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/CaffeinaLab/Ti.Notifications?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\n### com.caffeinalab.titanium.notifications\n\nAlloy Titanium widget to display an in-app notification.\n\nThe widget is a tiny view that comes from the top with a simple animation.\n\n![image](http://cl.ly/image/2j462U291g3e/b.gif)\n\n### Cross Platform?\n\nOn iOS7+, the animation is managed by `Ti.UI.iOS.Animator` physics engine (Tweetbot style).\n\n## Installation\n\n#### Via Gittio\n\n```\ngittio install com.caffeinalab.titanium.notifications\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.notifications\": \"*\"\n}\n```\n\n#### Require\n\n```js\nvar Notifier = Alloy.createWidget('com.caffeinalab.titanium.notifications', /* options */);\n```\n\n#### The Options\n\n```js\n{\n\n\tmessage: 'Notification Test', // the message to display.\n\n\tduration: 2000, // time after go away. Valid for iOS7+ and Android\n\ticon: '/appicon.png', // icon to display on the left\n\n\tstyle: 'info', // 'info', 'success', 'error', 'warn',  notification background blue, green, red or amber.\n\n\telasticity: 0.5, // iOS7+ only\n\tpushForce: 30, // iOS7+ only\n\tusePhysicsEngine: true, // disable if you don't want on iOS7+\n\n\tanimationDuration: 200, // animation sliding duration\n\n}\n```\n\n#### Usage\n\n```js\n\n// Show the widget setting the title\nNotifier.show('Hello, world!');\n\n// Show the widget, and override defaults\nNotifier.show({\n\tmessage: 'Notification Test',\n\ticon: '/appicon.png',\n\tpushForce: 10,\n\tstyle: 'info', // sets the message background to blue (50% opacity)\n\tduration: 2500,\n\tonClick: function(){ alert(\"OH, you clicked me!\\nDo you think I'm weird?\"); }\n});\n\n// Update the notification text. Useful for loading %\nNotifier.setMessage('I updated the notifcation message!');\n\n// Update the notification style. Useful for error and success messages\nNotifier.setStyle('error');\n\n// Update the icon to a new one\nNotifier.setIcon('/newicon.png');\n\n// Hide\nNotifier.hide();\n\n```\n\n#### Loading Notification Example (With styling)\n\n```js\nvar Notifier = Alloy.createWidget('com.caffeinalab.titanium.notifications', { duration: null });\nNotifier.show('Loading');\n\n// 50MB test file from thinkbroadband to simulate a slow load.\nvar url = \"http://ipv4.download.thinkbroadband.com:8080/50MB.zip\";\nvar client = Ti.Network.createHTTPClient({\n\t// function called when the response data is available\n\tonload : function(e) {\n\t\tNotifier.setStyle('success');\n\t\tNotifier.setMessage('Successful Download!');\n      \tsetTimeout(Notifier.hide, 3000);\n\t\t},\n     \t// function called at regular intervals as the request data is being received.\n     \tondatastream : function(e) {\n        \tNotifier.setMessage('Loading ' + Math.round(e.progress.toFixed(2)*100) + '%');\n     \t},\n     \t// function called when an error occurs, including a timeout\n     \tonerror : function(e) {\n        \tTi.API.debug(e.error);\n        \tNotifier.setStyle('error');\n        \tNotifier.setMessage('Error, Please try again.');\n        \tsetTimeout(Notifier.hide, 3000);\n     \t},\n     \ttimeout: 5000\n});\nclient.open(\"GET\", url);\nclient.send();\n```\n\n\n#### Fully stylable via TSS\n\nOverride this options in your `app.tss`.\n\n```json\n\".caffeinaToastView\":{\n\t\"top\": 0,\n\t\"backgroundColor\": \"#A000\",\n\t\"height\": 65,\n\t\"touchEnabled\": false\n},\n\".caffeinaToastIcon\":{\n\t\"left\": 8,\n\t\"height\": 42\n},\n\".caffeinaToastLabel\":{\n\t\"touchEnabled\": false,\n\t\"left\": 60,\n\t\"right\": 10,\n\t\"height\": 60,\n\t\"color\": \"#fff\",\n\t\"textAlign\": \"left\",\n\t\"font\": {\n\t\t\"fontSize\": 14\n\t}\n}\n```\n\n#### Work with Android or iOS modal Windows\n\nOn Android is not possible to make it work with Windows.\n\nOn iOS, with modal Windows, in not possible to open a non-modal window in front of another modal window.\n\nSo, to make it work with theese two cases, use the `view` property on open:\n\n```js\nNotifier.show({\n\tview: /* Your Window/View */\n});\n```\n\n## Contributing\n\nHow to get involved:\n\n1. [Star](https://github.com/CaffeinaLab/Ti.Notifications/stargazers) the project!\n2. Answer questions that come through [GitHub issues](https://github.com/CaffeinaLab/Ti.Notifications/issues?state=open)\n3. [Report a bug](https://github.com/CaffeinaLab/Ti.Notifications/issues/new) that you find\n\nPull requests are **highly appreciated**.\n\nSolve a problem. Features are great, but even better is cleaning-up and fixing issues in the code that you discover.\n\n## Copyright and license\n\nCopyright 2015 [Caffeina](http://caffeinalab.com) srl under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaffeinalab%2Fti.notifications","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaffeinalab%2Fti.notifications","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaffeinalab%2Fti.notifications/lists"}