This commit is contained in:
Patrick Wardle 2024-09-24 00:29:31 +02:00
parent 450e69eb2f
commit d635db74b4
2 changed files with 15 additions and 24 deletions

View File

@ -1440,34 +1440,25 @@ bail:
} //PREF_NO_EXTERNAL_DEVICES_MODE } //PREF_NO_EXTERNAL_DEVICES_MODE
//macOS sometimes toggles / delivers 2x events for same device //macOS sometimes toggles delivers 2x events for same device
if(deviceLastEvent.deviceType == event.deviceType) if(deviceLastEvent.deviceType == event.deviceType)
{ {
//ignore if last event was < 1.0s ago //ignore if last event was < 1.0s ago
if([event.timestamp timeIntervalSinceDate:deviceLastEvent.timestamp] < 1.0f) if([event.timestamp timeIntervalSinceDate:deviceLastEvent.timestamp] < 1.0f)
{ {
//set result //ignore if last event was same state
result = NOTIFICATION_SPURIOUS; if( (deviceLastEvent.state == event.state) &&
([event.timestamp timeIntervalSinceDate:deviceLastEvent.timestamp] < 1.0f) )
//dbg msg {
os_log_debug(logHandle, "ignoring event, as last event happened <1.0s ago"); //set result
result = NOTIFICATION_SPURIOUS;
//bail
goto bail; //dbg msg
} os_log_debug(logHandle, "ignoring event as it was same state as last (%ld), and happened <1.0s ago", (long)event.state);
//ignore if last event was same state //bail
if( (deviceLastEvent.state == event.state) && goto bail;
([event.timestamp timeIntervalSinceDate:deviceLastEvent.timestamp] < 1.0f) ) }
{
//set result
result = NOTIFICATION_SPURIOUS;
//dbg msg
os_log_debug(logHandle, "ignoring event as it was same state as last (%ld), and happened <1.0s ago", (long)event.state);
//bail
goto bail;
} }
} //same device } //same device

View File

@ -341,7 +341,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "#Note: To build uninstaller for app (menu)\n# 0. Delete this script and Installer.app from App's on-disk folder \n# 1. Build Installer\n# 2. Copy into App \"Uninstaller\" folder (& proj if needed)\n# 3. Re-add script, and then build (archive) for deployment\n\n#archive\n# copy in main application \nif [[ $BUILT_PRODUCTS_DIR = *\"ArchiveIntermediates\"* ]]; then\n cp -R -f \"$PROJECT_TEMP_ROOT/UninstalledProducts/macosx/OverSight.app\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Resources\"\n \n#normal build\n# delete and copy in main application \nelse\n\nrm -rf \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Resources/OverSight.app\"\ncp -R -f \"$BUILT_PRODUCTS_DIR/OverSight.app\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Resources\"\n\nfi\n"; shellScript = "#Note: To build uninstaller for app (menu)\n# 0. Delete this script and Installer.app from App's on-disk folder \n# 1. Build Installer\n# 2. Copy into App \"Uninstaller\" folder (& proj if needed)\n# 3. Re-add script, and then build (archive) for deployment\n\n#archive\n# copy in main application \nif [[ $BUILT_PRODUCTS_DIR = *\"ArchiveIntermediates\"* ]]; then\n cp -R -f \"$PROJECT_TEMP_ROOT/UninstalledProducts/macosx/OverSight.app\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Resources\"\n \n#normal build\n# delete and copy in main application \nelse\n\nrm -rf \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Resources/OverSight.app\"\ncp -R -f \"$BUILT_PRODUCTS_DIR/OverSight.app\" \"$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH/Resources\"\n\nfi\n\n";
}; };
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */