Skip to content

Commit

Permalink
Merge branch 'master' into 230729_android_window_close
Browse files Browse the repository at this point in the history
  • Loading branch information
m1ga committed Jun 1, 2024
2 parents a9f3d40 + 2f1212f commit 8fa6ece
Show file tree
Hide file tree
Showing 20 changed files with 459 additions and 9,047 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@ public void update(boolean force)
|| properties.containsKeyAndNotNull(TiC.PROPERTY_FOOTER_VIEW);

String query = properties.optString(TiC.PROPERTY_SEARCH_TEXT, filterQuery);
filterQuery = query;
final boolean caseInsensitive = properties.optBoolean(TiC.PROPERTY_CASE_INSENSITIVE_SEARCH, true);
if (query != null && caseInsensitive) {
query = query.toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.google.android.material.bottomnavigation.BottomNavigationItemView;
import com.google.android.material.bottomnavigation.BottomNavigationMenuView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.bottomnavigation.LabelVisibilityMode;
import com.google.android.material.navigation.NavigationBarView;
import com.google.android.material.shape.CornerFamily;
import com.google.android.material.shape.MaterialShapeDrawable;
import com.google.android.material.shape.ShapeAppearanceModel;
Expand Down Expand Up @@ -238,14 +238,14 @@ public void addTabItemInController(TiViewProxy tabProxy)
final int shiftMode = proxy.getProperties().optInt(TiC.PROPERTY_SHIFT_MODE, 1);
switch (shiftMode) {
case 0:
this.mBottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_LABELED);
this.mBottomNavigationView.setLabelVisibilityMode(NavigationBarView.LABEL_VISIBILITY_LABELED);
break;
case 1:
this.mBottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_AUTO);
this.mBottomNavigationView.setLabelVisibilityMode(NavigationBarView.LABEL_VISIBILITY_AUTO);
break;
case 2:
// NOTE: Undocumented for now, will create new property that has parity with iOS.
this.mBottomNavigationView.setLabelVisibilityMode(LabelVisibilityMode.LABEL_VISIBILITY_UNLABELED);
this.mBottomNavigationView.setLabelVisibilityMode(NavigationBarView.LABEL_VISIBILITY_UNLABELED);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"minSDKVersion": "21",
"compileSDKVersion": "33",
"vendorDependencies": {
"android sdk": ">=23.x <=33.x",
"android sdk": ">=23.x <=34.x",
"android build tools": ">=30.0.2 <=33.x",
"android platform tools": "33.x",
"android tools": "<=26.x",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
*/
package org.appcelerator.kroll.common;

import android.util.Config;

/**
* A replacement class for org.appcelerator.titanium.config.TitaniumConfig so that I can change
* settings via tiapp.xml
Expand All @@ -24,9 +22,9 @@ public class TiConfig
* &lt;property name="ti.android.debug" type="bool"&gt;true&lt;/property&gt;
* </pre>
*/
public static boolean LOGD = Config.DEBUG;
public static boolean LOGV = Config.DEBUG;
public static boolean DEBUG = Config.DEBUG;
public static boolean RELEASE = !Config.DEBUG;
public static boolean PROFILE = Config.PROFILE;
public static boolean LOGD = false;
public static boolean LOGV = false;
public static boolean DEBUG = false;
public static boolean RELEASE = true;
public static boolean PROFILE = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public class TiC
public static final String PROPERTY_ACCESSIBILITY_HINT = "accessibilityHint";
public static final String PROPERTY_ACCESSIBILITY_LABEL = "accessibilityLabel";
public static final String PROPERTY_ACCESSIBILITY_VALUE = "accessibilityValue";
public static final String PROPERTY_ACCESSIBILITY_DISABLE_LONG = "accessibilityDisableLongPress";
public static final String PROPERTY_ACCESSORY_TYPE = "accessoryType";
public static final String PROPERTY_ACTION = "action";
public static final String PROPERTY_ACTION_VIEW = "actionView";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
TiC.PROPERTY_TOUCH_FEEDBACK_COLOR,
TiC.PROPERTY_TRANSITION_NAME,
TiC.PROPERTY_HIDDEN_BEHAVIOR,
TiC.PROPERTY_ANCHOR_POINT
TiC.PROPERTY_ANCHOR_POINT,
TiC.PROPERTY_ACCESSIBILITY_DISABLE_LONG
})
public abstract class TiViewProxy extends KrollProxy
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
import android.graphics.drawable.ShapeDrawable;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.core.view.AccessibilityDelegateCompat;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;

import android.text.TextUtils;
import android.util.Pair;
import android.util.SparseArray;
Expand Down Expand Up @@ -1915,6 +1918,12 @@ protected void registerForTouch(final View touchable)
boolean soundEnabled = TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_SOUND_EFFECTS_ENABLED), true);
touchable.setSoundEffectsEnabled(soundEnabled);
}

if (proxy.hasPropertyAndNotNull(TiC.PROPERTY_ACCESSIBILITY_DISABLE_LONG)) {
if (TiConvert.toBoolean(proxy.getProperty(TiC.PROPERTY_ACCESSIBILITY_DISABLE_LONG))) {
removeAccessibilityLongClick();
}
}
registerTouchEvents(touchable);

// Previously, we used the single tap handling above to fire our click event. It doesn't
Expand Down Expand Up @@ -2363,4 +2372,19 @@ public String composeContentDescription()
}
return composeContentDescription(proxy.getProperties());
}

public void removeAccessibilityLongClick()
{
ViewCompat.setAccessibilityDelegate(nativeView, new AccessibilityDelegateCompat()
{
@Override
public void onInitializeAccessibilityNodeInfo(@NonNull View host,
@NonNull AccessibilityNodeInfoCompat info)
{
super.onInitializeAccessibilityNodeInfo(host, info);
info.removeAction(AccessibilityNodeInfoCompat.AccessibilityActionCompat.ACTION_LONG_CLICK);
info.setLongClickable(false);
}
});
}
}
10 changes: 10 additions & 0 deletions apidoc/Titanium/UI/View.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,16 @@ properties:
platforms: [android, iphone, ipad, macos]
type: String

- name: accessibilityDisableLongPress
summary: Boolean value to remove the long press notification for the device's accessibility service.
description: |
Will disable the "double tap and hold for long press" message when selecting an item.
since: "12.4.0"
platforms: [android]
default: true
availability: creation
type: Boolean

- name: anchorPoint
summary: Coordinate of the view about which to pivot an animation.
description: |
Expand Down
2 changes: 1 addition & 1 deletion build/scons-check-lockfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function checkDependencies(deps) {
const packageNames = Object.keys(deps);
for (const packageName of packageNames) {
const whatever = deps[packageName];
const version = whatever.version;
const version = whatever.version.replace('@', '-').replace('npm:', '');
const resolved = whatever.resolved;
if (resolved && !resolved.endsWith(`${version}.tgz`)) {
console.error(`There may be a mismatched url (${resolved}) for the given version (${version}) of dependency ${packageName}`);
Expand Down
2 changes: 1 addition & 1 deletion cli/commands/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ CreateCommand.prototype.run = function run(logger, config, cli, finished) {
}

if (cli.argv.alloy !== undefined) {
execSync('alloy new ' + cli.argv['workspace-dir'] + '/' + cli.argv.name);
execSync(`alloy new "${path.join(cli.argv['workspace-dir'], cli.argv.name)}"`, { stdio: 'inherit' });
}

finished(err);
Expand Down
23 changes: 4 additions & 19 deletions iphone/Classes/AppModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,9 @@ - (void)_resumeRestart:(id)unused
#ifndef TI_USE_AUTOLAYOUT
[TiLayoutQueue resetQueue];
#endif

// Get the currently active scene
UIScene *activeScene = nil;
for (UIScene *scene in UIApplication.sharedApplication.connectedScenes) {
if (scene.activationState == UISceneActivationStateForegroundActive) {
activeScene = scene;
break;
}
}

if (activeScene == nil) {
NSLog(@"[ERROR] No active scene connected - this may lead to an undefined behavior");
}

/* Begin backgrounding simulation */
[appDelegate sceneWillResignActive:activeScene];
[appDelegate sceneDidEnterBackground:activeScene];
[appDelegate applicationWillResignActive:app];
[appDelegate applicationDidEnterBackground:app];
[appDelegate endBackgrounding];
/* End backgrounding simulation */

Expand All @@ -90,9 +76,8 @@ - (void)_resumeRestart:(id)unused

/* Begin foregrounding simulation */
[appDelegate application:app didFinishLaunchingWithOptions:[appDelegate launchOptions]];
[appDelegate scene:activeScene willConnectToSession:activeScene.session options:TiApp.app.connectionOptions];
[appDelegate sceneWillEnterForeground:activeScene];
[appDelegate sceneDidBecomeActive:activeScene];
[appDelegate applicationWillEnterForeground:app];
[appDelegate applicationDidBecomeActive:app];
/* End foregrounding simulation */
}

Expand Down
68 changes: 36 additions & 32 deletions iphone/Classes/TiMediaAudioRecorderProxy.mm
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,17 @@ - (void)start:(id)args
return;
}
RELEASE_TO_NIL(file);
TiThreadPerformOnMainThread(^{
[self configureRecorder];
if (recorder != nil) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioInterruptionBegin:) name:kTiMediaAudioSessionInterruptionBegin object:[TiMediaAudioSession sharedSession]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioInterruptionEnd:) name:kTiMediaAudioSessionInterruptionEnd object:[TiMediaAudioSession sharedSession]];
[[TiMediaAudioSession sharedSession] startAudioSession];
[recorder record];
curState = RecordStarted;
}
},
TiThreadPerformOnMainThread(
^{
[self configureRecorder];
if (recorder != nil) {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioInterruptionBegin:) name:kTiMediaAudioSessionInterruptionBegin object:[TiMediaAudioSession sharedSession]];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioInterruptionEnd:) name:kTiMediaAudioSessionInterruptionEnd object:[TiMediaAudioSession sharedSession]];
[[TiMediaAudioSession sharedSession] startAudioSession];
[recorder record];
curState = RecordStarted;
}
},
YES);
}

Expand All @@ -81,16 +82,17 @@ - (id)stop:(id)args
return;
}
__block TiFilesystemFileProxy *theProxy = nil;
TiThreadPerformOnMainThread(^{
if (recorder != nil) {
[recorder stop];
[[TiMediaAudioSession sharedSession] stopAudioSession];
}
curState = RecordStopped;
[[NSNotificationCenter defaultCenter] removeObserver:self];
theProxy = [[[TiFilesystemFileProxy alloc] initWithFile:[file path]] retain];
RELEASE_TO_NIL_AUTORELEASE(recorder);
},
TiThreadPerformOnMainThread(
^{
if (recorder != nil) {
[recorder stop];
[[TiMediaAudioSession sharedSession] stopAudioSession];
}
curState = RecordStopped;
[[NSNotificationCenter defaultCenter] removeObserver:self];
theProxy = [[[TiFilesystemFileProxy alloc] initWithFile:[file path]] retain];
RELEASE_TO_NIL_AUTORELEASE(recorder);
},
YES);
return [theProxy autorelease];
}
Expand All @@ -100,12 +102,13 @@ - (void)pause:(id)args
if (curState != RecordStarted) {
return;
}
TiThreadPerformOnMainThread(^{
if (recorder != nil) {
[recorder pause];
curState = RecordPaused;
}
},
TiThreadPerformOnMainThread(
^{
if (recorder != nil) {
[recorder pause];
curState = RecordPaused;
}
},
YES);
}

Expand All @@ -114,12 +117,13 @@ - (void)resume:(id)args
if (curState != RecordPaused) {
return;
}
TiThreadPerformOnMainThread(^{
if (recorder != nil) {
[recorder record];
curState = RecordStarted;
}
},
TiThreadPerformOnMainThread(
^{
if (recorder != nil) {
[recorder record];
curState = RecordStarted;
}
},
YES);
}

Expand Down
17 changes: 8 additions & 9 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@
#import "TiRootViewController.h"
#import <JavaScriptCore/JavaScriptCore.h>

extern BOOL applicationInMemoryPanic; // TODO: Remove in SDK 9.0+

// TODO: Remove in SDK 9.0+
TI_INLINE void waitForMemoryPanicCleared() // WARNING: This must never be run on main thread, or else there is a risk of deadlock!
{
}

/**
TiApp represents an instance of an application. There is always only one instance per application which could be accessed through <app> class method.
*/
@interface TiApp : TiHost <UIApplicationDelegate, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate, UNUserNotificationCenterDelegate, UIWindowSceneDelegate> {
@interface TiApp : TiHost <UIApplicationDelegate, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate, UNUserNotificationCenterDelegate> {
UIWindow *window;
UIImageView *loadView;
UIView *splashScreenView;
Expand All @@ -26,7 +33,6 @@
KrollBridge *kjsBridge;

NSMutableDictionary *launchOptions;
UISceneConnectionOptions *_connectionOptions;
NSTimeInterval started;

int32_t networkActivityCount;
Expand Down Expand Up @@ -113,13 +119,6 @@
*/
@property (nonatomic, readonly) NSDictionary *localNotification;

/**
Returns details for the last remote notification.
Dictionary containing details about remote notification, or _nil_.
*/
@property (nonatomic, readonly) UISceneConnectionOptions *connectionOptions;

/**
Returns the application's root view controller.
*/
Expand Down
Loading

0 comments on commit 8fa6ece

Please sign in to comment.