mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Wallet send & receive screens
This commit is contained in:
parent
140a77d7ac
commit
96a68a619b
21
BUCK
21
BUCK
@ -397,6 +397,15 @@ apple_bundle(
|
||||
|
||||
# Watch
|
||||
|
||||
apple_resource(
|
||||
name = "WatchAppStringResources",
|
||||
files = [],
|
||||
variants = glob([
|
||||
"Telegram-iOS/*.lproj/Localizable.strings",
|
||||
]),
|
||||
visibility = ["PUBLIC"],
|
||||
)
|
||||
|
||||
apple_binary(
|
||||
name = "WatchAppExtensionBinary",
|
||||
srcs = glob([
|
||||
@ -426,6 +435,9 @@ apple_binary(
|
||||
"$SDKROOT/System/Library/Frameworks/CoreLocation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/CoreGraphics.framework",
|
||||
],
|
||||
deps = [
|
||||
":WatchAppStringResources",
|
||||
],
|
||||
)
|
||||
|
||||
apple_bundle(
|
||||
@ -460,15 +472,6 @@ apple_resource(
|
||||
visibility = ["PUBLIC"],
|
||||
)
|
||||
|
||||
apple_resource(
|
||||
name = "WatchAppStringResources",
|
||||
files = [],
|
||||
variants = glob([
|
||||
"Telegram-iOS/*.lproj/Localizable.strings",
|
||||
]),
|
||||
visibility = ["PUBLIC"],
|
||||
)
|
||||
|
||||
apple_binary(
|
||||
name = "WatchAppBinary",
|
||||
configs = watch_binary_configs(),
|
||||
|
@ -202,7 +202,7 @@
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).compatibility</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
@ -215,10 +215,10 @@
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Viewer</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).dropbox</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER).ton</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>db-pa9wtoz9l514anx</string>
|
||||
<string>ton</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2218,6 +2218,20 @@
|
||||
ReferencedContainer = "container:submodules/UrlHandling/UrlHandling.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
buildForProfiling = "YES"
|
||||
buildForArchiving = "YES"
|
||||
buildForAnalyzing = "YES">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "E66DC04E77DEAF4500000000"
|
||||
BuildableName = "libCamera.a"
|
||||
BlueprintName = "Camera"
|
||||
ReferencedContainer = "container:submodules/Camera/Camera.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildActionEntry>
|
||||
<BuildActionEntry
|
||||
buildForTesting = "YES"
|
||||
buildForRunning = "YES"
|
||||
|
18
submodules/Camera/BUCK
Normal file
18
submodules/Camera/BUCK
Normal file
@ -0,0 +1,18 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
static_library(
|
||||
name = "Camera",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
|
||||
"//submodules/AsyncDisplayKit:AsyncDisplayKit#shared",
|
||||
"//submodules/Display:Display#shared",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/AVFoundation.framework",
|
||||
],
|
||||
)
|
501
submodules/Camera/Camera.xcodeproj/project.pbxproj
Normal file
501
submodules/Camera/Camera.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,501 @@
|
||||
<?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>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>1DD70E2992F8922A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>Camera.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/Camera.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E2908EBF46000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>CameraDevice.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/CameraDevice.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E29264D2E6A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>CameraInput.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/CameraInput.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E29387802CB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>CameraOutput.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/CameraOutput.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E29FFA2D84A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>CameraPreviewNode.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/CameraPreviewNode.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E29F10E5E1100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>CameraUtils.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/CameraUtils.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>1DD70E2992F8922A00000000</string>
|
||||
<string>1DD70E2908EBF46000000000</string>
|
||||
<string>1DD70E29264D2E6A00000000</string>
|
||||
<string>1DD70E29387802CB00000000</string>
|
||||
<string>1DD70E29FFA2D84A00000000</string>
|
||||
<string>1DD70E29F10E5E1100000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>B401C97977DEAF4500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXGroup</string>
|
||||
<key>name</key>
|
||||
<string>Camera</string>
|
||||
<key>sourceTree</key>
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29001F47FB00000000</string>
|
||||
<string>B401C979EAB5339800000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E2939BFF6D000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>Camera-Debug.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/Camera/Camera-Debug.xcconfig</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.xcconfig</string>
|
||||
</dict>
|
||||
<key>1DD70E29AEC01A3A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>Camera-Profile.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/Camera/Camera-Profile.xcconfig</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>text.xcconfig</string>
|
||||
</dict>
|
||||
<key>1DD70E292256C59C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>Camera-Release.xcconfig</string>
|
||||
<key>path</key>
|
||||
<string>../../buck-out/gen/submodules/Camera/Camera-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>1DD70E2939BFF6D000000000</string>
|
||||
<string>1DD70E29AEC01A3A00000000</string>
|
||||
<string>1DD70E292256C59C00000000</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>1DD70E29BFBD457D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libCamera.a</string>
|
||||
<key>path</key>
|
||||
<string>libCamera.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>1DD70E29BFBD457D00000000</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>B401C97977DEAF4500000000</string>
|
||||
<string>B401C979B781F65D00000000</string>
|
||||
<string>B401C97968022A5500000000</string>
|
||||
<string>B401C979C806358400000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>E7A30F0492F8922A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2992F8922A00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0408EBF46000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2908EBF46000000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04264D2E6A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29264D2E6A00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04387802CB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29387802CB00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04FFA2D84A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29FFA2D84A00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04F10E5E1100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29F10E5E1100000000</string>
|
||||
</dict>
|
||||
<key>1870857F0000000000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXSourcesBuildPhase</string>
|
||||
<key>files</key>
|
||||
<array>
|
||||
<string>E7A30F0492F8922A00000000</string>
|
||||
<string>E7A30F0408EBF46000000000</string>
|
||||
<string>E7A30F04264D2E6A00000000</string>
|
||||
<string>E7A30F04387802CB00000000</string>
|
||||
<string>E7A30F04FFA2D84A00000000</string>
|
||||
<string>E7A30F04F10E5E1100000000</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>1DD70E2939BFF6D000000000</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>1DD70E29AEC01A3A00000000</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>1DD70E292256C59C00000000</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>E66DC04E77DEAF4500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXNativeTarget</string>
|
||||
<key>name</key>
|
||||
<string>Camera</string>
|
||||
<key>productName</key>
|
||||
<string>Camera</string>
|
||||
<key>productReference</key>
|
||||
<string>1DD70E29BFBD457D00000000</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>96C8479377DEAF4500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXProject</string>
|
||||
<key>mainGroup</key>
|
||||
<string>B401C979EFB6AC4600000000</string>
|
||||
<key>targets</key>
|
||||
<array>
|
||||
<string>E66DC04E77DEAF4500000000</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>96C8479377DEAF4500000000</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="E66DC04E77DEAF4500000000" BlueprintName="Camera" BuildableIdentifier="primary" BuildableName="libCamera.a" ReferencedContainer="container:Camera.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/Camera/Info.plist
Normal file
22
submodules/Camera/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>
|
11
submodules/Camera/Sources/Camera.h
Normal file
11
submodules/Camera/Sources/Camera.h
Normal file
@ -0,0 +1,11 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for Camera.
|
||||
FOUNDATION_EXPORT double CameraVersionNumber;
|
||||
|
||||
//! Project version string for Camera.
|
||||
FOUNDATION_EXPORT const unsigned char CameraVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <Camera/PublicHeader.h>
|
||||
|
||||
|
183
submodules/Camera/Sources/Camera.swift
Normal file
183
submodules/Camera/Sources/Camera.swift
Normal file
@ -0,0 +1,183 @@
|
||||
import Foundation
|
||||
import SwiftSignalKit
|
||||
import AVFoundation
|
||||
|
||||
private final class CameraContext {
|
||||
private let queue: Queue
|
||||
private let session = AVCaptureSession()
|
||||
private let device: CameraDevice
|
||||
private let input = CameraInput()
|
||||
private let output = CameraOutput()
|
||||
|
||||
private let initialConfiguration: Camera.Configuration
|
||||
|
||||
var previewNode: CameraPreviewNode? {
|
||||
didSet {
|
||||
self.previewNode?.prepare()
|
||||
}
|
||||
}
|
||||
|
||||
var previousSampleBuffer: CMSampleBuffer?
|
||||
var processSampleBuffer: ((CMSampleBuffer) -> Void)?
|
||||
|
||||
private var invalidated = false
|
||||
|
||||
init(queue: Queue, configuration: Camera.Configuration) {
|
||||
self.queue = queue
|
||||
self.initialConfiguration = configuration
|
||||
|
||||
self.device = CameraDevice()
|
||||
self.device.configure(for: self.session, position: configuration.position)
|
||||
|
||||
self.session.beginConfiguration()
|
||||
self.session.sessionPreset = configuration.preset
|
||||
self.input.configure(for: self.session, device: self.device, audio: configuration.audio)
|
||||
self.output.configure(for: self.session)
|
||||
self.session.commitConfiguration()
|
||||
|
||||
self.output.processSampleBuffer = { [weak self] sampleBuffer, connection in
|
||||
if let formatDescription = CMSampleBufferGetFormatDescription(sampleBuffer), CMFormatDescriptionGetMediaType(formatDescription) == kCMMediaType_Video {
|
||||
self?.previousSampleBuffer = sampleBuffer
|
||||
self?.previewNode?.enqueue(sampleBuffer)
|
||||
}
|
||||
|
||||
self?.queue.async {
|
||||
self?.processSampleBuffer?(sampleBuffer)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func startCapture() {
|
||||
guard !self.session.isRunning else {
|
||||
return
|
||||
}
|
||||
|
||||
self.session.startRunning()
|
||||
}
|
||||
|
||||
func stopCapture() {
|
||||
self.session.beginConfiguration()
|
||||
self.input.invalidate(for: self.session)
|
||||
self.output.invalidate(for: self.session)
|
||||
self.session.commitConfiguration()
|
||||
|
||||
self.session.stopRunning()
|
||||
}
|
||||
|
||||
func focus(at point: CGPoint) {
|
||||
self.device.setFocusPoint(point, focusMode: .continuousAutoFocus, exposureMode: .continuousAutoExposure, monitorSubjectAreaChange: true)
|
||||
}
|
||||
|
||||
func setFPS(_ fps: Float64) {
|
||||
self.device.fps = fps
|
||||
}
|
||||
|
||||
func togglePosition() {
|
||||
self.session.beginConfiguration()
|
||||
self.input.invalidate(for: self.session)
|
||||
let targetPosition: Camera.Position
|
||||
if case .back = self.device.position {
|
||||
targetPosition = .front
|
||||
} else {
|
||||
targetPosition = .back
|
||||
}
|
||||
self.device.configure(for: self.session, position: targetPosition)
|
||||
self.input.configure(for: self.session, device: self.device, audio: self.initialConfiguration.audio)
|
||||
self.session.commitConfiguration()
|
||||
}
|
||||
}
|
||||
|
||||
final class Camera {
|
||||
typealias Preset = AVCaptureSession.Preset
|
||||
typealias Position = AVCaptureDevice.Position
|
||||
typealias FocusMode = AVCaptureDevice.FocusMode
|
||||
typealias ExposureMode = AVCaptureDevice.ExposureMode
|
||||
|
||||
struct Configuration {
|
||||
let preset: Preset
|
||||
let position: Position
|
||||
let audio: Bool
|
||||
}
|
||||
|
||||
private let queue = Queue()
|
||||
private var contextRef: Unmanaged<CameraContext>?
|
||||
|
||||
init(configuration: Camera.Configuration = Configuration(preset: .hd1920x1080, position: .back, audio: true)) {
|
||||
self.queue.async {
|
||||
let context = CameraContext(queue: self.queue, configuration: configuration)
|
||||
self.contextRef = Unmanaged.passRetained(context)
|
||||
}
|
||||
}
|
||||
|
||||
deinit {
|
||||
let contextRef = self.contextRef
|
||||
self.queue.async {
|
||||
contextRef?.release()
|
||||
}
|
||||
}
|
||||
|
||||
func startCapture() {
|
||||
self.queue.async {
|
||||
if let context = self.contextRef?.takeUnretainedValue() {
|
||||
context.startCapture()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func stopCapture() {
|
||||
self.queue.async {
|
||||
if let context = self.contextRef?.takeUnretainedValue() {
|
||||
context.stopCapture()
|
||||
}
|
||||
}
|
||||
}
|
||||
func togglePosition() {
|
||||
self.queue.async {
|
||||
if let context = self.contextRef?.takeUnretainedValue() {
|
||||
context.togglePosition()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func takePhoto() -> Signal<Void, NoError> {
|
||||
return .never()
|
||||
}
|
||||
|
||||
func focus(at point: CGPoint) {
|
||||
self.queue.async {
|
||||
if let context = self.contextRef?.takeUnretainedValue() {
|
||||
context.focus(at: point)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setFPS(_ fps: Double) {
|
||||
self.queue.async {
|
||||
if let context = self.contextRef?.takeUnretainedValue() {
|
||||
context.setFPS(fps)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func attachPreviewNode(_ node: CameraPreviewNode) {
|
||||
let nodeRef: Unmanaged<CameraPreviewNode> = Unmanaged.passRetained(node)
|
||||
self.queue.async {
|
||||
if let context = self.contextRef?.takeUnretainedValue() {
|
||||
context.previewNode = nodeRef.takeUnretainedValue()
|
||||
nodeRef.release()
|
||||
} else {
|
||||
Queue.mainQueue().async {
|
||||
nodeRef.release()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setProcessSampleBuffer(_ block: ((CMSampleBuffer) -> Void)?) {
|
||||
self.queue.async {
|
||||
if let context = self.contextRef?.takeUnretainedValue() {
|
||||
context.processSampleBuffer = block
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
138
submodules/Camera/Sources/CameraDevice.swift
Normal file
138
submodules/Camera/Sources/CameraDevice.swift
Normal file
@ -0,0 +1,138 @@
|
||||
import Foundation
|
||||
import AVFoundation
|
||||
import SwiftSignalKit
|
||||
|
||||
private let defaultFPS: Double = 30.0
|
||||
|
||||
final class CameraDevice {
|
||||
public private(set) var videoDevice: AVCaptureDevice? = nil
|
||||
public private(set) var audioDevice: AVCaptureDevice? = nil
|
||||
private var videoDevicePromise = Promise<AVCaptureDevice>()
|
||||
|
||||
init() {
|
||||
}
|
||||
|
||||
var position: Camera.Position = .back
|
||||
|
||||
func configure(for session: AVCaptureSession, position: Camera.Position) {
|
||||
self.position = position
|
||||
if #available(iOSApplicationExtension 10.0, iOS 10.0, *) {
|
||||
self.videoDevice = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInDuoCamera, .builtInWideAngleCamera, .builtInTelephotoCamera], mediaType: .video, position: position).devices.first
|
||||
} else {
|
||||
self.videoDevice = AVCaptureDevice.devices(for: .video).filter { $0.position == position }.first
|
||||
}
|
||||
if let videoDevice = self.videoDevice {
|
||||
self.videoDevicePromise.set(.single(videoDevice))
|
||||
}
|
||||
self.audioDevice = AVCaptureDevice.default(for: .audio)
|
||||
}
|
||||
|
||||
func transaction(_ device: AVCaptureDevice, update: (AVCaptureDevice) -> Void) {
|
||||
if let _ = try? device.lockForConfiguration() {
|
||||
update(device)
|
||||
device.unlockForConfiguration()
|
||||
}
|
||||
}
|
||||
|
||||
private func subscribeForChanges() {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(self.subjectAreaChanged), name: Notification.Name.AVCaptureDeviceSubjectAreaDidChange, object: self.videoDevice)
|
||||
}
|
||||
|
||||
private func unsubscribeFromChanges() {
|
||||
NotificationCenter.default.removeObserver(self, name: Notification.Name.AVCaptureDeviceSubjectAreaDidChange, object: self.videoDevice)
|
||||
}
|
||||
|
||||
@objc private func subjectAreaChanged() {
|
||||
|
||||
}
|
||||
|
||||
var fps: Double = defaultFPS {
|
||||
didSet {
|
||||
guard let device = self.videoDevice, let targetFPS = device.actualFPS(Double(self.fps)) else {
|
||||
return
|
||||
}
|
||||
|
||||
self.fps = targetFPS.fps
|
||||
|
||||
self.transaction(device) { device in
|
||||
device.activeVideoMinFrameDuration = targetFPS.duration
|
||||
device.activeVideoMaxFrameDuration = targetFPS.duration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var isFlashActive: Signal<Bool, NoError> {
|
||||
return self.videoDevicePromise.get()
|
||||
|> mapToSignal { device -> Signal<Bool, NoError> in
|
||||
return Signal { subscriber in
|
||||
subscriber.putNext(device.isFlashActive)
|
||||
let observer = device.observe(\.isFlashActive, options: [.new], changeHandler: { device, _ in
|
||||
subscriber.putNext(device.isFlashActive)
|
||||
})
|
||||
return ActionDisposable {
|
||||
observer.invalidate()
|
||||
}
|
||||
}
|
||||
|> distinctUntilChanged
|
||||
}
|
||||
}
|
||||
|
||||
var isFlashAvailable: Signal<Bool, NoError> {
|
||||
return self.videoDevicePromise.get()
|
||||
|> mapToSignal { device -> Signal<Bool, NoError> in
|
||||
return Signal { subscriber in
|
||||
subscriber.putNext(device.isFlashAvailable)
|
||||
let observer = device.observe(\.isFlashAvailable, options: [.new], changeHandler: { device, _ in
|
||||
subscriber.putNext(device.isFlashAvailable)
|
||||
})
|
||||
return ActionDisposable {
|
||||
observer.invalidate()
|
||||
}
|
||||
}
|
||||
|> distinctUntilChanged
|
||||
}
|
||||
}
|
||||
|
||||
var isAdjustingFocus: Signal<Bool, NoError> {
|
||||
return self.videoDevicePromise.get()
|
||||
|> mapToSignal { device -> Signal<Bool, NoError> in
|
||||
return Signal { subscriber in
|
||||
subscriber.putNext(device.isAdjustingFocus)
|
||||
let observer = device.observe(\.isAdjustingFocus, options: [.new], changeHandler: { device, _ in
|
||||
subscriber.putNext(device.isAdjustingFocus)
|
||||
})
|
||||
return ActionDisposable {
|
||||
observer.invalidate()
|
||||
}
|
||||
}
|
||||
|> distinctUntilChanged
|
||||
}
|
||||
}
|
||||
|
||||
func setFocusPoint(_ point: CGPoint, focusMode: Camera.FocusMode, exposureMode: Camera.ExposureMode, monitorSubjectAreaChange: Bool) {
|
||||
guard let device = self.videoDevice else {
|
||||
return
|
||||
}
|
||||
self.transaction(device) { device in
|
||||
if device.isExposurePointOfInterestSupported && device.isExposureModeSupported(exposureMode) {
|
||||
device.exposurePointOfInterest = point
|
||||
device.exposureMode = exposureMode
|
||||
}
|
||||
if device.isFocusPointOfInterestSupported && device.isFocusModeSupported(focusMode) {
|
||||
device.focusPointOfInterest = point
|
||||
device.focusMode = focusMode
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func setExposureTargetBias(_ bias: Float) {
|
||||
guard let device = self.videoDevice else {
|
||||
return
|
||||
}
|
||||
self.transaction(device) { device in
|
||||
let extremum = (bias >= 0) ? device.maxExposureTargetBias : device.minExposureTargetBias;
|
||||
let value = abs(bias) * extremum * 0.85
|
||||
device.setExposureTargetBias(value, completionHandler: nil)
|
||||
}
|
||||
}
|
||||
}
|
45
submodules/Camera/Sources/CameraInput.swift
Normal file
45
submodules/Camera/Sources/CameraInput.swift
Normal file
@ -0,0 +1,45 @@
|
||||
import AVFoundation
|
||||
|
||||
class CameraInput {
|
||||
private var videoInput: AVCaptureDeviceInput?
|
||||
private var audioInput: AVCaptureDeviceInput?
|
||||
|
||||
func configure(for session: AVCaptureSession, device: CameraDevice, audio: Bool) {
|
||||
if let videoDevice = device.videoDevice {
|
||||
self.configureVideoInput(for: session, device: videoDevice)
|
||||
}
|
||||
if audio, let audioDevice = device.audioDevice {
|
||||
self.configureAudioInput(for: session, device: audioDevice)
|
||||
}
|
||||
}
|
||||
|
||||
func invalidate(for session: AVCaptureSession) {
|
||||
for input in session.inputs {
|
||||
session.removeInput(input)
|
||||
}
|
||||
}
|
||||
|
||||
private func configureVideoInput(for session: AVCaptureSession, device: AVCaptureDevice) {
|
||||
if let videoInput = try? AVCaptureDeviceInput(device: device) {
|
||||
if let currentVideoInput = self.videoInput {
|
||||
session.removeInput(currentVideoInput)
|
||||
}
|
||||
self.videoInput = videoInput
|
||||
if session.canAddInput(videoInput) {
|
||||
session.addInput(videoInput)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func configureAudioInput(for session: AVCaptureSession, device: AVCaptureDevice) {
|
||||
guard self.audioInput == nil else {
|
||||
return
|
||||
}
|
||||
if let audioInput = try? AVCaptureDeviceInput(device: device) {
|
||||
self.audioInput = audioInput
|
||||
if session.canAddInput(audioInput) {
|
||||
session.addInput(audioInput)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
67
submodules/Camera/Sources/CameraOutput.swift
Normal file
67
submodules/Camera/Sources/CameraOutput.swift
Normal file
@ -0,0 +1,67 @@
|
||||
import AVFoundation
|
||||
|
||||
final class CameraOutput: NSObject {
|
||||
//private let photoOutput = CameraPhotoOutput()
|
||||
private let videoOutput = AVCaptureVideoDataOutput()
|
||||
private let audioOutput = AVCaptureAudioDataOutput()
|
||||
private let metadataOutput = AVCaptureMetadataOutput()
|
||||
|
||||
private let queue = DispatchQueue(label: "")
|
||||
|
||||
var processSampleBuffer: ((CMSampleBuffer, AVCaptureConnection) -> Void)?
|
||||
var processQRCode: ((String, AVMetadataMachineReadableCodeObject) -> Void)?
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
self.videoOutput.alwaysDiscardsLateVideoFrames = true;
|
||||
self.videoOutput.videoSettings = [kCVPixelBufferPixelFormatTypeKey: kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange] as [String : Any]
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.videoOutput.setSampleBufferDelegate(nil, queue: nil)
|
||||
self.audioOutput.setSampleBufferDelegate(nil, queue: nil)
|
||||
}
|
||||
|
||||
func configure(for session: AVCaptureSession) {
|
||||
if session.canAddOutput(self.videoOutput) {
|
||||
session.addOutput(self.videoOutput)
|
||||
self.videoOutput.setSampleBufferDelegate(self, queue: self.queue)
|
||||
}
|
||||
if session.canAddOutput(self.audioOutput) {
|
||||
session.addOutput(self.audioOutput)
|
||||
self.audioOutput.setSampleBufferDelegate(self, queue: self.queue)
|
||||
}
|
||||
if session.canAddOutput(self.metadataOutput) {
|
||||
session.addOutput(self.metadataOutput)
|
||||
}
|
||||
}
|
||||
|
||||
func invalidate(for session: AVCaptureSession) {
|
||||
for output in session.outputs {
|
||||
session.removeOutput(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension CameraOutput: AVCaptureVideoDataOutputSampleBufferDelegate, AVCaptureAudioDataOutputSampleBufferDelegate {
|
||||
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
|
||||
guard CMSampleBufferDataIsReady(sampleBuffer) else {
|
||||
return
|
||||
}
|
||||
|
||||
self.processSampleBuffer?(sampleBuffer, connection)
|
||||
}
|
||||
|
||||
func captureOutput(_ output: AVCaptureOutput, didDrop sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
extension CameraOutput: AVCaptureMetadataOutputObjectsDelegate {
|
||||
func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {
|
||||
if let object = metadataObjects.first as? AVMetadataMachineReadableCodeObject, object.type == .qr, let stringValue = object.stringValue, !stringValue.isEmpty {
|
||||
self.processQRCode?(stringValue, object)
|
||||
}
|
||||
}
|
||||
}
|
50
submodules/Camera/Sources/CameraPreviewNode.swift
Normal file
50
submodules/Camera/Sources/CameraPreviewNode.swift
Normal file
@ -0,0 +1,50 @@
|
||||
import Foundation
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import AVFoundation
|
||||
|
||||
private final class CameraPreviewNodeLayerNullAction: NSObject, CAAction {
|
||||
@objc func run(forKey event: String, object anObject: Any, arguments dict: [AnyHashable : Any]?) {
|
||||
}
|
||||
}
|
||||
|
||||
private final class CameraPreviewNodeLayer: AVSampleBufferDisplayLayer {
|
||||
override func action(forKey event: String) -> CAAction? {
|
||||
return CameraPreviewNodeLayerNullAction()
|
||||
}
|
||||
}
|
||||
|
||||
class CameraPreviewNode: ASDisplayNode {
|
||||
private var displayLayer: AVSampleBufferDisplayLayer
|
||||
|
||||
override init() {
|
||||
self.displayLayer = AVSampleBufferDisplayLayer()
|
||||
self.displayLayer.videoGravity = .resizeAspectFill
|
||||
|
||||
super.init()
|
||||
|
||||
self.clipsToBounds = true
|
||||
|
||||
self.layer.addSublayer(self.displayLayer)
|
||||
}
|
||||
|
||||
func prepare() {
|
||||
DispatchQueue.main.async {
|
||||
self.displayLayer.flushAndRemoveImage()
|
||||
}
|
||||
}
|
||||
|
||||
func enqueue(_ sampleBuffer: CMSampleBuffer) {
|
||||
self.displayLayer.enqueue(sampleBuffer)
|
||||
}
|
||||
|
||||
override func layout() {
|
||||
super.layout()
|
||||
|
||||
var transform = CGAffineTransform(rotationAngle: CGFloat.pi / 2.0)
|
||||
transform = transform.scaledBy(x: 1.0, y: -1.0)
|
||||
self.displayLayer.setAffineTransform(transform)
|
||||
|
||||
self.displayLayer.frame = self.bounds
|
||||
}
|
||||
}
|
43
submodules/Camera/Sources/CameraUtils.swift
Normal file
43
submodules/Camera/Sources/CameraUtils.swift
Normal file
@ -0,0 +1,43 @@
|
||||
import AVFoundation
|
||||
|
||||
extension AVFrameRateRange {
|
||||
func clamp(rate: Float64) -> Float64 {
|
||||
return max(self.minFrameRate, min(self.maxFrameRate, rate))
|
||||
}
|
||||
|
||||
func contains(rate: Float64) -> Bool {
|
||||
return (self.minFrameRate...self.maxFrameRate) ~= rate
|
||||
}
|
||||
}
|
||||
|
||||
extension AVCaptureDevice {
|
||||
func actualFPS(_ fps: Double) -> (fps: Double, duration: CMTime)? {
|
||||
var durations: [CMTime] = []
|
||||
var frameRates: [Double] = []
|
||||
|
||||
for range in self.activeFormat.videoSupportedFrameRateRanges {
|
||||
if range.minFrameRate == range.maxFrameRate {
|
||||
durations.append(range.minFrameDuration)
|
||||
frameRates.append(range.maxFrameRate)
|
||||
continue
|
||||
}
|
||||
|
||||
if range.contains(rate: fps) {
|
||||
return (fps, CMTimeMake(value: 100, timescale: Int32(100 * fps)))
|
||||
}
|
||||
|
||||
let actualFPS: Double = range.clamp(rate: fps)
|
||||
return (actualFPS, CMTimeMake(value: 100, timescale: Int32(100 * actualFPS)))
|
||||
}
|
||||
|
||||
let diff = frameRates.map { abs($0 - fps) }
|
||||
|
||||
if let minElement: Float64 = diff.min() {
|
||||
for i in 0..<diff.count where diff[i] == minElement {
|
||||
return (frameRates[i], durations[i])
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
@ -135,7 +135,7 @@ private enum CreatePollEntry: ItemListNodeEntry {
|
||||
case let .text(theme, placeholder, text, maxLength):
|
||||
return ItemListMultilineInputItem(theme: theme, text: text, placeholder: placeholder, maxLength: ItemListMultilineInputItemTextLimit(value: maxLength, display: false), sectionId: self.section, style: .blocks, textUpdated: { value in
|
||||
arguments.updatePollText(value)
|
||||
}, tag: CreatePollEntryTag.text, action: {})
|
||||
}, tag: CreatePollEntryTag.text)
|
||||
case let .optionsHeader(theme, text):
|
||||
return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section)
|
||||
case let .option(theme, strings, id, _, placeholder, text, revealed, hasNext):
|
||||
|
@ -36,10 +36,15 @@ final class HashtagSearchControllerNode: ASDisplayNode {
|
||||
self.toolbarSeparatorNode = ASDisplayNode()
|
||||
self.toolbarSeparatorNode.backgroundColor = theme.rootController.navigationBar.separatorColor
|
||||
|
||||
let items = [
|
||||
peer?.displayTitle ?? "",
|
||||
strings.HashtagSearch_AllChats
|
||||
]
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
var items: [String] = []
|
||||
if peer?.id == context.account.peerId {
|
||||
items.append(presentationData.strings.Conversation_SavedMessages)
|
||||
} else {
|
||||
items.append(peer?.displayTitle ?? "")
|
||||
}
|
||||
items.append(strings.HashtagSearch_AllChats)
|
||||
self.segmentedControlNode = SegmentedControlNode(theme: SegmentedControlTheme(theme: theme), items: items.map { SegmentedControlItem(title: $0) }, selectedIndex: 0)
|
||||
|
||||
if let peer = peer {
|
||||
|
@ -5,6 +5,9 @@ static_library(
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/TextFormat:TextFormat",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
|
||||
|
@ -78,6 +78,130 @@
|
||||
<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>1DD70E2936DE2CF900000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libMediaResources.a</string>
|
||||
<key>path</key>
|
||||
<string>libMediaResources.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29DB6520C800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libPostbox.dylib</string>
|
||||
<key>path</key>
|
||||
<string>libPostbox.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>1DD70E29119CDA0700000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libTelegramCore.dylib</string>
|
||||
<key>path</key>
|
||||
<string>libTelegramCore.dylib</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>compiled.mach-o.dylib</string>
|
||||
</dict>
|
||||
<key>1DD70E2984A59C1D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libTelegramPresentationData.a</string>
|
||||
<key>path</key>
|
||||
<string>libTelegramPresentationData.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E292395015100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libTelegramUIPreferences.a</string>
|
||||
<key>path</key>
|
||||
<string>libTelegramUIPreferences.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29F0C15F9C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libTextFormat.a</string>
|
||||
<key>path</key>
|
||||
<string>libTextFormat.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</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>1DD70E2936DE2CF900000000</string>
|
||||
<string>1DD70E29DB6520C800000000</string>
|
||||
<string>1DD70E29D65BA68200000000</string>
|
||||
<string>1DD70E29119CDA0700000000</string>
|
||||
<string>1DD70E2984A59C1D00000000</string>
|
||||
<string>1DD70E292395015100000000</string>
|
||||
<string>1DD70E29F0C15F9C00000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E29001F47FB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -166,6 +290,7 @@
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>B401C979B781F65D00000000</string>
|
||||
<string>B401C97968022A5500000000</string>
|
||||
<string>B401C979E6D3C92800000000</string>
|
||||
<string>B401C979C806358400000000</string>
|
||||
</array>
|
||||
@ -186,6 +311,86 @@
|
||||
<string>E7A30F049A1D75CD00000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>E7A30F04FF334B1F00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29FF334B1F00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04119CDA0700000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29119CDA0700000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04DB6520C800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29DB6520C800000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04D65BA68200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29D65BA68200000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0436DE2CF900000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2936DE2CF900000000</string>
|
||||
</dict>
|
||||
<key>E7A30F042395015100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E292395015100000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0484A59C1D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2984A59C1D00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04F0C15F9C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29F0C15F9C00000000</string>
|
||||
</dict>
|
||||
<key>FAF5FAC90000000000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXCopyFilesBuildPhase</string>
|
||||
<key>files</key>
|
||||
<array>
|
||||
<string>E7A30F04FF334B1F00000000</string>
|
||||
<string>E7A30F04119CDA0700000000</string>
|
||||
<string>E7A30F04DB6520C800000000</string>
|
||||
<string>E7A30F04D65BA68200000000</string>
|
||||
<string>E7A30F0436DE2CF900000000</string>
|
||||
<string>E7A30F042395015100000000</string>
|
||||
<string>E7A30F0484A59C1D00000000</string>
|
||||
<string>E7A30F04F0C15F9C00000000</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>
|
||||
@ -253,6 +458,7 @@
|
||||
<key>buildPhases</key>
|
||||
<array>
|
||||
<string>1870857F0000000000000000</string>
|
||||
<string>FAF5FAC90000000000000000</string>
|
||||
</array>
|
||||
<key>buildConfigurationList</key>
|
||||
<string>218C37090000000000000000</string>
|
||||
|
@ -1,21 +1,6 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
private extension String {
|
||||
func rightJustified(width: Int, pad: String = " ", truncate: Bool = false) -> String {
|
||||
guard width > count else {
|
||||
return truncate ? String(suffix(width)) : self
|
||||
}
|
||||
return String(repeating: pad, count: width - count) + self
|
||||
}
|
||||
|
||||
func leftJustified(width: Int, pad: String = " ", truncate: Bool = false) -> String {
|
||||
guard width > count else {
|
||||
return truncate ? String(prefix(width)) : self
|
||||
}
|
||||
return self + String(repeating: pad, count: width - count)
|
||||
}
|
||||
}
|
||||
import TextFormat
|
||||
|
||||
public extension UIColor {
|
||||
var hexString: String {
|
||||
|
@ -21,19 +21,29 @@ public class ItemListMultilineInputItem: ListViewItem, ItemListItem {
|
||||
let placeholder: String
|
||||
public let sectionId: ItemListSectionId
|
||||
let style: ItemListStyle
|
||||
let action: () -> Void
|
||||
let capitalization: Bool
|
||||
let autocorrection: Bool
|
||||
let returnKeyType: UIReturnKeyType
|
||||
let action: (() -> Void)?
|
||||
let textUpdated: (String) -> Void
|
||||
let shouldUpdateText: (String) -> Bool
|
||||
public let tag: ItemListItemTag?
|
||||
let maxLength: ItemListMultilineInputItemTextLimit?
|
||||
let minimalHeight: CGFloat?
|
||||
|
||||
public init(theme: PresentationTheme, text: String, placeholder: String, maxLength: ItemListMultilineInputItemTextLimit?, sectionId: ItemListSectionId, style: ItemListStyle, textUpdated: @escaping (String) -> Void, tag: ItemListItemTag? = nil, action: @escaping () -> Void) {
|
||||
public init(theme: PresentationTheme, text: String, placeholder: String, maxLength: ItemListMultilineInputItemTextLimit?, sectionId: ItemListSectionId, style: ItemListStyle, capitalization: Bool = true, autocorrection: Bool = true, returnKeyType: UIReturnKeyType = .default, minimalHeight: CGFloat? = nil, textUpdated: @escaping (String) -> Void, shouldUpdateText: @escaping (String) -> Bool = { _ in return true }, tag: ItemListItemTag? = nil, action: (() -> Void)? = nil) {
|
||||
self.theme = theme
|
||||
self.text = text
|
||||
self.placeholder = placeholder
|
||||
self.maxLength = maxLength
|
||||
self.sectionId = sectionId
|
||||
self.style = style
|
||||
self.capitalization = capitalization
|
||||
self.autocorrection = autocorrection
|
||||
self.returnKeyType = returnKeyType
|
||||
self.minimalHeight = minimalHeight
|
||||
self.textUpdated = textUpdated
|
||||
self.shouldUpdateText = shouldUpdateText
|
||||
self.tag = tag
|
||||
self.action = action
|
||||
}
|
||||
@ -188,7 +198,12 @@ public class ItemListMultilineInputItemNode: ListViewItemNode, ASEditableTextNod
|
||||
let textTopInset: CGFloat = 11.0
|
||||
let textBottomInset: CGFloat = 11.0
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: textLayout.size.height + textTopInset + textBottomInset)
|
||||
var contentHeight: CGFloat = textLayout.size.height + textTopInset + textBottomInset
|
||||
if let minimalHeight = item.minimalHeight {
|
||||
contentHeight = max(minimalHeight, contentHeight)
|
||||
}
|
||||
|
||||
let contentSize = CGSize(width: params.width, height: contentHeight)
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
@ -212,6 +227,19 @@ public class ItemListMultilineInputItemNode: ListViewItemNode, ASEditableTextNod
|
||||
}
|
||||
}
|
||||
|
||||
let capitalizationType: UITextAutocapitalizationType = item.capitalization ? .sentences : .none
|
||||
let autocorrectionType: UITextAutocorrectionType = item.autocorrection ? .default : .no
|
||||
|
||||
if strongSelf.textNode.textView.autocapitalizationType != capitalizationType {
|
||||
strongSelf.textNode.textView.autocapitalizationType = capitalizationType
|
||||
}
|
||||
if strongSelf.textNode.textView.autocorrectionType != autocorrectionType {
|
||||
strongSelf.textNode.textView.autocorrectionType = autocorrectionType
|
||||
}
|
||||
if strongSelf.textNode.textView.returnKeyType != item.returnKeyType {
|
||||
strongSelf.textNode.textView.returnKeyType = item.returnKeyType
|
||||
}
|
||||
|
||||
let _ = textApply()
|
||||
if let currentText = strongSelf.textNode.attributedText {
|
||||
if currentText.string != attributedText.string {
|
||||
@ -299,6 +327,22 @@ public class ItemListMultilineInputItemNode: ListViewItemNode, ASEditableTextNod
|
||||
self.textClippingNode.frame = CGRect(origin: CGPoint(x: leftInset, y: textTopInset), size: CGSize(width: max(0.0, params.width - leftInset - params.rightInset), height: max(0.0, contentSize.height - textTopInset - textBottomInset)))
|
||||
}
|
||||
|
||||
public func editableTextNode(_ editableTextNode: ASEditableTextNode, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
|
||||
if let item = self.item {
|
||||
if let action = item.action, text == "\n" {
|
||||
action()
|
||||
return false
|
||||
}
|
||||
|
||||
var newText: String = editableTextNode.textView.text
|
||||
newText.replaceSubrange(newText.index(newText.startIndex, offsetBy: range.lowerBound) ..< newText.index(newText.startIndex, offsetBy: range.upperBound), with: text)
|
||||
if !item.shouldUpdateText(newText) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
public func editableTextNodeDidUpdateText(_ editableTextNode: ASEditableTextNode) {
|
||||
if let item = self.item {
|
||||
if let text = self.textNode.attributedText {
|
||||
|
@ -7,10 +7,16 @@ import TelegramPresentationData
|
||||
import TextFormat
|
||||
import AccountContext
|
||||
|
||||
public enum ItemListMultilineTextBaseFont {
|
||||
case `default`
|
||||
case monospace
|
||||
}
|
||||
|
||||
public class ItemListMultilineTextItem: ListViewItem, ItemListItem {
|
||||
let theme: PresentationTheme
|
||||
let text: String
|
||||
let enabledEntityTypes: EnabledEntityTypes
|
||||
let font: ItemListMultilineTextBaseFont
|
||||
public let sectionId: ItemListSectionId
|
||||
let style: ItemListStyle
|
||||
let action: (() -> Void)?
|
||||
@ -21,10 +27,11 @@ public class ItemListMultilineTextItem: ListViewItem, ItemListItem {
|
||||
|
||||
public let selectable: Bool
|
||||
|
||||
public init(theme: PresentationTheme, text: String, enabledEntityTypes: EnabledEntityTypes, sectionId: ItemListSectionId, style: ItemListStyle, action: (() -> Void)? = nil, longTapAction: (() -> Void)? = nil, linkItemAction: ((TextLinkItemActionType, TextLinkItem) -> Void)? = nil, tag: Any? = nil) {
|
||||
public init(theme: PresentationTheme, text: String, enabledEntityTypes: EnabledEntityTypes, font: ItemListMultilineTextBaseFont = .default, sectionId: ItemListSectionId, style: ItemListStyle, action: (() -> Void)? = nil, longTapAction: (() -> Void)? = nil, linkItemAction: ((TextLinkItemActionType, TextLinkItem) -> Void)? = nil, tag: Any? = nil) {
|
||||
self.theme = theme
|
||||
self.text = text
|
||||
self.enabledEntityTypes = enabledEntityTypes
|
||||
self.font = font
|
||||
self.sectionId = sectionId
|
||||
self.style = style
|
||||
self.action = action
|
||||
@ -175,8 +182,21 @@ public class ItemListMultilineTextItemNode: ListViewItemNode {
|
||||
leftInset = 16.0 + params.rightInset
|
||||
}
|
||||
|
||||
var baseFont = titleFont
|
||||
var linkFont = titleFont
|
||||
var boldFont = titleBoldFont
|
||||
var italicFont = titleItalicFont
|
||||
var boldItalicFont = titleBoldItalicFont
|
||||
if case .monospace = item.font {
|
||||
baseFont = Font.monospace(17.0)
|
||||
linkFont = Font.monospace(17.0)
|
||||
boldFont = Font.semiboldMonospace(17.0)
|
||||
italicFont = Font.italicMonospace(17.0)
|
||||
boldItalicFont = Font.semiboldItalicMonospace(17.0)
|
||||
}
|
||||
|
||||
let entities = generateTextEntities(item.text, enabledTypes: item.enabledEntityTypes)
|
||||
let string = stringWithAppliedEntities(item.text, entities: entities, baseColor: textColor, linkColor: item.theme.list.itemAccentColor, baseFont: titleFont, linkFont: titleFont, boldFont: titleBoldFont, italicFont: titleItalicFont, boldItalicFont: titleBoldItalicFont, fixedFont: titleFixedFont, blockQuoteFont: titleFont)
|
||||
let string = stringWithAppliedEntities(item.text, entities: entities, baseColor: textColor, linkColor: item.theme.list.itemAccentColor, baseFont: baseFont, linkFont: linkFont, boldFont: boldFont, italicFont: italicFont, boldItalicFont: boldItalicFont, fixedFont: titleFixedFont, blockQuoteFont: titleFont)
|
||||
|
||||
let (titleLayout, titleApply) = makeTextLayout(TextNodeLayoutArguments(attributedString: string, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: params.width - params.leftInset - params.rightInset - 20.0, height: CGFloat.greatestFiniteMagnitude), alignment: .natural, cutout: nil, insets: UIEdgeInsets()))
|
||||
|
||||
|
@ -10,6 +10,7 @@ public enum ItemListSingleLineInputItemType: Equatable {
|
||||
case password
|
||||
case email
|
||||
case number
|
||||
case decimal
|
||||
case username
|
||||
}
|
||||
|
||||
@ -262,6 +263,11 @@ public class ItemListSingleLineInputItemNode: ListViewItemNode, UITextFieldDeleg
|
||||
} else {
|
||||
keyboardType = .numberPad
|
||||
}
|
||||
case .decimal:
|
||||
secureEntry = false
|
||||
capitalizationType = .none
|
||||
autocorrectionType = .no
|
||||
keyboardType = .decimalPad
|
||||
case .username:
|
||||
secureEntry = false
|
||||
capitalizationType = .none
|
||||
@ -393,8 +399,12 @@ public class ItemListSingleLineInputItemNode: ListViewItemNode, UITextFieldDeleg
|
||||
}
|
||||
|
||||
@objc public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
||||
if let item = self.item, !item.shouldUpdateText(string) {
|
||||
return false
|
||||
if let item = self.item {
|
||||
var newText = textField.text ?? ""
|
||||
newText.replaceSubrange(newText.index(newText.startIndex, offsetBy: range.lowerBound) ..< newText.index(newText.startIndex, offsetBy: range.upperBound), with: string)
|
||||
if !item.shouldUpdateText(newText) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if string.count > 1, let item = self.item, let processPaste = item.processPaste {
|
||||
|
@ -128,7 +128,7 @@ private class PasscodeEntryDotNode: ASImageNode {
|
||||
}
|
||||
}
|
||||
|
||||
final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
public final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
private var background: PasscodeBackground?
|
||||
private var color: UIColor
|
||||
private var accentColor: UIColor
|
||||
@ -141,19 +141,19 @@ final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
|
||||
private var validLayout: PasscodeLayout?
|
||||
|
||||
var complete: ((String) -> Void)?
|
||||
public var complete: ((String) -> Void)?
|
||||
|
||||
var text: String {
|
||||
public var text: String {
|
||||
return self.textFieldNode.textField.text ?? ""
|
||||
}
|
||||
|
||||
var keyboardAppearance: UIKeyboardAppearance {
|
||||
public var keyboardAppearance: UIKeyboardAppearance {
|
||||
didSet {
|
||||
self.textFieldNode.textField.keyboardAppearance = self.keyboardAppearance
|
||||
}
|
||||
}
|
||||
|
||||
init(color: UIColor, accentColor: UIColor, fieldType: PasscodeEntryFieldType, keyboardAppearance: UIKeyboardAppearance, useCustomNumpad: Bool = false) {
|
||||
public init(color: UIColor, accentColor: UIColor, fieldType: PasscodeEntryFieldType, keyboardAppearance: UIKeyboardAppearance, useCustomNumpad: Bool = false) {
|
||||
self.color = color
|
||||
self.accentColor = accentColor
|
||||
self.fieldType = fieldType
|
||||
@ -175,7 +175,7 @@ final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
self.addSubnode(self.borderNode)
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
override public func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
self.textFieldNode.textField.isSecureTextEntry = true
|
||||
@ -214,7 +214,7 @@ final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func activateInput() {
|
||||
public func activateInput() {
|
||||
self.textFieldNode.textField.becomeFirstResponder()
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func reset(animated: Bool = true) {
|
||||
public func reset(animated: Bool = true) {
|
||||
var delay: Double = 0.0
|
||||
for node in self.dotNodes.reversed() {
|
||||
if node.alpha < 1.0 {
|
||||
@ -297,7 +297,7 @@ final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func update(fieldType: PasscodeEntryFieldType) {
|
||||
public func update(fieldType: PasscodeEntryFieldType) {
|
||||
if fieldType != self.fieldType {
|
||||
self.textFieldNode.textField.text = ""
|
||||
}
|
||||
@ -307,7 +307,7 @@ final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func updateLayout(layout: PasscodeLayout, transition: ContainedViewLayoutTransition) -> CGRect {
|
||||
public func updateLayout(layout: PasscodeLayout, transition: ContainedViewLayoutTransition) -> CGRect {
|
||||
self.validLayout = layout
|
||||
|
||||
let fieldAlpha: CGFloat
|
||||
@ -353,7 +353,7 @@ final class PasscodeEntryInputFieldNode: ASDisplayNode, UITextFieldDelegate {
|
||||
return fieldFrame
|
||||
}
|
||||
|
||||
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
||||
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
||||
let currentText = textField.text ?? ""
|
||||
let text = (currentText as NSString).replacingCharacters(in: range, with: string)
|
||||
if let maxLength = self.fieldType.maxLength, text.count > maxLength {
|
||||
|
@ -108,7 +108,7 @@ struct PasscodeKeyboardLayout {
|
||||
}
|
||||
}
|
||||
|
||||
struct PasscodeLayout {
|
||||
public struct PasscodeLayout {
|
||||
let layout: ContainerViewLayout
|
||||
let keyboard: PasscodeKeyboardLayout
|
||||
let titleOffset: CGFloat
|
||||
@ -155,7 +155,7 @@ struct PasscodeLayout {
|
||||
}
|
||||
}
|
||||
|
||||
init(layout: ContainerViewLayout, titleOffset: CGFloat, subtitleOffset: CGFloat, inputFieldOffset: CGFloat) {
|
||||
public init(layout: ContainerViewLayout, titleOffset: CGFloat, subtitleOffset: CGFloat, inputFieldOffset: CGFloat) {
|
||||
self.layout = layout
|
||||
self.keyboard = PasscodeKeyboardLayout(layout: layout)
|
||||
self.titleOffset = titleOffset
|
||||
|
@ -355,8 +355,6 @@ private enum ChannelInfoEntry: ItemListNodeEntry {
|
||||
case let .channelDescriptionSetup(theme, placeholder, value):
|
||||
return ItemListMultilineInputItem(theme: theme, text: value, placeholder: placeholder, maxLength: ItemListMultilineInputItemTextLimit(value: 255, display: true), sectionId: self.section, style: .plain, textUpdated: { updatedText in
|
||||
arguments.updateEditingDescriptionText(updatedText)
|
||||
}, action: {
|
||||
|
||||
})
|
||||
case let .admins(theme, text, value):
|
||||
return ItemListDisclosureItem(theme: theme, title: text, label: value, sectionId: self.section, style: .plain, action: {
|
||||
|
@ -541,8 +541,6 @@ private enum GroupInfoEntry: ItemListNodeEntry {
|
||||
case let .groupDescriptionSetup(theme, placeholder, text):
|
||||
return ItemListMultilineInputItem(theme: theme, text: text, placeholder: placeholder, maxLength: ItemListMultilineInputItemTextLimit(value: 255, display: true), sectionId: self.section, style: .blocks, textUpdated: { updatedText in
|
||||
arguments.updateEditingDescriptionText(updatedText)
|
||||
}, action: {
|
||||
|
||||
})
|
||||
case let .permissions(theme, title, text):
|
||||
return ItemListDisclosureItem(theme: theme, icon: PresentationResourcesChat.groupInfoPermissionsIcon(theme), title: title, label: text, sectionId: self.section, style: .blocks, action: {
|
||||
|
@ -254,7 +254,7 @@ private enum PeerReportControllerEntry: ItemListNodeEntry {
|
||||
case let .text(theme, title, value):
|
||||
return ItemListMultilineInputItem(theme: theme, text: value, placeholder: title, maxLength: nil, sectionId: self.section, style: .blocks, textUpdated: { text in
|
||||
arguments.updateText(text)
|
||||
}, tag: PeerReportControllerEntryTag.text, action: {})
|
||||
}, tag: PeerReportControllerEntryTag.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,23 @@ static_library(
|
||||
name = "QrCode",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
"Sources/**/*.cpp",
|
||||
]) + [
|
||||
"Sources/QrCodeInstance.mm"
|
||||
],
|
||||
has_cpp = True,
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
|
||||
"//submodules/Display:Display#shared",
|
||||
],
|
||||
headers = glob([
|
||||
"Sources/**/*.hpp",
|
||||
]) + [
|
||||
"Sources/QrCodeInstance.h"
|
||||
],
|
||||
exported_headers = [
|
||||
"Sources/QrCodeInstance.h"
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
|
||||
|
@ -157,16 +157,120 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>text.script.python</string>
|
||||
</dict>
|
||||
<key>1DD70E29213163D300000000</key>
|
||||
<key>1DD70E2905A53BC200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>QRCode.swift</string>
|
||||
<string>BitBuffer.cpp</string>
|
||||
<key>path</key>
|
||||
<string>Sources/QRCode.swift</string>
|
||||
<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>
|
||||
@ -178,7 +282,15 @@
|
||||
<string><![CDATA[<group>]]></string>
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29213163D300000000</string>
|
||||
<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>
|
||||
@ -211,12 +323,40 @@
|
||||
<string>B401C979909F23CE00000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>E7A30F04213163D300000000</key>
|
||||
<key>E7A30F0405A53BC200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29213163D300000000</string>
|
||||
<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>
|
||||
@ -224,7 +364,11 @@
|
||||
<string>PBXSourcesBuildPhase</string>
|
||||
<key>files</key>
|
||||
<array>
|
||||
<string>E7A30F04213163D300000000</string>
|
||||
<string>E7A30F0405A53BC200000000</string>
|
||||
<string>E7A30F0421C2F78300000000</string>
|
||||
<string>E7A30F04BDC7BBF300000000</string>
|
||||
<string>E7A30F0486AF18EB00000000</string>
|
||||
<string>E7A30F040F1C936700000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>E7A30F04FF334B1F00000000</key>
|
||||
|
41
submodules/QrCode/Sources/BitBuffer.cpp
Executable file
41
submodules/QrCode/Sources/BitBuffer.cpp
Executable file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#include <stdexcept>
|
||||
#include "BitBuffer.hpp"
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
BitBuffer::BitBuffer()
|
||||
: std::vector<bool>() {}
|
||||
|
||||
|
||||
void BitBuffer::appendBits(std::uint32_t val, int len) {
|
||||
if (len < 0 || len > 31 || val >> len != 0)
|
||||
throw std::domain_error("Value out of range");
|
||||
for (int i = len - 1; i >= 0; i--) // Append bit by bit
|
||||
this->push_back(((val >> i) & 1) != 0);
|
||||
}
|
||||
|
||||
}
|
52
submodules/QrCode/Sources/BitBuffer.hpp
Executable file
52
submodules/QrCode/Sources/BitBuffer.hpp
Executable file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
/*
|
||||
* An appendable sequence of bits (0s and 1s). Mainly used by QrSegment.
|
||||
*/
|
||||
class BitBuffer final : public std::vector<bool> {
|
||||
|
||||
/*---- Constructor ----*/
|
||||
|
||||
// Creates an empty bit buffer (length 0).
|
||||
public: BitBuffer();
|
||||
|
||||
|
||||
|
||||
/*---- Method ----*/
|
||||
|
||||
// Appends the given number of low-order bits of the given value
|
||||
// to this buffer. Requires 0 <= len <= 31 and val < 2^len.
|
||||
public: void appendBits(std::uint32_t val, int len);
|
||||
|
||||
};
|
||||
|
||||
}
|
660
submodules/QrCode/Sources/QrCode.cpp
Executable file
660
submodules/QrCode/Sources/QrCode.cpp
Executable file
@ -0,0 +1,660 @@
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
#include "BitBuffer.hpp"
|
||||
#include "QrCode.hpp"
|
||||
|
||||
using std::int8_t;
|
||||
using std::uint8_t;
|
||||
using std::size_t;
|
||||
using std::vector;
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
int QrCode::getFormatBits(Ecc ecl) {
|
||||
switch (ecl) {
|
||||
case Ecc::LOW : return 1;
|
||||
case Ecc::MEDIUM : return 0;
|
||||
case Ecc::QUARTILE: return 3;
|
||||
case Ecc::HIGH : return 2;
|
||||
default: throw std::logic_error("Assertion error");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QrCode QrCode::encodeText(const char *text, Ecc ecl) {
|
||||
vector<QrSegment> segs = QrSegment::makeSegments(text);
|
||||
return encodeSegments(segs, ecl);
|
||||
}
|
||||
|
||||
|
||||
QrCode QrCode::encodeBinary(const vector<uint8_t> &data, Ecc ecl) {
|
||||
vector<QrSegment> segs{QrSegment::makeBytes(data)};
|
||||
return encodeSegments(segs, ecl);
|
||||
}
|
||||
|
||||
|
||||
QrCode QrCode::encodeSegments(const vector<QrSegment> &segs, Ecc ecl,
|
||||
int minVersion, int maxVersion, int mask, bool boostEcl) {
|
||||
if (!(MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= MAX_VERSION) || mask < -1 || mask > 7)
|
||||
throw std::invalid_argument("Invalid value");
|
||||
|
||||
// Find the minimal version number to use
|
||||
int version, dataUsedBits;
|
||||
for (version = minVersion; ; version++) {
|
||||
int dataCapacityBits = getNumDataCodewords(version, ecl) * 8; // Number of data bits available
|
||||
dataUsedBits = QrSegment::getTotalBits(segs, version);
|
||||
if (dataUsedBits != -1 && dataUsedBits <= dataCapacityBits)
|
||||
break; // This version number is found to be suitable
|
||||
if (version >= maxVersion) { // All versions in the range could not fit the given data
|
||||
std::ostringstream sb;
|
||||
if (dataUsedBits == -1)
|
||||
sb << "Segment too long";
|
||||
else {
|
||||
sb << "Data length = " << dataUsedBits << " bits, ";
|
||||
sb << "Max capacity = " << dataCapacityBits << " bits";
|
||||
}
|
||||
throw data_too_long(sb.str());
|
||||
}
|
||||
}
|
||||
if (dataUsedBits == -1)
|
||||
throw std::logic_error("Assertion error");
|
||||
|
||||
// Increase the error correction level while the data still fits in the current version number
|
||||
for (Ecc newEcl : vector<Ecc>{Ecc::MEDIUM, Ecc::QUARTILE, Ecc::HIGH}) { // From low to high
|
||||
if (boostEcl && dataUsedBits <= getNumDataCodewords(version, newEcl) * 8)
|
||||
ecl = newEcl;
|
||||
}
|
||||
|
||||
// Concatenate all segments to create the data bit string
|
||||
BitBuffer bb;
|
||||
for (const QrSegment &seg : segs) {
|
||||
bb.appendBits(static_cast<uint32_t>(seg.getMode().getModeBits()), 4);
|
||||
bb.appendBits(static_cast<uint32_t>(seg.getNumChars()), seg.getMode().numCharCountBits(version));
|
||||
bb.insert(bb.end(), seg.getData().begin(), seg.getData().end());
|
||||
}
|
||||
if (bb.size() != static_cast<unsigned int>(dataUsedBits))
|
||||
throw std::logic_error("Assertion error");
|
||||
|
||||
// Add terminator and pad up to a byte if applicable
|
||||
size_t dataCapacityBits = static_cast<size_t>(getNumDataCodewords(version, ecl)) * 8;
|
||||
if (bb.size() > dataCapacityBits)
|
||||
throw std::logic_error("Assertion error");
|
||||
bb.appendBits(0, std::min(4, static_cast<int>(dataCapacityBits - bb.size())));
|
||||
bb.appendBits(0, (8 - static_cast<int>(bb.size() % 8)) % 8);
|
||||
if (bb.size() % 8 != 0)
|
||||
throw std::logic_error("Assertion error");
|
||||
|
||||
// Pad with alternating bytes until data capacity is reached
|
||||
for (uint8_t padByte = 0xEC; bb.size() < dataCapacityBits; padByte ^= 0xEC ^ 0x11)
|
||||
bb.appendBits(padByte, 8);
|
||||
|
||||
// Pack bits into bytes in big endian
|
||||
vector<uint8_t> dataCodewords(bb.size() / 8);
|
||||
for (size_t i = 0; i < bb.size(); i++)
|
||||
dataCodewords[i >> 3] |= (bb.at(i) ? 1 : 0) << (7 - (i & 7));
|
||||
|
||||
// Create the QR Code object
|
||||
return QrCode(version, ecl, dataCodewords, mask);
|
||||
}
|
||||
|
||||
|
||||
QrCode::QrCode(int ver, Ecc ecl, const vector<uint8_t> &dataCodewords, int mask) :
|
||||
// Initialize fields and check arguments
|
||||
version(ver),
|
||||
errorCorrectionLevel(ecl) {
|
||||
if (ver < MIN_VERSION || ver > MAX_VERSION)
|
||||
throw std::domain_error("Version value out of range");
|
||||
if (mask < -1 || mask > 7)
|
||||
throw std::domain_error("Mask value out of range");
|
||||
size = ver * 4 + 17;
|
||||
size_t sz = static_cast<size_t>(size);
|
||||
modules = vector<vector<bool> >(sz, vector<bool>(sz)); // Initially all white
|
||||
isFunction = vector<vector<bool> >(sz, vector<bool>(sz));
|
||||
|
||||
// Compute ECC, draw modules
|
||||
drawFunctionPatterns();
|
||||
const vector<uint8_t> allCodewords = addEccAndInterleave(dataCodewords);
|
||||
drawCodewords(allCodewords);
|
||||
|
||||
// Do masking
|
||||
if (mask == -1) { // Automatically choose best mask
|
||||
long minPenalty = LONG_MAX;
|
||||
for (int i = 0; i < 8; i++) {
|
||||
applyMask(i);
|
||||
drawFormatBits(i);
|
||||
long penalty = getPenaltyScore();
|
||||
if (penalty < minPenalty) {
|
||||
mask = i;
|
||||
minPenalty = penalty;
|
||||
}
|
||||
applyMask(i); // Undoes the mask due to XOR
|
||||
}
|
||||
}
|
||||
if (mask < 0 || mask > 7)
|
||||
throw std::logic_error("Assertion error");
|
||||
this->mask = mask;
|
||||
applyMask(mask); // Apply the final choice of mask
|
||||
drawFormatBits(mask); // Overwrite old format bits
|
||||
|
||||
isFunction.clear();
|
||||
isFunction.shrink_to_fit();
|
||||
}
|
||||
|
||||
|
||||
int QrCode::getVersion() const {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
int QrCode::getSize() const {
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
QrCode::Ecc QrCode::getErrorCorrectionLevel() const {
|
||||
return errorCorrectionLevel;
|
||||
}
|
||||
|
||||
|
||||
int QrCode::getMask() const {
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
bool QrCode::getModule(int x, int y) const {
|
||||
return 0 <= x && x < size && 0 <= y && y < size && module(x, y);
|
||||
}
|
||||
|
||||
|
||||
std::string QrCode::toSvgString(int border) const {
|
||||
if (border < 0)
|
||||
throw std::domain_error("Border must be non-negative");
|
||||
if (border > INT_MAX / 2 || border * 2 > INT_MAX - size)
|
||||
throw std::overflow_error("Border too large");
|
||||
|
||||
std::ostringstream sb;
|
||||
sb << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||
sb << "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n";
|
||||
sb << "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" viewBox=\"0 0 ";
|
||||
sb << (size + border * 2) << " " << (size + border * 2) << "\" stroke=\"none\">\n";
|
||||
sb << "\t<rect width=\"100%\" height=\"100%\" fill=\"#FFFFFF\"/>\n";
|
||||
sb << "\t<path d=\"";
|
||||
for (int y = 0; y < size; y++) {
|
||||
for (int x = 0; x < size; x++) {
|
||||
if (getModule(x, y)) {
|
||||
if (x != 0 || y != 0)
|
||||
sb << " ";
|
||||
sb << "M" << (x + border) << "," << (y + border) << "h1v1h-1z";
|
||||
}
|
||||
}
|
||||
}
|
||||
sb << "\" fill=\"#000000\"/>\n";
|
||||
sb << "</svg>\n";
|
||||
return sb.str();
|
||||
}
|
||||
|
||||
|
||||
void QrCode::drawFunctionPatterns() {
|
||||
// Draw horizontal and vertical timing patterns
|
||||
for (int i = 0; i < size; i++) {
|
||||
setFunctionModule(6, i, i % 2 == 0);
|
||||
setFunctionModule(i, 6, i % 2 == 0);
|
||||
}
|
||||
|
||||
// Draw 3 finder patterns (all corners except bottom right; overwrites some timing modules)
|
||||
drawFinderPattern(3, 3);
|
||||
drawFinderPattern(size - 4, 3);
|
||||
drawFinderPattern(3, size - 4);
|
||||
|
||||
// Draw numerous alignment patterns
|
||||
const vector<int> alignPatPos = getAlignmentPatternPositions();
|
||||
size_t numAlign = alignPatPos.size();
|
||||
for (size_t i = 0; i < numAlign; i++) {
|
||||
for (size_t j = 0; j < numAlign; j++) {
|
||||
// Don't draw on the three finder corners
|
||||
if (!((i == 0 && j == 0) || (i == 0 && j == numAlign - 1) || (i == numAlign - 1 && j == 0)))
|
||||
drawAlignmentPattern(alignPatPos.at(i), alignPatPos.at(j));
|
||||
}
|
||||
}
|
||||
|
||||
// Draw configuration data
|
||||
drawFormatBits(0); // Dummy mask value; overwritten later in the constructor
|
||||
drawVersion();
|
||||
}
|
||||
|
||||
|
||||
void QrCode::drawFormatBits(int mask) {
|
||||
// Calculate error correction code and pack bits
|
||||
int data = getFormatBits(errorCorrectionLevel) << 3 | mask; // errCorrLvl is uint2, mask is uint3
|
||||
int rem = data;
|
||||
for (int i = 0; i < 10; i++)
|
||||
rem = (rem << 1) ^ ((rem >> 9) * 0x537);
|
||||
int bits = (data << 10 | rem) ^ 0x5412; // uint15
|
||||
if (bits >> 15 != 0)
|
||||
throw std::logic_error("Assertion error");
|
||||
|
||||
// Draw first copy
|
||||
for (int i = 0; i <= 5; i++)
|
||||
setFunctionModule(8, i, getBit(bits, i));
|
||||
setFunctionModule(8, 7, getBit(bits, 6));
|
||||
setFunctionModule(8, 8, getBit(bits, 7));
|
||||
setFunctionModule(7, 8, getBit(bits, 8));
|
||||
for (int i = 9; i < 15; i++)
|
||||
setFunctionModule(14 - i, 8, getBit(bits, i));
|
||||
|
||||
// Draw second copy
|
||||
for (int i = 0; i < 8; i++)
|
||||
setFunctionModule(size - 1 - i, 8, getBit(bits, i));
|
||||
for (int i = 8; i < 15; i++)
|
||||
setFunctionModule(8, size - 15 + i, getBit(bits, i));
|
||||
setFunctionModule(8, size - 8, true); // Always black
|
||||
}
|
||||
|
||||
|
||||
void QrCode::drawVersion() {
|
||||
if (version < 7)
|
||||
return;
|
||||
|
||||
// Calculate error correction code and pack bits
|
||||
int rem = version; // version is uint6, in the range [7, 40]
|
||||
for (int i = 0; i < 12; i++)
|
||||
rem = (rem << 1) ^ ((rem >> 11) * 0x1F25);
|
||||
long bits = static_cast<long>(version) << 12 | rem; // uint18
|
||||
if (bits >> 18 != 0)
|
||||
throw std::logic_error("Assertion error");
|
||||
|
||||
// Draw two copies
|
||||
for (int i = 0; i < 18; i++) {
|
||||
bool bit = getBit(bits, i);
|
||||
int a = size - 11 + i % 3;
|
||||
int b = i / 3;
|
||||
setFunctionModule(a, b, bit);
|
||||
setFunctionModule(b, a, bit);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QrCode::drawFinderPattern(int x, int y) {
|
||||
for (int dy = -4; dy <= 4; dy++) {
|
||||
for (int dx = -4; dx <= 4; dx++) {
|
||||
int dist = std::max(std::abs(dx), std::abs(dy)); // Chebyshev/infinity norm
|
||||
int xx = x + dx, yy = y + dy;
|
||||
if (0 <= xx && xx < size && 0 <= yy && yy < size)
|
||||
setFunctionModule(xx, yy, dist != 2 && dist != 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QrCode::drawAlignmentPattern(int x, int y) {
|
||||
for (int dy = -2; dy <= 2; dy++) {
|
||||
for (int dx = -2; dx <= 2; dx++)
|
||||
setFunctionModule(x + dx, y + dy, std::max(std::abs(dx), std::abs(dy)) != 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void QrCode::setFunctionModule(int x, int y, bool isBlack) {
|
||||
size_t ux = static_cast<size_t>(x);
|
||||
size_t uy = static_cast<size_t>(y);
|
||||
modules .at(uy).at(ux) = isBlack;
|
||||
isFunction.at(uy).at(ux) = true;
|
||||
}
|
||||
|
||||
|
||||
bool QrCode::module(int x, int y) const {
|
||||
return modules.at(static_cast<size_t>(y)).at(static_cast<size_t>(x));
|
||||
}
|
||||
|
||||
|
||||
vector<uint8_t> QrCode::addEccAndInterleave(const vector<uint8_t> &data) const {
|
||||
if (data.size() != static_cast<unsigned int>(getNumDataCodewords(version, errorCorrectionLevel)))
|
||||
throw std::invalid_argument("Invalid argument");
|
||||
|
||||
// Calculate parameter numbers
|
||||
int numBlocks = NUM_ERROR_CORRECTION_BLOCKS[static_cast<int>(errorCorrectionLevel)][version];
|
||||
int blockEccLen = ECC_CODEWORDS_PER_BLOCK [static_cast<int>(errorCorrectionLevel)][version];
|
||||
int rawCodewords = getNumRawDataModules(version) / 8;
|
||||
int numShortBlocks = numBlocks - rawCodewords % numBlocks;
|
||||
int shortBlockLen = rawCodewords / numBlocks;
|
||||
|
||||
// Split data into blocks and append ECC to each block
|
||||
vector<vector<uint8_t> > blocks;
|
||||
const vector<uint8_t> rsDiv = reedSolomonComputeDivisor(blockEccLen);
|
||||
for (int i = 0, k = 0; i < numBlocks; i++) {
|
||||
vector<uint8_t> dat(data.cbegin() + k, data.cbegin() + (k + shortBlockLen - blockEccLen + (i < numShortBlocks ? 0 : 1)));
|
||||
k += static_cast<int>(dat.size());
|
||||
const vector<uint8_t> ecc = reedSolomonComputeRemainder(dat, rsDiv);
|
||||
if (i < numShortBlocks)
|
||||
dat.push_back(0);
|
||||
dat.insert(dat.end(), ecc.cbegin(), ecc.cend());
|
||||
blocks.push_back(std::move(dat));
|
||||
}
|
||||
|
||||
// Interleave (not concatenate) the bytes from every block into a single sequence
|
||||
vector<uint8_t> result;
|
||||
for (size_t i = 0; i < blocks.at(0).size(); i++) {
|
||||
for (size_t j = 0; j < blocks.size(); j++) {
|
||||
// Skip the padding byte in short blocks
|
||||
if (i != static_cast<unsigned int>(shortBlockLen - blockEccLen) || j >= static_cast<unsigned int>(numShortBlocks))
|
||||
result.push_back(blocks.at(j).at(i));
|
||||
}
|
||||
}
|
||||
if (result.size() != static_cast<unsigned int>(rawCodewords))
|
||||
throw std::logic_error("Assertion error");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void QrCode::drawCodewords(const vector<uint8_t> &data) {
|
||||
if (data.size() != static_cast<unsigned int>(getNumRawDataModules(version) / 8))
|
||||
throw std::invalid_argument("Invalid argument");
|
||||
|
||||
size_t i = 0; // Bit index into the data
|
||||
// Do the funny zigzag scan
|
||||
for (int right = size - 1; right >= 1; right -= 2) { // Index of right column in each column pair
|
||||
if (right == 6)
|
||||
right = 5;
|
||||
for (int vert = 0; vert < size; vert++) { // Vertical counter
|
||||
for (int j = 0; j < 2; j++) {
|
||||
size_t x = static_cast<size_t>(right - j); // Actual x coordinate
|
||||
bool upward = ((right + 1) & 2) == 0;
|
||||
size_t y = static_cast<size_t>(upward ? size - 1 - vert : vert); // Actual y coordinate
|
||||
if (!isFunction.at(y).at(x) && i < data.size() * 8) {
|
||||
modules.at(y).at(x) = getBit(data.at(i >> 3), 7 - static_cast<int>(i & 7));
|
||||
i++;
|
||||
}
|
||||
// If this QR Code has any remainder bits (0 to 7), they were assigned as
|
||||
// 0/false/white by the constructor and are left unchanged by this method
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i != data.size() * 8)
|
||||
throw std::logic_error("Assertion error");
|
||||
}
|
||||
|
||||
|
||||
void QrCode::applyMask(int mask) {
|
||||
if (mask < 0 || mask > 7)
|
||||
throw std::domain_error("Mask value out of range");
|
||||
size_t sz = static_cast<size_t>(size);
|
||||
for (size_t y = 0; y < sz; y++) {
|
||||
for (size_t x = 0; x < sz; x++) {
|
||||
bool invert;
|
||||
switch (mask) {
|
||||
case 0: invert = (x + y) % 2 == 0; break;
|
||||
case 1: invert = y % 2 == 0; break;
|
||||
case 2: invert = x % 3 == 0; break;
|
||||
case 3: invert = (x + y) % 3 == 0; break;
|
||||
case 4: invert = (x / 3 + y / 2) % 2 == 0; break;
|
||||
case 5: invert = x * y % 2 + x * y % 3 == 0; break;
|
||||
case 6: invert = (x * y % 2 + x * y % 3) % 2 == 0; break;
|
||||
case 7: invert = ((x + y) % 2 + x * y % 3) % 2 == 0; break;
|
||||
default: throw std::logic_error("Assertion error");
|
||||
}
|
||||
modules.at(y).at(x) = modules.at(y).at(x) ^ (invert & !isFunction.at(y).at(x));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long QrCode::getPenaltyScore() const {
|
||||
long result = 0;
|
||||
|
||||
// Adjacent modules in row having same color, and finder-like patterns
|
||||
for (int y = 0; y < size; y++) {
|
||||
bool runColor = false;
|
||||
int runX = 0;
|
||||
std::array<int,7> runHistory = {};
|
||||
int padRun = size; // Add white border to initial run
|
||||
for (int x = 0; x < size; x++) {
|
||||
if (module(x, y) == runColor) {
|
||||
runX++;
|
||||
if (runX == 5)
|
||||
result += PENALTY_N1;
|
||||
else if (runX > 5)
|
||||
result++;
|
||||
} else {
|
||||
finderPenaltyAddHistory(runX + padRun, runHistory);
|
||||
padRun = 0;
|
||||
if (!runColor)
|
||||
result += finderPenaltyCountPatterns(runHistory) * PENALTY_N3;
|
||||
runColor = module(x, y);
|
||||
runX = 1;
|
||||
}
|
||||
}
|
||||
result += finderPenaltyTerminateAndCount(runColor, runX + padRun, runHistory) * PENALTY_N3;
|
||||
}
|
||||
// Adjacent modules in column having same color, and finder-like patterns
|
||||
for (int x = 0; x < size; x++) {
|
||||
bool runColor = false;
|
||||
int runY = 0;
|
||||
std::array<int,7> runHistory = {};
|
||||
int padRun = size; // Add white border to initial run
|
||||
for (int y = 0; y < size; y++) {
|
||||
if (module(x, y) == runColor) {
|
||||
runY++;
|
||||
if (runY == 5)
|
||||
result += PENALTY_N1;
|
||||
else if (runY > 5)
|
||||
result++;
|
||||
} else {
|
||||
finderPenaltyAddHistory(runY + padRun, runHistory);
|
||||
padRun = 0;
|
||||
if (!runColor)
|
||||
result += finderPenaltyCountPatterns(runHistory) * PENALTY_N3;
|
||||
runColor = module(x, y);
|
||||
runY = 1;
|
||||
}
|
||||
}
|
||||
result += finderPenaltyTerminateAndCount(runColor, runY + padRun, runHistory) * PENALTY_N3;
|
||||
}
|
||||
|
||||
// 2*2 blocks of modules having same color
|
||||
for (int y = 0; y < size - 1; y++) {
|
||||
for (int x = 0; x < size - 1; x++) {
|
||||
bool color = module(x, y);
|
||||
if ( color == module(x + 1, y) &&
|
||||
color == module(x, y + 1) &&
|
||||
color == module(x + 1, y + 1))
|
||||
result += PENALTY_N2;
|
||||
}
|
||||
}
|
||||
|
||||
// Balance of black and white modules
|
||||
int black = 0;
|
||||
for (const vector<bool> &row : modules) {
|
||||
for (bool color : row) {
|
||||
if (color)
|
||||
black++;
|
||||
}
|
||||
}
|
||||
int total = size * size; // Note that size is odd, so black/total != 1/2
|
||||
// Compute the smallest integer k >= 0 such that (45-5k)% <= black/total <= (55+5k)%
|
||||
int k = static_cast<int>((std::abs(black * 20L - total * 10L) + total - 1) / total) - 1;
|
||||
result += k * PENALTY_N4;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
vector<int> QrCode::getAlignmentPatternPositions() const {
|
||||
if (version == 1)
|
||||
return vector<int>();
|
||||
else {
|
||||
int numAlign = version / 7 + 2;
|
||||
int step = (version == 32) ? 26 :
|
||||
(version*4 + numAlign*2 + 1) / (numAlign*2 - 2) * 2;
|
||||
vector<int> result;
|
||||
for (int i = 0, pos = size - 7; i < numAlign - 1; i++, pos -= step)
|
||||
result.insert(result.begin(), pos);
|
||||
result.insert(result.begin(), 6);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int QrCode::getNumRawDataModules(int ver) {
|
||||
if (ver < MIN_VERSION || ver > MAX_VERSION)
|
||||
throw std::domain_error("Version number out of range");
|
||||
int result = (16 * ver + 128) * ver + 64;
|
||||
if (ver >= 2) {
|
||||
int numAlign = ver / 7 + 2;
|
||||
result -= (25 * numAlign - 10) * numAlign - 55;
|
||||
if (ver >= 7)
|
||||
result -= 36;
|
||||
}
|
||||
if (!(208 <= result && result <= 29648))
|
||||
throw std::logic_error("Assertion error");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int QrCode::getNumDataCodewords(int ver, Ecc ecl) {
|
||||
return getNumRawDataModules(ver) / 8
|
||||
- ECC_CODEWORDS_PER_BLOCK [static_cast<int>(ecl)][ver]
|
||||
* NUM_ERROR_CORRECTION_BLOCKS[static_cast<int>(ecl)][ver];
|
||||
}
|
||||
|
||||
|
||||
vector<uint8_t> QrCode::reedSolomonComputeDivisor(int degree) {
|
||||
if (degree < 1 || degree > 255)
|
||||
throw std::domain_error("Degree out of range");
|
||||
// Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1.
|
||||
// For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}.
|
||||
vector<uint8_t> result(static_cast<size_t>(degree));
|
||||
result.at(result.size() - 1) = 1; // Start off with the monomial x^0
|
||||
|
||||
// Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),
|
||||
// and drop the highest monomial term which is always 1x^degree.
|
||||
// Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
|
||||
uint8_t root = 1;
|
||||
for (int i = 0; i < degree; i++) {
|
||||
// Multiply the current product by (x - r^i)
|
||||
for (size_t j = 0; j < result.size(); j++) {
|
||||
result.at(j) = reedSolomonMultiply(result.at(j), root);
|
||||
if (j + 1 < result.size())
|
||||
result.at(j) ^= result.at(j + 1);
|
||||
}
|
||||
root = reedSolomonMultiply(root, 0x02);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
vector<uint8_t> QrCode::reedSolomonComputeRemainder(const vector<uint8_t> &data, const vector<uint8_t> &divisor) {
|
||||
vector<uint8_t> result(divisor.size());
|
||||
for (uint8_t b : data) { // Polynomial division
|
||||
uint8_t factor = b ^ result.at(0);
|
||||
result.erase(result.begin());
|
||||
result.push_back(0);
|
||||
for (size_t i = 0; i < result.size(); i++)
|
||||
result.at(i) ^= reedSolomonMultiply(divisor.at(i), factor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
uint8_t QrCode::reedSolomonMultiply(uint8_t x, uint8_t y) {
|
||||
// Russian peasant multiplication
|
||||
int z = 0;
|
||||
for (int i = 7; i >= 0; i--) {
|
||||
z = (z << 1) ^ ((z >> 7) * 0x11D);
|
||||
z ^= ((y >> i) & 1) * x;
|
||||
}
|
||||
if (z >> 8 != 0)
|
||||
throw std::logic_error("Assertion error");
|
||||
return static_cast<uint8_t>(z);
|
||||
}
|
||||
|
||||
|
||||
int QrCode::finderPenaltyCountPatterns(const std::array<int,7> &runHistory) const {
|
||||
int n = runHistory.at(1);
|
||||
if (n > size * 3)
|
||||
throw std::logic_error("Assertion error");
|
||||
bool core = n > 0 && runHistory.at(2) == n && runHistory.at(3) == n * 3 && runHistory.at(4) == n && runHistory.at(5) == n;
|
||||
return (core && runHistory.at(0) >= n * 4 && runHistory.at(6) >= n ? 1 : 0)
|
||||
+ (core && runHistory.at(6) >= n * 4 && runHistory.at(0) >= n ? 1 : 0);
|
||||
}
|
||||
|
||||
|
||||
int QrCode::finderPenaltyTerminateAndCount(bool currentRunColor, int currentRunLength, std::array<int,7> &runHistory) const {
|
||||
if (currentRunColor) { // Terminate black run
|
||||
finderPenaltyAddHistory(currentRunLength, runHistory);
|
||||
currentRunLength = 0;
|
||||
}
|
||||
currentRunLength += size; // Add white border to final run
|
||||
finderPenaltyAddHistory(currentRunLength, runHistory);
|
||||
return finderPenaltyCountPatterns(runHistory);
|
||||
}
|
||||
|
||||
|
||||
void QrCode::finderPenaltyAddHistory(int currentRunLength, std::array<int,7> &runHistory) {
|
||||
std::copy_backward(runHistory.cbegin(), runHistory.cend() - 1, runHistory.end());
|
||||
runHistory.at(0) = currentRunLength;
|
||||
}
|
||||
|
||||
|
||||
bool QrCode::getBit(long x, int i) {
|
||||
return ((x >> i) & 1) != 0;
|
||||
}
|
||||
|
||||
|
||||
/*---- Tables of constants ----*/
|
||||
|
||||
const int QrCode::PENALTY_N1 = 3;
|
||||
const int QrCode::PENALTY_N2 = 3;
|
||||
const int QrCode::PENALTY_N3 = 40;
|
||||
const int QrCode::PENALTY_N4 = 10;
|
||||
|
||||
|
||||
const int8_t QrCode::ECC_CODEWORDS_PER_BLOCK[4][41] = {
|
||||
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
||||
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
||||
{-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30}, // Low
|
||||
{-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28}, // Medium
|
||||
{-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30}, // Quartile
|
||||
{-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30}, // High
|
||||
};
|
||||
|
||||
const int8_t QrCode::NUM_ERROR_CORRECTION_BLOCKS[4][41] = {
|
||||
// Version: (note that index 0 is for padding, and is set to an illegal value)
|
||||
//0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 Error correction level
|
||||
{-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25}, // Low
|
||||
{-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49}, // Medium
|
||||
{-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68}, // Quartile
|
||||
{-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81}, // High
|
||||
};
|
||||
|
||||
|
||||
data_too_long::data_too_long(const std::string &msg) :
|
||||
std::length_error(msg) {}
|
||||
|
||||
}
|
350
submodules/QrCode/Sources/QrCode.hpp
Executable file
350
submodules/QrCode/Sources/QrCode.hpp
Executable file
@ -0,0 +1,350 @@
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "QrSegment.hpp"
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
/*
|
||||
* A QR Code symbol, which is a type of two-dimension barcode.
|
||||
* Invented by Denso Wave and described in the ISO/IEC 18004 standard.
|
||||
* Instances of this class represent an immutable square grid of black and white cells.
|
||||
* The class provides static factory functions to create a QR Code from text or binary data.
|
||||
* The class covers the QR Code Model 2 specification, supporting all versions (sizes)
|
||||
* from 1 to 40, all 4 error correction levels, and 4 character encoding modes.
|
||||
*
|
||||
* Ways to create a QR Code object:
|
||||
* - High level: Take the payload data and call QrCode::encodeText() or QrCode::encodeBinary().
|
||||
* - Mid level: Custom-make the list of segments and call QrCode::encodeSegments().
|
||||
* - Low level: Custom-make the array of data codeword bytes (including
|
||||
* segment headers and final padding, excluding error correction codewords),
|
||||
* supply the appropriate version number, and call the QrCode() constructor.
|
||||
* (Note that all ways require supplying the desired error correction level.)
|
||||
*/
|
||||
class QrCode final {
|
||||
|
||||
/*---- Public helper enumeration ----*/
|
||||
|
||||
/*
|
||||
* The error correction level in a QR Code symbol.
|
||||
*/
|
||||
public: enum class Ecc {
|
||||
LOW = 0 , // The QR Code can tolerate about 7% erroneous codewords
|
||||
MEDIUM , // The QR Code can tolerate about 15% erroneous codewords
|
||||
QUARTILE, // The QR Code can tolerate about 25% erroneous codewords
|
||||
HIGH , // The QR Code can tolerate about 30% erroneous codewords
|
||||
};
|
||||
|
||||
|
||||
// Returns a value in the range 0 to 3 (unsigned 2-bit integer).
|
||||
private: static int getFormatBits(Ecc ecl);
|
||||
|
||||
|
||||
|
||||
/*---- Static factory functions (high level) ----*/
|
||||
|
||||
/*
|
||||
* Returns a QR Code representing the given Unicode text string at the given error correction level.
|
||||
* As a conservative upper bound, this function is guaranteed to succeed for strings that have 2953 or fewer
|
||||
* UTF-8 code units (not Unicode code points) if the low error correction level is used. The smallest possible
|
||||
* QR Code version is automatically chosen for the output. The ECC level of the result may be higher than
|
||||
* the ecl argument if it can be done without increasing the version.
|
||||
*/
|
||||
public: static QrCode encodeText(const char *text, Ecc ecl);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a QR Code representing the given binary data at the given error correction level.
|
||||
* This function always encodes using the binary segment mode, not any text mode. The maximum number of
|
||||
* bytes allowed is 2953. The smallest possible QR Code version is automatically chosen for the output.
|
||||
* The ECC level of the result may be higher than the ecl argument if it can be done without increasing the version.
|
||||
*/
|
||||
public: static QrCode encodeBinary(const std::vector<std::uint8_t> &data, Ecc ecl);
|
||||
|
||||
|
||||
/*---- Static factory functions (mid level) ----*/
|
||||
|
||||
/*
|
||||
* Returns a QR Code representing the given segments with the given encoding parameters.
|
||||
* The smallest possible QR Code version within the given range is automatically
|
||||
* chosen for the output. Iff boostEcl is true, then the ECC level of the result
|
||||
* may be higher than the ecl argument if it can be done without increasing the
|
||||
* version. The mask number is either between 0 to 7 (inclusive) to force that
|
||||
* mask, or -1 to automatically choose an appropriate mask (which may be slow).
|
||||
* This function allows the user to create a custom sequence of segments that switches
|
||||
* between modes (such as alphanumeric and byte) to encode text in less space.
|
||||
* This is a mid-level API; the high-level API is encodeText() and encodeBinary().
|
||||
*/
|
||||
public: static QrCode encodeSegments(const std::vector<QrSegment> &segs, Ecc ecl,
|
||||
int minVersion=1, int maxVersion=40, int mask=-1, bool boostEcl=true); // All optional parameters
|
||||
|
||||
|
||||
|
||||
/*---- Instance fields ----*/
|
||||
|
||||
// Immutable scalar parameters:
|
||||
|
||||
/* The version number of this QR Code, which is between 1 and 40 (inclusive).
|
||||
* This determines the size of this barcode. */
|
||||
private: int version;
|
||||
|
||||
/* The width and height of this QR Code, measured in modules, between
|
||||
* 21 and 177 (inclusive). This is equal to version * 4 + 17. */
|
||||
private: int size;
|
||||
|
||||
/* The error correction level used in this QR Code. */
|
||||
private: Ecc errorCorrectionLevel;
|
||||
|
||||
/* The index of the mask pattern used in this QR Code, which is between 0 and 7 (inclusive).
|
||||
* Even if a QR Code is created with automatic masking requested (mask = -1),
|
||||
* the resulting object still has a mask value between 0 and 7. */
|
||||
private: int mask;
|
||||
|
||||
// Private grids of modules/pixels, with dimensions of size*size:
|
||||
|
||||
// The modules of this QR Code (false = white, true = black).
|
||||
// Immutable after constructor finishes. Accessed through getModule().
|
||||
private: std::vector<std::vector<bool> > modules;
|
||||
|
||||
// Indicates function modules that are not subjected to masking. Discarded when constructor finishes.
|
||||
private: std::vector<std::vector<bool> > isFunction;
|
||||
|
||||
|
||||
|
||||
/*---- Constructor (low level) ----*/
|
||||
|
||||
/*
|
||||
* Creates a new QR Code with the given version number,
|
||||
* error correction level, data codeword bytes, and mask number.
|
||||
* This is a low-level API that most users should not use directly.
|
||||
* A mid-level API is the encodeSegments() function.
|
||||
*/
|
||||
public: QrCode(int ver, Ecc ecl, const std::vector<std::uint8_t> &dataCodewords, int mask);
|
||||
|
||||
|
||||
|
||||
/*---- Public instance methods ----*/
|
||||
|
||||
/*
|
||||
* Returns this QR Code's version, in the range [1, 40].
|
||||
*/
|
||||
public: int getVersion() const;
|
||||
|
||||
|
||||
/*
|
||||
* Returns this QR Code's size, in the range [21, 177].
|
||||
*/
|
||||
public: int getSize() const;
|
||||
|
||||
|
||||
/*
|
||||
* Returns this QR Code's error correction level.
|
||||
*/
|
||||
public: Ecc getErrorCorrectionLevel() const;
|
||||
|
||||
|
||||
/*
|
||||
* Returns this QR Code's mask, in the range [0, 7].
|
||||
*/
|
||||
public: int getMask() const;
|
||||
|
||||
|
||||
/*
|
||||
* Returns the color of the module (pixel) at the given coordinates, which is false
|
||||
* for white or true for black. The top left corner has the coordinates (x=0, y=0).
|
||||
* If the given coordinates are out of bounds, then false (white) is returned.
|
||||
*/
|
||||
public: bool getModule(int x, int y) const;
|
||||
|
||||
|
||||
/*
|
||||
* Returns a string of SVG code for an image depicting this QR Code, with the given number
|
||||
* of border modules. The string always uses Unix newlines (\n), regardless of the platform.
|
||||
*/
|
||||
public: std::string toSvgString(int border) const;
|
||||
|
||||
|
||||
|
||||
/*---- Private helper methods for constructor: Drawing function modules ----*/
|
||||
|
||||
// Reads this object's version field, and draws and marks all function modules.
|
||||
private: void drawFunctionPatterns();
|
||||
|
||||
|
||||
// Draws two copies of the format bits (with its own error correction code)
|
||||
// based on the given mask and this object's error correction level field.
|
||||
private: void drawFormatBits(int mask);
|
||||
|
||||
|
||||
// Draws two copies of the version bits (with its own error correction code),
|
||||
// based on this object's version field, iff 7 <= version <= 40.
|
||||
private: void drawVersion();
|
||||
|
||||
|
||||
// Draws a 9*9 finder pattern including the border separator,
|
||||
// with the center module at (x, y). Modules can be out of bounds.
|
||||
private: void drawFinderPattern(int x, int y);
|
||||
|
||||
|
||||
// Draws a 5*5 alignment pattern, with the center module
|
||||
// at (x, y). All modules must be in bounds.
|
||||
private: void drawAlignmentPattern(int x, int y);
|
||||
|
||||
|
||||
// Sets the color of a module and marks it as a function module.
|
||||
// Only used by the constructor. Coordinates must be in bounds.
|
||||
private: void setFunctionModule(int x, int y, bool isBlack);
|
||||
|
||||
|
||||
// Returns the color of the module at the given coordinates, which must be in range.
|
||||
private: bool module(int x, int y) const;
|
||||
|
||||
|
||||
/*---- Private helper methods for constructor: Codewords and masking ----*/
|
||||
|
||||
// Returns a new byte string representing the given data with the appropriate error correction
|
||||
// codewords appended to it, based on this object's version and error correction level.
|
||||
private: std::vector<std::uint8_t> addEccAndInterleave(const std::vector<std::uint8_t> &data) const;
|
||||
|
||||
|
||||
// Draws the given sequence of 8-bit codewords (data and error correction) onto the entire
|
||||
// data area of this QR Code. Function modules need to be marked off before this is called.
|
||||
private: void drawCodewords(const std::vector<std::uint8_t> &data);
|
||||
|
||||
|
||||
// XORs the codeword modules in this QR Code with the given mask pattern.
|
||||
// The function modules must be marked and the codeword bits must be drawn
|
||||
// before masking. Due to the arithmetic of XOR, calling applyMask() with
|
||||
// the same mask value a second time will undo the mask. A final well-formed
|
||||
// QR Code needs exactly one (not zero, two, etc.) mask applied.
|
||||
private: void applyMask(int mask);
|
||||
|
||||
|
||||
// Calculates and returns the penalty score based on state of this QR Code's current modules.
|
||||
// This is used by the automatic mask choice algorithm to find the mask pattern that yields the lowest score.
|
||||
private: long getPenaltyScore() const;
|
||||
|
||||
|
||||
|
||||
/*---- Private helper functions ----*/
|
||||
|
||||
// Returns an ascending list of positions of alignment patterns for this version number.
|
||||
// Each position is in the range [0,177), and are used on both the x and y axes.
|
||||
// This could be implemented as lookup table of 40 variable-length lists of unsigned bytes.
|
||||
private: std::vector<int> getAlignmentPatternPositions() const;
|
||||
|
||||
|
||||
// Returns the number of data bits that can be stored in a QR Code of the given version number, after
|
||||
// all function modules are excluded. This includes remainder bits, so it might not be a multiple of 8.
|
||||
// The result is in the range [208, 29648]. This could be implemented as a 40-entry lookup table.
|
||||
private: static int getNumRawDataModules(int ver);
|
||||
|
||||
|
||||
// Returns the number of 8-bit data (i.e. not error correction) codewords contained in any
|
||||
// QR Code of the given version number and error correction level, with remainder bits discarded.
|
||||
// This stateless pure function could be implemented as a (40*4)-cell lookup table.
|
||||
private: static int getNumDataCodewords(int ver, Ecc ecl);
|
||||
|
||||
|
||||
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
|
||||
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
|
||||
private: static std::vector<std::uint8_t> reedSolomonComputeDivisor(int degree);
|
||||
|
||||
|
||||
// Returns the Reed-Solomon error correction codeword for the given data and divisor polynomials.
|
||||
private: static std::vector<std::uint8_t> reedSolomonComputeRemainder(const std::vector<std::uint8_t> &data, const std::vector<std::uint8_t> &divisor);
|
||||
|
||||
|
||||
// Returns the product of the two given field elements modulo GF(2^8/0x11D).
|
||||
// All inputs are valid. This could be implemented as a 256*256 lookup table.
|
||||
private: static std::uint8_t reedSolomonMultiply(std::uint8_t x, std::uint8_t y);
|
||||
|
||||
|
||||
// Can only be called immediately after a white run is added, and
|
||||
// returns either 0, 1, or 2. A helper function for getPenaltyScore().
|
||||
private: int finderPenaltyCountPatterns(const std::array<int,7> &runHistory) const;
|
||||
|
||||
|
||||
// Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
|
||||
private: int finderPenaltyTerminateAndCount(bool currentRunColor, int currentRunLength, std::array<int,7> &runHistory) const;
|
||||
|
||||
|
||||
// Pushes the given value to the front and drops the last value. A helper function for getPenaltyScore().
|
||||
private: static void finderPenaltyAddHistory(int currentRunLength, std::array<int,7> &runHistory);
|
||||
|
||||
|
||||
// Returns true iff the i'th bit of x is set to 1.
|
||||
private: static bool getBit(long x, int i);
|
||||
|
||||
|
||||
/*---- Constants and tables ----*/
|
||||
|
||||
// The minimum version number supported in the QR Code Model 2 standard.
|
||||
public: static constexpr int MIN_VERSION = 1;
|
||||
|
||||
// The maximum version number supported in the QR Code Model 2 standard.
|
||||
public: static constexpr int MAX_VERSION = 40;
|
||||
|
||||
|
||||
// For use in getPenaltyScore(), when evaluating which mask is best.
|
||||
private: static const int PENALTY_N1;
|
||||
private: static const int PENALTY_N2;
|
||||
private: static const int PENALTY_N3;
|
||||
private: static const int PENALTY_N4;
|
||||
|
||||
|
||||
private: static const std::int8_t ECC_CODEWORDS_PER_BLOCK[4][41];
|
||||
private: static const std::int8_t NUM_ERROR_CORRECTION_BLOCKS[4][41];
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---- Public exception class ----*/
|
||||
|
||||
/*
|
||||
* Thrown when the supplied data does not fit any QR Code version. Ways to handle this exception include:
|
||||
* - Decrease the error correction level if it was greater than Ecc::LOW.
|
||||
* - If the encodeSegments() function was called with a maxVersion argument, then increase
|
||||
* it if it was less than QrCode::MAX_VERSION. (This advice does not apply to the other
|
||||
* factory functions because they search all versions up to QrCode::MAX_VERSION.)
|
||||
* - Split the text data into better or optimal segments in order to reduce the number of bits required.
|
||||
* - Change the text or binary data to be shorter.
|
||||
* - Change the text to fit the character set of a particular segment mode (e.g. alphanumeric).
|
||||
* - Propagate the error upward to the caller/user.
|
||||
*/
|
||||
class data_too_long : public std::length_error {
|
||||
|
||||
public: explicit data_too_long(const std::string &msg);
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -4,11 +4,17 @@ import CoreImage
|
||||
import SwiftSignalKit
|
||||
import Display
|
||||
|
||||
public func qrCode(string: String, color: UIColor, backgroundColor: UIColor? = nil, scale: CGFloat = 0.0) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
|
||||
public enum QrCodeIcon {
|
||||
case none
|
||||
case proxy
|
||||
case custom(UIImage?)
|
||||
}
|
||||
|
||||
public func qrCode(string: String, color: UIColor, backgroundColor: UIColor? = nil, icon: QrCodeIcon, ecl: String = "M", scale: CGFloat = 0.0) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
|
||||
return Signal<CIImage, NoError> { subscriber in
|
||||
if let data = string.data(using: .isoLatin1, allowLossyConversion: false), let filter = CIFilter(name: "CIQRCodeGenerator") {
|
||||
filter.setValue(data, forKey: "inputMessage")
|
||||
filter.setValue("M", forKey: "inputCorrectionLevel")
|
||||
filter.setValue(ecl, forKey: "inputCorrectionLevel")
|
||||
|
||||
if let output = filter.outputImage {
|
||||
subscriber.putNext(output)
|
||||
@ -67,28 +73,50 @@ public func qrCode(string: String, color: UIColor, backgroundColor: UIColor? = n
|
||||
}
|
||||
|
||||
let clipSide = 81.0 * fittedRect.width / 267.0 * codeScale
|
||||
c.fill(CGRect(x: fittedRect.midX - clipSide / 2.0, y: fittedRect.midY - clipSide / 2.0, width: clipSide, height: clipSide))
|
||||
c.setBlendMode(.normal)
|
||||
|
||||
let iconScale = fittedRect.width / 308.0 * codeScale
|
||||
let iconSize = CGSize(width: 65.0 * iconScale, height: 79.0 * iconScale)
|
||||
let point = CGPoint(x: fittedRect.midX - iconSize.width / 2.0, y: fittedRect.midY - iconSize.height / 2.0)
|
||||
c.translateBy(x: point.x, y: point.y)
|
||||
c.scaleBy(x: iconScale, y: iconScale)
|
||||
c.setFillColor(color.cgColor)
|
||||
let _ = try? drawSvgPath(c, path: "M0.0,40 C0,20.3664202 20.1230605,0.0 32.5,0.0 C44.8769395,0.0 65,20.3664202 65,40 C65,47.217934 65,55.5505326 65,64.9977957 L32.5,79 L0.0,64.9977957 C0.0,55.0825772 0.0,46.7499786 0.0,40 Z")
|
||||
|
||||
if let backgroundColor = backgroundColor {
|
||||
c.setFillColor(backgroundColor.cgColor)
|
||||
} else {
|
||||
c.setBlendMode(.clear)
|
||||
c.setFillColor(UIColor.clear.cgColor)
|
||||
let clipRect = CGRect(x: fittedRect.midX - clipSide / 2.0, y: fittedRect.midY - clipSide / 2.0, width: clipSide, height: clipSide)
|
||||
switch icon {
|
||||
case .proxy, .custom:
|
||||
c.fill(clipRect)
|
||||
default:
|
||||
break
|
||||
}
|
||||
let _ = try? drawSvgPath(c, path: "M7.03608247,43.556701 L18.9836689,32.8350515 L32.5,39.871134 L45.8888139,32.8350515 L57.9639175,43.556701 L57.9639175,60.0 L32.5,71.0 L7.03608247,60.0 Z")
|
||||
|
||||
|
||||
c.setBlendMode(.normal)
|
||||
c.setFillColor(color.cgColor)
|
||||
let _ = try? drawSvgPath(c, path: "M24.1237113,50.5927835 L40.8762887,50.5927835 L40.8762887,60.9793814 L32.5,64.0928525 L24.1237113,60.9793814 Z")
|
||||
|
||||
switch icon {
|
||||
case .proxy:
|
||||
let iconScale = fittedRect.width / 308.0 * codeScale
|
||||
let iconSize = CGSize(width: 65.0 * iconScale, height: 79.0 * iconScale)
|
||||
let point = CGPoint(x: fittedRect.midX - iconSize.width / 2.0, y: fittedRect.midY - iconSize.height / 2.0)
|
||||
c.translateBy(x: point.x, y: point.y)
|
||||
c.scaleBy(x: iconScale, y: iconScale)
|
||||
c.setFillColor(color.cgColor)
|
||||
let _ = try? drawSvgPath(c, path: "M0.0,40 C0,20.3664202 20.1230605,0.0 32.5,0.0 C44.8769395,0.0 65,20.3664202 65,40 C65,47.217934 65,55.5505326 65,64.9977957 L32.5,79 L0.0,64.9977957 C0.0,55.0825772 0.0,46.7499786 0.0,40 Z")
|
||||
|
||||
if let backgroundColor = backgroundColor {
|
||||
c.setFillColor(backgroundColor.cgColor)
|
||||
} else {
|
||||
c.setBlendMode(.clear)
|
||||
c.setFillColor(UIColor.clear.cgColor)
|
||||
}
|
||||
let _ = try? drawSvgPath(c, path: "M7.03608247,43.556701 L18.9836689,32.8350515 L32.5,39.871134 L45.8888139,32.8350515 L57.9639175,43.556701 L57.9639175,60.0 L32.5,71.0 L7.03608247,60.0 Z")
|
||||
|
||||
c.setBlendMode(.normal)
|
||||
c.setFillColor(color.cgColor)
|
||||
let _ = try? drawSvgPath(c, path: "M24.1237113,50.5927835 L40.8762887,50.5927835 L40.8762887,60.9793814 L32.5,64.0928525 L24.1237113,60.9793814 Z")
|
||||
case let .custom(image):
|
||||
if let image = image {
|
||||
let fittedSize = image.size.fitted(clipRect.size)
|
||||
let fittedRect = CGRect(origin: CGPoint(x: fittedRect.midX - fittedSize.width / 2.0, y: fittedRect.midY - fittedSize.height / 2.0), size: fittedSize)
|
||||
c.translateBy(x: fittedRect.midX, y: fittedRect.midY)
|
||||
c.scaleBy(x: 1.0, y: -1.0)
|
||||
c.translateBy(x: -fittedRect.midX, y: -fittedRect.midY)
|
||||
c.draw(image.cgImage!, in: fittedRect)
|
||||
}
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
}
|
||||
return context
|
||||
}
|
18
submodules/QrCode/Sources/QrCodeInstance.h
Executable file
18
submodules/QrCode/Sources/QrCodeInstance.h
Executable file
@ -0,0 +1,18 @@
|
||||
#ifndef QrCodeInstance_h
|
||||
#define QrCodeInstance_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
@interface QrCodeInstance : NSObject
|
||||
|
||||
@property (nonatomic, readonly) NSString *string;
|
||||
@property (nonatomic, readonly) int32_t size;
|
||||
|
||||
- (instancetype _Nullable)initWithStirng:(NSString * _Nonnull)string;
|
||||
|
||||
- (BOOL)getModuleAtX:(int32_t)x y:(int32_t)y;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* QrCodeInstance_h */
|
28
submodules/QrCode/Sources/QrCodeInstance.mm
Executable file
28
submodules/QrCode/Sources/QrCodeInstance.mm
Executable file
@ -0,0 +1,28 @@
|
||||
#import "QrCodeInstance.h"
|
||||
|
||||
#include "QrCode.hpp"
|
||||
|
||||
@interface QrCodeInstance () {
|
||||
std::unique_ptr<qrcodegen::QrCode> _qrCode;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation QrCodeInstance
|
||||
|
||||
- (instancetype _Nullable)initWithStirng:(NSString * _Nonnull)string {
|
||||
self = [super init];
|
||||
if (self != nil) {
|
||||
_qrCode = std::make_unique<qrcodegen::QrCode>(qrcodegen::QrCode::encodeText(string.UTF8String, qrcodegen::QrCode::Ecc::MEDIUM));
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (int32_t)size {
|
||||
return _qrCode->getSize()
|
||||
}
|
||||
|
||||
- (BOOL)getModuleAtX:(int32_t)x y:(int32_t)y {
|
||||
return _qrCode->getModule(x, y);
|
||||
}
|
||||
|
||||
@end
|
225
submodules/QrCode/Sources/QrSegment.cpp
Executable file
225
submodules/QrCode/Sources/QrSegment.cpp
Executable file
@ -0,0 +1,225 @@
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#include <climits>
|
||||
#include <cstring>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
#include "QrSegment.hpp"
|
||||
|
||||
using std::uint8_t;
|
||||
using std::vector;
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
QrSegment::Mode::Mode(int mode, int cc0, int cc1, int cc2) :
|
||||
modeBits(mode) {
|
||||
numBitsCharCount[0] = cc0;
|
||||
numBitsCharCount[1] = cc1;
|
||||
numBitsCharCount[2] = cc2;
|
||||
}
|
||||
|
||||
|
||||
int QrSegment::Mode::getModeBits() const {
|
||||
return modeBits;
|
||||
}
|
||||
|
||||
|
||||
int QrSegment::Mode::numCharCountBits(int ver) const {
|
||||
return numBitsCharCount[(ver + 7) / 17];
|
||||
}
|
||||
|
||||
|
||||
const QrSegment::Mode QrSegment::Mode::NUMERIC (0x1, 10, 12, 14);
|
||||
const QrSegment::Mode QrSegment::Mode::ALPHANUMERIC(0x2, 9, 11, 13);
|
||||
const QrSegment::Mode QrSegment::Mode::BYTE (0x4, 8, 16, 16);
|
||||
const QrSegment::Mode QrSegment::Mode::KANJI (0x8, 8, 10, 12);
|
||||
const QrSegment::Mode QrSegment::Mode::ECI (0x7, 0, 0, 0);
|
||||
|
||||
|
||||
|
||||
QrSegment QrSegment::makeBytes(const vector<uint8_t> &data) {
|
||||
if (data.size() > static_cast<unsigned int>(INT_MAX))
|
||||
throw std::length_error("Data too long");
|
||||
BitBuffer bb;
|
||||
for (uint8_t b : data)
|
||||
bb.appendBits(b, 8);
|
||||
return QrSegment(Mode::BYTE, static_cast<int>(data.size()), std::move(bb));
|
||||
}
|
||||
|
||||
|
||||
QrSegment QrSegment::makeNumeric(const char *digits) {
|
||||
BitBuffer bb;
|
||||
int accumData = 0;
|
||||
int accumCount = 0;
|
||||
int charCount = 0;
|
||||
for (; *digits != '\0'; digits++, charCount++) {
|
||||
char c = *digits;
|
||||
if (c < '0' || c > '9')
|
||||
throw std::domain_error("String contains non-numeric characters");
|
||||
accumData = accumData * 10 + (c - '0');
|
||||
accumCount++;
|
||||
if (accumCount == 3) {
|
||||
bb.appendBits(static_cast<uint32_t>(accumData), 10);
|
||||
accumData = 0;
|
||||
accumCount = 0;
|
||||
}
|
||||
}
|
||||
if (accumCount > 0) // 1 or 2 digits remaining
|
||||
bb.appendBits(static_cast<uint32_t>(accumData), accumCount * 3 + 1);
|
||||
return QrSegment(Mode::NUMERIC, charCount, std::move(bb));
|
||||
}
|
||||
|
||||
|
||||
QrSegment QrSegment::makeAlphanumeric(const char *text) {
|
||||
BitBuffer bb;
|
||||
int accumData = 0;
|
||||
int accumCount = 0;
|
||||
int charCount = 0;
|
||||
for (; *text != '\0'; text++, charCount++) {
|
||||
const char *temp = std::strchr(ALPHANUMERIC_CHARSET, *text);
|
||||
if (temp == nullptr)
|
||||
throw std::domain_error("String contains unencodable characters in alphanumeric mode");
|
||||
accumData = accumData * 45 + static_cast<int>(temp - ALPHANUMERIC_CHARSET);
|
||||
accumCount++;
|
||||
if (accumCount == 2) {
|
||||
bb.appendBits(static_cast<uint32_t>(accumData), 11);
|
||||
accumData = 0;
|
||||
accumCount = 0;
|
||||
}
|
||||
}
|
||||
if (accumCount > 0) // 1 character remaining
|
||||
bb.appendBits(static_cast<uint32_t>(accumData), 6);
|
||||
return QrSegment(Mode::ALPHANUMERIC, charCount, std::move(bb));
|
||||
}
|
||||
|
||||
|
||||
vector<QrSegment> QrSegment::makeSegments(const char *text) {
|
||||
// Select the most efficient segment encoding automatically
|
||||
vector<QrSegment> result;
|
||||
if (*text == '\0'); // Leave result empty
|
||||
else if (isNumeric(text))
|
||||
result.push_back(makeNumeric(text));
|
||||
else if (isAlphanumeric(text))
|
||||
result.push_back(makeAlphanumeric(text));
|
||||
else {
|
||||
vector<uint8_t> bytes;
|
||||
for (; *text != '\0'; text++)
|
||||
bytes.push_back(static_cast<uint8_t>(*text));
|
||||
result.push_back(makeBytes(bytes));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
QrSegment QrSegment::makeEci(long assignVal) {
|
||||
BitBuffer bb;
|
||||
if (assignVal < 0)
|
||||
throw std::domain_error("ECI assignment value out of range");
|
||||
else if (assignVal < (1 << 7))
|
||||
bb.appendBits(static_cast<uint32_t>(assignVal), 8);
|
||||
else if (assignVal < (1 << 14)) {
|
||||
bb.appendBits(2, 2);
|
||||
bb.appendBits(static_cast<uint32_t>(assignVal), 14);
|
||||
} else if (assignVal < 1000000L) {
|
||||
bb.appendBits(6, 3);
|
||||
bb.appendBits(static_cast<uint32_t>(assignVal), 21);
|
||||
} else
|
||||
throw std::domain_error("ECI assignment value out of range");
|
||||
return QrSegment(Mode::ECI, 0, std::move(bb));
|
||||
}
|
||||
|
||||
|
||||
QrSegment::QrSegment(Mode md, int numCh, const std::vector<bool> &dt) :
|
||||
mode(md),
|
||||
numChars(numCh),
|
||||
data(dt) {
|
||||
if (numCh < 0)
|
||||
throw std::domain_error("Invalid value");
|
||||
}
|
||||
|
||||
|
||||
QrSegment::QrSegment(Mode md, int numCh, std::vector<bool> &&dt) :
|
||||
mode(md),
|
||||
numChars(numCh),
|
||||
data(std::move(dt)) {
|
||||
if (numCh < 0)
|
||||
throw std::domain_error("Invalid value");
|
||||
}
|
||||
|
||||
|
||||
int QrSegment::getTotalBits(const vector<QrSegment> &segs, int version) {
|
||||
int result = 0;
|
||||
for (const QrSegment &seg : segs) {
|
||||
int ccbits = seg.mode.numCharCountBits(version);
|
||||
if (seg.numChars >= (1L << ccbits))
|
||||
return -1; // The segment's length doesn't fit the field's bit width
|
||||
if (4 + ccbits > INT_MAX - result)
|
||||
return -1; // The sum will overflow an int type
|
||||
result += 4 + ccbits;
|
||||
if (seg.data.size() > static_cast<unsigned int>(INT_MAX - result))
|
||||
return -1; // The sum will overflow an int type
|
||||
result += static_cast<int>(seg.data.size());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool QrSegment::isAlphanumeric(const char *text) {
|
||||
for (; *text != '\0'; text++) {
|
||||
if (std::strchr(ALPHANUMERIC_CHARSET, *text) == nullptr)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool QrSegment::isNumeric(const char *text) {
|
||||
for (; *text != '\0'; text++) {
|
||||
char c = *text;
|
||||
if (c < '0' || c > '9')
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QrSegment::Mode QrSegment::getMode() const {
|
||||
return mode;
|
||||
}
|
||||
|
||||
|
||||
int QrSegment::getNumChars() const {
|
||||
return numChars;
|
||||
}
|
||||
|
||||
|
||||
const std::vector<bool> &QrSegment::getData() const {
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
const char *QrSegment::ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";
|
||||
|
||||
}
|
216
submodules/QrCode/Sources/QrSegment.hpp
Executable file
216
submodules/QrCode/Sources/QrSegment.hpp
Executable file
@ -0,0 +1,216 @@
|
||||
/*
|
||||
* QR Code generator library (C++)
|
||||
*
|
||||
* Copyright (c) Project Nayuki. (MIT License)
|
||||
* https://www.nayuki.io/page/qr-code-generator-library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to
|
||||
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
* - The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* - The Software is provided "as is", without warranty of any kind, express or
|
||||
* implied, including but not limited to the warranties of merchantability,
|
||||
* fitness for a particular purpose and noninfringement. In no event shall the
|
||||
* authors or copyright holders be liable for any claim, damages or other
|
||||
* liability, whether in an action of contract, tort or otherwise, arising from,
|
||||
* out of or in connection with the Software or the use or other dealings in the
|
||||
* Software.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include "BitBuffer.hpp"
|
||||
|
||||
|
||||
namespace qrcodegen {
|
||||
|
||||
/*
|
||||
* A segment of character/binary/control data in a QR Code symbol.
|
||||
* Instances of this class are immutable.
|
||||
* The mid-level way to create a segment is to take the payload data
|
||||
* and call a static factory function such as QrSegment::makeNumeric().
|
||||
* The low-level way to create a segment is to custom-make the bit buffer
|
||||
* and call the QrSegment() constructor with appropriate values.
|
||||
* This segment class imposes no length restrictions, but QR Codes have restrictions.
|
||||
* Even in the most favorable conditions, a QR Code can only hold 7089 characters of data.
|
||||
* Any segment longer than this is meaningless for the purpose of generating QR Codes.
|
||||
*/
|
||||
class QrSegment final {
|
||||
|
||||
/*---- Public helper enumeration ----*/
|
||||
|
||||
/*
|
||||
* Describes how a segment's data bits are interpreted. Immutable.
|
||||
*/
|
||||
public: class Mode final {
|
||||
|
||||
/*-- Constants --*/
|
||||
|
||||
public: static const Mode NUMERIC;
|
||||
public: static const Mode ALPHANUMERIC;
|
||||
public: static const Mode BYTE;
|
||||
public: static const Mode KANJI;
|
||||
public: static const Mode ECI;
|
||||
|
||||
|
||||
/*-- Fields --*/
|
||||
|
||||
// The mode indicator bits, which is a uint4 value (range 0 to 15).
|
||||
private: int modeBits;
|
||||
|
||||
// Number of character count bits for three different version ranges.
|
||||
private: int numBitsCharCount[3];
|
||||
|
||||
|
||||
/*-- Constructor --*/
|
||||
|
||||
private: Mode(int mode, int cc0, int cc1, int cc2);
|
||||
|
||||
|
||||
/*-- Methods --*/
|
||||
|
||||
/*
|
||||
* (Package-private) Returns the mode indicator bits, which is an unsigned 4-bit value (range 0 to 15).
|
||||
*/
|
||||
public: int getModeBits() const;
|
||||
|
||||
/*
|
||||
* (Package-private) Returns the bit width of the character count field for a segment in
|
||||
* this mode in a QR Code at the given version number. The result is in the range [0, 16].
|
||||
*/
|
||||
public: int numCharCountBits(int ver) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---- Static factory functions (mid level) ----*/
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given binary data encoded in
|
||||
* byte mode. All input byte vectors are acceptable. Any text string
|
||||
* can be converted to UTF-8 bytes and encoded as a byte mode segment.
|
||||
*/
|
||||
public: static QrSegment makeBytes(const std::vector<std::uint8_t> &data);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given string of decimal digits encoded in numeric mode.
|
||||
*/
|
||||
public: static QrSegment makeNumeric(const char *digits);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing the given text string encoded in alphanumeric mode.
|
||||
* The characters allowed are: 0 to 9, A to Z (uppercase only), space,
|
||||
* dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
||||
*/
|
||||
public: static QrSegment makeAlphanumeric(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a list of zero or more segments to represent the given text string. The result
|
||||
* may use various segment modes and switch modes to optimize the length of the bit stream.
|
||||
*/
|
||||
public: static std::vector<QrSegment> makeSegments(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Returns a segment representing an Extended Channel Interpretation
|
||||
* (ECI) designator with the given assignment value.
|
||||
*/
|
||||
public: static QrSegment makeEci(long assignVal);
|
||||
|
||||
|
||||
/*---- Public static helper functions ----*/
|
||||
|
||||
/*
|
||||
* Tests whether the given string can be encoded as a segment in alphanumeric mode.
|
||||
* A string is encodable iff each character is in the following set: 0 to 9, A to Z
|
||||
* (uppercase only), space, dollar, percent, asterisk, plus, hyphen, period, slash, colon.
|
||||
*/
|
||||
public: static bool isAlphanumeric(const char *text);
|
||||
|
||||
|
||||
/*
|
||||
* Tests whether the given string can be encoded as a segment in numeric mode.
|
||||
* A string is encodable iff each character is in the range 0 to 9.
|
||||
*/
|
||||
public: static bool isNumeric(const char *text);
|
||||
|
||||
|
||||
|
||||
/*---- Instance fields ----*/
|
||||
|
||||
/* The mode indicator of this segment. Accessed through getMode(). */
|
||||
private: Mode mode;
|
||||
|
||||
/* The length of this segment's unencoded data. Measured in characters for
|
||||
* numeric/alphanumeric/kanji mode, bytes for byte mode, and 0 for ECI mode.
|
||||
* Always zero or positive. Not the same as the data's bit length.
|
||||
* Accessed through getNumChars(). */
|
||||
private: int numChars;
|
||||
|
||||
/* The data bits of this segment. Accessed through getData(). */
|
||||
private: std::vector<bool> data;
|
||||
|
||||
|
||||
/*---- Constructors (low level) ----*/
|
||||
|
||||
/*
|
||||
* Creates a new QR Code segment with the given attributes and data.
|
||||
* The character count (numCh) must agree with the mode and the bit buffer length,
|
||||
* but the constraint isn't checked. The given bit buffer is copied and stored.
|
||||
*/
|
||||
public: QrSegment(Mode md, int numCh, const std::vector<bool> &dt);
|
||||
|
||||
|
||||
/*
|
||||
* Creates a new QR Code segment with the given parameters and data.
|
||||
* The character count (numCh) must agree with the mode and the bit buffer length,
|
||||
* but the constraint isn't checked. The given bit buffer is moved and stored.
|
||||
*/
|
||||
public: QrSegment(Mode md, int numCh, std::vector<bool> &&dt);
|
||||
|
||||
|
||||
/*---- Methods ----*/
|
||||
|
||||
/*
|
||||
* Returns the mode field of this segment.
|
||||
*/
|
||||
public: Mode getMode() const;
|
||||
|
||||
|
||||
/*
|
||||
* Returns the character count field of this segment.
|
||||
*/
|
||||
public: int getNumChars() const;
|
||||
|
||||
|
||||
/*
|
||||
* Returns the data bits of this segment.
|
||||
*/
|
||||
public: const std::vector<bool> &getData() const;
|
||||
|
||||
|
||||
// (Package-private) Calculates the number of bits needed to encode the given segments at
|
||||
// the given version. Returns a non-negative number if successful. Otherwise returns -1 if a
|
||||
// segment has too many characters to fit its length field, or the total bits exceeds INT_MAX.
|
||||
public: static int getTotalBits(const std::vector<QrSegment> &segs, int version);
|
||||
|
||||
|
||||
/*---- Private constant ----*/
|
||||
|
||||
/* The set of all legal characters in alphanumeric mode, where
|
||||
* each character value maps to the index in the string. */
|
||||
private: static const char *ALPHANUMERIC_CHARSET;
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -182,6 +182,19 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29BFBD457D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libCamera.a</string>
|
||||
<key>path</key>
|
||||
<string>libCamera.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29FD72F45600000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -1539,6 +1552,7 @@
|
||||
<string>1DD70E296A100F7B00000000</string>
|
||||
<string>1DD70E29A54A195300000000</string>
|
||||
<string>1DD70E2938C0E4C800000000</string>
|
||||
<string>1DD70E29BFBD457D00000000</string>
|
||||
<string>1DD70E29FD72F45600000000</string>
|
||||
<string>1DD70E2907DC840B00000000</string>
|
||||
<string>1DD70E297AB043C800000000</string>
|
||||
@ -4754,6 +4768,13 @@
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29D81471E200000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04BFBD457D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29BFBD457D00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04D097476500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -4889,6 +4910,7 @@
|
||||
<string>E7A30F04F18DE1D900000000</string>
|
||||
<string>E7A30F04DA3FBAD600000000</string>
|
||||
<string>E7A30F04D81471E200000000</string>
|
||||
<string>E7A30F04BFBD457D00000000</string>
|
||||
<string>E7A30F04D097476500000000</string>
|
||||
<string>E7A30F04A7E1559B00000000</string>
|
||||
<string>E7A30F04DF12291E00000000</string>
|
||||
|
@ -38,7 +38,7 @@ public final class ShareProxyServerActionSheetController: ActionSheetController
|
||||
}))
|
||||
items.append(ActionSheetButtonItem(title: strings.SocksProxySetup_ShareQRCode, action: { [weak self] in
|
||||
self?.dismissAnimated()
|
||||
let _ = (qrCode(string: link, color: .black, backgroundColor: .white, scale: 1.0)
|
||||
let _ = (qrCode(string: link, color: .black, backgroundColor: .white, icon: .proxy, scale: 1.0)
|
||||
|> map { generator -> UIImage? in
|
||||
let imageSize = CGSize(width: 512.0, height: 512.0)
|
||||
let context = generator(TransformImageArguments(corners: ImageCorners(), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets()))
|
||||
@ -126,7 +126,7 @@ private final class ProxyServerQRCodeItemNode: ActionSheetItemNode {
|
||||
self.label.attributedText = NSAttributedString(string: strings.SocksProxySetup_ShareQRCodeInfo, font: ActionSheetTextNode.defaultFont, textColor: self.theme.secondaryTextColor, paragraphAlignment: .center)
|
||||
|
||||
self.imageNode = TransformImageNode()
|
||||
self.imageNode.setSignal(qrCode(string: link, color: .black, backgroundColor: .white), attemptSynchronously: true)
|
||||
self.imageNode.setSignal(qrCode(string: link, color: .black, backgroundColor: .white, icon: .proxy), attemptSynchronously: true)
|
||||
|
||||
super.init(theme: theme)
|
||||
|
||||
|
@ -201,8 +201,7 @@ private enum SettingsEntry: ItemListNodeEntry {
|
||||
case let .bioText(theme, currentText, placeholder):
|
||||
return ItemListMultilineInputItem(theme: theme, text: currentText, placeholder: placeholder, maxLength: ItemListMultilineInputItemTextLimit(value: 70, display: true), sectionId: self.section, style: .blocks, textUpdated: { updatedText in
|
||||
arguments.updateBioText(currentText, updatedText)
|
||||
}, tag: EditSettingsEntryTag.bio, action: {
|
||||
})
|
||||
}, tag: EditSettingsEntryTag.bio)
|
||||
case let .bioInfo(theme, text):
|
||||
return ItemListTextItem(theme: theme, text: .plain(text), sectionId: self.section)
|
||||
case let .phoneNumber(theme, text, number):
|
||||
|
@ -158,7 +158,7 @@ private enum CallFeedbackControllerEntry: ItemListNodeEntry {
|
||||
case let .comment(theme, text, placeholder):
|
||||
return ItemListMultilineInputItem(theme: theme, text: text, placeholder: placeholder, maxLength: nil, sectionId: self.section, style: .blocks, textUpdated: { updatedText in
|
||||
arguments.updateComment(updatedText)
|
||||
}, action: {})
|
||||
})
|
||||
case let .includeLogs(theme, title, value):
|
||||
return ItemListSwitchItem(theme: theme, title: title, value: value, sectionId: self.section, style: .blocks, updated: { value in
|
||||
arguments.toggleIncludeLogs(value)
|
||||
|
21
submodules/TelegramUI/Images.xcassets/Settings/Test.imageset/Contents.json
vendored
Normal file
21
submodules/TelegramUI/Images.xcassets/Settings/Test.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "Test.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Settings/Test.imageset/Test.png
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Settings/Test.imageset/Test.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 KiB |
12
submodules/TelegramUI/Images.xcassets/Settings/Wallet/PasscodeIcon.imageset/Contents.json
vendored
Normal file
12
submodules/TelegramUI/Images.xcassets/Settings/Wallet/PasscodeIcon.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "PasscodeIcon.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Settings/Wallet/PasscodeIcon.imageset/PasscodeIcon.pdf
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Settings/Wallet/PasscodeIcon.imageset/PasscodeIcon.pdf
vendored
Normal file
Binary file not shown.
21
submodules/TelegramUI/Images.xcassets/Settings/Wallet/SendingIcon.imageset/Contents.json
vendored
Normal file
21
submodules/TelegramUI/Images.xcassets/Settings/Wallet/SendingIcon.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "SendingIcon@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
BIN
submodules/TelegramUI/Images.xcassets/Settings/Wallet/SendingIcon.imageset/SendingIcon@3x.png
vendored
Normal file
BIN
submodules/TelegramUI/Images.xcassets/Settings/Wallet/SendingIcon.imageset/SendingIcon@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
@ -70,7 +70,7 @@ private class ApplicationStatusBarHost: StatusBarHost {
|
||||
}
|
||||
|
||||
var statusBarWindow: UIView? {
|
||||
return nil//self.application.value(forKey: "statusBarWindow") as? UIView
|
||||
return self.application.value(forKey: "statusBarWindow") as? UIView
|
||||
}
|
||||
|
||||
var statusBarView: UIView? {
|
||||
|
@ -146,8 +146,6 @@ private enum CreateChannelEntry: ItemListNodeEntry {
|
||||
case let .descriptionSetup(theme, text, value):
|
||||
return ItemListMultilineInputItem(theme: theme, text: value, placeholder: text, maxLength: ItemListMultilineInputItemTextLimit(value: 255, display: true), sectionId: self.section, style: .blocks, textUpdated: { updatedText in
|
||||
arguments.updateEditingDescriptionText(updatedText)
|
||||
}, action: {
|
||||
|
||||
})
|
||||
case let .descriptionInfo(theme, text):
|
||||
return ItemListTextItem(theme: theme, text: .plain(text), sectionId: self.section)
|
||||
|
@ -135,7 +135,7 @@ public func updateInfoController(context: AccountContext, appUpdateInfo: AppUpda
|
||||
}
|
||||
dismissImpl = { [weak controller] in
|
||||
controller?.view.endEditing(true)
|
||||
controller?.dismiss()
|
||||
controller?.presentingViewController?.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
return controller
|
||||
}
|
||||
|
17
submodules/TextFormat/Sources/StringPadding.swift
Normal file
17
submodules/TextFormat/Sources/StringPadding.swift
Normal file
@ -0,0 +1,17 @@
|
||||
import Foundation
|
||||
|
||||
public extension String {
|
||||
func rightJustified(width: Int, pad: String = " ", truncate: Bool = false) -> String {
|
||||
guard width > count else {
|
||||
return truncate ? String(suffix(width)) : self
|
||||
}
|
||||
return String(repeating: pad, count: width - count) + self
|
||||
}
|
||||
|
||||
func leftJustified(width: Int, pad: String = " ", truncate: Bool = false) -> String {
|
||||
guard width > count else {
|
||||
return truncate ? String(prefix(width)) : self
|
||||
}
|
||||
return self + String(repeating: pad, count: width - count)
|
||||
}
|
||||
}
|
@ -271,6 +271,17 @@
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E29C71C514500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>StringPadding.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/StringPadding.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E294ED72F2C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -307,6 +318,7 @@
|
||||
<string>1DD70E29D54426E100000000</string>
|
||||
<string>1DD70E294757B6A800000000</string>
|
||||
<string>1DD70E29080E447400000000</string>
|
||||
<string>1DD70E29C71C514500000000</string>
|
||||
<string>1DD70E294ED72F2C00000000</string>
|
||||
<string>1DD70E29E70765FD00000000</string>
|
||||
</array>
|
||||
@ -369,6 +381,13 @@
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29080E447400000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04C71C514500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29C71C514500000000</string>
|
||||
</dict>
|
||||
<key>E7A30F044ED72F2C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -393,6 +412,7 @@
|
||||
<string>E7A30F04D54426E100000000</string>
|
||||
<string>E7A30F044757B6A800000000</string>
|
||||
<string>E7A30F04080E447400000000</string>
|
||||
<string>E7A30F04C71C514500000000</string>
|
||||
<string>E7A30F044ED72F2C00000000</string>
|
||||
<string>E7A30F04E70765FD00000000</string>
|
||||
</array>
|
||||
|
@ -15,9 +15,15 @@ static_library(
|
||||
"//submodules/OverlayStatusController:OverlayStatusController",
|
||||
"//submodules/AppBundle:AppBundle",
|
||||
"//submodules/SolidRoundedButtonNode:SolidRoundedButtonNode",
|
||||
"//submodules/AccountContext:AccountContext",
|
||||
"//submodules/UndoUI:UndoUI",
|
||||
"//submodules/AlertUI:AlertUI",
|
||||
"//submodules/ItemListUI:ItemListUI",
|
||||
"//submodules/AccountContext:AccountContext",
|
||||
"//submodules/UndoUI:UndoUI",
|
||||
"//submodules/AlertUI:AlertUI",
|
||||
"//submodules/TextFormat:TextFormat",
|
||||
"//submodules/Camera:Camera",
|
||||
"//submodules/ShareController:ShareController",
|
||||
"//submodules/PasscodeUI:PasscodeUI",
|
||||
"//submodules/QrCode:QrCode",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
|
@ -36,6 +36,8 @@ public final class WalletInfoScreen: ViewController {
|
||||
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
|
||||
self.navigationBar?.intrinsicCanTransitionInline = false
|
||||
|
||||
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Receive", style: .plain, target: self, action: #selector(receivePressed))
|
||||
|
||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||
}
|
||||
|
||||
@ -47,6 +49,10 @@ public final class WalletInfoScreen: ViewController {
|
||||
self.dismiss()
|
||||
}
|
||||
|
||||
@objc private func receivePressed() {
|
||||
self.push(walletReceiveScreen(context: self.context, tonContext: self.tonContext, walletInfo: self.walletInfo, address: self.address))
|
||||
}
|
||||
|
||||
override public func loadDisplayNode() {
|
||||
self.displayNode = WalletInfoScreenNode(account: self.context.account, tonContext: self.tonContext, presentationData: self.presentationData, walletInfo: self.walletInfo, address: self.address, exportAction: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
@ -57,7 +63,8 @@ public final class WalletInfoScreen: ViewController {
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
strongSelf.push(WalletWordDisplayScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, walletInfo: strongSelf.walletInfo, wordList: wordList))
|
||||
strongSelf.push(walletSendScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, walletInfo: strongSelf.walletInfo))
|
||||
//strongSelf.push(WalletWordDisplayScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, walletInfo: strongSelf.walletInfo, wordList: wordList))
|
||||
}, error: { _ in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
@ -104,7 +111,7 @@ private final class WalletInfoScreenNode: ViewControllerTracingNode {
|
||||
|
||||
let title: String = address
|
||||
let text: String = "..."
|
||||
let buttonText: String = "Export"
|
||||
let buttonText: String = "Send"
|
||||
|
||||
self.titleNode = ImmediateTextNode()
|
||||
self.titleNode.displaysAsynchronously = false
|
||||
|
250
submodules/WalletUI/Sources/WalletPasscodeScreen.swift
Normal file
250
submodules/WalletUI/Sources/WalletPasscodeScreen.swift
Normal file
@ -0,0 +1,250 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AppBundle
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AnimationUI
|
||||
import SwiftSignalKit
|
||||
import OverlayStatusController
|
||||
import PasscodeUI
|
||||
|
||||
public enum WalletPasscodeMode {
|
||||
case setup
|
||||
case authorizeTransfer(WalletInfo, String, Int64, String)
|
||||
}
|
||||
|
||||
public final class WalletPasscodeScreen: ViewController {
|
||||
private let context: AccountContext
|
||||
private let tonContext: TonContext
|
||||
private var presentationData: PresentationData
|
||||
private let mode: WalletPasscodeMode
|
||||
|
||||
public init(context: AccountContext, tonContext: TonContext, mode: WalletPasscodeMode) {
|
||||
self.context = context
|
||||
self.tonContext = tonContext
|
||||
self.mode = mode
|
||||
|
||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
let defaultNavigationPresentationData = NavigationBarPresentationData(presentationTheme: self.presentationData.theme, presentationStrings: self.presentationData.strings)
|
||||
let navigationBarTheme = NavigationBarTheme(buttonColor: defaultNavigationPresentationData.theme.buttonColor, disabledButtonColor: defaultNavigationPresentationData.theme.disabledButtonColor, primaryTextColor: defaultNavigationPresentationData.theme.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: defaultNavigationPresentationData.theme.badgeBackgroundColor, badgeStrokeColor: defaultNavigationPresentationData.theme.badgeStrokeColor, badgeTextColor: defaultNavigationPresentationData.theme.badgeTextColor)
|
||||
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: defaultNavigationPresentationData.strings))
|
||||
|
||||
self.navigationPresentation = .modalInLargeLayout
|
||||
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
|
||||
self.navigationBar?.intrinsicCanTransitionInline = false
|
||||
|
||||
self.navigationItem.setLeftBarButton(UIBarButtonItem(title: self.presentationData.strings.Common_Cancel, style: .plain, target: self, action: #selector(self.backPressed)), animated: false)
|
||||
|
||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||
}
|
||||
|
||||
required init(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
@objc private func backPressed() {
|
||||
self.view.endEditing(true)
|
||||
self.dismiss()
|
||||
}
|
||||
|
||||
override public func loadDisplayNode() {
|
||||
self.displayNode = WalletPasscodeScreenNode(account: self.context.account, presentationData: self.presentationData, mode: self.mode, proceed: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
switch strongSelf.mode {
|
||||
case .setup:
|
||||
break
|
||||
case let .authorizeTransfer(walletInfo, address, amount, comment):
|
||||
if let navigationController = strongSelf.navigationController as? NavigationController {
|
||||
var controllers = navigationController.viewControllers
|
||||
controllers = controllers.filter { controller in
|
||||
if controller is WalletSplashScreen {
|
||||
return false
|
||||
}
|
||||
if controller is WalletSendScreen {
|
||||
return false
|
||||
}
|
||||
if controller is WalletPasscodeScreen {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
controllers.append(WalletSplashScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, mode: .sending(walletInfo, address, amount, comment)))
|
||||
strongSelf.view.endEditing(true)
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
}
|
||||
}
|
||||
}, requestBiometrics: {
|
||||
|
||||
})
|
||||
|
||||
self.displayNodeDidLoad()
|
||||
}
|
||||
|
||||
override public func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
(self.displayNode as! WalletPasscodeScreenNode).activateInput()
|
||||
}
|
||||
|
||||
override public func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
self.view.disablesInteractiveTransitionGestureRecognizer = true
|
||||
|
||||
(self.displayNode as! WalletPasscodeScreenNode).activateInput()
|
||||
}
|
||||
|
||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
super.containerLayoutUpdated(layout, transition: transition)
|
||||
|
||||
(self.displayNode as! WalletPasscodeScreenNode).containerLayoutUpdated(layout: layout, navigationHeight: self.navigationHeight, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
private final class WalletPasscodeScreenNode: ViewControllerTracingNode {
|
||||
private var presentationData: PresentationData
|
||||
private let mode: WalletPasscodeMode
|
||||
private let requestBiometrics: () -> Void
|
||||
|
||||
private let iconNode: ASImageNode
|
||||
private let animationNode: AnimatedStickerNode
|
||||
private let titleNode: ImmediateTextNode
|
||||
private let biometricsActionTitleNode: ImmediateTextNode
|
||||
private let biometricsActionButtonNode: HighlightTrackingButtonNode
|
||||
private let inputFieldNode: PasscodeEntryInputFieldNode
|
||||
|
||||
private let hapticFeedback = HapticFeedback()
|
||||
|
||||
init(account: Account, presentationData: PresentationData, mode: WalletPasscodeMode, proceed: @escaping () -> Void, requestBiometrics: @escaping () -> Void) {
|
||||
self.presentationData = presentationData
|
||||
self.mode = mode
|
||||
self.requestBiometrics = requestBiometrics
|
||||
|
||||
self.iconNode = ASImageNode()
|
||||
self.iconNode.displayWithoutProcessing = true
|
||||
self.iconNode.displaysAsynchronously = false
|
||||
|
||||
self.animationNode = AnimatedStickerNode()
|
||||
|
||||
let title: String
|
||||
let biometricsActionText: String
|
||||
|
||||
title = "Enter Passcode"
|
||||
biometricsActionText = "Use Face ID"
|
||||
|
||||
self.iconNode.image = UIImage(bundleImageName: "Settings/Wallet/PasscodeIcon")
|
||||
|
||||
self.titleNode = ImmediateTextNode()
|
||||
self.titleNode.displaysAsynchronously = false
|
||||
self.titleNode.attributedText = NSAttributedString(string: title, font: Font.bold(32.0), textColor: self.presentationData.theme.list.itemPrimaryTextColor)
|
||||
self.titleNode.maximumNumberOfLines = 0
|
||||
self.titleNode.textAlignment = .center
|
||||
|
||||
self.biometricsActionTitleNode = ImmediateTextNode()
|
||||
self.biometricsActionTitleNode.displaysAsynchronously = false
|
||||
self.biometricsActionTitleNode.attributedText = NSAttributedString(string: biometricsActionText, font: Font.regular(16.0), textColor: self.presentationData.theme.list.itemAccentColor, paragraphAlignment: .center)
|
||||
self.biometricsActionTitleNode.textAlignment = .center
|
||||
|
||||
self.biometricsActionButtonNode = HighlightTrackingButtonNode()
|
||||
|
||||
self.inputFieldNode = PasscodeEntryInputFieldNode(color: self.presentationData.theme.list.itemPrimaryTextColor, accentColor: self.presentationData.theme.list.itemAccentColor, fieldType: .digits4, keyboardAppearance: self.presentationData.theme.rootController.keyboardColor.keyboardAppearance)
|
||||
|
||||
super.init()
|
||||
|
||||
self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor
|
||||
|
||||
self.addSubnode(self.iconNode)
|
||||
self.addSubnode(self.animationNode)
|
||||
self.addSubnode(self.titleNode)
|
||||
self.addSubnode(self.biometricsActionTitleNode)
|
||||
self.addSubnode(self.biometricsActionButtonNode)
|
||||
self.addSubnode(self.inputFieldNode)
|
||||
|
||||
self.biometricsActionButtonNode.highligthedChanged = { [weak self] highlighted in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
if highlighted {
|
||||
strongSelf.biometricsActionTitleNode.layer.removeAnimation(forKey: "opacity")
|
||||
strongSelf.biometricsActionTitleNode.alpha = 0.4
|
||||
} else {
|
||||
strongSelf.biometricsActionTitleNode.alpha = 1.0
|
||||
strongSelf.biometricsActionTitleNode.layer.animateAlpha(from: 0.4, to: 1.0, duration: 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
self.biometricsActionButtonNode.addTarget(self, action: #selector(self.biometricsActionPressed), forControlEvents: .touchUpInside)
|
||||
|
||||
self.inputFieldNode.complete = { [weak self] passcode in
|
||||
if passcode == "1111" {
|
||||
proceed()
|
||||
} else {
|
||||
self?.animateError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func biometricsActionPressed() {
|
||||
self.requestBiometrics()
|
||||
}
|
||||
|
||||
func containerLayoutUpdated(layout: ContainerViewLayout, navigationHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
let sideInset: CGFloat = 32.0
|
||||
let buttonSideInset: CGFloat = 48.0
|
||||
let iconSpacing: CGFloat = 21.0
|
||||
let titleSpacing: CGFloat = 60.0
|
||||
let biometricsSpacing: CGFloat = 44.0
|
||||
let buttonHeight: CGFloat = 50.0
|
||||
let inputFieldHeight: CGFloat = 34.0
|
||||
|
||||
let iconSize = self.iconNode.image?.size ?? CGSize(width: 140.0, height: 140.0)
|
||||
var iconOffset = CGPoint()
|
||||
|
||||
let titleSize = self.titleNode.updateLayout(CGSize(width: layout.size.width - sideInset * 2.0, height: layout.size.height))
|
||||
let biometricsActionSize = self.biometricsActionTitleNode.updateLayout(CGSize(width: layout.size.width - sideInset * 2.0, height: layout.size.height))
|
||||
|
||||
let insets = layout.insets(options: [.input])
|
||||
let contentHeight = iconSize.height + iconSpacing + titleSize.height + titleSpacing + inputFieldHeight
|
||||
let contentVerticalOrigin = floor((layout.size.height - contentHeight - iconSize.height / 2.0 - insets.bottom) / 2.0)
|
||||
|
||||
let iconFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - iconSize.width) / 2.0), y: contentVerticalOrigin), size: iconSize).offsetBy(dx: iconOffset.x, dy: iconOffset.y)
|
||||
transition.updateFrameAdditive(node: self.iconNode, frame: iconFrame)
|
||||
self.animationNode.updateLayout(size: iconFrame.size)
|
||||
transition.updateFrameAdditive(node: self.animationNode, frame: iconFrame)
|
||||
let titleFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - titleSize.width) / 2.0), y: iconFrame.maxY + iconSpacing), size: titleSize)
|
||||
transition.updateFrameAdditive(node: self.titleNode, frame: titleFrame)
|
||||
|
||||
let passcodeLayout = PasscodeLayout(layout: layout, titleOffset: 0.0, subtitleOffset: 0.0, inputFieldOffset: titleFrame.maxY + titleSpacing)
|
||||
let inputFieldFrame = self.inputFieldNode.updateLayout(layout: passcodeLayout, transition: transition)
|
||||
transition.updateFrame(node: self.inputFieldNode, frame: CGRect(origin: CGPoint(), size: layout.size))
|
||||
|
||||
let minimalBottomInset: CGFloat = 60.0
|
||||
let bottomInset = layout.intrinsicInsets.bottom + max(minimalBottomInset, biometricsActionSize.height + biometricsSpacing * 2.0)
|
||||
|
||||
if !biometricsActionSize.width.isZero {
|
||||
let biometricsActionFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - biometricsActionSize.width) / 2.0), y: inputFieldFrame.maxY + floor((layout.size.height - insets.bottom - inputFieldFrame.maxY - biometricsActionSize.height) / 2.0)), size: biometricsActionSize)
|
||||
transition.updateFrameAdditive(node: self.biometricsActionTitleNode, frame: biometricsActionFrame)
|
||||
transition.updateFrame(node: self.biometricsActionButtonNode, frame: biometricsActionFrame.insetBy(dx: -10.0, dy: -10.0))
|
||||
}
|
||||
}
|
||||
|
||||
func activateInput() {
|
||||
self.inputFieldNode.activateInput()
|
||||
|
||||
UIAccessibility.post(notification: UIAccessibility.Notification.announcement, argument: self.titleNode.attributedText?.string)
|
||||
}
|
||||
|
||||
func animateError() {
|
||||
self.inputFieldNode.reset()
|
||||
self.inputFieldNode.layer.addShakeAnimation(amplitude: -30.0, duration: 0.5, count: 6, decay: true)
|
||||
|
||||
self.hapticFeedback.error()
|
||||
}
|
||||
}
|
209
submodules/WalletUI/Sources/WalletQrCodeItem.swift
Normal file
209
submodules/WalletUI/Sources/WalletQrCodeItem.swift
Normal file
@ -0,0 +1,209 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import ItemListUI
|
||||
import QrCode
|
||||
|
||||
class WalletQrCodeItem: ListViewItem, ItemListItem {
|
||||
let theme: PresentationTheme
|
||||
let address: String
|
||||
let sectionId: ItemListSectionId
|
||||
let style: ItemListStyle
|
||||
|
||||
init(theme: PresentationTheme, address: String, sectionId: ItemListSectionId, style: ItemListStyle) {
|
||||
self.theme = theme
|
||||
self.address = address
|
||||
self.sectionId = sectionId
|
||||
self.style = style
|
||||
}
|
||||
|
||||
func nodeConfiguredForParams(async: @escaping (@escaping () -> Void) -> Void, params: ListViewItemLayoutParams, synchronousLoads: Bool, previousItem: ListViewItem?, nextItem: ListViewItem?, completion: @escaping (ListViewItemNode, @escaping () -> (Signal<Void, NoError>?, (ListViewItemApply) -> Void)) -> Void) {
|
||||
async {
|
||||
let node = WalletQrCodeItemNode()
|
||||
let (layout, apply) = node.asyncLayout()(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem))
|
||||
|
||||
node.contentSize = layout.contentSize
|
||||
node.insets = layout.insets
|
||||
|
||||
Queue.mainQueue().async {
|
||||
completion(node, {
|
||||
return (nil, { _ in apply() })
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateNode(async: @escaping (@escaping () -> Void) -> Void, node: @escaping () -> ListViewItemNode, params: ListViewItemLayoutParams, previousItem: ListViewItem?, nextItem: ListViewItem?, animation: ListViewItemUpdateAnimation, completion: @escaping (ListViewItemNodeLayout, @escaping (ListViewItemApply) -> Void) -> Void) {
|
||||
Queue.mainQueue().async {
|
||||
if let nodeValue = node() as? WalletQrCodeItemNode {
|
||||
let makeLayout = nodeValue.asyncLayout()
|
||||
|
||||
async {
|
||||
let (layout, apply) = makeLayout(self, params, itemListNeighbors(item: self, topItem: previousItem as? ItemListItem, bottomItem: nextItem as? ItemListItem))
|
||||
Queue.mainQueue().async {
|
||||
completion(layout, { _ in
|
||||
apply()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WalletQrCodeItemNode: ListViewItemNode {
|
||||
private let backgroundNode: ASDisplayNode
|
||||
private let topStripeNode: ASDisplayNode
|
||||
private let bottomStripeNode: ASDisplayNode
|
||||
|
||||
private let imageNode: TransformImageNode
|
||||
|
||||
private var item: WalletQrCodeItem?
|
||||
|
||||
var tag: Any? {
|
||||
return self.item?.tag
|
||||
}
|
||||
|
||||
init() {
|
||||
self.backgroundNode = ASDisplayNode()
|
||||
self.backgroundNode.isLayerBacked = true
|
||||
self.backgroundNode.backgroundColor = .white
|
||||
|
||||
self.topStripeNode = ASDisplayNode()
|
||||
self.topStripeNode.isLayerBacked = true
|
||||
|
||||
self.bottomStripeNode = ASDisplayNode()
|
||||
self.bottomStripeNode.isLayerBacked = true
|
||||
|
||||
self.imageNode = TransformImageNode()
|
||||
|
||||
super.init(layerBacked: false, dynamicBounce: false)
|
||||
|
||||
self.addSubnode(self.imageNode)
|
||||
}
|
||||
|
||||
func asyncLayout() -> (_ item: WalletQrCodeItem, _ params: ListViewItemLayoutParams, _ neighbors: ItemListNeighbors) -> (ListViewItemNodeLayout, () -> Void) {
|
||||
let makeImageLayout = self.imageNode.asyncLayout()
|
||||
|
||||
let currentItem = self.item
|
||||
|
||||
return { item, params, neighbors in
|
||||
var updatedTheme: PresentationTheme?
|
||||
var updatedAddress: String?
|
||||
|
||||
if currentItem?.theme !== item.theme {
|
||||
updatedTheme = item.theme
|
||||
}
|
||||
|
||||
if currentItem?.address != item.address {
|
||||
updatedAddress = item.address
|
||||
}
|
||||
|
||||
let contentSize: CGSize
|
||||
let insets: UIEdgeInsets
|
||||
let separatorHeight = UIScreenPixel
|
||||
|
||||
let inset: CGFloat = 12.0
|
||||
var imageSize = CGSize(width: 256.0, height: 256.0)
|
||||
let imageApply = makeImageLayout(TransformImageArguments(corners: ImageCorners(), imageSize: imageSize, boundingSize: imageSize, intrinsicInsets: UIEdgeInsets(), emptyColor: nil))
|
||||
|
||||
let itemBackgroundColor: UIColor
|
||||
let itemSeparatorColor: UIColor
|
||||
switch item.style {
|
||||
case .plain:
|
||||
itemBackgroundColor = item.theme.list.plainBackgroundColor
|
||||
itemSeparatorColor = item.theme.list.itemPlainSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: imageSize.height + inset * 2.0)
|
||||
insets = itemListNeighborsPlainInsets(neighbors)
|
||||
case .blocks:
|
||||
itemBackgroundColor = item.theme.list.itemBlocksBackgroundColor
|
||||
itemSeparatorColor = item.theme.list.itemBlocksSeparatorColor
|
||||
contentSize = CGSize(width: params.width, height: imageSize.height + inset * 2.0)
|
||||
insets = itemListNeighborsGroupedInsets(neighbors)
|
||||
}
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
||||
return (layout, { [weak self] in
|
||||
if let strongSelf = self {
|
||||
strongSelf.item = item
|
||||
|
||||
if let _ = updatedTheme {
|
||||
strongSelf.topStripeNode.backgroundColor = itemSeparatorColor
|
||||
strongSelf.bottomStripeNode.backgroundColor = itemSeparatorColor
|
||||
strongSelf.backgroundNode.backgroundColor = itemBackgroundColor
|
||||
}
|
||||
|
||||
if let updatedAddress = updatedAddress {
|
||||
strongSelf.imageNode.setSignal(qrCode(string: updatedAddress, color: .black, backgroundColor: .white, icon: .custom(UIImage(bundleImageName: "Settings/Wallet/IntroIcon")), ecl: "Q"), attemptSynchronously: true)
|
||||
}
|
||||
|
||||
let _ = imageApply()
|
||||
|
||||
let leftInset: CGFloat
|
||||
|
||||
switch item.style {
|
||||
case .plain:
|
||||
leftInset = 35.0 + params.leftInset
|
||||
|
||||
if strongSelf.backgroundNode.supernode != nil {
|
||||
strongSelf.backgroundNode.removeFromSupernode()
|
||||
}
|
||||
if strongSelf.topStripeNode.supernode != nil {
|
||||
strongSelf.topStripeNode.removeFromSupernode()
|
||||
}
|
||||
if strongSelf.bottomStripeNode.supernode == nil {
|
||||
strongSelf.insertSubnode(strongSelf.bottomStripeNode, at: 0)
|
||||
}
|
||||
|
||||
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: leftInset, y: contentSize.height - separatorHeight), size: CGSize(width: params.width - leftInset, height: separatorHeight))
|
||||
case .blocks:
|
||||
leftInset = 16.0 + params.leftInset
|
||||
|
||||
if strongSelf.backgroundNode.supernode == nil {
|
||||
strongSelf.insertSubnode(strongSelf.backgroundNode, at: 0)
|
||||
}
|
||||
if strongSelf.topStripeNode.supernode == nil {
|
||||
strongSelf.insertSubnode(strongSelf.topStripeNode, at: 1)
|
||||
}
|
||||
if strongSelf.bottomStripeNode.supernode == nil {
|
||||
strongSelf.insertSubnode(strongSelf.bottomStripeNode, at: 2)
|
||||
}
|
||||
switch neighbors.top {
|
||||
case .sameSection(false):
|
||||
strongSelf.topStripeNode.isHidden = true
|
||||
default:
|
||||
strongSelf.topStripeNode.isHidden = false
|
||||
}
|
||||
let bottomStripeInset: CGFloat
|
||||
let bottomStripeOffset: CGFloat
|
||||
switch neighbors.bottom {
|
||||
case .sameSection(false):
|
||||
bottomStripeInset = 16.0 + params.leftInset
|
||||
bottomStripeOffset = -separatorHeight
|
||||
default:
|
||||
bottomStripeInset = 0.0
|
||||
bottomStripeOffset = 0.0
|
||||
}
|
||||
strongSelf.backgroundNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: contentSize.height + min(insets.top, separatorHeight) + min(insets.bottom, separatorHeight)))
|
||||
strongSelf.topStripeNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -min(insets.top, separatorHeight)), size: CGSize(width: params.width, height: separatorHeight))
|
||||
strongSelf.bottomStripeNode.frame = CGRect(origin: CGPoint(x: bottomStripeInset, y: contentSize.height + bottomStripeOffset), size: CGSize(width: params.width - bottomStripeInset, height: separatorHeight))
|
||||
}
|
||||
|
||||
strongSelf.imageNode.frame = CGRect(origin: CGPoint(x: (params.width - imageSize.width) / 2.0, y: 12.0), size: imageSize)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
override func animateInsertion(_ currentTimestamp: Double, duration: Double, short: Bool) {
|
||||
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.4)
|
||||
}
|
||||
|
||||
override func animateRemoved(_ currentTimestamp: Double, duration: Double) {
|
||||
self.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.15, removeOnCompletion: false)
|
||||
}
|
||||
}
|
184
submodules/WalletUI/Sources/WalletQrScanScreen.swift
Normal file
184
submodules/WalletUI/Sources/WalletQrScanScreen.swift
Normal file
@ -0,0 +1,184 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AppBundle
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import AlertUI
|
||||
|
||||
public final class WalletQrScanScreen: ViewController {
|
||||
private let context: AccountContext
|
||||
private let tonContext: TonContext
|
||||
private var presentationData: PresentationData
|
||||
|
||||
public init(context: AccountContext, tonContext: TonContext) {
|
||||
self.context = context
|
||||
self.tonContext = tonContext
|
||||
|
||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
let defaultNavigationPresentationData = NavigationBarPresentationData(presentationTheme: self.presentationData.theme, presentationStrings: self.presentationData.strings)
|
||||
let navigationBarTheme = NavigationBarTheme(buttonColor: defaultNavigationPresentationData.theme.buttonColor, disabledButtonColor: defaultNavigationPresentationData.theme.disabledButtonColor, primaryTextColor: defaultNavigationPresentationData.theme.primaryTextColor, backgroundColor: .clear, separatorColor: .clear, badgeBackgroundColor: defaultNavigationPresentationData.theme.badgeBackgroundColor, badgeStrokeColor: defaultNavigationPresentationData.theme.badgeStrokeColor, badgeTextColor: defaultNavigationPresentationData.theme.badgeTextColor)
|
||||
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(theme: navigationBarTheme, strings: defaultNavigationPresentationData.strings))
|
||||
|
||||
self.navigationPresentation = .modalInLargeLayout
|
||||
self.supportedOrientations = ViewControllerSupportedOrientations(regularSize: .all, compactSize: .portrait)
|
||||
self.navigationBar?.intrinsicCanTransitionInline = false
|
||||
|
||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||
}
|
||||
|
||||
required init(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
@objc private func backPressed() {
|
||||
self.dismiss()
|
||||
}
|
||||
|
||||
override public func loadDisplayNode() {
|
||||
self.displayNode = WalletQrScanScreenNode(presentationData: self.presentationData)
|
||||
|
||||
self.displayNodeDidLoad()
|
||||
}
|
||||
|
||||
override public func containerLayoutUpdated(_ layout: ContainerViewLayout, transition: ContainedViewLayoutTransition) {
|
||||
super.containerLayoutUpdated(layout, transition: transition)
|
||||
|
||||
(self.displayNode as! WalletQrScanScreenNode).containerLayoutUpdated(layout: layout, navigationHeight: self.navigationHeight, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
private final class WalletQrScanScreenNode: ViewControllerTracingNode, UIScrollViewDelegate {
|
||||
private var presentationData: PresentationData
|
||||
|
||||
private let navigationBackgroundNode: ASDisplayNode
|
||||
private let navigationSeparatorNode: ASDisplayNode
|
||||
private let navigationTitleNode: ImmediateTextNode
|
||||
private let scrollNode: ASScrollNode
|
||||
private let iconNode: ASImageNode
|
||||
private let titleNode: ImmediateTextNode
|
||||
private let textNode: ImmediateTextNode
|
||||
|
||||
private var navigationHeight: CGFloat?
|
||||
|
||||
init(presentationData: PresentationData) {
|
||||
self.presentationData = presentationData
|
||||
|
||||
self.navigationBackgroundNode = ASDisplayNode()
|
||||
self.navigationBackgroundNode.backgroundColor = self.presentationData.theme.rootController.navigationBar.backgroundColor
|
||||
self.navigationBackgroundNode.alpha = 0.0
|
||||
self.navigationSeparatorNode = ASDisplayNode()
|
||||
self.navigationSeparatorNode.backgroundColor = self.presentationData.theme.rootController.navigationBar.separatorColor
|
||||
|
||||
self.scrollNode = ASScrollNode()
|
||||
|
||||
self.iconNode = ASImageNode()
|
||||
self.iconNode.displayWithoutProcessing = true
|
||||
self.iconNode.displaysAsynchronously = false
|
||||
|
||||
let title: String = "24 Secret Words"
|
||||
let text: String = "Write down these 24 words in the correct order and store them in a secret place.\n\nUse these secret words to restore access to your wallet if you lose your passcode or Telegram account."
|
||||
let buttonText: String = "Done"
|
||||
|
||||
self.iconNode.image = UIImage(bundleImageName: "Settings/Wallet/WordsDisplayIcon")
|
||||
|
||||
self.titleNode = ImmediateTextNode()
|
||||
self.titleNode.displaysAsynchronously = false
|
||||
self.titleNode.attributedText = NSAttributedString(string: title, font: Font.bold(32.0), textColor: self.presentationData.theme.list.itemPrimaryTextColor)
|
||||
self.titleNode.maximumNumberOfLines = 0
|
||||
self.titleNode.textAlignment = .center
|
||||
|
||||
self.navigationTitleNode = ImmediateTextNode()
|
||||
self.navigationTitleNode.displaysAsynchronously = false
|
||||
self.navigationTitleNode.attributedText = NSAttributedString(string: title, font: Font.bold(17.0), textColor: self.presentationData.theme.list.itemPrimaryTextColor)
|
||||
self.navigationTitleNode.maximumNumberOfLines = 0
|
||||
self.navigationTitleNode.textAlignment = .center
|
||||
|
||||
self.textNode = ImmediateTextNode()
|
||||
self.textNode.displaysAsynchronously = false
|
||||
self.textNode.attributedText = NSAttributedString(string: text, font: Font.regular(16.0), textColor: self.presentationData.theme.list.itemPrimaryTextColor)
|
||||
self.textNode.maximumNumberOfLines = 0
|
||||
self.textNode.lineSpacing = 0.1
|
||||
self.textNode.textAlignment = .center
|
||||
|
||||
super.init()
|
||||
|
||||
self.backgroundColor = self.presentationData.theme.list.plainBackgroundColor
|
||||
|
||||
self.addSubnode(self.scrollNode)
|
||||
|
||||
self.scrollNode.addSubnode(self.iconNode)
|
||||
self.scrollNode.addSubnode(self.titleNode)
|
||||
self.scrollNode.addSubnode(self.textNode)
|
||||
|
||||
self.navigationBackgroundNode.addSubnode(self.navigationSeparatorNode)
|
||||
self.navigationBackgroundNode.addSubnode(self.navigationTitleNode)
|
||||
self.addSubnode(self.navigationBackgroundNode)
|
||||
}
|
||||
|
||||
override func didLoad() {
|
||||
super.didLoad()
|
||||
|
||||
self.scrollNode.view.alwaysBounceVertical = false
|
||||
self.scrollNode.view.showsVerticalScrollIndicator = false
|
||||
self.scrollNode.view.showsHorizontalScrollIndicator = false
|
||||
if #available(iOSApplicationExtension 11.0, iOS 11.0, *) {
|
||||
self.scrollNode.view.contentInsetAdjustmentBehavior = .never
|
||||
}
|
||||
self.scrollNode.view.delegate = self
|
||||
}
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
let navigationHeight = self.navigationHeight ?? 0.0
|
||||
let alpha: CGFloat = scrollView.contentOffset.y >= (self.titleNode.frame.maxY - navigationHeight) ? 1.0 : 0.0
|
||||
if self.navigationBackgroundNode.alpha != alpha {
|
||||
let transition: ContainedViewLayoutTransition = .animated(duration: 0.12, curve: .easeInOut)
|
||||
transition.updateAlpha(node: self.navigationBackgroundNode, alpha: alpha, beginWithCurrentState: true)
|
||||
}
|
||||
}
|
||||
|
||||
func containerLayoutUpdated(layout: ContainerViewLayout, navigationHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
self.navigationHeight = navigationHeight
|
||||
|
||||
let sideInset: CGFloat = 32.0
|
||||
let buttonSideInset: CGFloat = 48.0
|
||||
let iconSpacing: CGFloat = 5.0
|
||||
let titleSpacing: CGFloat = 19.0
|
||||
let textSpacing: CGFloat = 37.0
|
||||
let buttonHeight: CGFloat = 50.0
|
||||
let buttonSpacing: CGFloat = 45.0
|
||||
let wordSpacing: CGFloat = 12.0
|
||||
let indexSpacing: CGFloat = 4.0
|
||||
|
||||
transition.updateFrame(node: self.navigationBackgroundNode, frame: CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: navigationHeight)))
|
||||
transition.updateFrame(node: self.navigationSeparatorNode, frame: CGRect(origin: CGPoint(x: 0.0, y: navigationHeight), size: CGSize(width: layout.size.width, height: UIScreenPixel)))
|
||||
|
||||
transition.updateFrame(node: self.scrollNode, frame: CGRect(origin: CGPoint(), size: layout.size))
|
||||
|
||||
let iconSize = self.iconNode.image?.size ?? CGSize(width: 50.0, height: 50.0)
|
||||
|
||||
let titleSize = self.titleNode.updateLayout(CGSize(width: layout.size.width - sideInset * 2.0, height: layout.size.height))
|
||||
let navigationTitleSize = self.navigationTitleNode.updateLayout(CGSize(width: layout.size.width - sideInset * 2.0, height: layout.size.height))
|
||||
let textSize = self.textNode.updateLayout(CGSize(width: layout.size.width - sideInset * 2.0, height: layout.size.height))
|
||||
|
||||
var contentHeight: CGFloat = 0.0
|
||||
|
||||
let contentVerticalOrigin = navigationHeight + 10.0
|
||||
|
||||
let iconFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - iconSize.width) / 2.0), y: contentVerticalOrigin), size: iconSize)
|
||||
transition.updateFrameAdditive(node: self.iconNode, frame: iconFrame)
|
||||
let titleFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - titleSize.width) / 2.0), y: iconFrame.maxY + iconSpacing), size: titleSize)
|
||||
transition.updateFrameAdditive(node: self.titleNode, frame: titleFrame)
|
||||
let textFrame = CGRect(origin: CGPoint(x: floor((layout.size.width - textSize.width) / 2.0), y: titleFrame.maxY + titleSpacing), size: textSize)
|
||||
transition.updateFrameAdditive(node: self.textNode, frame: textFrame)
|
||||
|
||||
transition.updateFrameAdditive(node: self.navigationTitleNode, frame: CGRect(origin: CGPoint(x: floor((layout.size.width - navigationTitleSize.width) / 2.0), y: navigationHeight - 44.0 + floor((44.0 - navigationTitleSize.height) / 2.0)), size: navigationTitleSize))
|
||||
|
||||
contentHeight = textFrame.maxY + textSpacing
|
||||
}
|
||||
}
|
196
submodules/WalletUI/Sources/WalletReceiveScreen.swift
Normal file
196
submodules/WalletUI/Sources/WalletReceiveScreen.swift
Normal file
@ -0,0 +1,196 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AppBundle
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import ItemListUI
|
||||
import SwiftSignalKit
|
||||
import OverlayStatusController
|
||||
import ShareController
|
||||
|
||||
private final class WalletReceiveScreenArguments {
|
||||
let context: AccountContext
|
||||
let copyAddress: () -> Void
|
||||
let shareAddressLink: () -> Void
|
||||
|
||||
init(context: AccountContext, copyAddress: @escaping () -> Void, shareAddressLink: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.copyAddress = copyAddress
|
||||
self.shareAddressLink = shareAddressLink
|
||||
}
|
||||
}
|
||||
|
||||
private enum WalletReceiveScreenSection: Int32 {
|
||||
case address
|
||||
}
|
||||
|
||||
private enum WalletReceiveScreenEntry: ItemListNodeEntry {
|
||||
case addressHeader(PresentationTheme, String)
|
||||
case addressCode(PresentationTheme, String)
|
||||
case address(PresentationTheme, String)
|
||||
case copyAddress(PresentationTheme, String)
|
||||
case shareAddressLink(PresentationTheme, String)
|
||||
case addressInfo(PresentationTheme, String)
|
||||
|
||||
var section: ItemListSectionId {
|
||||
switch self {
|
||||
case .addressHeader, .addressCode, .address, .copyAddress, .shareAddressLink, .addressInfo:
|
||||
return WalletReceiveScreenSection.address.rawValue
|
||||
}
|
||||
}
|
||||
|
||||
var stableId: Int32 {
|
||||
switch self {
|
||||
case .addressHeader:
|
||||
return 0
|
||||
case .addressCode:
|
||||
return 1
|
||||
case .address:
|
||||
return 2
|
||||
case .copyAddress:
|
||||
return 3
|
||||
case .shareAddressLink:
|
||||
return 4
|
||||
case .addressInfo:
|
||||
return 5
|
||||
}
|
||||
}
|
||||
|
||||
static func ==(lhs: WalletReceiveScreenEntry, rhs: WalletReceiveScreenEntry) -> Bool {
|
||||
switch lhs {
|
||||
case let .addressHeader(lhsTheme, lhsText):
|
||||
if case let .addressHeader(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .addressCode(lhsTheme, lhsAddress):
|
||||
if case let .addressCode(rhsTheme, rhsAddress) = rhs, lhsTheme === rhsTheme, lhsAddress == rhsAddress {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .address(lhsTheme, lhsAddress):
|
||||
if case let .address(rhsTheme, rhsAddress) = rhs, lhsTheme === rhsTheme, lhsAddress == rhsAddress {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .copyAddress(lhsTheme, lhsText):
|
||||
if case let .copyAddress(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .shareAddressLink(lhsTheme, lhsText):
|
||||
if case let .shareAddressLink(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .addressInfo(lhsTheme, lhsText):
|
||||
if case let .addressInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func <(lhs: WalletReceiveScreenEntry, rhs: WalletReceiveScreenEntry) -> Bool {
|
||||
return lhs.stableId < rhs.stableId
|
||||
}
|
||||
|
||||
func item(_ arguments: WalletReceiveScreenArguments) -> ListViewItem {
|
||||
switch self {
|
||||
case let .addressHeader(theme, text):
|
||||
return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section)
|
||||
case let .addressCode(theme, address):
|
||||
return WalletQrCodeItem(theme: theme, address: "ton://\(address)", sectionId: self.section, style: .blocks)
|
||||
case let .address(theme, address):
|
||||
return ItemListMultilineTextItem(theme: theme, text: address, enabledEntityTypes: [], font: .monospace, sectionId: self.section, style: .blocks)
|
||||
case let .copyAddress(theme, text):
|
||||
return ItemListActionItem(theme: theme, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: {
|
||||
arguments.copyAddress()
|
||||
})
|
||||
case let .shareAddressLink(theme, text):
|
||||
return ItemListActionItem(theme: theme, title: text, kind: .generic, alignment: .natural, sectionId: self.section, style: .blocks, action: {
|
||||
arguments.shareAddressLink()
|
||||
})
|
||||
case let .addressInfo(theme, text):
|
||||
return ItemListTextItem(theme: theme, text: .markdown(text), sectionId: self.section)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func walletReceiveScreenEntries(presentationData: PresentationData, address: String) -> [WalletReceiveScreenEntry] {
|
||||
var entries: [WalletReceiveScreenEntry] = []
|
||||
entries.append(.addressHeader(presentationData.theme, "YOUR WALLET ADDRESS"))
|
||||
|
||||
let address = String(address[address.startIndex..<address.index(address.startIndex, offsetBy: 24)] + "\n" + address[address.index(address.startIndex, offsetBy: 24)..<address.endIndex])
|
||||
entries.append(.addressCode(presentationData.theme, address))
|
||||
entries.append(.address(presentationData.theme, address))
|
||||
entries.append(.copyAddress(presentationData.theme, "Copy Wallet Address"))
|
||||
entries.append(.shareAddressLink(presentationData.theme, "Share Wallet Address"))
|
||||
entries.append(.addressInfo(presentationData.theme, "Share this link with other Gram wallet owners to receive Grams from them."))
|
||||
return entries
|
||||
}
|
||||
|
||||
protocol WalletReceiveScreen {
|
||||
|
||||
}
|
||||
|
||||
private final class WalletReceiveScreenImpl: ItemListController<WalletReceiveScreenEntry>, WalletSendScreen {
|
||||
|
||||
}
|
||||
|
||||
func walletReceiveScreen(context: AccountContext, tonContext: TonContext, walletInfo: WalletInfo, address: String) -> ViewController {
|
||||
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
||||
var presentInGlobalOverlayImpl: ((ViewController, Any?) -> Void)?
|
||||
var dismissImpl: (() -> Void)?
|
||||
|
||||
let arguments = WalletReceiveScreenArguments(context: context, copyAddress: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
UIPasteboard.general.string = address
|
||||
|
||||
presentInGlobalOverlayImpl?(OverlayStatusController(theme: presentationData.theme, strings: presentationData.strings, type: .genericSuccess("Address copied to clipboard.", false)), nil)
|
||||
}, shareAddressLink: {
|
||||
guard let address = address.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed) else {
|
||||
return
|
||||
}
|
||||
let controller = ShareController(context: context, subject: .url("ton://\(address)"), preferredAction: .default)
|
||||
presentControllerImpl?(controller, nil)
|
||||
})
|
||||
|
||||
let address: Signal<String, NoError> = .single(address)
|
||||
|
||||
let signal = combineLatest(queue: .mainQueue(), context.sharedContext.presentationData, address)
|
||||
|> map { presentationData, address -> (ItemListControllerState, (ItemListNodeState<WalletReceiveScreenEntry>, WalletReceiveScreenEntry.ItemGenerationArguments)) in
|
||||
let rightNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Done), style: .regular, enabled: true, action: {
|
||||
dismissImpl?()
|
||||
})
|
||||
|
||||
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text("Receive Grams"), leftNavigationButton: rightNavigationButton, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
|
||||
let listState = ItemListNodeState(entries: walletReceiveScreenEntries(presentationData: presentationData, address: address), style: .blocks, animateChanges: false)
|
||||
|
||||
return (controllerState, (listState, arguments))
|
||||
}
|
||||
|
||||
let controller = WalletReceiveScreenImpl(context: context, state: signal)
|
||||
controller.navigationPresentation = .modal
|
||||
presentControllerImpl = { [weak controller] c, a in
|
||||
controller?.present(c, in: .window(.root), with: a)
|
||||
}
|
||||
presentInGlobalOverlayImpl = { [weak controller] c, a in
|
||||
controller?.presentInGlobalOverlay(c, with: a)
|
||||
}
|
||||
dismissImpl = { [weak controller] in
|
||||
let _ = controller?.dismiss()
|
||||
}
|
||||
return controller
|
||||
}
|
425
submodules/WalletUI/Sources/WalletSendScreen.swift
Normal file
425
submodules/WalletUI/Sources/WalletSendScreen.swift
Normal file
@ -0,0 +1,425 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AppBundle
|
||||
import AccountContext
|
||||
import TelegramPresentationData
|
||||
import AsyncDisplayKit
|
||||
import Display
|
||||
import Postbox
|
||||
import TelegramCore
|
||||
import ItemListUI
|
||||
import SwiftSignalKit
|
||||
import AlertUI
|
||||
import TextFormat
|
||||
|
||||
private let walletAddressLength: Int = 48
|
||||
|
||||
private final class WalletSendScreenArguments {
|
||||
let context: AccountContext
|
||||
let updateState: ((WalletSendScreenState) -> WalletSendScreenState) -> Void
|
||||
let selectNextInputItem: (WalletSendScreenEntryTag) -> Void
|
||||
let proceed: () -> Void
|
||||
|
||||
init(context: AccountContext, updateState: @escaping ((WalletSendScreenState) -> WalletSendScreenState) -> Void, selectNextInputItem: @escaping (WalletSendScreenEntryTag) -> Void, proceed: @escaping () -> Void) {
|
||||
self.context = context
|
||||
self.updateState = updateState
|
||||
self.selectNextInputItem = selectNextInputItem
|
||||
self.proceed = proceed
|
||||
}
|
||||
}
|
||||
|
||||
private enum WalletSendScreenSection: Int32 {
|
||||
case address
|
||||
case amount
|
||||
case comment
|
||||
}
|
||||
|
||||
private enum WalletSendScreenEntryTag: ItemListItemTag {
|
||||
case address
|
||||
case amount
|
||||
case comment
|
||||
|
||||
func isEqual(to other: ItemListItemTag) -> Bool {
|
||||
if let other = other as? WalletSendScreenEntryTag {
|
||||
return self == other
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private let invalidAddressCharacters = CharacterSet(charactersIn: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=").inverted
|
||||
private func isValidAddress(_ address: String, exactLength: Bool = false) -> Bool {
|
||||
if address.count > walletAddressLength || address.rangeOfCharacter(from: invalidAddressCharacters) != nil {
|
||||
return false
|
||||
}
|
||||
if exactLength && address.count != walletAddressLength {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private let invalidAmountCharacters = CharacterSet(charactersIn: "01234567890.,").inverted
|
||||
private func isValidAmount(_ amount: String) -> Bool {
|
||||
if amount.rangeOfCharacter(from: invalidAmountCharacters) != nil {
|
||||
return false
|
||||
}
|
||||
var hasDecimalSeparator = false
|
||||
var hasLeadingZero = false
|
||||
var index = 0
|
||||
for c in amount {
|
||||
if c == "." || c == "," {
|
||||
if !hasDecimalSeparator {
|
||||
hasDecimalSeparator = true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
index += 1
|
||||
}
|
||||
|
||||
var decimalIndex: String.Index?
|
||||
if let index = amount.firstIndex(of: ".") {
|
||||
decimalIndex = index
|
||||
} else if let index = amount.firstIndex(of: ",") {
|
||||
decimalIndex = index
|
||||
}
|
||||
|
||||
if let decimalIndex = decimalIndex, amount.distance(from: decimalIndex, to: amount.endIndex) > 4 {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
private func stringForGramsAmount(_ amount: Int64, decimalSeparator: String = ".") -> String {
|
||||
if amount < 1000 {
|
||||
return "0\(decimalSeparator)\(String(amount).rightJustified(width: 3, pad: "0"))"
|
||||
} else {
|
||||
var string = String(amount)
|
||||
string.insert(contentsOf: decimalSeparator, at: string.index(string.endIndex, offsetBy: -3))
|
||||
return string
|
||||
}
|
||||
}
|
||||
|
||||
private func amountValue(_ string: String) -> Int64 {
|
||||
return Int64((Double(string) ?? 0.0) * 1000.0)
|
||||
}
|
||||
|
||||
private func normalizedStringForGramsString(_ string: String, decimalSeparator: String = ".") -> String {
|
||||
return stringForGramsAmount(amountValue(string), decimalSeparator: decimalSeparator)
|
||||
}
|
||||
|
||||
private enum WalletSendScreenEntry: ItemListNodeEntry {
|
||||
case addressHeader(PresentationTheme, String)
|
||||
case address(PresentationTheme, String, String)
|
||||
case addressInfo(PresentationTheme, String)
|
||||
|
||||
case amountHeader(PresentationTheme, String, String, Bool)
|
||||
case amount(PresentationTheme, PresentationStrings, String, String)
|
||||
|
||||
case commentHeader(PresentationTheme, String)
|
||||
case comment(PresentationTheme, String, String)
|
||||
|
||||
var section: ItemListSectionId {
|
||||
switch self {
|
||||
case .addressHeader, .address, .addressInfo:
|
||||
return WalletSendScreenSection.address.rawValue
|
||||
case .amountHeader, .amount:
|
||||
return WalletSendScreenSection.amount.rawValue
|
||||
case .commentHeader, .comment:
|
||||
return WalletSendScreenSection.comment.rawValue
|
||||
}
|
||||
}
|
||||
|
||||
var stableId: Int32 {
|
||||
switch self {
|
||||
case .addressHeader:
|
||||
return 0
|
||||
case .address:
|
||||
return 1
|
||||
case .addressInfo:
|
||||
return 2
|
||||
case .amountHeader:
|
||||
return 3
|
||||
case .amount:
|
||||
return 4
|
||||
case .commentHeader:
|
||||
return 5
|
||||
case .comment:
|
||||
return 6
|
||||
}
|
||||
}
|
||||
|
||||
static func ==(lhs: WalletSendScreenEntry, rhs: WalletSendScreenEntry) -> Bool {
|
||||
switch lhs {
|
||||
case let .addressHeader(lhsTheme, lhsText):
|
||||
if case let .addressHeader(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .address(lhsTheme, lhsPlaceholder, lhsAddress):
|
||||
if case let .address(rhsTheme, rhsPlaceholder, rhsAddress) = rhs, lhsTheme === rhsTheme, lhsPlaceholder == rhsPlaceholder, lhsAddress == rhsAddress {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .addressInfo(lhsTheme, lhsText):
|
||||
if case let .addressInfo(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .amountHeader(lhsTheme, lhsText, lhsBalance, lhsInsufficient):
|
||||
if case let .amountHeader(rhsTheme, rhsText, rhsBalance, rhsInsufficient) = rhs, lhsTheme === rhsTheme, lhsText == rhsText, lhsBalance == rhsBalance, lhsInsufficient == rhsInsufficient {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .amount(lhsTheme, lhsStrings, lhsPlaceholder, lhsBalance):
|
||||
if case let .amount(rhsTheme, rhsStrings, rhsPlaceholder, rhsBalance) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsPlaceholder == rhsPlaceholder, lhsBalance == rhsBalance {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .commentHeader(lhsTheme, lhsText):
|
||||
if case let .commentHeader(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .comment(lhsTheme, lhsPlaceholder, lhsText):
|
||||
if case let .comment(rhsTheme, rhsPlaceholder, rhsText) = rhs, lhsTheme === rhsTheme, lhsPlaceholder == rhsPlaceholder, lhsText == rhsText {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func <(lhs: WalletSendScreenEntry, rhs: WalletSendScreenEntry) -> Bool {
|
||||
return lhs.stableId < rhs.stableId
|
||||
}
|
||||
|
||||
func item(_ arguments: WalletSendScreenArguments) -> ListViewItem {
|
||||
switch self {
|
||||
case let .addressHeader(theme, text):
|
||||
return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section)
|
||||
case let .address(theme, placeholder, address):
|
||||
return ItemListMultilineInputItem(theme: theme, text: address, placeholder: "Enter wallet address...", maxLength: .init(value: walletAddressLength, display: false), sectionId: self.section, style: .blocks, capitalization: false, autocorrection: false, returnKeyType: .next, minimalHeight: 68.0, textUpdated: { address in
|
||||
arguments.updateState { state in
|
||||
var state = state
|
||||
state.address = address
|
||||
return state
|
||||
}
|
||||
}, shouldUpdateText: { text in
|
||||
return isValidAddress(text)
|
||||
}, tag: WalletSendScreenEntryTag.address, action: {
|
||||
arguments.selectNextInputItem(WalletSendScreenEntryTag.address)
|
||||
})
|
||||
case let .addressInfo(theme, text):
|
||||
return ItemListTextItem(theme: theme, text: .markdown(text), sectionId: self.section)
|
||||
case let .amountHeader(theme, text, balance, insufficient):
|
||||
return ItemListSectionHeaderItem(theme: theme, text: text, accessoryText: ItemListSectionHeaderAccessoryText(value: balance, color: insufficient ? .destructive : .generic), sectionId: self.section)
|
||||
case let .amount(theme, strings, placeholder, text):
|
||||
return ItemListSingleLineInputItem(theme: theme, strings: strings, title: NSAttributedString(string: ""), text: text, placeholder: placeholder, type: .decimal, returnKeyType: .next, tag: WalletSendScreenEntryTag.amount, sectionId: self.section, textUpdated: { text in
|
||||
arguments.updateState { state in
|
||||
var state = state
|
||||
state.amount = text
|
||||
return state
|
||||
}
|
||||
}, shouldUpdateText: { text in
|
||||
return isValidAmount(text)
|
||||
}, processPaste: { pastedText in
|
||||
if isValidAmount(pastedText) {
|
||||
return normalizedStringForGramsString(pastedText)
|
||||
} else {
|
||||
return text
|
||||
}
|
||||
}, updatedFocus: { focus in
|
||||
if !focus {
|
||||
let presentationData = arguments.context.sharedContext.currentPresentationData.with { $0 }
|
||||
arguments.updateState { state in
|
||||
var state = state
|
||||
if !state.amount.isEmpty {
|
||||
state.amount = normalizedStringForGramsString(state.amount, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator)
|
||||
}
|
||||
return state
|
||||
}
|
||||
}
|
||||
}, action: {
|
||||
arguments.selectNextInputItem(WalletSendScreenEntryTag.amount)
|
||||
})
|
||||
case let .commentHeader(theme, text):
|
||||
return ItemListSectionHeaderItem(theme: theme, text: text, sectionId: self.section)
|
||||
case let .comment(theme, placeholder, value):
|
||||
return ItemListMultilineInputItem(theme: theme, text: value, placeholder: placeholder, maxLength: nil, sectionId: self.section, style: .blocks, returnKeyType: .send, textUpdated: { comment in
|
||||
arguments.updateState { state in
|
||||
var state = state
|
||||
state.comment = comment
|
||||
return state
|
||||
}
|
||||
}, tag: WalletSendScreenEntryTag.comment, action: {
|
||||
arguments.proceed()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct WalletSendScreenState: Equatable {
|
||||
var address: String
|
||||
var amount: String
|
||||
var comment: String
|
||||
}
|
||||
|
||||
private func walletSendScreenEntries(presentationData: PresentationData, balance: Int64?, state: WalletSendScreenState) -> [WalletSendScreenEntry] {
|
||||
var entries: [WalletSendScreenEntry] = []
|
||||
entries.append(.addressHeader(presentationData.theme, "RECIPIENT WALLET ADDRESS"))
|
||||
entries.append(.address(presentationData.theme, "Enter wallet address...", state.address))
|
||||
entries.append(.addressInfo(presentationData.theme, "Copy the 48-letter address of the recipient here or ask them to send you a ton:// link."))
|
||||
|
||||
let amount = amountValue(state.amount)
|
||||
entries.append(.amountHeader(presentationData.theme, "AMOUNT", "BALANCE: \(stringForGramsAmount(balance ?? 0, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator))💎", amount > 0 && (balance ?? 0) < amount))
|
||||
entries.append(.amount(presentationData.theme, presentationData.strings, "Grams to send", state.amount ?? ""))
|
||||
|
||||
entries.append(.commentHeader(presentationData.theme, "COMMENT"))
|
||||
entries.append(.comment(presentationData.theme, "Optional description of the payment", state.comment))
|
||||
return entries
|
||||
}
|
||||
|
||||
protocol WalletSendScreen {
|
||||
|
||||
}
|
||||
|
||||
private final class WalletSendScreenImpl: ItemListController<WalletSendScreenEntry>, WalletSendScreen {
|
||||
|
||||
}
|
||||
|
||||
func walletSendScreen(context: AccountContext, tonContext: TonContext, walletInfo: WalletInfo, address: String? = nil, amount: Int64? = nil) -> ViewController {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let initialState = WalletSendScreenState(address: address ?? "", amount: amount.flatMap { stringForGramsAmount($0, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator) } ?? "", comment: "")
|
||||
|
||||
let statePromise = ValuePromise(initialState, ignoreRepeated: true)
|
||||
let stateValue = Atomic(value: initialState)
|
||||
let updateState: ((WalletSendScreenState) -> WalletSendScreenState) -> Void = { f in
|
||||
statePromise.set(stateValue.modify { f($0) })
|
||||
}
|
||||
|
||||
var presentControllerImpl: ((ViewController, Any?) -> Void)?
|
||||
var presentInGlobalOverlayImpl: ((ViewController, Any?) -> Void)?
|
||||
var pushImpl: ((ViewController) -> Void)?
|
||||
var dismissImpl: (() -> Void)?
|
||||
var selectNextInputItemImpl: ((WalletSendScreenEntryTag) -> Void)?
|
||||
|
||||
let arguments = WalletSendScreenArguments(context: context, updateState: { f in
|
||||
updateState(f)
|
||||
}, selectNextInputItem: { tag in
|
||||
selectNextInputItemImpl?(tag)
|
||||
}, proceed: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let state = stateValue.with { $0 }
|
||||
let amount = amountValue(state.amount)
|
||||
|
||||
updateState { state in
|
||||
var state = state
|
||||
state.amount = stringForGramsAmount(amount, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator)
|
||||
return state
|
||||
}
|
||||
|
||||
let title = NSAttributedString(string: "Confirmation", font: Font.semibold(17.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
|
||||
|
||||
let address = state.address[state.address.startIndex..<state.address.index(state.address.startIndex, offsetBy: walletAddressLength / 2)] + " \n " + state.address[state.address.index(state.address.startIndex, offsetBy: walletAddressLength / 2)..<state.address.endIndex]
|
||||
|
||||
let text = "Do you want to send **\(stringForGramsAmount(amount, decimalSeparator: presentationData.dateTimeFormat.decimalSeparator))** Grams to\n\(address)?"
|
||||
let bodyAttributes = MarkdownAttributeSet(font: Font.regular(13.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
|
||||
let boldAttributes = MarkdownAttributeSet(font: Font.semibold(13.0), textColor: presentationData.theme.actionSheet.primaryTextColor)
|
||||
let attributedText = NSMutableAttributedString(attributedString: parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: bodyAttributes, bold: boldAttributes, link: bodyAttributes, linkAttribute: { _ in return nil }), textAlignment: .center))
|
||||
attributedText.addAttribute(.font, value: Font.monospace(14.0), range: NSMakeRange(attributedText.string.count - address.count - 1, address.count))
|
||||
|
||||
var dismissAlertImpl: ((Bool) -> Void)?
|
||||
let controller = richTextAlertController(context: context, title: title, text: attributedText, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
|
||||
dismissAlertImpl?(true)
|
||||
}), TextAlertAction(type: .defaultAction, title: "Confirm", action: {
|
||||
dismissAlertImpl?(false)
|
||||
pushImpl?(WalletPasscodeScreen(context: context, tonContext: tonContext, mode: .authorizeTransfer(walletInfo, state.address, amount, state.comment)))
|
||||
})], dismissAutomatically: false)
|
||||
presentInGlobalOverlayImpl?(controller, nil)
|
||||
|
||||
dismissAlertImpl = { [weak controller] animated in
|
||||
if animated {
|
||||
controller?.dismissAnimated()
|
||||
} else {
|
||||
controller?.dismiss()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
let balance: Signal<WalletBalance?, NoError> = Signal.single(WalletBalance(rawValue: 2500))
|
||||
|
||||
var focusItemTag: ItemListItemTag?
|
||||
if address == nil {
|
||||
focusItemTag = WalletSendScreenEntryTag.address
|
||||
} else if amount == nil {
|
||||
focusItemTag = WalletSendScreenEntryTag.amount
|
||||
}
|
||||
|
||||
let signal = combineLatest(queue: .mainQueue(), context.sharedContext.presentationData, balance, statePromise.get())
|
||||
|> map { presentationData, balance, state -> (ItemListControllerState, (ItemListNodeState<WalletSendScreenEntry>, WalletSendScreenEntry.ItemGenerationArguments)) in
|
||||
let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: {
|
||||
dismissImpl?()
|
||||
})
|
||||
|
||||
let amount = amountValue(state.amount)
|
||||
var sendEnabled = false
|
||||
if let balance = balance {
|
||||
sendEnabled = isValidAddress(state.address, exactLength: true) && amount > 0 && amount <= balance.rawValue
|
||||
}
|
||||
let rightNavigationButton = ItemListNavigationButton(content: .text("Send"), style: .bold, enabled: sendEnabled, action: {
|
||||
arguments.proceed()
|
||||
})
|
||||
|
||||
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text("Send Grams"), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
|
||||
let listState = ItemListNodeState(entries: walletSendScreenEntries(presentationData: presentationData, balance: balance?.rawValue, state: state), style: .blocks, focusItemTag: focusItemTag, animateChanges: false)
|
||||
|
||||
return (controllerState, (listState, arguments))
|
||||
}
|
||||
|
||||
let controller = WalletSendScreenImpl(context: context, state: signal)
|
||||
controller.navigationPresentation = .modalInLargeLayout
|
||||
presentControllerImpl = { [weak controller] c, a in
|
||||
controller?.present(c, in: .window(.root), with: a)
|
||||
}
|
||||
presentInGlobalOverlayImpl = { [weak controller] c, a in
|
||||
controller?.presentInGlobalOverlay(c, with: a)
|
||||
}
|
||||
pushImpl = { [weak controller] c in
|
||||
controller?.push(c)
|
||||
}
|
||||
dismissImpl = { [weak controller] in
|
||||
controller?.view.endEditing(true)
|
||||
let _ = controller?.dismiss()
|
||||
}
|
||||
selectNextInputItemImpl = { [weak controller] currentTag in
|
||||
guard let controller = controller else {
|
||||
return
|
||||
}
|
||||
var resultItemNode: ItemListItemFocusableNode?
|
||||
var focusOnNext = false
|
||||
let _ = controller.frameForItemNode({ itemNode in
|
||||
if let itemNode = itemNode as? ItemListItemNode, let tag = itemNode.tag, let focusableItemNode = itemNode as? ItemListItemFocusableNode {
|
||||
if focusOnNext && resultItemNode == nil {
|
||||
resultItemNode = focusableItemNode
|
||||
return true
|
||||
} else if currentTag.isEqual(to: tag) {
|
||||
focusOnNext = true
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
if let resultItemNode = resultItemNode {
|
||||
resultItemNode.focus()
|
||||
}
|
||||
}
|
||||
return controller
|
||||
}
|
@ -11,12 +11,15 @@ import SolidRoundedButtonNode
|
||||
import AnimationUI
|
||||
import SwiftSignalKit
|
||||
import OverlayStatusController
|
||||
import ItemListUI
|
||||
|
||||
public enum WalletSplashMode {
|
||||
case intro
|
||||
case created(WalletInfo, [String])
|
||||
case success(WalletInfo)
|
||||
case restoreFailed
|
||||
case sending(WalletInfo, String, Int64, String)
|
||||
case sent(WalletInfo, Int64)
|
||||
}
|
||||
|
||||
public final class WalletSplashScreen: ViewController {
|
||||
@ -45,6 +48,33 @@ public final class WalletSplashScreen: ViewController {
|
||||
case .intro:
|
||||
self.navigationItem.setLeftBarButton(UIBarButtonItem(title: "Not Now", style: .plain, target: self, action: #selector(self.backPressed)), animated: false)
|
||||
self.navigationItem.setRightBarButton(UIBarButtonItem(title: "Import existing wallet", style: .plain, target: self, action: #selector(self.importPressed)), animated: false)
|
||||
case let .sending(walletInfo, address, amount, comment):
|
||||
self.navigationItem.setLeftBarButton(UIBarButtonItem(customDisplayNode: ASDisplayNode())!, animated: false)
|
||||
let _ = (Signal<Never, NoError>.complete() |> delay(3.0, queue: Queue.mainQueue())).start(completed: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
}
|
||||
if let navigationController = strongSelf.navigationController as? NavigationController {
|
||||
var controllers = navigationController.viewControllers
|
||||
controllers = controllers.filter { controller in
|
||||
if controller is WalletSplashScreen {
|
||||
return false
|
||||
}
|
||||
if controller is WalletSendScreen {
|
||||
return false
|
||||
}
|
||||
if controller is WalletInfoScreen {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
controllers.append(WalletSplashScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, mode: .sent(walletInfo, amount)))
|
||||
strongSelf.view.endEditing(true)
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
}
|
||||
})
|
||||
case .sent:
|
||||
self.navigationItem.setLeftBarButton(UIBarButtonItem(customDisplayNode: ASDisplayNode())!, animated: false)
|
||||
case .created, .success, .restoreFailed:
|
||||
break
|
||||
}
|
||||
@ -83,7 +113,7 @@ public final class WalletSplashScreen: ViewController {
|
||||
})
|
||||
case let .created(walletInfo, wordList):
|
||||
strongSelf.push(WalletWordDisplayScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, walletInfo: walletInfo, wordList: wordList))
|
||||
case let .success(walletInfo):
|
||||
case let .success(walletInfo), let .sent(walletInfo, _):
|
||||
let _ = (walletAddress(publicKey: walletInfo.publicKey, tonInstance: strongSelf.tonContext.instance)
|
||||
|> deliverOnMainQueue).start(next: { address in
|
||||
guard let strongSelf = self else {
|
||||
@ -127,6 +157,8 @@ public final class WalletSplashScreen: ViewController {
|
||||
strongSelf.view.endEditing(true)
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
}
|
||||
case .sending:
|
||||
break
|
||||
}
|
||||
}, secondaryAction: { [weak self] in
|
||||
guard let strongSelf = self else {
|
||||
@ -182,7 +214,7 @@ private final class WalletSplashScreenNode: ViewControllerTracingNode {
|
||||
let buttonText: String
|
||||
let termsText: String
|
||||
let secondaryActionText: String
|
||||
|
||||
|
||||
switch mode {
|
||||
case .intro:
|
||||
title = "Gram Wallet"
|
||||
@ -220,6 +252,24 @@ private final class WalletSplashScreenNode: ViewControllerTracingNode {
|
||||
self.animationNode.visibility = true
|
||||
}
|
||||
secondaryActionText = "Enter 24 words"
|
||||
case .sending:
|
||||
title = "Sending Grams"
|
||||
text = "Please wait a few seconds for your transaction to be processed..."
|
||||
buttonText = ""
|
||||
termsText = ""
|
||||
self.iconNode.image = UIImage(bundleImageName: "Settings/Wallet/SendingIcon")
|
||||
secondaryActionText = ""
|
||||
case let .sent(_, amount):
|
||||
title = "Done!"
|
||||
text = "\(amount) Grams have been sent."
|
||||
buttonText = "View My Wallet"
|
||||
termsText = ""
|
||||
self.iconNode.image = nil
|
||||
if let path = getAppBundle().path(forResource: "celebrate", ofType: "tgs") {
|
||||
self.animationNode.setup(account: account, resource: .localFile(path), width: 280, height: 280, mode: .direct)
|
||||
self.animationNode.visibility = true
|
||||
}
|
||||
secondaryActionText = ""
|
||||
}
|
||||
|
||||
self.titleNode = ImmediateTextNode()
|
||||
@ -248,6 +298,7 @@ private final class WalletSplashScreenNode: ViewControllerTracingNode {
|
||||
self.secondaryActionButtonNode = HighlightTrackingButtonNode()
|
||||
|
||||
self.buttonNode = SolidRoundedButtonNode(title: buttonText, theme: self.presentationData.theme, height: 50.0, cornerRadius: 10.0, gloss: true)
|
||||
self.buttonNode.isHidden = buttonText.isEmpty
|
||||
|
||||
super.init()
|
||||
|
||||
|
@ -91,6 +91,32 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E291E16CC6C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libActionSheetPeerItem.a</string>
|
||||
<key>path</key>
|
||||
<string>libActionSheetPeerItem.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29BF0846EE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libActivityIndicator.a</string>
|
||||
<key>path</key>
|
||||
<string>libActivityIndicator.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29F523B9DE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -117,6 +143,84 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29A54A195300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libAvatarNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libAvatarNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29BFBD457D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libCamera.a</string>
|
||||
<key>path</key>
|
||||
<string>libCamera.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E297AB043C800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libChatListSearchRecentPeersNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libChatListSearchRecentPeersNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E2997B4D6D800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libCheckNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libCheckNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E296C9831F100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libContextUI.a</string>
|
||||
<key>path</key>
|
||||
<string>libContextUI.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E292417E0B200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libDeviceAccess.a</string>
|
||||
<key>path</key>
|
||||
<string>libDeviceAccess.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E295915423000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -143,6 +247,19 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>compiled.mach-o.dylib</string>
|
||||
</dict>
|
||||
<key>1DD70E2971ED41B100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libHorizontalPeerItem.a</string>
|
||||
<key>path</key>
|
||||
<string>libHorizontalPeerItem.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29D6F14E1000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -156,6 +273,45 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E295A26607D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libItemListUI.a</string>
|
||||
<key>path</key>
|
||||
<string>libItemListUI.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29AC43662400000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libListSectionHeaderNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libListSectionHeaderNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29A889192100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libLocalAuth.a</string>
|
||||
<key>path</key>
|
||||
<string>libLocalAuth.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29CE34063500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -182,6 +338,19 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29C37F741500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libMergeLists.a</string>
|
||||
<key>path</key>
|
||||
<string>libMergeLists.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29BBAF750C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -195,6 +364,45 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29D0DBC52A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libPasscodeUI.a</string>
|
||||
<key>path</key>
|
||||
<string>libPasscodeUI.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29928D142900000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libPeerOnlineMarkerNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libPeerOnlineMarkerNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29D233F68C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libPeerPresenceStatusManager.a</string>
|
||||
<key>path</key>
|
||||
<string>libPeerPresenceStatusManager.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E290F1A3C6400000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -221,6 +429,32 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>compiled.mach-o.dylib</string>
|
||||
</dict>
|
||||
<key>1DD70E29CBE117ED00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libProgressNavigationButtonNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libProgressNavigationButtonNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</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>1DD70E293E4DE92B00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -234,6 +468,71 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29AD66967300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libReactionSelectionNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libReactionSelectionNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E291D58331200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libSaveToCameraRoll.a</string>
|
||||
<key>path</key>
|
||||
<string>libSaveToCameraRoll.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E2957B5522500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libSegmentedControlNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libSegmentedControlNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29097DBE9200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libSelectablePeerNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libSelectablePeerNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E2981AE180900000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libShareController.a</string>
|
||||
<key>path</key>
|
||||
<string>libShareController.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29524F478E00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -273,6 +572,19 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>compiled.mach-o.dylib</string>
|
||||
</dict>
|
||||
<key>1DD70E2925BBFEEE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libSwitchNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libSwitchNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29F33FDAC300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -364,6 +676,19 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29F40A586F00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libTextSelectionNode.a</string>
|
||||
<key>path</key>
|
||||
<string>libTextSelectionNode.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29CD296A8300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -403,6 +728,19 @@
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>1DD70E29597BAFBB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>libUrlEscaping.a</string>
|
||||
<key>path</key>
|
||||
<string>libUrlEscaping.a</string>
|
||||
<key>sourceTree</key>
|
||||
<string>BUILT_PRODUCTS_DIR</string>
|
||||
<key>explicitFileType</key>
|
||||
<string>archive.ar</string>
|
||||
</dict>
|
||||
<key>B401C97968022A5500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -414,20 +752,44 @@
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E299D2580DA00000000</string>
|
||||
<string>1DD70E291E16CC6C00000000</string>
|
||||
<string>1DD70E29BF0846EE00000000</string>
|
||||
<string>1DD70E29F523B9DE00000000</string>
|
||||
<string>1DD70E292420028600000000</string>
|
||||
<string>1DD70E29A54A195300000000</string>
|
||||
<string>1DD70E29BFBD457D00000000</string>
|
||||
<string>1DD70E297AB043C800000000</string>
|
||||
<string>1DD70E2997B4D6D800000000</string>
|
||||
<string>1DD70E296C9831F100000000</string>
|
||||
<string>1DD70E292417E0B200000000</string>
|
||||
<string>1DD70E295915423000000000</string>
|
||||
<string>1DD70E29FF334B1F00000000</string>
|
||||
<string>1DD70E2971ED41B100000000</string>
|
||||
<string>1DD70E29D6F14E1000000000</string>
|
||||
<string>1DD70E295A26607D00000000</string>
|
||||
<string>1DD70E29AC43662400000000</string>
|
||||
<string>1DD70E29A889192100000000</string>
|
||||
<string>1DD70E29CE34063500000000</string>
|
||||
<string>1DD70E2936DE2CF900000000</string>
|
||||
<string>1DD70E29C37F741500000000</string>
|
||||
<string>1DD70E29BBAF750C00000000</string>
|
||||
<string>1DD70E29D0DBC52A00000000</string>
|
||||
<string>1DD70E29928D142900000000</string>
|
||||
<string>1DD70E29D233F68C00000000</string>
|
||||
<string>1DD70E290F1A3C6400000000</string>
|
||||
<string>1DD70E29DB6520C800000000</string>
|
||||
<string>1DD70E29CBE117ED00000000</string>
|
||||
<string>1DD70E29AA32BBC600000000</string>
|
||||
<string>1DD70E293E4DE92B00000000</string>
|
||||
<string>1DD70E29AD66967300000000</string>
|
||||
<string>1DD70E291D58331200000000</string>
|
||||
<string>1DD70E2957B5522500000000</string>
|
||||
<string>1DD70E29097DBE9200000000</string>
|
||||
<string>1DD70E2981AE180900000000</string>
|
||||
<string>1DD70E29524F478E00000000</string>
|
||||
<string>1DD70E293594DCC000000000</string>
|
||||
<string>1DD70E29D65BA68200000000</string>
|
||||
<string>1DD70E2925BBFEEE00000000</string>
|
||||
<string>1DD70E29F33FDAC300000000</string>
|
||||
<string>1DD70E29119CDA0700000000</string>
|
||||
<string>1DD70E2984A59C1D00000000</string>
|
||||
@ -435,9 +797,11 @@
|
||||
<string>1DD70E292395015100000000</string>
|
||||
<string>1DD70E29BA06E3A600000000</string>
|
||||
<string>1DD70E29F0C15F9C00000000</string>
|
||||
<string>1DD70E29F40A586F00000000</string>
|
||||
<string>1DD70E29CD296A8300000000</string>
|
||||
<string>1DD70E29AE67341000000000</string>
|
||||
<string>1DD70E2951398CF200000000</string>
|
||||
<string>1DD70E29597BAFBB00000000</string>
|
||||
</array>
|
||||
</dict>
|
||||
<key>1DD70E29D097476500000000</key>
|
||||
@ -490,6 +854,61 @@
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E29E336006800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>WalletPasscodeScreen.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/WalletPasscodeScreen.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E296D49CFFF00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>WalletQrCodeItem.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/WalletQrCodeItem.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E29DE28A96800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>WalletQrScanScreen.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/WalletQrScanScreen.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E2979DDEBBB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>WalletReceiveScreen.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/WalletReceiveScreen.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E2948FA33F200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXFileReference</string>
|
||||
<key>name</key>
|
||||
<string>WalletSendScreen.swift</string>
|
||||
<key>path</key>
|
||||
<string>Sources/WalletSendScreen.swift</string>
|
||||
<key>sourceTree</key>
|
||||
<string>SOURCE_ROOT</string>
|
||||
</dict>
|
||||
<key>1DD70E2964068E1100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -534,6 +953,11 @@
|
||||
<key>children</key>
|
||||
<array>
|
||||
<string>1DD70E29D2B1401800000000</string>
|
||||
<string>1DD70E29E336006800000000</string>
|
||||
<string>1DD70E296D49CFFF00000000</string>
|
||||
<string>1DD70E29DE28A96800000000</string>
|
||||
<string>1DD70E2979DDEBBB00000000</string>
|
||||
<string>1DD70E2948FA33F200000000</string>
|
||||
<string>1DD70E2964068E1100000000</string>
|
||||
<string>1DD70E2936794EB600000000</string>
|
||||
<string>1DD70E290678D03000000000</string>
|
||||
@ -576,6 +1000,41 @@
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29D2B1401800000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04E336006800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29E336006800000000</string>
|
||||
</dict>
|
||||
<key>E7A30F046D49CFFF00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E296D49CFFF00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04DE28A96800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29DE28A96800000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0479DDEBBB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2979DDEBBB00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0448FA33F200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2948FA33F200000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0464068E1100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -604,6 +1063,11 @@
|
||||
<key>files</key>
|
||||
<array>
|
||||
<string>E7A30F04D2B1401800000000</string>
|
||||
<string>E7A30F04E336006800000000</string>
|
||||
<string>E7A30F046D49CFFF00000000</string>
|
||||
<string>E7A30F04DE28A96800000000</string>
|
||||
<string>E7A30F0479DDEBBB00000000</string>
|
||||
<string>E7A30F0448FA33F200000000</string>
|
||||
<string>E7A30F0464068E1100000000</string>
|
||||
<string>E7A30F0436794EB600000000</string>
|
||||
<string>E7A30F040678D03000000000</string>
|
||||
@ -728,19 +1192,12 @@
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29F523B9DE00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04BBAF750C00000000</key>
|
||||
<key>E7A30F04BFBD457D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29BBAF750C00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04524F478E00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29524F478E00000000</string>
|
||||
<string>1DD70E29BFBD457D00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04D6F14E1000000000</key>
|
||||
<dict>
|
||||
@ -770,6 +1227,160 @@
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E292420028600000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0497B4D6D800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2997B4D6D800000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04C37F741500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29C37F741500000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04BF0846EE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29BF0846EE00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04CBE117ED00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29CBE117ED00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0457B5522500000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2957B5522500000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0425BBFEEE00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2925BBFEEE00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F045A26607D00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E295A26607D00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04BBAF750C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29BBAF750C00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04A889192100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29A889192100000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04D0DBC52A00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29D0DBC52A00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04AA32BBC600000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29AA32BBC600000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04A54A195300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29A54A195300000000</string>
|
||||
</dict>
|
||||
<key>E7A30F041E16CC6C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E291E16CC6C00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04AD66967300000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29AD66967300000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04F40A586F00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29F40A586F00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F046C9831F100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E296C9831F100000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04928D142900000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29928D142900000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04097DBE9200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29097DBE9200000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0471ED41B100000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2971ED41B100000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04AC43662400000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29AC43662400000000</string>
|
||||
</dict>
|
||||
<key>E7A30F047AB043C800000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E297AB043C800000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04D233F68C00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29D233F68C00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F043E4DE92B00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -777,6 +1388,41 @@
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E293E4DE92B00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F042417E0B200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E292417E0B200000000</string>
|
||||
</dict>
|
||||
<key>E7A30F041D58331200000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E291D58331200000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04597BAFBB00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29597BAFBB00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F0481AE180900000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E2981AE180900000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04524F478E00000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
<string>PBXBuildFile</string>
|
||||
<key>fileRef</key>
|
||||
<string>1DD70E29524F478E00000000</string>
|
||||
</dict>
|
||||
<key>E7A30F04AE67341000000000</key>
|
||||
<dict>
|
||||
<key>isa</key>
|
||||
@ -807,13 +1453,39 @@
|
||||
<string>E7A30F04BA06E3A600000000</string>
|
||||
<string>E7A30F049D2580DA00000000</string>
|
||||
<string>E7A30F04F523B9DE00000000</string>
|
||||
<string>E7A30F04BBAF750C00000000</string>
|
||||
<string>E7A30F04524F478E00000000</string>
|
||||
<string>E7A30F04BFBD457D00000000</string>
|
||||
<string>E7A30F04D6F14E1000000000</string>
|
||||
<string>E7A30F04CD296A8300000000</string>
|
||||
<string>E7A30F043594DCC000000000</string>
|
||||
<string>E7A30F042420028600000000</string>
|
||||
<string>E7A30F0497B4D6D800000000</string>
|
||||
<string>E7A30F04C37F741500000000</string>
|
||||
<string>E7A30F04BF0846EE00000000</string>
|
||||
<string>E7A30F04CBE117ED00000000</string>
|
||||
<string>E7A30F0457B5522500000000</string>
|
||||
<string>E7A30F0425BBFEEE00000000</string>
|
||||
<string>E7A30F045A26607D00000000</string>
|
||||
<string>E7A30F04BBAF750C00000000</string>
|
||||
<string>E7A30F04A889192100000000</string>
|
||||
<string>E7A30F04D0DBC52A00000000</string>
|
||||
<string>E7A30F04AA32BBC600000000</string>
|
||||
<string>E7A30F04A54A195300000000</string>
|
||||
<string>E7A30F041E16CC6C00000000</string>
|
||||
<string>E7A30F04AD66967300000000</string>
|
||||
<string>E7A30F04F40A586F00000000</string>
|
||||
<string>E7A30F046C9831F100000000</string>
|
||||
<string>E7A30F04928D142900000000</string>
|
||||
<string>E7A30F04097DBE9200000000</string>
|
||||
<string>E7A30F0471ED41B100000000</string>
|
||||
<string>E7A30F04AC43662400000000</string>
|
||||
<string>E7A30F047AB043C800000000</string>
|
||||
<string>E7A30F04D233F68C00000000</string>
|
||||
<string>E7A30F043E4DE92B00000000</string>
|
||||
<string>E7A30F042417E0B200000000</string>
|
||||
<string>E7A30F041D58331200000000</string>
|
||||
<string>E7A30F04597BAFBB00000000</string>
|
||||
<string>E7A30F0481AE180900000000</string>
|
||||
<string>E7A30F04524F478E00000000</string>
|
||||
<string>E7A30F04AE67341000000000</string>
|
||||
</array>
|
||||
<key>name</key>
|
||||
|
Loading…
x
Reference in New Issue
Block a user