mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Wallet QR code scanner and other improvements
This commit is contained in:
16
submodules/GlassButtonNode/BUCK
Normal file
16
submodules/GlassButtonNode/BUCK
Normal file
@@ -0,0 +1,16 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
static_library(
|
||||
name = "GlassButtonNode",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit#shared",
|
||||
"//submodules/Display:Display#shared",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,379 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>archiveVersion</key>
|
||||
<string>1</string>
|
||||
<key>classes</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>objectVersion</key>
|
||||
<string>46</string>
|
||||
<key>objects</key>
|
||||
<dict>
|
||||
<key>1DD70E294F632DE500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>GlassButtonNode-Debug.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/GlassButtonNode/GlassButtonNode-Debug.xcconfig</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.xcconfig</string>
|
||||
</dict>
|
||||
<key>1DD70E29E871E00F00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>GlassButtonNode-Profile.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/GlassButtonNode/GlassButtonNode-Profile.xcconfig</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.xcconfig</string>
|
||||
</dict>
|
||||
<key>1DD70E295C088B7100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>GlassButtonNode-Release.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/GlassButtonNode/GlassButtonNode-Release.xcconfig</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.xcconfig</string>
|
||||
</dict>
|
||||
<key>B401C9792F7F325000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Buck (Do Not Modify)</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E294F632DE500000000</string>
|
||||
<string>1DD70E29E871E00F00000000</string>
|
||||
<string>1DD70E295C088B7100000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>B401C979B781F65D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Configurations</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>B401C9792F7F325000000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E29FF334B1F00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libDisplay.dylib</string>
|
||||
<key>path</key>
|
||||
<string>libDisplay.dylib</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>compiled.mach-o.dylib</string>
|
||||
</dict>
|
||||
<key>B401C97968022A5500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Frameworks</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29FF334B1F00000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E29001F47FB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>BUCK</string>
|
||||
<key>path</key>
|
||||
<string>BUCK</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.script.python</string>
|
||||
</dict>
|
||||
<key>1DD70E2923081F7500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>GlassButtonNode.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/GlassButtonNode.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>B401C979EAB5339800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Sources</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E2923081F7500000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>B401C97978C8D0D000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>GlassButtonNode</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29001F47FB00000000</string>
|
||||
<string>B401C979EAB5339800000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E29BCD8FADE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libGlassButtonNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libGlassButtonNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>B401C979C806358400000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Products</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29BCD8FADE00000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>B401C979EFB6AC4600000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>mainGroup</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>B401C979B781F65D00000000</string>
|
||||
<string>B401C97968022A5500000000</string>
|
||||
<string>B401C97978C8D0D000000000</string>
|
||||
<string>B401C979C806358400000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>E7A30F0423081F7500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2923081F7500000000</string>
|
||||
</dict>
|
||||
<key>1870857F0000000000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXSourcesBuildPhase</string>
|
||||
<key>files</key>
|
||||
<array>
|
||||
<string>E7A30F0423081F7500000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>E7A30F04FF334B1F00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29FF334B1F00000000</string>
|
||||
</dict>
|
||||
<key>FAF5FAC90000000000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXCopyFilesBuildPhase</string>
|
||||
<key>files</key>
|
||||
<array>
|
||||
<string>E7A30F04FF334B1F00000000</string>
|
||||
</array>
|
||||
<key>name</key>
|
||||
<string>Fake Swift Dependencies (Copy Files Phase)</string>
|
||||
<key>runOnlyForDeploymentPostprocessing</key>
|
||||
<integer>1</integer>
|
||||
<key>dstSubfolderSpec</key>
|
||||
<integer>16</integer>
|
||||
<key>dstPath</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
<key>4952437303EDA63300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Debug</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>baseConfigurationReference</key>
|
||||
<string>1DD70E294F632DE500000000</string>
|
||||
</dict>
|
||||
<key>4952437350C7218900000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Profile</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>baseConfigurationReference</key>
|
||||
<string>1DD70E29E871E00F00000000</string>
|
||||
</dict>
|
||||
<key>49524373A439BFE700000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Release</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>baseConfigurationReference</key>
|
||||
<string>1DD70E295C088B7100000000</string>
|
||||
</dict>
|
||||
<key>218C37090000000000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCConfigurationList</string>
|
||||
<key>buildConfigurations</key>
|
||||
<array>
|
||||
<string>4952437303EDA63300000000</string>
|
||||
<string>4952437350C7218900000000</string>
|
||||
<string>49524373A439BFE700000000</string>
|
||||
</array>
|
||||
<key>defaultConfigurationIsVisible</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>E66DC04E78C8D0D000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXNativeTarget</string>
|
||||
<key>name</key>
|
||||
<string>GlassButtonNode</string>
|
||||
<key>productName</key>
|
||||
<string>GlassButtonNode</string>
|
||||
<key>productReference</key>
|
||||
<string>1DD70E29BCD8FADE00000000</string>
|
||||
<key>productType</key>
|
||||
<string>com.apple.product-type.library.static</string>
|
||||
<key>dependencies</key>
|
||||
<array>
|
||||
</array>
|
||||
<key>buildPhases</key>
|
||||
<array>
|
||||
<string>1870857F0000000000000000</string>
|
||||
<string>FAF5FAC90000000000000000</string>
|
||||
</array>
|
||||
<key>buildConfigurationList</key>
|
||||
<string>218C37090000000000000000</string>
|
||||
</dict>
|
||||
<key>4952437303EDA63300000001</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Debug</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>4952437350C7218900000001</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Profile</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>49524373A439BFE700000001</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Release</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>218C37090000000000000001</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCConfigurationList</string>
|
||||
<key>buildConfigurations</key>
|
||||
<array>
|
||||
<string>4952437303EDA63300000001</string>
|
||||
<string>4952437350C7218900000001</string>
|
||||
<string>49524373A439BFE700000001</string>
|
||||
</array>
|
||||
<key>defaultConfigurationIsVisible</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>96C8479378C8D0D000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXProject</string>
|
||||
<key>mainGroup</key>
|
||||
<string>B401C979EFB6AC4600000000</string>
|
||||
<key>targets</key>
|
||||
<array>
|
||||
<string>E66DC04E78C8D0D000000000</string>
|
||||
</array>
|
||||
<key>buildConfigurationList</key>
|
||||
<string>218C37090000000000000001</string>
|
||||
<key>compatibilityVersion</key>
|
||||
<string>Xcode 3.2</string>
|
||||
<key>attributes</key>
|
||||
<dict>
|
||||
<key>LastUpgradeCheck</key>
|
||||
<string>9999</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rootObject</key>
|
||||
<string>96C8479378C8D0D000000000</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Scheme LastUpgradeVersion="9999" version="1.7"><BuildAction buildImplicitDependencies="YES" parallelizeBuildables="YES"><BuildActionEntries><BuildActionEntry buildForAnalyzing="YES" buildForArchiving="YES" buildForProfiling="YES" buildForRunning="YES" buildForTesting="YES"><BuildableReference BlueprintIdentifier="E66DC04E78C8D0D000000000" BlueprintName="GlassButtonNode" BuildableIdentifier="primary" BuildableName="libGlassButtonNode.a" ReferencedContainer="container:GlassButtonNode.xcodeproj"/></BuildActionEntry></BuildActionEntries></BuildAction><TestAction buildConfiguration="Debug" shouldUseLaunchSchemeArgsEnv="YES"><Testables/></TestAction><LaunchAction buildConfiguration="Debug"/><ProfileAction buildConfiguration="Release"/><AnalyzeAction buildConfiguration="Debug"/><ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"/></Scheme>
|
||||
22
submodules/GlassButtonNode/Info.plist
Normal file
22
submodules/GlassButtonNode/Info.plist
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
</dict>
|
||||
</plist>
|
||||
545
submodules/GlassButtonNode/QrCode.xcodeproj/project.pbxproj
Normal file
545
submodules/GlassButtonNode/QrCode.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,545 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>archiveVersion</key>
|
||||
<string>1</string>
|
||||
<key>classes</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>objectVersion</key>
|
||||
<string>46</string>
|
||||
<key>objects</key>
|
||||
<dict>
|
||||
<key>1DD70E295898BF2700000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrCode-Debug.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/QrCode/QrCode-Debug.xcconfig</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.xcconfig</string>
|
||||
</dict>
|
||||
<key>1DD70E297A8828D100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrCode-Profile.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/QrCode/QrCode-Profile.xcconfig</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.xcconfig</string>
|
||||
</dict>
|
||||
<key>1DD70E29EE1ED43300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrCode-Release.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/QrCode/QrCode-Release.xcconfig</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.xcconfig</string>
|
||||
</dict>
|
||||
<key>B401C9792F7F325000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Buck (Do Not Modify)</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E295898BF2700000000</string>
|
||||
<string>1DD70E297A8828D100000000</string>
|
||||
<string>1DD70E29EE1ED43300000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>B401C979B781F65D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Configurations</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>B401C9792F7F325000000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E29FF334B1F00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libDisplay.dylib</string>
|
||||
<key>path</key>
|
||||
<string>libDisplay.dylib</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>compiled.mach-o.dylib</string>
|
||||
</dict>
|
||||
<key>1DD70E29D65BA68200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libSwiftSignalKit.dylib</string>
|
||||
<key>path</key>
|
||||
<string>libSwiftSignalKit.dylib</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>compiled.mach-o.dylib</string>
|
||||
</dict>
|
||||
<key>B401C97968022A5500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Frameworks</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29FF334B1F00000000</string>
|
||||
<string>1DD70E29D65BA68200000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E29AA32BBC600000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libQrCode.a</string>
|
||||
<key>path</key>
|
||||
<string>libQrCode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>B401C979C806358400000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Products</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29AA32BBC600000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E29001F47FB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>BUCK</string>
|
||||
<key>path</key>
|
||||
<string>BUCK</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.script.python</string>
|
||||
</dict>
|
||||
<key>1DD70E2905A53BC200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>BitBuffer.cpp</string>
|
||||
<key>path</key>
|
||||
<string>Sources/BitBuffer.cpp</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>lastKnownFileType</key>
|
||||
<string>sourcecode.cpp.cpp</string>
|
||||
</dict>
|
||||
<key>1DD70E2905A54E8700000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>BitBuffer.hpp</string>
|
||||
<key>path</key>
|
||||
<string>Sources/BitBuffer.hpp</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>lastKnownFileType</key>
|
||||
<string>sourcecode.cpp.h</string>
|
||||
</dict>
|
||||
<key>1DD70E2921C2F78300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrCode.cpp</string>
|
||||
<key>path</key>
|
||||
<string>Sources/QrCode.cpp</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>lastKnownFileType</key>
|
||||
<string>sourcecode.cpp.cpp</string>
|
||||
</dict>
|
||||
<key>1DD70E2921C30A4800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrCode.hpp</string>
|
||||
<key>path</key>
|
||||
<string>Sources/QrCode.hpp</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>lastKnownFileType</key>
|
||||
<string>sourcecode.cpp.h</string>
|
||||
</dict>
|
||||
<key>1DD70E29BDC7BBF300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrCode.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/QrCode.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E2956ECDFBD00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrCodeInstance.h</string>
|
||||
<key>path</key>
|
||||
<string>Sources/QrCodeInstance.h</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>lastKnownFileType</key>
|
||||
<string>sourcecode.c.h</string>
|
||||
</dict>
|
||||
<key>1DD70E2986AF18EB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrCodeInstance.mm</string>
|
||||
<key>path</key>
|
||||
<string>Sources/QrCodeInstance.mm</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>lastKnownFileType</key>
|
||||
<string>sourcecode.cpp.objcpp</string>
|
||||
</dict>
|
||||
<key>1DD70E290F1C936700000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrSegment.cpp</string>
|
||||
<key>path</key>
|
||||
<string>Sources/QrSegment.cpp</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>lastKnownFileType</key>
|
||||
<string>sourcecode.cpp.cpp</string>
|
||||
</dict>
|
||||
<key>1DD70E290F1CA62C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QrSegment.hpp</string>
|
||||
<key>path</key>
|
||||
<string>Sources/QrSegment.hpp</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>lastKnownFileType</key>
|
||||
<string>sourcecode.cpp.h</string>
|
||||
</dict>
|
||||
<key>B401C979EAB5339800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Sources</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E2905A53BC200000000</string>
|
||||
<string>1DD70E2905A54E8700000000</string>
|
||||
<string>1DD70E2921C2F78300000000</string>
|
||||
<string>1DD70E2921C30A4800000000</string>
|
||||
<string>1DD70E29BDC7BBF300000000</string>
|
||||
<string>1DD70E2956ECDFBD00000000</string>
|
||||
<string>1DD70E2986AF18EB00000000</string>
|
||||
<string>1DD70E290F1C936700000000</string>
|
||||
<string>1DD70E290F1CA62C00000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>B401C979909F23CE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>QrCode</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29001F47FB00000000</string>
|
||||
<string>B401C979EAB5339800000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>B401C979EFB6AC4600000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>mainGroup</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>B401C979B781F65D00000000</string>
|
||||
<string>B401C97968022A5500000000</string>
|
||||
<string>B401C979C806358400000000</string>
|
||||
<string>B401C979909F23CE00000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>E7A30F0405A53BC200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2905A53BC200000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0421C2F78300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2921C2F78300000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04BDC7BBF300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29BDC7BBF300000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0486AF18EB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2986AF18EB00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F040F1C936700000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E290F1C936700000000</string>
|
||||
</dict>
|
||||
<key>1870857F0000000000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXSourcesBuildPhase</string>
|
||||
<key>files</key>
|
||||
<array>
|
||||
<string>E7A30F0405A53BC200000000</string>
|
||||
<string>E7A30F0421C2F78300000000</string>
|
||||
<string>E7A30F04BDC7BBF300000000</string>
|
||||
<string>E7A30F0486AF18EB00000000</string>
|
||||
<string>E7A30F040F1C936700000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>E7A30F04FF334B1F00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29FF334B1F00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04D65BA68200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29D65BA68200000000</string>
|
||||
</dict>
|
||||
<key>FAF5FAC90000000000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXCopyFilesBuildPhase</string>
|
||||
<key>files</key>
|
||||
<array>
|
||||
<string>E7A30F04FF334B1F00000000</string>
|
||||
<string>E7A30F04D65BA68200000000</string>
|
||||
</array>
|
||||
<key>name</key>
|
||||
<string>Fake Swift Dependencies (Copy Files Phase)</string>
|
||||
<key>runOnlyForDeploymentPostprocessing</key>
|
||||
<integer>1</integer>
|
||||
<key>dstSubfolderSpec</key>
|
||||
<integer>16</integer>
|
||||
<key>dstPath</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
<key>4952437303EDA63300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Debug</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>baseConfigurationReference</key>
|
||||
<string>1DD70E295898BF2700000000</string>
|
||||
</dict>
|
||||
<key>4952437350C7218900000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Profile</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>baseConfigurationReference</key>
|
||||
<string>1DD70E297A8828D100000000</string>
|
||||
</dict>
|
||||
<key>49524373A439BFE700000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Release</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
<key>baseConfigurationReference</key>
|
||||
<string>1DD70E29EE1ED43300000000</string>
|
||||
</dict>
|
||||
<key>218C37090000000000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCConfigurationList</string>
|
||||
<key>buildConfigurations</key>
|
||||
<array>
|
||||
<string>4952437303EDA63300000000</string>
|
||||
<string>4952437350C7218900000000</string>
|
||||
<string>49524373A439BFE700000000</string>
|
||||
</array>
|
||||
<key>defaultConfigurationIsVisible</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>E66DC04E909F23CE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXNativeTarget</string>
|
||||
<key>name</key>
|
||||
<string>QrCode</string>
|
||||
<key>productName</key>
|
||||
<string>QrCode</string>
|
||||
<key>productReference</key>
|
||||
<string>1DD70E29AA32BBC600000000</string>
|
||||
<key>productType</key>
|
||||
<string>com.apple.product-type.library.static</string>
|
||||
<key>dependencies</key>
|
||||
<array>
|
||||
</array>
|
||||
<key>buildPhases</key>
|
||||
<array>
|
||||
<string>1870857F0000000000000000</string>
|
||||
<string>FAF5FAC90000000000000000</string>
|
||||
</array>
|
||||
<key>buildConfigurationList</key>
|
||||
<string>218C37090000000000000000</string>
|
||||
</dict>
|
||||
<key>4952437303EDA63300000001</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Debug</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>4952437350C7218900000001</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Profile</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>49524373A439BFE700000001</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCBuildConfiguration</string>
|
||||
<key>name</key>
|
||||
<string>Release</string>
|
||||
<key>buildSettings</key>
|
||||
<dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>218C37090000000000000001</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>XCConfigurationList</string>
|
||||
<key>buildConfigurations</key>
|
||||
<array>
|
||||
<string>4952437303EDA63300000001</string>
|
||||
<string>4952437350C7218900000001</string>
|
||||
<string>49524373A439BFE700000001</string>
|
||||
</array>
|
||||
<key>defaultConfigurationIsVisible</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>96C84793909F23CE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXProject</string>
|
||||
<key>mainGroup</key>
|
||||
<string>B401C979EFB6AC4600000000</string>
|
||||
<key>targets</key>
|
||||
<array>
|
||||
<string>E66DC04E909F23CE00000000</string>
|
||||
</array>
|
||||
<key>buildConfigurationList</key>
|
||||
<string>218C37090000000000000001</string>
|
||||
<key>compatibilityVersion</key>
|
||||
<string>Xcode 3.2</string>
|
||||
<key>attributes</key>
|
||||
<dict>
|
||||
<key>LastUpgradeCheck</key>
|
||||
<string>9999</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rootObject</key>
|
||||
<string>96C84793909F23CE00000000</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><Scheme LastUpgradeVersion="9999" version="1.7"><BuildAction buildImplicitDependencies="YES" parallelizeBuildables="YES"><BuildActionEntries><BuildActionEntry buildForAnalyzing="YES" buildForArchiving="YES" buildForProfiling="YES" buildForRunning="YES" buildForTesting="YES"><BuildableReference BlueprintIdentifier="E66DC04E909F23CE00000000" BlueprintName="QrCode" BuildableIdentifier="primary" BuildableName="libQrCode.a" ReferencedContainer="container:QrCode.xcodeproj"/></BuildActionEntry></BuildActionEntries></BuildAction><TestAction buildConfiguration="Debug" shouldUseLaunchSchemeArgsEnv="YES"><Testables/></TestAction><LaunchAction buildConfiguration="Debug"/><ProfileAction buildConfiguration="Release"/><AnalyzeAction buildConfiguration="Debug"/><ArchiveAction buildConfiguration="Release" revealArchiveInOrganizer="YES"/></Scheme>
|
||||
178
submodules/GlassButtonNode/Sources/GlassButtonNode.swift
Normal file
178
submodules/GlassButtonNode/Sources/GlassButtonNode.swift
Normal file
@@ -0,0 +1,178 @@
|
||||
import Foundation
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
|
||||
private let largeButtonSize = CGSize(width: 72.0, height: 72.0)
|
||||
private let smallButtonSize = CGSize(width: 60.0, height: 60.0)
|
||||
|
||||
private func generateEmptyButtonImage(icon: UIImage?, strokeColor: UIColor?, fillColor: UIColor, knockout: Bool = false, angle: CGFloat = 0.0, buttonSize: CGSize = smallButtonSize) -> UIImage? {
|
||||
return generateImage(buttonSize, contextGenerator: { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setBlendMode(.copy)
|
||||
if let strokeColor = strokeColor {
|
||||
context.setFillColor(strokeColor.cgColor)
|
||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
|
||||
context.setFillColor(fillColor.cgColor)
|
||||
context.fillEllipse(in: CGRect(origin: CGPoint(x: 1.5, y: 1.5), size: CGSize(width: size.width - 3.0, height: size.height - 3.0)))
|
||||
} else {
|
||||
context.setFillColor(fillColor.cgColor)
|
||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: CGSize(width: size.width, height: size.height)))
|
||||
}
|
||||
|
||||
if let icon = icon {
|
||||
if !angle.isZero {
|
||||
context.translateBy(x: size.width / 2.0, y: size.height / 2.0)
|
||||
context.rotate(by: angle)
|
||||
context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0)
|
||||
}
|
||||
let imageSize = icon.size
|
||||
let imageRect = CGRect(origin: CGPoint(x: floor((size.width - imageSize.width) / 2.0), y: floor((size.width - imageSize.height) / 2.0)), size: imageSize)
|
||||
if knockout {
|
||||
context.setBlendMode(.copy)
|
||||
context.clip(to: imageRect, mask: icon.cgImage!)
|
||||
context.setFillColor(UIColor.clear.cgColor)
|
||||
context.fill(imageRect)
|
||||
} else {
|
||||
context.setBlendMode(.normal)
|
||||
context.draw(icon.cgImage!, in: imageRect)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private func generateFilledButtonImage(color: UIColor, icon: UIImage?, angle: CGFloat = 0.0, buttonSize: CGSize = smallButtonSize) -> UIImage? {
|
||||
return generateImage(buttonSize, contextGenerator: { size, context in
|
||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||
context.setBlendMode(.normal)
|
||||
context.setFillColor(color.cgColor)
|
||||
context.fillEllipse(in: CGRect(origin: CGPoint(), size: size))
|
||||
|
||||
if let icon = icon {
|
||||
if !angle.isZero {
|
||||
context.translateBy(x: size.width / 2.0, y: size.height / 2.0)
|
||||
context.rotate(by: angle)
|
||||
context.translateBy(x: -size.width / 2.0, y: -size.height / 2.0)
|
||||
}
|
||||
context.draw(icon.cgImage!, in: CGRect(origin: CGPoint(x: floor((size.width - icon.size.width) / 2.0), y: floor((size.height - icon.size.height) / 2.0)), size: icon.size))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private let emptyHighlightedFill = UIColor(white: 1.0, alpha: 0.3)
|
||||
private let invertedFill = UIColor(white: 1.0, alpha: 1.0)
|
||||
|
||||
private let largeLabelFont = Font.regular(14.5)
|
||||
private let smallLabelFont = Font.regular(11.5)
|
||||
|
||||
public final class GlassButtonNode: HighlightTrackingButtonNode {
|
||||
private var regularImage: UIImage?
|
||||
private var highlightedImage: UIImage?
|
||||
private var filledImage: UIImage?
|
||||
|
||||
private let blurView: UIVisualEffectView
|
||||
private let iconNode: ASImageNode
|
||||
private var labelNode: ASTextNode?
|
||||
|
||||
public init(icon: UIImage, label: String?) {
|
||||
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
|
||||
blurView.clipsToBounds = true
|
||||
blurView.isUserInteractionEnabled = false
|
||||
self.blurView = blurView
|
||||
|
||||
self.iconNode = ASImageNode()
|
||||
self.iconNode.isLayerBacked = true
|
||||
self.iconNode.displayWithoutProcessing = false
|
||||
self.iconNode.displaysAsynchronously = false
|
||||
|
||||
self.regularImage = generateEmptyButtonImage(icon: icon, strokeColor: nil, fillColor: .clear, buttonSize: largeButtonSize)
|
||||
self.highlightedImage = generateEmptyButtonImage(icon: icon, strokeColor: nil, fillColor: emptyHighlightedFill, buttonSize: largeButtonSize)
|
||||
self.filledImage = generateEmptyButtonImage(icon: icon, strokeColor: nil, fillColor: invertedFill, knockout: true, buttonSize: largeButtonSize)
|
||||
|
||||
if let label = label {
|
||||
let labelNode = ASTextNode()
|
||||
let labelFont: UIFont
|
||||
if let image = regularImage, image.size.width < 70.0 {
|
||||
labelFont = smallLabelFont
|
||||
} else {
|
||||
labelFont = largeLabelFont
|
||||
}
|
||||
labelNode.attributedText = NSAttributedString(string: label, font: labelFont, textColor: .white)
|
||||
self.labelNode = labelNode
|
||||
} else {
|
||||
self.labelNode = nil
|
||||
}
|
||||
|
||||
super.init()
|
||||
|
||||
self.view.addSubview(blurView)
|
||||
self.addSubnode(self.iconNode)
|
||||
if let labelNode = self.labelNode {
|
||||
self.addSubnode(labelNode)
|
||||
}
|
||||
self.iconNode.image = regularImage
|
||||
self.currentImage = regularImage
|
||||
|
||||
self.highligthedChanged = { [weak self] highlighted in
|
||||
if let strongSelf = self {
|
||||
strongSelf.internalHighlighted = highlighted
|
||||
strongSelf.updateState(highlighted: highlighted, selected: strongSelf.isSelected)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var internalHighlighted = false
|
||||
|
||||
override public var isSelected: Bool {
|
||||
didSet {
|
||||
self.updateState(highlighted: self.internalHighlighted, selected: self.isSelected)
|
||||
}
|
||||
}
|
||||
|
||||
private var currentImage: UIImage?
|
||||
|
||||
private func updateState(highlighted: Bool, selected: Bool) {
|
||||
let image: UIImage?
|
||||
if selected {
|
||||
image = self.filledImage
|
||||
} else if highlighted {
|
||||
image = self.highlightedImage
|
||||
} else {
|
||||
image = self.regularImage
|
||||
}
|
||||
|
||||
if self.currentImage !== image {
|
||||
let currentContents = self.iconNode.layer.contents
|
||||
self.iconNode.layer.removeAnimation(forKey: "contents")
|
||||
if let currentContents = currentContents, let image = image {
|
||||
self.iconNode.image = image
|
||||
self.iconNode.layer.animate(from: currentContents as AnyObject, to: image.cgImage!, keyPath: "contents", timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, duration: image === self.currentImage || image === self.filledImage ? 0.25 : 0.15)
|
||||
} else {
|
||||
self.iconNode.image = image
|
||||
}
|
||||
self.currentImage = image
|
||||
}
|
||||
}
|
||||
|
||||
override public func layout() {
|
||||
super.layout()
|
||||
|
||||
let size = self.bounds.size
|
||||
|
||||
self.blurView.layer.cornerRadius = size.width / 2.0
|
||||
blurView.frame = self.bounds
|
||||
|
||||
self.iconNode.frame = self.bounds
|
||||
|
||||
if let labelNode = self.labelNode {
|
||||
let labelSize = labelNode.measure(CGSize(width: 200.0, height: 100.0))
|
||||
let offset: CGFloat
|
||||
if size.width < 70.0 {
|
||||
offset = 65.0
|
||||
} else {
|
||||
offset = 81.0
|
||||
}
|
||||
labelNode.frame = CGRect(origin: CGPoint(x: floor((size.width - labelSize.width) / 2.0), y: offset), size: labelSize)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user