Skip to content

Commit

Permalink
Merge branch 'master' into require-hack
Browse files Browse the repository at this point in the history
  • Loading branch information
garymathews committed Jul 16, 2020
2 parents 2fe9b0f + 50c4a5c commit 9272cf2
Show file tree
Hide file tree
Showing 12 changed files with 354 additions and 236 deletions.
15 changes: 11 additions & 4 deletions apidoc/Titanium/Blob.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@ description: |
In both cases, the conversion involves copying the data from one object to another, so
you should be conscious of the amount of the data being copied.
extends: Titanium.Proxy
since: "0.9"
platforms: [android, iphone, ipad]
createable: false
properties:

- name: file
type: Titanium.Filesystem.File
summary: |
Expand Down Expand Up @@ -66,15 +64,24 @@ properties:
type: Number
summary: If this blob represents an image, this is the height of the image in pixels.
description: |
If this blob doesn't represent an image, `height` is 0.
If this blob doesn't represent an image, `height` is reported as 0.
**NOTE**: On SDK versions prior to 9.1.0, Ti.Blob images may have reported in points, not pixels.
This would occur for images with a higher density/scale returned by <Titanium.UI.View.toImage> or images with `@dx` density suffixes.
You may multiply by <Ti.Platform.displayCaps.logicalDensityFactor> to try and determine the pixels, but this value may be off for some pixel/density combinations.
(i.e. a `10px` image would report as `3` on a `3x` density screen, so multiplying would give you `9` pixels, which is still incorrect)
permission: read-only

- name: width
type: Number
summary: If this blob represents an image, this is the width of the image in pixels.
description: |
If this blob doesn't represent an image, `height` is 0.
If this blob doesn't represent an image, `width` is reported as 0.
**NOTE**: On SDK versions prior to 9.1.0, Ti.Blob images may have reported in points, not pixels.
This would occur for images with a higher density/scale returned by <Titanium.UI.View.toImage> or images with `@dx` density suffixes.
You may multiply by <Ti.Platform.displayCaps.logicalDensityFactor> to try and determine the pixels, but this value may be off for some pixel/density combinations.
(i.e. a `10px` image would report as `3` on a `3x` density screen, so multiplying would give you `9` pixels, which is still incorrect)
permission: read-only

- name: nativePath
Expand Down
6 changes: 3 additions & 3 deletions apidoc/Titanium/Platform/DisplayCaps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ description: |
extends: Titanium.Proxy
since: "0.8"
createable: false

properties:
- name: density
summary: Logical density of the display.
Expand Down Expand Up @@ -52,7 +51,6 @@ properties:
platforms: [android, iphone, ipad]
since: {iphone: "3.4.1", ipad: "3.4.1"}


- name: platformHeight
summary: |
Absolute height of the display in relation to UI orientation. Measured in platform-specific
Expand Down Expand Up @@ -101,6 +99,7 @@ properties:
logDisplayCaps();
```
- name: platformWidth
summary: |
Absolute width of the display in relation to UI orientation. Measured in platform-specific
Expand Down Expand Up @@ -148,7 +147,8 @@ properties:
win.open();
logDisplayCaps();
```
```
- name: xdpi
summary: Physical pixels per inch of the display in the X dimension.
type: Number
Expand Down
5 changes: 3 additions & 2 deletions dangerfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ async function checkCommitMessages() {
// Check that we have a JIRA Link in the body
async function checkJIRA() {
const body = github.pr.body;
// TODO: Cross-reference JIRA tickets linked in PR body versus in commit messages!
const hasJIRALink = body.match(/https:\/\/jira\.appcelerator\.org\/browse\/[A-Z]+-\d+/);
if (!hasJIRALink) {
labelsToAdd.add(Label.NEEDS_JIRA);
Expand Down Expand Up @@ -162,8 +163,8 @@ async function checkMergeable() {

// Check PR author to see if it's community, etc
async function checkCommunity() {
// Don't give special thanks to the greenkeeper bot account
if (github.pr.user.login === 'greenkeeper[bot]' || github.pr.user.login === 'dependabot-preview[bot]') {
// Don't give special thanks to bot accounts
if (github.pr.user.login === 'dependabot-preview[bot]') {
return;
}
if (github.pr.author_association === 'FIRST_TIMER') {
Expand Down
10 changes: 9 additions & 1 deletion iphone/Classes/LocaleModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,16 @@ - (NSNumber *)parseDecimal:(NSString *)text withLocaleId:(id)localeId
}

// Remove localized thousands separators from string if they exist. NSScanner fails to parse them.
// Note: If locale uses whitespace separators (like French), then remove all whitespace character types.
NSString *thousandsSeparator = [locale objectForKey:NSLocaleGroupingSeparator];
text = [text stringByReplacingOccurrencesOfString:thousandsSeparator withString:@""];
NSCharacterSet *whitespaceCharSet = [NSCharacterSet whitespaceCharacterSet];
if ([thousandsSeparator rangeOfCharacterFromSet:whitespaceCharSet].location != NSNotFound) {
if ([text rangeOfCharacterFromSet:whitespaceCharSet].location != NSNotFound) {
text = [[text componentsSeparatedByCharactersInSet:whitespaceCharSet] componentsJoinedByString:@""];
}
} else {
text = [text stringByReplacingOccurrencesOfString:thousandsSeparator withString:@""];
}

// Attempt to parse a number from given text. Return not-a-number if failed.
NSScanner *scanner = [NSScanner localizedScannerWithString:text];
Expand Down
11 changes: 11 additions & 0 deletions iphone/Classes/StreamModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ - (void)invokeRWOperation:(SEL)operation withArgs:(id)args
lengthValue = [[buffer data] length];
}

if (lengthValue == 0) {
// NO-OP
NSMutableDictionary *event = [TiUtils dictionaryWithCode:0 message:nil];
if (stream != nil) {
[event setObject:stream forKey:@"source"];
}
[event setObject:NUMINT(0) forKey:@"bytesProcessed"];
[self _fireEventToListener:@"io" withObject:event listener:callback thisObject:nil];
return;
}

if (offsetValue >= [[buffer data] length]) {
NSString *errorStr = [NSString stringWithFormat:@"Offset %ld is past buffer bounds (length %lu)", (long)offsetValue, (unsigned long)[[buffer data] length]];
NSMutableDictionary *event = [TiUtils dictionaryWithCode:-1 message:errorStr];
Expand Down
16 changes: 9 additions & 7 deletions iphone/Classes/TiDatabaseProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -333,23 +333,25 @@ - (void)executeAsync:(NSString *)sql
- (NSArray<TiDatabaseResultSetProxy *> *)executeAll:(NSArray<NSString *> *)queries
{
NSError *error = nil;
JSContext *context = [JSContext currentContext];
JSContext *context = JSContext.currentContext;
NSMutableArray *results = [NSMutableArray arrayWithCapacity:[queries count]];
NSUInteger index = 0;
for (NSString *sql in queries) {
TiDatabaseResultSetProxy *result = [self executeSQL:sql withParams:nil withError:&error];
if (result == nil) {
[results addObject:[JSValue valueWithNullInContext:context]];
} else {
[results addObject:result];
}

if (error != nil) {
JSValue *jsError = [self createError:@"failed to execute SQL statements" subreason:[error description] location:CODELOCATION inContext:context];
jsError[@"results"] = result;
jsError[@"results"] = results;
jsError[@"index"] = [NSNumber numberWithUnsignedInteger:index];
[context setException:jsError];
return nil;
}
if (result == nil) {
[results addObject:[JSValue valueWithNullInContext:context]];
} else {
[results addObject:result];
}

index++;
}
return results;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@ - (NSInteger)writeFromBuffer:(TiBuffer *)buffer offset:(NSInteger)offset length:
THROW_IF_HANDLE_NIL(CODELOCATION);

if (length == 0) {
if (callback != nil) {
NSMutableDictionary *event = [TiUtils dictionaryWithCode:0 message:nil];
[event setObject:self forKey:@"source"];
[event setObject:NUMUINTEGER(0) forKey:@"bytesProcessed"];
[self _fireEventToListener:@"write" withObject:event listener:callback thisObject:nil];
}
return 0; // NO-OP
}

Expand Down
46 changes: 9 additions & 37 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@
"@commitlint/config-conventional": "^9.1.1",
"@seadub/clang-format-lint": "0.0.2",
"@seadub/danger-plugin-dependencies": "0.1.0",
"@seadub/danger-plugin-eslint": "^1.0.1",
"@seadub/danger-plugin-junit": "0.1.2",
"@seadub/danger-plugin-eslint": "^2.0.0",
"@seadub/danger-plugin-junit": "0.2.0",
"babel-plugin-transform-titanium": "^0.1.1",
"chai": "^4.2.0",
"clang-format": "1.4.0",
Expand Down
118 changes: 0 additions & 118 deletions tests/Resources/ti.locale.addontest.js

This file was deleted.

0 comments on commit 9272cf2

Please sign in to comment.