Merge branch 'mkirk/remove-test-build-config'

pull/1/head
Michael Kirk 7 years ago
commit 256ad75a46

@ -52,48 +52,9 @@ target 'SignalMessaging' do
end end
post_install do |installer| post_install do |installer|
# Disable some asserts when building for tests
set_building_for_tests_config(installer, 'SignalServiceKit')
disable_optimizations_for_tests(installer)
enable_extension_support_for_purelayout(installer) enable_extension_support_for_purelayout(installer)
end end
# There are some asserts and debug checks that make testing difficult - e.g. Singleton asserts
def set_building_for_tests_config(installer, target_name)
target = installer.pods_project.targets.detect { |target| target.to_s == target_name }
if target == nil
throw "failed to find target: #{target_name}"
end
build_config_name = "Test"
build_config = target.build_configurations.detect { |config| config.to_s == build_config_name }
if build_config == nil
throw "failed to find config: #{build_config_name} for target: #{target_name}"
end
puts "--[!] Disabling singleton enforcement for target: #{target} in config: #{build_config}"
existing_definitions = build_config.build_settings['GCC_PREPROCESSOR_DEFINITIONS']
if existing_definitions == nil || existing.length == 0
existing_definitions = "$(inheritied)"
end
build_config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = "#{existing_definitions} POD_CONFIGURATION_TEST=1 COCOAPODS=1 SSK_BUILDING_FOR_TESTS=1"
end
def disable_optimizations_for_tests(installer)
installer.pods_project.targets.each do | target|
build_config_name = "Test"
build_config = target.build_configurations.detect { |config| config.to_s == build_config_name }
if build_config == nil
throw "failed to find config: #{build_config_name} for target: #{target_name}"
end
# Allow accurate step-thru debugging while in tests
build_config.build_settings['GCC_OPTIMIZATION_LEVEL'] = '0'
build_config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
end
end
# PureLayout by default makes use of UIApplication, and must be configured to be built for an extension. # PureLayout by default makes use of UIApplication, and must be configured to be built for an extension.
def enable_extension_support_for_purelayout(installer) def enable_extension_support_for_purelayout(installer)
installer.pods_project.targets.each do |target| installer.pods_project.targets.each do |target|

@ -237,6 +237,6 @@ SPEC CHECKSUMS:
YapDatabase: 299a32de9d350d37a9ac5b0532609d87d5d2a5de YapDatabase: 299a32de9d350d37a9ac5b0532609d87d5d2a5de
YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54 YYImage: 1e1b62a9997399593e4b9c4ecfbbabbf1d3f3b54
PODFILE CHECKSUM: 497de356704a8d141a2dd132ab5c7fa4acffe2b6 PODFILE CHECKSUM: 66640e0d5c06e9fb855faf7f6a8a3e9915eb5b78
COCOAPODS: 1.5.3 COCOAPODS: 1.5.3

@ -1 +1 @@
Subproject commit a9402f6cc03285da65da62e14eeb1efc848267b3 Subproject commit 727e254519570775e82fc9ae3a2c50e2d1cd45a4

@ -3505,204 +3505,6 @@
/* End PBXVariantGroup section */ /* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
451DA3CC1F152887008E2423 /* Test */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_RECEIVER_WEAK = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_NO_COMMON_BLOCKS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = (
"DEBUG=1",
"$(inherited)",
"SSK_BUILDING_FOR_TESTS=1",
);
GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES;
GCC_WARN_CHECK_SWITCH_STATEMENTS = YES;
GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES;
GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES;
GCC_WARN_MISSING_PARENTHESES = YES;
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = YES;
GCC_WARN_SHADOW = YES;
GCC_WARN_SIGN_COMPARE = YES;
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
GCC_WARN_UNUSED_VALUE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-fobjc-arc-exceptions";
SDKROOT = iphoneos;
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
};
name = Test;
};
451DA3CD1F152887008E2423 /* Test */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1CE3CD5C23334683BDD3D78C /* Pods-Signal.test.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = U68MSDN6DR;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Signal/Signal-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
HAVE_CONFIG_H,
);
GCC_STRICT_ALIASING = NO;
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO;
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"${SRCROOT}/RedPhone/lib/ogg/include\"",
"\"${SRCROOT}/RedPhone/lib/debug/include\"",
"\"$(SRCROOT)/libtommath\"",
"\"$(SRCROOT)/libtomcrypt/headers\"",
"\"$(SRCROOT)/MMDrawerController\"",
"\"$(SRCROOT)/Libraries\"/**",
);
INFOPLIST_FILE = "$(SRCROOT)/Signal/Signal-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
);
LLVM_LTO = NO;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = org.whispersystems.signal;
PRODUCT_NAME = Signal;
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Signal/src/Signal-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TEST_AFTER_BUILD = YES;
VALID_ARCHS = "arm64 armv7 armv7s";
WRAPPER_EXTENSION = app;
};
name = Test;
};
451DA3CE1F152887008E2423 /* Test */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 8981C8F64D94D3C52EB67A2C /* Pods-SignalTests.test.xcconfig */;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEFINES_MODULE = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
GCC_GENERATE_TEST_COVERAGE_FILES = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Signal/Signal-Prefix.pch";
GCC_VERSION = "";
GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO;
GCC_WARN_STRICT_SELECTOR_MATCH = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
HEADER_SEARCH_PATHS = (
"${PODS_HEADERS_SEARCH_PATHS}",
"$(inherited)",
"\"${SRCROOT}/Signal/lib/speex/include\"",
"\"${SRCROOT}/Signal/lib/ogg/include\"",
"\"${SRCROOT}/Signal/lib/debug/include\"",
"\"$(SRCROOT)/libtommath\"",
"\"$(SRCROOT)/libtomcrypt/headers\"",
"\"$(SRCROOT)/spandsp/spandsp/spandsp\"",
"\"$(SRCROOT)/Libraries\"/**",
"\"$(TARGET_TEMP_DIR)/../$(PROJECT_NAME).build/DerivedSources\"",
);
INFOPLIST_FILE = "Signal/test/Supporting Files/SignalTests-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)",
);
OTHER_LDFLAGS = (
"-all_load",
"-ObjC",
"$(inherited)",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.whispersystems.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = SignalTests;
PROVISIONING_PROFILE = "";
SWIFT_OBJC_BRIDGING_HEADER = "Signal/test/SignalTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Signal.app/Signal";
VALID_ARCHS = "arm64 armv7s armv7 i386 x86_64";
};
name = Test;
};
453518731FC635DD00210559 /* Debug */ = { 453518731FC635DD00210559 /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 69349DE607F5BA6036C9AC60 /* Pods-SignalShareExtension.debug.xcconfig */; baseConfigurationReference = 69349DE607F5BA6036C9AC60 /* Pods-SignalShareExtension.debug.xcconfig */;
@ -3752,76 +3554,6 @@
}; };
name = Debug; name = Debug;
}; };
453518741FC635DD00210559 /* Test */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 1C93CF3971B64E8B6C1F9AC1 /* Pods-SignalShareExtension.test.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_ENTITLEMENTS = SignalShareExtension/SignalShareExtension.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = U68MSDN6DR;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SignalShareExtension/SignalShareExtension-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SignalShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = org.whispersystems.signal.shareextension;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "SignalShareExtension/SignalShareExtension-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
VALIDATE_PRODUCT = YES;
};
name = Test;
};
453518751FC635DD00210559 /* App Store Release */ = { 453518751FC635DD00210559 /* App Store Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 435EAC2E5E22D3F087EB3192 /* Pods-SignalShareExtension.app store release.xcconfig */; baseConfigurationReference = 435EAC2E5E22D3F087EB3192 /* Pods-SignalShareExtension.app store release.xcconfig */;
@ -3949,85 +3681,6 @@
}; };
name = Debug; name = Debug;
}; };
4535189C1FC63DBF00210559 /* Test */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 948239851C08032C842937CC /* Pods-SignalMessaging.test.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
APPLICATION_EXTENSION_API_ONLY = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = U68MSDN6DR;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SignalMessaging/SignalMessaging-Prefix.pch";
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
INFOPLIST_FILE = SignalMessaging/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = org.whispersystems.signal.SignalMessaging;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SDKROOT = iphoneos;
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Test;
};
4535189D1FC63DBF00210559 /* App Store Release */ = { 4535189D1FC63DBF00210559 /* App Store Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
baseConfigurationReference = 8EEE74B0753448C085B48721 /* Pods-SignalMessaging.app store release.xcconfig */; baseConfigurationReference = 8EEE74B0753448C085B48721 /* Pods-SignalMessaging.app store release.xcconfig */;
@ -4253,7 +3906,13 @@
buildSettings = { buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW = YES;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_INTEGER = YES;
CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES;
CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements; CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@ -4298,6 +3957,7 @@
PRODUCT_NAME = Signal; PRODUCT_NAME = Signal;
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Signal/src/Signal-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Signal/src/Signal-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -4315,6 +3975,10 @@
buildSettings = { buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ADDRESS_SANITIZER_CONTAINER_OVERFLOW = NO;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements; CODE_SIGN_ENTITLEMENTS = Signal/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer"; CODE_SIGN_IDENTITY = "iPhone Developer";
@ -4359,6 +4023,7 @@
PRODUCT_BUNDLE_IDENTIFIER = org.whispersystems.signal; PRODUCT_BUNDLE_IDENTIFIER = org.whispersystems.signal;
PRODUCT_NAME = Signal; PRODUCT_NAME = Signal;
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OBJC_BRIDGING_HEADER = "Signal/src/Signal-Bridging-Header.h"; SWIFT_OBJC_BRIDGING_HEADER = "Signal/src/Signal-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
@ -4495,7 +4160,6 @@
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
453518731FC635DD00210559 /* Debug */, 453518731FC635DD00210559 /* Debug */,
453518741FC635DD00210559 /* Test */,
453518751FC635DD00210559 /* App Store Release */, 453518751FC635DD00210559 /* App Store Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
@ -4505,7 +4169,6 @@
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
4535189B1FC63DBF00210559 /* Debug */, 4535189B1FC63DBF00210559 /* Debug */,
4535189C1FC63DBF00210559 /* Test */,
4535189D1FC63DBF00210559 /* App Store Release */, 4535189D1FC63DBF00210559 /* App Store Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
@ -4515,7 +4178,6 @@
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
D221A0BA169C9E5F00537ABF /* Debug */, D221A0BA169C9E5F00537ABF /* Debug */,
451DA3CC1F152887008E2423 /* Test */,
D221A0BB169C9E5F00537ABF /* App Store Release */, D221A0BB169C9E5F00537ABF /* App Store Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
@ -4525,7 +4187,6 @@
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
D221A0BD169C9E5F00537ABF /* Debug */, D221A0BD169C9E5F00537ABF /* Debug */,
451DA3CD1F152887008E2423 /* Test */,
D221A0BE169C9E5F00537ABF /* App Store Release */, D221A0BE169C9E5F00537ABF /* App Store Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
@ -4535,7 +4196,6 @@
isa = XCConfigurationList; isa = XCConfigurationList;
buildConfigurations = ( buildConfigurations = (
D221A0C0169C9E5F00537ABF /* Debug */, D221A0C0169C9E5F00537ABF /* Debug */,
451DA3CE1F152887008E2423 /* Test */,
D221A0C1169C9E5F00537ABF /* App Store Release */, D221A0C1169C9E5F00537ABF /* App Store Release */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;

@ -37,7 +37,7 @@
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Test" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO"> shouldUseLaunchSchemeArgsEnv = "NO">
@ -76,6 +76,9 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableAddressSanitizer = "YES"
enableASanStackUseAfterReturn = "YES"
enableUBSanitizer = "YES"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"

@ -278,6 +278,7 @@ static NSTimeInterval launchStartedAt;
} }
OWSBackgroundTask *_Nullable backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__]; OWSBackgroundTask *_Nullable backgroundTask = [OWSBackgroundTask backgroundTaskWithLabelStr:__PRETTY_FUNCTION__];
SUPPRESS_DEADSTORE_WARNING(backgroundTask);
if ([NSFileManager.defaultManager fileExistsAtPath:OWSPrimaryStorage.legacyDatabaseFilePath]) { if ([NSFileManager.defaultManager fileExistsAtPath:OWSPrimaryStorage.legacyDatabaseFilePath]) {
DDLogInfo(@"%@ Legacy Database file size: %@", DDLogInfo(@"%@ Legacy Database file size: %@",
@ -925,7 +926,7 @@ static NSTimeInterval launchStartedAt;
- (void)application:(UIApplication *)application - (void)application:(UIApplication *)application
handleActionWithIdentifier:(NSString *)identifier handleActionWithIdentifier:(NSString *)identifier
forLocalNotification:(UILocalNotification *)notification forLocalNotification:(UILocalNotification *)notification
completionHandler:(void (^)(void))completionHandler completionHandler:(void (^)())completionHandler
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();

@ -204,6 +204,7 @@
// TODO: Always show backup when we go to production. // TODO: Always show backup when we go to production.
BOOL isBackupEnabled = [OWSBackup.sharedManager isBackupEnabled]; BOOL isBackupEnabled = [OWSBackup.sharedManager isBackupEnabled];
BOOL showBackup = isBackupEnabled; BOOL showBackup = isBackupEnabled;
SUPPRESS_DEADSTORE_WARNING(showBackup);
#ifdef DEBUG #ifdef DEBUG
showBackup = YES; showBackup = YES;
#endif #endif

@ -11,6 +11,8 @@
- (void)viewDidLoad - (void)viewDidLoad
{ {
[super viewDidLoad];
[self updateTableContents]; [self updateTableContents];
} }

@ -22,6 +22,8 @@
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
{ {
[super viewDidAppear:animated];
[self updateTableContents]; [self updateTableContents];
} }

@ -45,6 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
{ {
[super viewDidAppear:animated];
[self updateTableContents]; [self updateTableContents];
} }

@ -312,7 +312,7 @@ int const OWSLinkedDevicesTableViewControllerSectionAddDevice = 1;
return cell; return cell;
} else { } else {
DDLogError(@"Unknown section: %@", indexPath); DDLogError(@"Unknown section: %@", indexPath);
return nil; return [UITableViewCell new];
} }
} }

@ -38,6 +38,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
{ {
[super viewDidAppear:animated];
[self updateTableContents]; [self updateTableContents];
} }

@ -30,6 +30,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)viewDidAppear:(BOOL)animated - (void)viewDidAppear:(BOOL)animated
{ {
[super viewDidAppear:animated];
[self updateTableContents]; [self updateTableContents];
} }

@ -331,7 +331,9 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssert(self.quotedTextLabel); OWSAssert(self.quotedTextLabel);
UIColor *textColor = self.quotedTextColor; UIColor *textColor = self.quotedTextColor;
SUPPRESS_DEADSTORE_WARNING(textColor);
UIFont *font = self.quotedTextFont; UIFont *font = self.quotedTextFont;
SUPPRESS_DEADSTORE_WARNING(font);
NSString *text = @""; NSString *text = @"";
NSString *_Nullable fileTypeForSnippet = [self fileTypeForSnippet]; NSString *_Nullable fileTypeForSnippet = [self fileTypeForSnippet];

@ -1413,9 +1413,8 @@ typedef enum : NSUInteger {
UIColor *subtitleColor = [UIColor.ows_navbarTitleColor colorWithAlphaComponent:(CGFloat)0.9]; UIColor *subtitleColor = [UIColor.ows_navbarTitleColor colorWithAlphaComponent:(CGFloat)0.9];
if (self.thread.isMuted) { if (self.thread.isMuted) {
// Show a "mute" icon before the navigation bar subtitle if this thread is muted. // Show a "mute" icon before the navigation bar subtitle if this thread is muted.
[subtitleText [subtitleText appendAttributedString:[[NSAttributedString alloc]
appendAttributedString:[[NSAttributedString alloc] initWithString:LocalizationNotNeeded(@"\ue067 ")
initWithString:@"\ue067 "
attributes:@{ attributes:@{
NSFontAttributeName : [UIFont ows_elegantIconsFont:7.f], NSFontAttributeName : [UIFont ows_elegantIconsFont:7.f],
NSForegroundColorAttributeName : subtitleColor NSForegroundColorAttributeName : subtitleColor
@ -1432,9 +1431,8 @@ typedef enum : NSUInteger {
} }
if (isVerified) { if (isVerified) {
// Show a "checkmark" icon before the navigation bar subtitle if this thread is verified. // Show a "checkmark" icon before the navigation bar subtitle if this thread is verified.
[subtitleText [subtitleText appendAttributedString:[[NSAttributedString alloc]
appendAttributedString:[[NSAttributedString alloc] initWithString:LocalizationNotNeeded(@"\uf00c ")
initWithString:@"\uf00c "
attributes:@{ attributes:@{
NSFontAttributeName : [UIFont ows_fontAwesomeFont:10.f], NSFontAttributeName : [UIFont ows_fontAwesomeFont:10.f],
NSForegroundColorAttributeName : subtitleColor, NSForegroundColorAttributeName : subtitleColor,
@ -1862,21 +1860,25 @@ typedef enum : NSUInteger {
[self presentViewController:actionSheetController animated:YES completion:nil]; [self presentViewController:actionSheetController animated:YES completion:nil];
} }
- (void)tappedNonBlockingIdentityChangeForRecipientId:(nullable NSString *)signalId - (void)tappedNonBlockingIdentityChangeForRecipientId:(nullable NSString *)signalIdParam
{ {
if (signalId == nil) { if (signalIdParam == nil) {
if (self.thread.isGroupThread) { if (self.thread.isGroupThread) {
// Before 2.13 we didn't track the recipient id in the identity change error. // Before 2.13 we didn't track the recipient id in the identity change error.
DDLogWarn(@"%@ Ignoring tap on legacy nonblocking identity change since it has no signal id", self.logTag); DDLogWarn(@"%@ Ignoring tap on legacy nonblocking identity change since it has no signal id", self.logTag);
return;
} else { } else {
DDLogInfo( DDLogInfo(
@"%@ Assuming tap on legacy nonblocking identity change corresponds to current contact thread: %@", @"%@ Assuming tap on legacy nonblocking identity change corresponds to current contact thread: %@",
self.logTag, self.logTag,
self.thread.contactIdentifier); self.thread.contactIdentifier);
signalId = self.thread.contactIdentifier; signalIdParam = self.thread.contactIdentifier;
} }
} }
NSString *signalId = signalIdParam;
[self showFingerprintWithRecipientId:signalId]; [self showFingerprintWithRecipientId:signalId];
} }

@ -371,7 +371,7 @@ NS_ASSUME_NONNULL_BEGIN
} else { } else {
if ([thread isMuted]) { if ([thread isMuted]) {
[snippetText appendAttributedString:[[NSAttributedString alloc] [snippetText appendAttributedString:[[NSAttributedString alloc]
initWithString:@"\ue067 " initWithString:LocalizationNotNeeded(@"\ue067 ")
attributes:@{ attributes:@{
NSFontAttributeName : [UIFont ows_elegantIconsFont:9.f], NSFontAttributeName : [UIFont ows_elegantIconsFont:9.f],
NSForegroundColorAttributeName : NSForegroundColorAttributeName :

@ -907,7 +907,7 @@ NS_ASSUME_NONNULL_BEGIN
return result; return result;
} }
- (NSString *)callingCodeForPossiblePhoneNumber:(NSString *)phoneNumber - (nullable NSString *)callingCodeForPossiblePhoneNumber:(NSString *)phoneNumber
{ {
OWSAssert([phoneNumber hasPrefix:@"+"]); OWSAssert([phoneNumber hasPrefix:@"+"]);
@ -924,7 +924,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *searchText = self.searchBar.text; NSString *searchText = self.searchBar.text;
if (searchText.length < 8) { if (searchText.length < 8) {
return nil; return @[];
} }
NSMutableSet<NSString *> *parsedPhoneNumbers = [NSMutableSet new]; NSMutableSet<NSString *> *parsedPhoneNumbers = [NSMutableSet new];
@ -935,7 +935,7 @@ NS_ASSUME_NONNULL_BEGIN
NSString *phoneNumberString = phoneNumber.toE164; NSString *phoneNumberString = phoneNumber.toE164;
// Ignore phone numbers with an unrecognized calling code. // Ignore phone numbers with an unrecognized calling code.
NSString *callingCode = [self callingCodeForPossiblePhoneNumber:phoneNumberString]; NSString *_Nullable callingCode = [self callingCodeForPossiblePhoneNumber:phoneNumberString];
if (!callingCode) { if (!callingCode) {
continue; continue;
} }

@ -329,7 +329,7 @@ NS_ASSUME_NONNULL_BEGIN
[alert addAction:[UIAlertAction actionWithTitle:CommonStrings.dismissButton [alert addAction:[UIAlertAction actionWithTitle:CommonStrings.dismissButton
style:UIAlertActionStyleDefault style:UIAlertActionStyleDefault
handler:^(UIAlertAction *action) { handler:^(UIAlertAction *action) {
[_challengeTextField becomeFirstResponder]; [self.challengeTextField becomeFirstResponder];
}]]; }]];
[self presentViewController:alert animated:YES completion:nil]; [self presentViewController:alert animated:YES completion:nil];

@ -354,7 +354,7 @@ typedef void (^CustomLayoutBlock)(void);
// Show a "checkmark" if this user is verified. // Show a "checkmark" if this user is verified.
[labelText [labelText
appendAttributedString:[[NSAttributedString alloc] appendAttributedString:[[NSAttributedString alloc]
initWithString:@"\uf00c " initWithString:LocalizationNotNeeded(@"\uf00c ")
attributes:@{ attributes:@{
NSFontAttributeName : [UIFont NSFontAttributeName : [UIFont
ows_fontAwesomeFont:self.verificationStateLabel.font.pointSize], ows_fontAwesomeFont:self.verificationStateLabel.font.pointSize],
@ -383,7 +383,7 @@ typedef void (^CustomLayoutBlock)(void);
// Show a "checkmark" if this user is not verified. // Show a "checkmark" if this user is not verified.
[buttonText [buttonText
appendAttributedString:[[NSAttributedString alloc] appendAttributedString:[[NSAttributedString alloc]
initWithString:@"\uf00c " initWithString:LocalizationNotNeeded(@"\uf00c ")
attributes:@{ attributes:@{
NSFontAttributeName : [UIFont NSFontAttributeName : [UIFont
ows_fontAwesomeFont:self.verifyUnverifyButtonLabel.font.pointSize], ows_fontAwesomeFont:self.verifyUnverifyButtonLabel.font.pointSize],

@ -786,7 +786,7 @@ const CGFloat kIconViewLength = 24;
NSMutableAttributedString *subtitle = [NSMutableAttributedString new]; NSMutableAttributedString *subtitle = [NSMutableAttributedString new];
// "checkmark" // "checkmark"
[subtitle appendAttributedString:[[NSAttributedString alloc] [subtitle appendAttributedString:[[NSAttributedString alloc]
initWithString:@"\uf00c " initWithString:LocalizationNotNeeded(@"\uf00c ")
attributes:@{ attributes:@{
NSFontAttributeName : NSFontAttributeName :
[UIFont ows_fontAwesomeFont:kSubtitlePointSize], [UIFont ows_fontAwesomeFont:kSubtitlePointSize],

@ -15,14 +15,6 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
#ifdef SSK_BUILDING_FOR_TESTS
#define CleanupLogDebug NSLog
#define CleanupLogInfo NSLog
#else
#define CleanupLogDebug DDLogDebug
#define CleanupLogInfo DDLogInfo
#endif
@implementation OWSOrphanedDataCleaner @implementation OWSOrphanedDataCleaner
+ (void)auditAsync + (void)auditAsync
@ -83,20 +75,18 @@ NS_ASSUME_NONNULL_BEGIN
}]; }];
}]; }];
CleanupLogDebug(@"%@ fileCount: %lu", self.logTag, (unsigned long)fileCount); DDLogDebug(@"%@ fileCount: %lu", self.logTag, (unsigned long)fileCount);
CleanupLogDebug(@"%@ totalFileSize: %lld", self.logTag, totalFileSize); DDLogDebug(@"%@ totalFileSize: %lld", self.logTag, totalFileSize);
CleanupLogDebug(@"%@ attachmentStreams: %d", self.logTag, attachmentStreamCount); DDLogDebug(@"%@ attachmentStreams: %d", self.logTag, attachmentStreamCount);
CleanupLogDebug( DDLogDebug(@"%@ attachmentStreams with file paths: %lu", self.logTag, (unsigned long)attachmentFilePaths.count);
@"%@ attachmentStreams with file paths: %lu", self.logTag, (unsigned long)attachmentFilePaths.count);
NSMutableSet<NSString *> *orphanDiskFilePaths = [diskFilePaths mutableCopy]; NSMutableSet<NSString *> *orphanDiskFilePaths = [diskFilePaths mutableCopy];
[orphanDiskFilePaths minusSet:attachmentFilePaths]; [orphanDiskFilePaths minusSet:attachmentFilePaths];
NSMutableSet<NSString *> *missingAttachmentFilePaths = [attachmentFilePaths mutableCopy]; NSMutableSet<NSString *> *missingAttachmentFilePaths = [attachmentFilePaths mutableCopy];
[missingAttachmentFilePaths minusSet:diskFilePaths]; [missingAttachmentFilePaths minusSet:diskFilePaths];
CleanupLogDebug(@"%@ orphan disk file paths: %lu", self.logTag, (unsigned long)orphanDiskFilePaths.count); DDLogDebug(@"%@ orphan disk file paths: %lu", self.logTag, (unsigned long)orphanDiskFilePaths.count);
CleanupLogDebug( DDLogDebug(@"%@ missing attachment file paths: %lu", self.logTag, (unsigned long)missingAttachmentFilePaths.count);
@"%@ missing attachment file paths: %lu", self.logTag, (unsigned long)missingAttachmentFilePaths.count);
[self printPaths:orphanDiskFilePaths.allObjects label:@"orphan disk file paths"]; [self printPaths:orphanDiskFilePaths.allObjects label:@"orphan disk file paths"];
[self printPaths:missingAttachmentFilePaths.allObjects label:@"missing attachment file paths"]; [self printPaths:missingAttachmentFilePaths.allObjects label:@"missing attachment file paths"];
@ -142,12 +132,12 @@ NS_ASSUME_NONNULL_BEGIN
}]; }];
}]; }];
CleanupLogDebug(@"%@ attachmentIds: %lu", self.logTag, (unsigned long)attachmentIds.count); DDLogDebug(@"%@ attachmentIds: %lu", self.logTag, (unsigned long)attachmentIds.count);
CleanupLogDebug(@"%@ messageAttachmentIds: %lu", self.logTag, (unsigned long)messageAttachmentIds.count); DDLogDebug(@"%@ messageAttachmentIds: %lu", self.logTag, (unsigned long)messageAttachmentIds.count);
CleanupLogDebug(@"%@ quotedReplyThumbnailAttachmentIds: %lu", DDLogDebug(@"%@ quotedReplyThumbnailAttachmentIds: %lu",
self.logTag, self.logTag,
(unsigned long)quotedReplyThumbnailAttachmentIds.count); (unsigned long)quotedReplyThumbnailAttachmentIds.count);
CleanupLogDebug( DDLogDebug(
@"%@ contactShareAvatarAttachmentIds: %lu", self.logTag, (unsigned long)contactShareAvatarAttachmentIds.count); @"%@ contactShareAvatarAttachmentIds: %lu", self.logTag, (unsigned long)contactShareAvatarAttachmentIds.count);
NSMutableSet<NSString *> *orphanAttachmentIds = [attachmentIds mutableCopy]; NSMutableSet<NSString *> *orphanAttachmentIds = [attachmentIds mutableCopy];
@ -157,17 +147,14 @@ NS_ASSUME_NONNULL_BEGIN
NSMutableSet<NSString *> *missingAttachmentIds = [messageAttachmentIds mutableCopy]; NSMutableSet<NSString *> *missingAttachmentIds = [messageAttachmentIds mutableCopy];
[missingAttachmentIds minusSet:attachmentIds]; [missingAttachmentIds minusSet:attachmentIds];
CleanupLogDebug(@"%@ orphan attachmentIds: %lu", self.logTag, (unsigned long)orphanAttachmentIds.count); DDLogDebug(@"%@ orphan attachmentIds: %lu", self.logTag, (unsigned long)orphanAttachmentIds.count);
CleanupLogDebug(@"%@ missing attachmentIds: %lu", self.logTag, (unsigned long)missingAttachmentIds.count); DDLogDebug(@"%@ missing attachmentIds: %lu", self.logTag, (unsigned long)missingAttachmentIds.count);
CleanupLogDebug(@"%@ orphan interactions: %lu", self.logTag, (unsigned long)orphanInteractionIds.count); DDLogDebug(@"%@ orphan interactions: %lu", self.logTag, (unsigned long)orphanInteractionIds.count);
// We need to avoid cleaning up new attachments and files that are still in the process of // We need to avoid cleaning up new attachments and files that are still in the process of
// being created/written, so we don't clean up anything recent. // being created/written, so we don't clean up anything recent.
#ifdef SSK_BUILDING_FOR_TESTS
const NSTimeInterval kMinimumOrphanAge = 0.f; const NSTimeInterval kMinimumOrphanAge = CurrentAppContext().isRunningTests ? 0.f : 15 * kMinuteInterval;
#else
const NSTimeInterval kMinimumOrphanAge = 15 * kMinuteInterval;
#endif
if (!shouldCleanup) { if (!shouldCleanup) {
return; return;
@ -181,7 +168,7 @@ NS_ASSUME_NONNULL_BEGIN
OWSFail(@"%@ Could not load interaction: %@", self.logTag, interactionId); OWSFail(@"%@ Could not load interaction: %@", self.logTag, interactionId);
continue; continue;
} }
CleanupLogInfo(@"%@ Removing orphan message: %@", self.logTag, interaction.uniqueId); DDLogInfo(@"%@ Removing orphan message: %@", self.logTag, interaction.uniqueId);
[interaction removeWithTransaction:transaction]; [interaction removeWithTransaction:transaction];
} }
for (NSString *attachmentId in orphanAttachmentIds) { for (NSString *attachmentId in orphanAttachmentIds) {
@ -198,11 +185,12 @@ NS_ASSUME_NONNULL_BEGIN
TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment; TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment;
// Don't delete attachments which were created in the last N minutes. // Don't delete attachments which were created in the last N minutes.
if (fabs([attachmentStream.creationTimestamp timeIntervalSinceNow]) < kMinimumOrphanAge) { if (fabs([attachmentStream.creationTimestamp timeIntervalSinceNow]) < kMinimumOrphanAge) {
CleanupLogInfo(@"%@ Skipping orphan attachment due to age: %f", self.logTag, DDLogInfo(@"%@ Skipping orphan attachment due to age: %f",
self.logTag,
fabs([attachmentStream.creationTimestamp timeIntervalSinceNow])); fabs([attachmentStream.creationTimestamp timeIntervalSinceNow]));
continue; continue;
} }
CleanupLogInfo(@"%@ Removing orphan attachmentStream from DB: %@", self.logTag, attachmentStream.uniqueId); DDLogInfo(@"%@ Removing orphan attachmentStream from DB: %@", self.logTag, attachmentStream.uniqueId);
[attachmentStream removeWithTransaction:transaction]; [attachmentStream removeWithTransaction:transaction];
} }
}]; }];
@ -216,12 +204,13 @@ NS_ASSUME_NONNULL_BEGIN
} }
// Don't delete files which were created in the last N minutes. // Don't delete files which were created in the last N minutes.
if (fabs([attributes.fileModificationDate timeIntervalSinceNow]) < kMinimumOrphanAge) { if (fabs([attributes.fileModificationDate timeIntervalSinceNow]) < kMinimumOrphanAge) {
CleanupLogInfo(@"%@ Skipping orphan attachment file due to age: %f", self.logTag, DDLogInfo(@"%@ Skipping orphan attachment file due to age: %f",
self.logTag,
fabs([attributes.fileModificationDate timeIntervalSinceNow])); fabs([attributes.fileModificationDate timeIntervalSinceNow]));
continue; continue;
} }
CleanupLogInfo(@"%@ Deleting orphan attachment file: %@", self.logTag, filePath); DDLogInfo(@"%@ Deleting orphan attachment file: %@", self.logTag, filePath);
[[NSFileManager defaultManager] removeItemAtPath:filePath error:&error]; [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error];
if (error) { if (error) {
OWSFail(@"%@ Could not remove orphan file at: %@", self.logTag, filePath); OWSFail(@"%@ Could not remove orphan file at: %@", self.logTag, filePath);
@ -238,14 +227,14 @@ NS_ASSUME_NONNULL_BEGIN
+ (void)printPaths:(NSArray<NSString *> *)paths label:(NSString *)label + (void)printPaths:(NSArray<NSString *> *)paths label:(NSString *)label
{ {
for (NSString *path in [paths sortedArrayUsingSelector:@selector(compare:)]) { for (NSString *path in [paths sortedArrayUsingSelector:@selector(compare:)]) {
CleanupLogDebug(@"%@ %@: %@", self.logTag, label, path); DDLogDebug(@"%@ %@: %@", self.logTag, label, path);
} }
} }
+ (NSSet<NSString *> *)filePathsInAttachmentsFolder + (NSSet<NSString *> *)filePathsInAttachmentsFolder
{ {
NSString *attachmentsFolder = [TSAttachmentStream attachmentsFolder]; NSString *attachmentsFolder = [TSAttachmentStream attachmentsFolder];
CleanupLogDebug(@"%@ attachmentsFolder: %@", self.logTag, attachmentsFolder); DDLogDebug(@"%@ attachmentsFolder: %@", self.logTag, attachmentsFolder);
return [self filePathsInDirectory:attachmentsFolder]; return [self filePathsInDirectory:attachmentsFolder];
} }

@ -2,6 +2,8 @@
// Copyright (c) 2018 Open Whisper Systems. All rights reserved. // Copyright (c) 2018 Open Whisper Systems. All rights reserved.
// //
#import "AppContext.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
#ifndef OWSAssert #ifndef OWSAssert
@ -89,12 +91,10 @@ NS_ASSUME_NONNULL_BEGIN
// 1. Use OWSSingletonAssertFlag() outside the class definition. // 1. Use OWSSingletonAssertFlag() outside the class definition.
// 2. Use OWSSingletonAssertInit() in each initializer. // 2. Use OWSSingletonAssertInit() in each initializer.
#ifndef SSK_BUILDING_FOR_TESTS
#ifdef DEBUG #ifdef DEBUG
#define ENFORCE_SINGLETONS #define ENFORCE_SINGLETONS
#endif
#endif #endif
#ifdef ENFORCE_SINGLETONS #ifdef ENFORCE_SINGLETONS
@ -104,8 +104,10 @@ NS_ASSUME_NONNULL_BEGIN
#define OWSSingletonAssertInit() \ #define OWSSingletonAssertInit() \
@synchronized([self class]) \ @synchronized([self class]) \
{ \ { \
if (!CurrentAppContext().isRunningTests) { \
OWSAssert(!_isSingletonCreated); \ OWSAssert(!_isSingletonCreated); \
_isSingletonCreated = YES; \ _isSingletonCreated = YES; \
} \
} }
#define OWSSingletonAssert() OWSSingletonAssertFlag() OWSSingletonAssertInit() #define OWSSingletonAssert() OWSSingletonAssertFlag() OWSSingletonAssertInit()
@ -135,6 +137,19 @@ NS_ASSUME_NONNULL_BEGIN
OWSCFail(_messageFormat, ##__VA_ARGS__); \ OWSCFail(_messageFormat, ##__VA_ARGS__); \
} }
// Avoids Clang analyzer warning:
// Value stored to 'x' during it's initialization is never read
#define SUPPRESS_DEADSTORE_WARNING(x) \
do { \
(void)x; \
} while (0)
__attribute__((annotate("returns_localized_nsstring"))) static inline NSString *LocalizationNotNeeded(NSString *s)
{
return s;
}
// This function is intended for use in Swift. // This function is intended for use in Swift.
void SwiftAssertIsOnMainThread(NSString *functionName); void SwiftAssertIsOnMainThread(NSString *functionName);

Loading…
Cancel
Save