{ "id": "165152", "key": "TIMOB-24266", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20115", "name": "Release 7.3.0", "archived": false, "released": true, "releaseDate": "2018-08-17" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-03-23T17:44:48.000+0000", "created": "2016-12-31T15:51:05.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2018-07-17T15:20:22.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13715", "name": "Hyperloop", "description": "Hyperloop project" }, { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "We are currently lacking support for a \"non-hacky\" solution to ping native modules / hyerloop modules about global app delegates. Example use-cases:\r\n- Push notification delegates\r\n- Background service delegates\r\n- URL opening delegates\r\n- Lifecycle delegates\r\n\r\nWe could either achieve this by sending notifications using the {{NSNotificationCenter}} or by writing a delegate that is called by our core and implemented by other modules that want to use it. Both solutions require a core-SDK change, rather than CLI/Hyperloop changes. I would prefer the latter solution, since it's more transparent clear to the developer and easier to extend.\r\n\r\nBefore implementing anything of this, we should scope the impact on the current SDK and the required delegates to be exposed. ", "attachment": [], "flagged": false, "summary": "iOS: Be able to receive native delegates from app to native modules / Hyperloop", "creator": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "environment": null, "closedSprints": [ { "id": 1008, "state": "closed", "name": "2018 Sprint 06 SDK", "startDate": "2018-03-11T22:18:04.396Z", "endDate": "2018-03-25T22:18:00.000Z", "completeDate": "2018-03-25T21:52:36.683Z", "originBoardId": 216 } ], "comment": { "comments": [ { "id": "429130", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR (titanium_mobile/master): https://github.com/appcelerator/titanium_mobile/pull/9761\r\nPR (titanium_mobile/7_1_X): https://github.com/appcelerator/titanium_mobile/pull/9849\r\nPR (hyperloop.next/master): https://github.com/appcelerator/hyperloop.next/pull/267\r\n\r\nTest-Case:\r\n# Create a native iOS-module (make sure to select the SDK compiled before)\r\n# Go to the module implementation and connect to the delegate (e.g. inside create the following method):\r\n{code:objc}\r\n- (void)_configure\r\n{\r\n [super _configure];\r\n [[TiApp app] registerApplicationDelegate:self];\r\n}\r\n\r\n- (void)_destroy\r\n{\r\n [super _destroy];\r\n [[TiApp app] unregisterApplicationDelegate:self];\r\n}\r\n{code}\r\n# Add a native delegate method, e.g.\r\n{code:objc}\r\n- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\r\n{\r\n NSLog(@\"[INFO] Hey there!\");\r\n}\r\n{code}\r\n# Build the module, it should work properly", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-10-16T10:43:43.000+0000", "updated": "2018-02-16T16:45:48.000+0000" }, { "id": "433033", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "New guide: https://wiki.appcelerator.org/display/guides2/iOS+modules%3A+Use+native+UIApplication+delegates+in+Hyperloop+and+native+modules", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-11T14:31:30.000+0000", "updated": "2018-01-11T14:31:30.000+0000" }, { "id": "433137", "author": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "body": "Will only native modules have access to these delegate events?\r\n\r\nA guide to bring this into JS (Ti controller) would be helpful.", "updateAuthor": { "name": "Nirmalkumar_Patel", "key": "nirmalkumar_patel", "displayName": "Nirmal", "active": true, "timeZone": "America/Chicago" }, "created": "2018-01-14T19:26:28.000+0000", "updated": "2018-01-14T19:26:28.000+0000" }, { "id": "433330", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hyperloop example (will require Titanium 7.1.0 and Hyperloop 3.1.0):\r\n{code:js}\r\nvar TiApp = require('Titanium/TiApp');\r\nvar UIApplicationDelegate = require('UIKit').UIApplicationDelegate;\r\n\r\nvar TiAppApplicationDelegate = Hyperloop.defineClass('TiAppApplicationDelegate', 'NSObject', UIApplicationDelegate);\r\n\r\nTiAppApplicationDelegate.addMethod({\r\n selector: 'application:didFinishLaunchingWithOptions:',\r\n instance: true,\r\n returnType: 'BOOL',\r\n arguments: [\r\n 'UIApplication',\r\n 'NSDictionary'\r\n ],\r\n callback: function(application, options) {\r\n if (this.didFinishLaunchingWithOptions) {\r\n return this.didFinishLaunchingWithOptions(application, options);\r\n }\r\n return true;\r\n }\r\n});\r\n\r\nvar applicationDelegate = new TiAppApplicationDelegate();\r\n\r\n// Called when the application finished launching. Initialize SDK's here for example\r\napplicationDelegate.didFinishLaunchingWithOptions = function(application, options) {\r\n return true\r\n};\r\n\r\nTiApp.app().registerApplicationDelegate(applicationDelegate);\r\n{code}\r\n\r\n[~Nirmalkumar_Patel] We have a [guide|https://wiki.appcelerator.org/display/guides2/iOS+modules%3A+Use+native+UIApplication+delegates+in+Hyperloop+and+native+modules] ready for the release :-). You can test it today if you manually build the SDK from the above pull-request and update the \"titanium.js\" (located in {{modules/iphone/hyperloop/3.0.1/hooks/node_modules/hyperloop-metabase/templates/builtins/titanium.js}} and add this property:\r\n{code}\r\napplicationDelegate: {\r\n\tname: 'applicationDelegate',\r\n\ttype: {\r\n\t\ttype: 'id',\r\n\t\tencoding: '@',\r\n\t\tvalue: 'id'\r\n\t}\r\n}\r\n{code}", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-19T14:46:28.000+0000", "updated": "2018-01-22T16:11:02.000+0000" }, { "id": "433455", "author": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~hknoechel], as i understand it, this only allows to set one delegate. What if multiple modules want to make use of this feature? Wouldn't the modules override each others delegates and only the last module has its delegate method called? The same would then apply to Hyperloop, of course.", "updateAuthor": { "name": "jvennemann", "key": "jvennemann", "displayName": "Jan Vennemann", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-22T10:07:11.000+0000", "updated": "2018-01-22T10:07:11.000+0000" }, { "id": "433463", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~jvennemann] You are right, I will adjust the PR to make it more flexible for multiple hook-ins.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-01-22T12:45:19.000+0000", "updated": "2018-01-22T12:45:19.000+0000" }, { "id": "435810", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "For the watchers of this ticket: You can use this changes today by using the [Hyperloop 3.1.0 Beta 1|https://github.com/appcelerator-modules/hyperloop-builds/releases] and latest Titanium master ({{appc ti sdk install -b master}}). ", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-03-21T19:07:53.000+0000", "updated": "2018-03-21T19:07:53.000+0000" }, { "id": "437724", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "For all developers who can't wait for the next stable release: I have compiled a custom \"7.1.2\" that is basically a 7.1.1.GA + the commits from this ticket. Download [here|https://www.dropbox.com/s/enfatxsle7o1d3a/mobilesdk-7.1.2-osx.zip?dl=1]!", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2018-05-17T09:25:11.000+0000", "updated": "2018-05-17T09:25:11.000+0000" }, { "id": "439267", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified changes are in SDKs 7.3.0.v20180711185043 & 7.4.0.v20180715180240", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2018-07-17T15:20:22.000+0000", "updated": "2018-07-17T15:20:22.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }