Skip to content

Commit

Permalink
Merge branch 'master' of github.com:appcelerator/titanium_mobile into…
Browse files Browse the repository at this point in the history
… pr-11294
  • Loading branch information
Gary Mathews committed Dec 5, 2019
2 parents ca7af1a + aedd2aa commit 6a094f6
Show file tree
Hide file tree
Showing 137 changed files with 201 additions and 39 deletions.
Binary file modified .github/logo-titanium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/dev/TitaniumTest/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-hdpi-v4/notification_bg_low_pressed.9.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-hdpi-v4/notification_bg_normal_pressed.9.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-hdpi-v4/notify_panel_notification_icon_bg.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notification_bg_low_normal.9.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notification_bg_low_pressed.9.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notification_bg_normal.9.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notification_bg_normal_pressed.9.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/compat/res/drawable-xhdpi-v4/notify_panel_notification_icon_bg.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_36.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_check_buttonless_on_96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_36.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/btn_more_96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/disclosure_144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/disclosure_192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/disclosure_36.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/modules/ui/res/drawable/disclosure_48.png
Binary file modified android/modules/ui/res/drawable/disclosure_72.png
Binary file modified android/modules/ui/res/drawable/disclosure_96.png
25 changes: 25 additions & 0 deletions apidoc/Titanium/UI/ButtonBar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,31 @@ properties:
</Alloy>
type: [Array<String>, Array<BarItemType>]

- name: textColor
summary: Color of title of button, as a color name or hex triplet.
description: |
For information about color values, see the "Colors" section of <Titanium.UI>.
type: String
platforms: [iphone, ipad]
since: "9.0.0"

- name: selectedTextColor
summary: Color of title of button when it is selected, as a color name or hex triplet.
description: |
For information about color values, see the "Colors" section of <Titanium.UI>.
type: String
platforms: [iphone, ipad]
since: "9.0.0"

- name: selectedButtonColor
summary: Color of selected button, as a color name or hex triplet.
description: |
For information about color values, see the "Colors" section of <Titanium.UI>.
type: String
platforms: [iphone, ipad]
since: "9.0.0"
osver: {ios: {min: "13.0"}}

examples:
- title: Simple 3 button button bar
example: |
Expand Down
6 changes: 6 additions & 0 deletions apidoc/Titanium/UI/WebView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ events:
constants: Titanium.UI.iOS.WEBVIEW_NAVIGATIONTYPE_*
platforms: [ipad, iphone]

- name: isMainFrame
summary: Indicate if the event was generated from the main page or an iframe.
type: Boolean
platforms: [ipad, iphone]
since: "9.0.0"

- name: error
summary: Fired when the web view cannot load the content.
description: |
Expand Down
Binary file modified apidoc/images/activityindicator/activityindicator_android.png
Binary file modified apidoc/images/activityindicator/activityindicator_ios.png
Binary file modified apidoc/images/activityindicator/activityindicator_mobileweb.png
Binary file modified apidoc/images/activityindicator/activityindicator_wp.png
Binary file modified apidoc/images/alertdialog/alertdialog_android.png
Binary file modified apidoc/images/alertdialog/alertdialog_ios.png
Binary file modified apidoc/images/alertdialog/alertdialog_mobileweb.png
Binary file modified apidoc/images/alertdialog/alertdialog_wp.png
Binary file modified apidoc/images/button/button_android.png
Binary file modified apidoc/images/button/button_ios.png
Binary file modified apidoc/images/button/button_mobileweb.png
Binary file modified apidoc/images/button/button_wp.png
Binary file modified apidoc/images/emaildialog/emaildialog_android.png
Binary file modified apidoc/images/emaildialog/emaildialog_ios.png
Binary file modified apidoc/images/emaildialog/emaildialog_wp.png
Binary file modified apidoc/images/listview/listview_android.png
Binary file modified apidoc/images/listview/listview_ios.png
Binary file modified apidoc/images/listview/listview_wp.png
Binary file modified apidoc/images/optiondialog/optiondialog_android.png
Binary file modified apidoc/images/optiondialog/optiondialog_bb.png
Binary file modified apidoc/images/optiondialog/optiondialog_ipad.png
Binary file modified apidoc/images/optiondialog/optiondialog_iphone.png
Binary file modified apidoc/images/optiondialog/optiondialog_mobileweb.png
Binary file modified apidoc/images/picker/picker_android.png
Binary file modified apidoc/images/picker/picker_ios.png
Binary file modified apidoc/images/picker/picker_mobileweb.png
Binary file modified apidoc/images/progressbar/progressbar_android.png
Binary file modified apidoc/images/progressbar/progressbar_ios.png
Binary file modified apidoc/images/progressbar/progressbar_mobileweb.png
Binary file modified apidoc/images/progressbar/progressbar_wp.png
Binary file modified apidoc/images/searchbar/searchbar_android.png
Binary file modified apidoc/images/searchbar/searchbar_ios.png
Binary file modified apidoc/images/searchbar/searchbar_windows.png
Binary file modified apidoc/images/slider/slider_android.png
Binary file modified apidoc/images/slider/slider_ios.png
Binary file modified apidoc/images/slider/slider_mobileweb.png
Binary file modified apidoc/images/slider/slider_wp.png
Binary file modified apidoc/images/stepper/stepper.png
Binary file modified apidoc/images/stepper/stepper_custom.png
Binary file modified apidoc/images/switch/switch_android.png
Binary file modified apidoc/images/switch/switch_ios.png
Binary file modified apidoc/images/switch/switch_mobileweb.png
Binary file modified apidoc/images/switch/switch_wp.png
Binary file modified apidoc/images/systembutton/system_icons.png
Binary file modified apidoc/images/tableview/tableview_android.png
Binary file modified apidoc/images/tableview/tableview_ios.png
Binary file modified apidoc/images/tableview/tableview_mobileweb.png
Binary file modified apidoc/images/tableview/tableview_wp.png
Binary file modified apidoc/images/textarea/textarea_android.png
Binary file modified apidoc/images/textarea/textarea_ios.png
Binary file modified apidoc/images/textarea/textarea_mobileweb.png
Binary file modified apidoc/images/textarea/textarea_wp.png
Binary file modified apidoc/images/textfield/textfield_android.png
Binary file modified apidoc/images/textfield/textfield_ios.png
Binary file modified apidoc/images/textfield/textfield_mobileweb.png
Binary file modified apidoc/images/textfield/textfield_wp.png
Binary file modified apidoc/images/window/window-modal.png
79 changes: 78 additions & 1 deletion iphone/Classes/TiUIButtonBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,42 @@ - (id)accessibilityElement
return [self segmentedControl];
}

- (UIColor *)reverseColorOf:(UIColor *)oldColor
{
CGColorRef oldCGColor = oldColor.CGColor;

int numberOfComponents = CGColorGetNumberOfComponents(oldCGColor);
// can not invert - the only component is the alpha
if (numberOfComponents == 1) {
return [UIColor colorWithCGColor:oldCGColor];
}

const CGFloat *oldComponentColors = CGColorGetComponents(oldCGColor);
CGFloat newComponentColors[numberOfComponents];

int i = numberOfComponents - 1;
newComponentColors[i] = oldComponentColors[i]; // alpha
while (--i >= 0) {
newComponentColors[i] = 1 - oldComponentColors[i];
}

CGColorRef newCGColor = CGColorCreate(CGColorGetColorSpace(oldCGColor), newComponentColors);
UIColor *newColor = [UIColor colorWithCGColor:newCGColor];
CGColorRelease(newCGColor);

//For the GRAY colors 'Middle level colors'
CGFloat white = 0;
[oldColor getWhite:&white alpha:nil];

if (white > 0.3 && white < 0.67) {
if (white >= 0.5)
newColor = [UIColor darkGrayColor];
else if (white < 0.5)
newColor = [UIColor blackColor];
}
return newColor;
}

// For regression #1880. Because there are essentially TWO kinds of 'width' going on with tabbed/button bars
// (width of all elements, width of the proxy) we assume that if the user has set the width of the bar completely,
// AND the width of the proxy is undefined, they want magic!
Expand All @@ -84,12 +120,53 @@ - (void)setTabbedBar:(BOOL)newIsTabbed;
[[self segmentedControl] setMomentary:!newIsTabbed];
}

- (void)setTintColor_:(id)value
{
UIColor *color = [[TiUtils colorValue:value] color];

if ([TiUtils isIOSVersionLower:@"13.0"]) {
[[self segmentedControl] setTintColor:color];
return;
}

UIColor *newColor = [self reverseColorOf:color];
[[self segmentedControl] setTitleTextAttributes:@{ NSForegroundColorAttributeName : color } forState:UIControlStateNormal];
[[self segmentedControl] setTitleTextAttributes:@{ NSForegroundColorAttributeName : newColor } forState:UIControlStateSelected];

[[self segmentedControl] setSelectedSegmentTintColor:color];
}

- (void)setBackgroundColor_:(id)value
{
TiColor *color = [TiUtils colorValue:value];
[[self segmentedControl] setTintColor:[color _color]];
[[self segmentedControl] setBackgroundColor:[color _color]];
}

- (void)setTextColor_:(id)value
{
UIColor *color = [[TiUtils colorValue:value] color];

[[self segmentedControl] setTitleTextAttributes:@{ NSForegroundColorAttributeName : color } forState:UIControlStateNormal];
}

- (void)setSelectedTextColor_:(id)value
{
UIColor *color = [[TiUtils colorValue:value] color];

[[self segmentedControl] setTitleTextAttributes:@{ NSForegroundColorAttributeName : color } forState:UIControlStateSelected];
}

#if IS_SDK_IOS_13
- (void)setSelectedButtonColor_:(id)value
{
if (![TiUtils isIOSVersionOrGreater:@"13.0"]) {
return;
}
UIColor *color = [[TiUtils colorValue:value] color];
[[self segmentedControl] setSelectedSegmentTintColor:color];
}
#endif

- (void)setIndex_:(id)value
{
selectedIndex = [TiUtils intValue:value def:-1];
Expand Down
25 changes: 16 additions & 9 deletions iphone/Classes/TiUIWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,18 @@ - (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSSt
[[TiApp app] showModalController:alertController animated:YES];
}

- (void)fireBeforeLoad:(nonnull WKNavigationAction *)navigationAction
{
if ([[self proxy] _hasListeners:@"beforeload"]) {
[[self proxy] fireEvent:@"beforeload"
withObject:@{
@"url" : navigationAction.request.URL.absoluteString,
@"navigationType" : @(navigationAction.navigationType),
@"isMainFrame" : NUMBOOL(navigationAction.targetFrame.isMainFrame),
}];
}
}

- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(nonnull WKNavigationAction *)navigationAction decisionHandler:(nonnull void (^)(WKNavigationActionPolicy))decisionHandler
{
if (_isViewDetached) {
Expand Down Expand Up @@ -1008,20 +1020,13 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(nonnull WK
}
}

if ([[self proxy] _hasListeners:@"beforeload"]) {
[[self proxy] fireEvent:@"beforeload"
withObject:@{
@"url" : navigationAction.request.URL.absoluteString,
@"navigationType" : @(navigationAction.navigationType)
}];
}

// Use "onlink" callback property to decide the navigation policy
KrollWrapper *onLink = [[self proxy] valueForKey:@"onlink"];
if (onLink != nil) {
if (onLink != nil && navigationAction.navigationType == WKNavigationTypeLinkActivated) {
JSValueRef functionResult = [onLink executeWithArguments:@[ @{ @"url" : navigationAction.request.URL.absoluteString } ]];
if (functionResult != NULL && JSValueIsBoolean([onLink.bridge.krollContext context], functionResult)) {
if (JSValueToBoolean([onLink.bridge.krollContext context], functionResult)) {
[self fireBeforeLoad:navigationAction];
decisionHandler(WKNavigationActionPolicyAllow);
} else {
decisionHandler(WKNavigationActionPolicyCancel);
Expand All @@ -1030,6 +1035,8 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(nonnull WK
}
}

[self fireBeforeLoad:navigationAction];

NSString *scheme = [navigationAction.request.URL.scheme lowercaseString];

if ([allowedURLSchemes containsObject:navigationAction.request.URL.scheme]) {
Expand Down
1 change: 1 addition & 0 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/ObjcProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ JSExportAs(fireEvent,
@deprecated Only here for backwards compatibility with SDK < 8.1.0. Use `init` instead.
*/
- (id)_initWithPageContext:(id<TiEvaluator>)context __attribute__((deprecated));
- (id)_initWithPageContext:(id<TiEvaluator>)context args:(NSArray *)args __attribute__((deprecated));

// hooks for when an event listener gets added/removed
- (void)_listenerAdded:(NSString *)type count:(int)count;
Expand Down
64 changes: 55 additions & 9 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/ObjcProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,17 @@ @implementation ObjcProxy
+ (JSValue *)createError:(NSString *)reason subreason:(NSString *)subreason location:(NSString *)location inContext:(JSContext *)context
{
NSString *exceptionName = @"org.appcelerator";
NSDictionary *details = @{
kTiExceptionSubreason : subreason,
kTiExceptionLocation : location
};
NSDictionary *details;
if (subreason != nil) {
details = @{
kTiExceptionSubreason : subreason,
kTiExceptionLocation : location
};
} else {
details = @{
kTiExceptionLocation : location
};
}
NSException *exc = [NSException exceptionWithName:exceptionName reason:reason userInfo:details];
JSGlobalContextRef jsContext = [context JSGlobalContextRef];
JSValueRef jsValueRef = TiBindingTiValueFromNSObject(jsContext, exc);
Expand All @@ -29,10 +36,17 @@ + (JSValue *)createError:(NSString *)reason subreason:(NSString *)subreason loca
- (JSValue *)createError:(NSString *)reason subreason:(NSString *)subreason location:(NSString *)location inContext:(JSContext *)context
{
NSString *exceptionName = [@"org.appcelerator." stringByAppendingString:NSStringFromClass([self class])];
NSDictionary *details = @{
kTiExceptionSubreason : subreason,
kTiExceptionLocation : location
};
NSDictionary *details;
if (subreason != nil) {
details = @{
kTiExceptionSubreason : subreason,
kTiExceptionLocation : location
};
} else {
details = @{
kTiExceptionLocation : location
};
}
NSException *exc = [NSException exceptionWithName:exceptionName reason:reason userInfo:details];
JSGlobalContextRef jsContext = [context JSGlobalContextRef];
JSValueRef jsValueRef = TiBindingTiValueFromNSObject(jsContext, exc);
Expand Down Expand Up @@ -98,6 +112,38 @@ - (id)_initWithPageContext:(id<TiEvaluator>)context
return [self init];
}

- (id)_initWithPageContext:(id<TiEvaluator>)context_ args:(NSArray *)args
{
if (self = [self _initWithPageContext:context_]) {
NSDictionary *a = nil;
NSUInteger count = [args count];
if (count > 0 && [[args objectAtIndex:0] isKindOfClass:[NSDictionary class]]) {
a = [args objectAtIndex:0];
}

// If we're being created by an old proxy/module but we're a new-style obj-c proxy
// we need to handle assigning the properties object passed into the constructor
if (a != nil) {
// Get the JS object corresponding to "this" proxy
// Note that [JSContext currentContext] is nil, so we need to hack and get the global context
// TODO: Can we hack in a nice method that gets current context if available, falls back to global context?
// Because a lot of the code in the proxy base class assumes current context is not nil
KrollContext *krollContext = [context_ krollContext];
JSGlobalContextRef ref = krollContext.context;
JSValueRef jsValueRef = TiBindingTiValueFromNSObject(ref, self);
JSContext *context = [JSContext contextWithJSGlobalContextRef:ref];
JSValue *this = [JSValue valueWithJSValueRef:jsValueRef inContext:context];

// Go through the key/value pairs and set them on "this"
for (NSString *key in a) {
id value = a[key];
this[key] = value;
}
}
}
return self;
}

- (NSURL *)_baseURL
{
return baseURL;
Expand Down Expand Up @@ -206,7 +252,7 @@ - (void)fireEvent:(NSString *)name withDict:(NSDictionary *)dict
// FIXME: looks like we need to handle bubble logic/etc. See other fireEvent impl
for (JSManagedValue *storedCallback in listenersForType) {
JSValue *function = [storedCallback value];
[function callWithArguments:@[ dict ]];
[self _fireEventToListener:name withObject:dict listener:function];
}
}
@finally {
Expand Down
2 changes: 1 addition & 1 deletion iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ TI_INLINE void waitForMemoryPanicCleared() //WARNING: This must never be run on
/**
Returns singleton instance of TiApp application object.
*/
+ (TiApp *)app;
+ (TiApp *)app NS_SWIFT_NAME(sharedApp());

/**
* Returns a read-only dictionary from tiapp.xml properties
Expand Down
2 changes: 1 addition & 1 deletion iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6017,7 +6017,7 @@ iOSBuilder.prototype.copyResources = function copyResources(next) {
resourcesDir: this.xcodeAppDir,
logger: this.logger,
targets: {
ios: this.minSupportedIosSdk
ios: this.minIosVersion
}
}
});
Expand Down
Binary file modified iphone/iphone/Assets.xcassets/AppIcon.appiconset/appicon-76.png
Binary file modified .../templates/app/default/template/Resources/iphone/[email protected]
100755 → 100644
Binary file modified ...e/templates/app/default/template/Resources/iphone/[email protected]
100755 → 100644
34 changes: 17 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"ssri": "^7.1.0",
"titanium-docgen": "^0.2.0"
"titanium-docgen": "^4.0.0"
},
"repository": {
"type": "git",
Expand Down
Binary file modified templates/app/angular-default/template/DefaultIcon.png

0 comments on commit 6a094f6

Please sign in to comment.