Skip to content

Commit

Permalink
Merge pull request #43 from metaplex-foundation/feature/phatom-connec…
Browse files Browse the repository at this point in the history
…t-support

Add phantom connect support
  • Loading branch information
ajamaica authored Jun 15, 2022
2 parents 81b0138 + 43cc115 commit 5f9e3c2
Show file tree
Hide file tree
Showing 11 changed files with 460 additions and 24 deletions.
10 changes: 9 additions & 1 deletion Sample/Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
B7968E612832DFC900F2F82A /* SampleUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7968E602832DFC900F2F82A /* SampleUITestsLaunchTests.swift */; };
B7968E7A2832F7D600F2F82A /* Metaplex in Frameworks */ = {isa = PBXBuildFile; productRef = B7968E792832F7D600F2F82A /* Metaplex */; };
B79BF1972835C93D00E45723 /* NFTCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = B79BF1962835C93D00E45723 /* NFTCollectionViewCell.swift */; };
B7E55C832858DBB60017B329 /* LogInViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7E55C822858DBB60017B329 /* LogInViewController.swift */; };
B7E55C852858DCED0017B329 /* PhantomDeepLinking.swift in Sources */ = {isa = PBXBuildFile; fileRef = B7E55C842858DCED0017B329 /* PhantomDeepLinking.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -53,6 +55,8 @@
B7968E5E2832DFC800F2F82A /* SampleUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleUITests.swift; sourceTree = "<group>"; };
B7968E602832DFC900F2F82A /* SampleUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleUITestsLaunchTests.swift; sourceTree = "<group>"; };
B79BF1962835C93D00E45723 /* NFTCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NFTCollectionViewCell.swift; sourceTree = "<group>"; };
B7E55C822858DBB60017B329 /* LogInViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogInViewController.swift; sourceTree = "<group>"; };
B7E55C842858DCED0017B329 /* PhantomDeepLinking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhantomDeepLinking.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -109,11 +113,13 @@
B7968E3D2832DFBC00F2F82A /* AppDelegate.swift */,
B7968E3F2832DFBC00F2F82A /* SceneDelegate.swift */,
B7968E412832DFBC00F2F82A /* ViewController.swift */,
B79BF1962835C93D00E45723 /* NFTCollectionViewCell.swift */,
B7E55C822858DBB60017B329 /* LogInViewController.swift */,
B7E55C842858DCED0017B329 /* PhantomDeepLinking.swift */,
B7968E432832DFBC00F2F82A /* Main.storyboard */,
B7968E462832DFC800F2F82A /* Assets.xcassets */,
B7968E482832DFC800F2F82A /* LaunchScreen.storyboard */,
B7968E4B2832DFC800F2F82A /* Info.plist */,
B79BF1962835C93D00E45723 /* NFTCollectionViewCell.swift */,
);
path = Sample;
sourceTree = "<group>";
Expand Down Expand Up @@ -284,7 +290,9 @@
B7968E422832DFBC00F2F82A /* ViewController.swift in Sources */,
B79BF1972835C93D00E45723 /* NFTCollectionViewCell.swift in Sources */,
B7968E3E2832DFBC00F2F82A /* AppDelegate.swift in Sources */,
B7E55C832858DBB60017B329 /* LogInViewController.swift in Sources */,
B7968E402832DFBC00F2F82A /* SceneDelegate.swift in Sources */,
B7E55C852858DCED0017B329 /* PhantomDeepLinking.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
13 changes: 3 additions & 10 deletions Sample/Sample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,21 @@ import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {




func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

38 changes: 38 additions & 0 deletions Sample/Sample/Assets.xcassets/Colors/Green.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.741",
"green" : "1.000",
"red" : "0.000"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.741",
"green" : "1.000",
"red" : "0.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
21 changes: 21 additions & 0 deletions Sample/Sample/Assets.xcassets/metaplex_pdf.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Nav primary position.pdf",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
90 changes: 88 additions & 2 deletions Sample/Sample/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@
<outlet property="delegate" destination="BYZ-38-t0r" id="qHt-1v-BOP"/>
</connections>
</collectionView>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" hidesWhenStopped="YES" animating="YES" style="whiteLarge" translatesAutoresizingMaskIntoConstraints="NO" id="771-iK-zTU">
<rect key="frame" x="188.5" y="429.5" width="37" height="37"/>
<color key="tintColor" name="Green"/>
</activityIndicatorView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jRd-xi-TQq">
<rect key="frame" x="0.0" y="44" width="414" height="64"/>
<subviews>
Expand All @@ -104,12 +108,23 @@
<constraint firstAttribute="width" constant="80.5" id="N3Q-a0-gW1"/>
</constraints>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="right" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ID5-Dw-OD5">
<rect key="frame" x="301" y="22" width="103" height="20.5"/>
<constraints>
<constraint firstAttribute="width" constant="103" id="hpj-2P-QHv"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" name="Neutral90"/>
<constraints>
<constraint firstAttribute="height" constant="64" id="ChB-kt-FWZ"/>
<constraint firstItem="T3j-Q2-AGw" firstAttribute="top" secondItem="jRd-xi-TQq" secondAttribute="top" id="Mjq-Ju-gS9"/>
<constraint firstItem="T3j-Q2-AGw" firstAttribute="leading" secondItem="jRd-xi-TQq" secondAttribute="leading" id="Olu-2l-G4Z"/>
<constraint firstAttribute="trailing" secondItem="ID5-Dw-OD5" secondAttribute="trailing" constant="10" id="WGZ-dL-CX2"/>
<constraint firstItem="ID5-Dw-OD5" firstAttribute="centerY" secondItem="ndT-C1-pf5" secondAttribute="centerY" id="nJZ-ZS-cn4"/>
<constraint firstAttribute="bottom" secondItem="T3j-Q2-AGw" secondAttribute="bottom" id="zh1-nh-G3a"/>
</constraints>
</view>
Expand All @@ -119,22 +134,26 @@
<constraints>
<constraint firstAttribute="trailing" secondItem="Bd4-vP-Hhn" secondAttribute="trailing" id="1jJ-cm-5zN"/>
<constraint firstItem="Bd4-vP-Hhn" firstAttribute="top" secondItem="jRd-xi-TQq" secondAttribute="bottom" id="E3p-Az-rPI"/>
<constraint firstItem="771-iK-zTU" firstAttribute="centerY" secondItem="8bC-Xf-vdC" secondAttribute="centerY" id="JlM-O3-s7k"/>
<constraint firstItem="jRd-xi-TQq" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="NhP-Ng-md4"/>
<constraint firstItem="jRd-xi-TQq" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="TK4-Ff-h7S"/>
<constraint firstItem="jRd-xi-TQq" firstAttribute="trailing" secondItem="6Tk-OE-BBY" secondAttribute="trailing" id="dJd-Nw-ka8"/>
<constraint firstAttribute="bottom" secondItem="Bd4-vP-Hhn" secondAttribute="bottom" id="dyO-7z-e8f"/>
<constraint firstItem="771-iK-zTU" firstAttribute="centerX" secondItem="8bC-Xf-vdC" secondAttribute="centerX" id="iyV-GW-gHa"/>
<constraint firstItem="Bd4-vP-Hhn" firstAttribute="top" secondItem="jRd-xi-TQq" secondAttribute="bottom" id="wEZ-hv-1zg"/>
<constraint firstItem="Bd4-vP-Hhn" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="yry-iV-0zc"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="kuu-HP-jeq"/>
<connections>
<outlet property="collectionView" destination="Bd4-vP-Hhn" id="cnY-sA-Qo4"/>
<outlet property="loadingIndicator" destination="771-iK-zTU" id="rXs-yl-h7k"/>
<outlet property="publicKeyLabel" destination="ID5-Dw-OD5" id="4OZ-Nj-p5X"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="944.92753623188412" y="81.696428571428569"/>
<point key="canvasLocation" x="1524.6376811594205" y="81.696428571428569"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="3yx-1v-Hk5">
Expand All @@ -147,19 +166,86 @@
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="B80-G0-4p0"/>
<segue destination="Utb-uB-lVA" kind="relationship" relationship="rootViewController" id="wKE-Ku-yjA"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="lhm-Mt-QEm" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="34.782608695652179" y="81.696428571428569"/>
</scene>
<!--Log In View Controller-->
<scene sceneID="fZv-dg-JXn">
<objects>
<viewController id="Utb-uB-lVA" customClass="LogInViewController" customModule="Sample" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="SxN-1a-eqO">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="metaplex_pdf" translatesAutoresizingMaskIntoConstraints="NO" id="QPD-x3-bi7">
<rect key="frame" x="56.5" y="250" width="301" height="138"/>
<constraints>
<constraint firstAttribute="width" constant="301" id="Uii-vM-jOh"/>
<constraint firstAttribute="height" constant="138" id="eo5-8a-pZO"/>
</constraints>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="aaS-Ga-cdQ">
<rect key="frame" x="82" y="423" width="250" height="50"/>
<color key="backgroundColor" name="Green"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="hTI-xs-hfc"/>
<constraint firstAttribute="width" constant="250" id="t2s-BC-Ryv"/>
</constraints>
<fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Login with Phantom">
<color key="titleColor" name="Background"/>
</state>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="onLogInWithPhantom:" destination="Utb-uB-lVA" eventType="touchUpInside" id="OEs-za-nRi"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Created by Metaplex" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tqq-FH-x3r">
<rect key="frame" x="128" y="841" width="158" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.37254902719999999" green="0.37254902719999999" blue="0.37254902719999999" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="m9s-SM-hvO"/>
<color key="backgroundColor" name="Background"/>
<constraints>
<constraint firstItem="tqq-FH-x3r" firstAttribute="centerX" secondItem="SxN-1a-eqO" secondAttribute="centerX" id="0vJ-mS-n7M"/>
<constraint firstItem="aaS-Ga-cdQ" firstAttribute="centerY" secondItem="SxN-1a-eqO" secondAttribute="centerY" id="64w-cl-ov2"/>
<constraint firstItem="aaS-Ga-cdQ" firstAttribute="centerX" secondItem="SxN-1a-eqO" secondAttribute="centerX" id="Jbh-nU-gVs"/>
<constraint firstItem="QPD-x3-bi7" firstAttribute="centerX" secondItem="SxN-1a-eqO" secondAttribute="centerX" id="iQ8-I5-fky"/>
<constraint firstItem="aaS-Ga-cdQ" firstAttribute="top" secondItem="QPD-x3-bi7" secondAttribute="bottom" constant="35" id="kY3-Cb-bVZ"/>
<constraint firstItem="tqq-FH-x3r" firstAttribute="bottom" secondItem="m9s-SM-hvO" secondAttribute="bottom" id="qYA-P9-OXZ"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="hVR-Pg-8kp"/>
<connections>
<segue destination="BYZ-38-t0r" kind="show" identifier="goToWallet" id="M7W-Rg-n0o"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="FHP-x7-nlW" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="785.50724637681162" y="81.696428571428569"/>
</scene>
</scenes>
<resources>
<image name="metaplex_logo" width="80.5" height="64"/>
<image name="metaplex_pdf" width="213" height="72"/>
<namedColor name="Background">
<color red="0.071000002324581146" green="0.071000002324581146" blue="0.071000002324581146" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
</namedColor>
<namedColor name="Green">
<color red="0.0" green="1" blue="0.74117647058823533" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="Neutral800">
<color red="0.11800000071525574" green="0.11800000071525574" blue="0.11800000071525574" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
Expand Down
11 changes: 11 additions & 0 deletions Sample/Sample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>metaplex</string>
</array>
</dict>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down
Loading

0 comments on commit 5f9e3c2

Please sign in to comment.