Skip to content

Commit

Permalink
Merge branch 'master' into ios-background-tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullahFaqeir authored Dec 1, 2024
2 parents b9246f9 + e3a9364 commit 29c05a3
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Size;
import android.view.OrientationEventListener;
import android.view.ScaleGestureDetector;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
Expand Down Expand Up @@ -112,6 +114,8 @@ public class TiCameraXActivity extends TiBaseActivity implements CameraXConfig.P
private ProcessCameraProvider cameraProvider;
static int targetResolutionWidth = -1;
static int targetResolutionHeight = -1;
private OrientationEventListener orientationEventListener;
private int lastDisplayOrientation = 0;

public static void takePicture()
{
Expand Down Expand Up @@ -417,6 +421,30 @@ private void startCamera()
int rotation = getWindowManager().getDefaultDisplay().getRotation();

Activity activity = TiApplication.getAppCurrentActivity();

orientationEventListener = new OrientationEventListener(activity)
{
@Override
public void onOrientationChanged(int orientation)
{
if (orientationEventListener == null || orientation == ORIENTATION_UNKNOWN) {
return;
}
int rotation = getWindowManager().getDefaultDisplay().getRotation();
if (lastDisplayOrientation != rotation) {
imageCapture.setTargetRotation(rotation);
lastDisplayOrientation = rotation;
}

}
};
if (orientationEventListener.canDetectOrientation()) {
orientationEventListener.enable();
} else {
orientationEventListener.disable();
orientationEventListener = null;
}

ListenableFuture cameraProviderFuture = ProcessCameraProvider.getInstance(activity);
cameraProviderFuture.addListener(() -> {
try {
Expand Down Expand Up @@ -493,8 +521,13 @@ private void startCamera()
}

if (targetResolutionWidth != -1 && targetResolutionHeight != -1) {
imageCaptureBuilder.setTargetResolution(
new Size(targetResolutionWidth, targetResolutionHeight));
if (rotation == Surface.ROTATION_0 || rotation == Surface.ROTATION_180) {
imageCaptureBuilder.setTargetResolution(
new Size(targetResolutionWidth, targetResolutionHeight));
} else {
imageCaptureBuilder.setTargetResolution(
new Size(targetResolutionHeight, targetResolutionWidth));
}
}

imageCapture = imageCaptureBuilder.build();
Expand Down Expand Up @@ -573,6 +606,11 @@ protected void onDestroy()
if (camera != null) {
camera = null;
}
if (orientationEventListener != null) {
orientationEventListener.disable();
orientationEventListener = null;
}

// Destroy this activity.
super.onDestroy();
}
Expand All @@ -581,6 +619,10 @@ protected void onDestroy()
public void finish()
{
overlayProxy = null;
if (orientationEventListener != null) {
orientationEventListener.disable();
orientationEventListener = null;
}
super.finish();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ private void appendRowInternal(Object rows, KrollDict animation, boolean interna
row.getProperties().getString(TiC.PROPERTY_FOOTER)));

// Add row to section.
row.setParent(section);
section.add(row);
}

Expand Down
20 changes: 16 additions & 4 deletions iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5809,6 +5809,8 @@ iOSBuilder.prototype.createAppIconSetAndiTunesArtwork = async function createApp
'-76': { height: 76, width: 76, scale: 1, idioms: [ 'ipad' ], required: true },
'-76@2x': { height: 76, width: 76, scale: 2, idioms: [ 'ipad' ], required: true },
'-83.5@2x': { height: 83.5, width: 83.5, scale: 2, idioms: [ 'ipad' ], minXcodeVer: '7.2' },
'-Dark': { height: 1024, width: 1024, scale: 1, idioms: [ 'universal' ], required: true, minXcodeVer: '16.0' },
'-Tinted': { height: 1024, width: 1024, scale: 1, idioms: [ 'universal' ], required: true, minXcodeVer: '16.0' },
'-Marketing': { height: 1024, width: 1024, scale: 1, idioms: [ 'ios-marketing' ], required: true, minXcodeVer: '9.0' }
};
// Add macOS icons if target is macOS
Expand Down Expand Up @@ -5897,12 +5899,22 @@ iOSBuilder.prototype.createAppIconSetAndiTunesArtwork = async function createApp
let flatten = false;
if (pngInfo.alpha) {
if (defaultIcon && !defaultIconHasAlpha) {
this.logger.warn(__('Skipping %s because it has an alpha channel and generating one from %s', info.src.replace(this.projectDir + '/', ''), defaultIcon.replace(this.projectDir + '/', '')));
return;
if (filename === 'DefaultIcon-Dark.png' || filename === 'DefaultIcon-Tinted.png') {
// Do nothing
} else {
this.logger.warn(__('Skipping %s because it has an alpha channel and generating one from %s', info.src.replace(this.projectDir + '/', ''), defaultIcon.replace(this.projectDir + '/', '')));
return;
}
}

if (filename === 'DefaultIcon-Dark.png' || filename === 'DefaultIcon-Tinted.png') {
this.logger.warn(__('%s contains an alpha channel and will NOT BE flattened against a white background', info.src.replace(this.projectDir + '/', '')));
flatten = false;
} else {
this.logger.warn(__('%s contains an alpha channel and will be flattened against a white background', info.src.replace(this.projectDir + '/', '')));
flatten = true;
}

this.logger.warn(__('%s contains an alpha channel and will be flattened against a white background', info.src.replace(this.projectDir + '/', '')));
flatten = true;
flattenIcons.push(info);
}

Expand Down
24 changes: 24 additions & 0 deletions iphone/iphone/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,30 @@
"idiom" : "ios-marketing",
"filename" : "appicon-1024.png",
"scale" : "1x"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "DefaultIcon-Dark.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "tinted"
}
],
"filename" : "DefaultIcon-Tinted.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
Expand Down
18 changes: 9 additions & 9 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
@@ -1,7 +1,7 @@
{
"name": "titanium-mobile",
"description": "Titanium SDK",
"version": "12.6.0",
"version": "12.7.0",
"moduleApiVersion": {
"iphone": "2",
"android": "4"
Expand Down Expand Up @@ -106,7 +106,7 @@
"markdown": "0.5.0",
"moment": "2.30.1",
"node-appc": "1.1.7",
"node-titanium-sdk": "6.0.0",
"node-titanium-sdk": "6.0.1",
"node-uuid": "1.4.8",
"nodeify": "1.0.1",
"p-limit": "3.1.0",
Expand Down
4 changes: 2 additions & 2 deletions support/module/packaged/modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"commonjs": {},
"hyperloop": {
"hyperloop": {
"url": "https://github.com/tidev/hyperloop.next/releases/download/v7.0.8/hyperloop-7.0.8.zip",
"integrity": "sha512-JM75vnzaJQR2ygN+M7hUKFVa64CKCgG9xCGHijfOpRq+BaSyVaDaagbMBDGgm2m9xlrHJetOKwcfwzfE0wXfkg=="
"url": "https://github.com/tidev/hyperloop.next/releases/download/v7.0.9/hyperloop-7.0.9.zip",
"integrity": "sha512-IhFR4zLLEGAuLz1rgkQprjL5nDuIUHLh0lcAXL+NJPJ3Roy9JsrCuH7JtrKrXelpyp1H6yXQlC+4Wqh1kQLhRg=="
}
}
}

0 comments on commit 29c05a3

Please sign in to comment.