-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-26294] TiAPI: Notify app about user-interactions #10248
Changes from 12 commits
1918832
e4daafd
b33b541
45c13b8
558c3d8
e75a0ce
b876597
34b4fb5
17dd252
e5e1bd8
60d9ca8
5644e96
8d5a56a
6dd6609
01e2cf2
1e0ea8f
bda342b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,6 +331,22 @@ events: | |
platforms: [iphone, ipad] | ||
since: '3.1.0' | ||
|
||
- name: userinteraction | ||
summary: Called whenever an interaction with the window occurred. To be used together with the <Titanium.App.trackUserInteraction> property. | ||
description: | | ||
Implement this method if you wish to know that the user has interacted with the device in some | ||
way while your app is running. | ||
|
||
Note that this callback will be invoked for the touch down action that begins a touch gesture, | ||
but may not be invoked for the touch-moved and touch-up actions that follow. | ||
|
||
See also: | ||
- Android: See the [onUserInteraction](https://developer.android.com/reference/android/app/Activity.html#onUserInteraction()) callback | ||
- iOS: See the [sendEvent](https://developer.apple.com/documentation/uikit/uiapplication/1623043-sendevent) delegate | ||
|
||
platforms: [android, iphone, ipad] | ||
since: "7.4.0" | ||
|
||
methods: | ||
- name: fireSystemEvent | ||
summary: Fire a system-level event such as <Titanium.App.EVENT_ACCESSIBILITY_ANNOUNCEMENT>. | ||
|
@@ -520,6 +536,16 @@ properties: | |
permission: read-only | ||
platforms: [iphone, ipad] | ||
|
||
- name: trackUserInteraction | ||
summary: Indicates whether or not the user interaction shoud be tracked. | ||
description: | | ||
Use the <Titanium.App.userinteraction> event to get notified about user interaction. | ||
For Android, user-interactions are controlled by the event and do not require this | ||
property to be set explicitely. For iOS, this is done to prevent additional overhead. | ||
type: Boolean | ||
accessors: false | ||
platforms: [iphone, ipad] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably need to add a since value here for 7.5.0 as well |
||
|
||
--- | ||
name: launchOptions | ||
summary: | | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2018-present by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface TiUIApplication : UIApplication | ||
|
||
#ifdef USE_TI_APPTRACKUSERINTERACTION | ||
- (void)sendEvent:(UIEvent *)event; | ||
#endif | ||
|
||
@end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Appcelerator Titanium Mobile | ||
* Copyright (c) 2018-present by Appcelerator, Inc. All Rights Reserved. | ||
* Licensed under the terms of the Apache Public License | ||
* Please see the LICENSE included with this distribution for details. | ||
*/ | ||
|
||
#import "TiUIApplication.h" | ||
#import "TiBase.h" | ||
|
||
@implementation TiUIApplication | ||
|
||
#ifdef USE_TI_APPTRACKUSERINTERACTION | ||
- (void)sendEvent:(UIEvent *)event | ||
{ | ||
[super sendEvent:event]; | ||
|
||
for (UITouch *touch in event.allTouches) { | ||
if (touch.phase == UITouchPhaseBegan) { | ||
[[NSNotificationCenter defaultCenter] postNotificationName:kTiUserInteraction object:nil]; | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also lint here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dont! |
||
#endif | ||
|
||
@end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be updated to 7.5.0 before merge now...