Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@W-16171422: [iOS] Update Native Login Sample App to include QR Code Login Flow #422

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions iOSNativeSwiftTemplate/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative './mobile_sdk/SalesforceMobileSDK-iOS/mobilesdk_pods'
require_relative '../../SalesforceMobileSDK-iOS/mobilesdk_pods'
JohnsonEricAtSalesforce marked this conversation as resolved.
Show resolved Hide resolved

platform :ios, '16.0'

Expand All @@ -14,4 +14,4 @@ post_install do |installer|
signposts_post_install(installer)

mobile_sdk_post_install(installer)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@
4FD6C47A1B754AF1002F9F90 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FD6C4791B754AF1002F9F90 /* AppDelegate.swift */; };
4FD6C4A01B755242002F9F90 /* InitialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FD6C49D1B755242002F9F90 /* InitialViewController.swift */; };
69B48C322AD4E7AD0026AEC6 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 69B48C312AD4E7AD0026AEC6 /* PrivacyInfo.xcprivacy */; };
B7168FBC1FACC6F900A48DB5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B7168FBB1FACC6F900A48DB5 /* LaunchScreen.storyboard */; };
96DA78A26C5F837CAFBCDA18 /* Pods_iOSNativeSwiftTemplate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 761909FDDB7AF84F4909F94E /* Pods_iOSNativeSwiftTemplate.framework */; };
B73B520D234FA65F001B069B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B73B520C234FA65F001B069B /* SceneDelegate.swift */; };
B77BD8A321125B510036B284 /* bootconfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = B77BD8A221125B510036B284 /* bootconfig.plist */; };
CEA8CA041F071B2300448B51 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CEA8CA031F071B2300448B51 /* Images.xcassets */; };
D322A61B2C9E2471001F8453 /* QrCodeScanController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D322A6192C9E2471001F8453 /* QrCodeScanController.swift */; };
D322A61C2C9E2471001F8453 /* LoginTypeSelectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D322A61A2C9E2471001F8453 /* LoginTypeSelectionViewController.swift */; };
D322A61F2C9E276E001F8453 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D322A61D2C9E276E001F8453 /* Images.xcassets */; };
D322A6202C9E276E001F8453 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D322A61E2C9E276E001F8453 /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
04E2305AC10D65D17D80DF60 /* Pods-iOSNativeSwiftTemplate.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOSNativeSwiftTemplate.release.xcconfig"; path = "Target Support Files/Pods-iOSNativeSwiftTemplate/Pods-iOSNativeSwiftTemplate.release.xcconfig"; sourceTree = "<group>"; };
0FEBAE0F50CDBC23E1D48FF4 /* Pods-iOSNativeSwiftTemplate.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iOSNativeSwiftTemplate.debug.xcconfig"; path = "Target Support Files/Pods-iOSNativeSwiftTemplate/Pods-iOSNativeSwiftTemplate.debug.xcconfig"; sourceTree = "<group>"; };
4F13E936237DD5D9005BCAE9 /* ContactDetailsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactDetailsView.swift; sourceTree = "<group>"; };
4F13E937237DD5D9005BCAE9 /* ContactsForAccountModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsForAccountModel.swift; sourceTree = "<group>"; };
4F13E938237DD5D9005BCAE9 /* ContactsForAccountListView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactsForAccountListView.swift; sourceTree = "<group>"; };
Expand All @@ -41,25 +44,35 @@
4FD6C49D1B755242002F9F90 /* InitialViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InitialViewController.swift; sourceTree = "<group>"; };
4FF12F8A1DCA91F5004D9EF9 /* iOSNativeSwiftTemplate.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = iOSNativeSwiftTemplate.entitlements; sourceTree = "<group>"; };
69B48C312AD4E7AD0026AEC6 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
B7168FBB1FACC6F900A48DB5 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = "../mobile_sdk/SalesforceMobileSDK-iOS/shared/resources/LaunchScreen.storyboard"; sourceTree = "<group>"; };
761909FDDB7AF84F4909F94E /* Pods_iOSNativeSwiftTemplate.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iOSNativeSwiftTemplate.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B73B520C234FA65F001B069B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
B77BD8A221125B510036B284 /* bootconfig.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = bootconfig.plist; sourceTree = "<group>"; };
CEA8CA031F071B2300448B51 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "mobile_sdk/SalesforceMobileSDK-iOS/shared/resources/Images.xcassets"; sourceTree = SOURCE_ROOT; };
D322A6192C9E2471001F8453 /* QrCodeScanController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QrCodeScanController.swift; sourceTree = "<group>"; };
D322A61A2C9E2471001F8453 /* LoginTypeSelectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginTypeSelectionViewController.swift; sourceTree = "<group>"; };
D322A61D2C9E276E001F8453 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "../../../SalesforceMobileSDK-iOS/shared/resources/Images.xcassets"; sourceTree = "<group>"; };
D322A61E2C9E276E001F8453 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = "../../../SalesforceMobileSDK-iOS/shared/resources/LaunchScreen.storyboard"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
4FD6C4711B754AF1002F9F90 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
96DA78A26C5F837CAFBCDA18 /* Pods_iOSNativeSwiftTemplate.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
10A8D5451CB473C2F4EDC8AC /* Frameworks */ = {
isa = PBXGroup;
children = (
761909FDDB7AF84F4909F94E /* Pods_iOSNativeSwiftTemplate.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
4F13E944237DD626005BCAE9 /* SwiftUI */ = {
isa = PBXGroup;
children = (
Expand All @@ -86,6 +99,8 @@
children = (
4FD6C4761B754AF1002F9F90 /* iOSNativeSwiftTemplate */,
4FD6C4751B754AF1002F9F90 /* Products */,
E7F574B7A060F1E98830E13C /* Pods */,
10A8D5451CB473C2F4EDC8AC /* Frameworks */,
);
sourceTree = "<group>";
};
Expand All @@ -110,12 +125,12 @@
4FD6C4771B754AF1002F9F90 /* Supporting Files */ = {
isa = PBXGroup;
children = (
D322A61D2C9E276E001F8453 /* Images.xcassets */,
D322A61E2C9E276E001F8453 /* LaunchScreen.storyboard */,
69B48C312AD4E7AD0026AEC6 /* PrivacyInfo.xcprivacy */,
4F13E941237DD5EE005BCAE9 /* userstore.json */,
4F13E940237DD5EE005BCAE9 /* usersyncs.json */,
B77BD8A221125B510036B284 /* bootconfig.plist */,
B7168FBB1FACC6F900A48DB5 /* LaunchScreen.storyboard */,
CEA8CA031F071B2300448B51 /* Images.xcassets */,
4FD6C4781B754AF1002F9F90 /* Info.plist */,
);
name = "Supporting Files";
Expand All @@ -134,16 +149,28 @@
name = Classes;
sourceTree = "<group>";
};
E7F574B7A060F1E98830E13C /* Pods */ = {
isa = PBXGroup;
children = (
0FEBAE0F50CDBC23E1D48FF4 /* Pods-iOSNativeSwiftTemplate.debug.xcconfig */,
04E2305AC10D65D17D80DF60 /* Pods-iOSNativeSwiftTemplate.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
4FD6C4731B754AF1002F9F90 /* iOSNativeSwiftTemplate */ = {
isa = PBXNativeTarget;
buildConfigurationList = 4FD6C4931B754AF1002F9F90 /* Build configuration list for PBXNativeTarget "iOSNativeSwiftTemplate" */;
buildPhases = (
C8758747059070ECA4C1FAA1 /* [CP] Check Pods Manifest.lock */,
4FD6C4701B754AF1002F9F90 /* Sources */,
4FD6C4711B754AF1002F9F90 /* Frameworks */,
4FD6C4721B754AF1002F9F90 /* Resources */,
09AACF901317746B37188A7B /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -199,16 +226,58 @@
buildActionMask = 2147483647;
files = (
69B48C322AD4E7AD0026AEC6 /* PrivacyInfo.xcprivacy in Resources */,
D322A61F2C9E276E001F8453 /* Images.xcassets in Resources */,
4F13E943237DD5EE005BCAE9 /* userstore.json in Resources */,
D322A6202C9E276E001F8453 /* LaunchScreen.storyboard in Resources */,
B77BD8A321125B510036B284 /* bootconfig.plist in Resources */,
4F13E942237DD5EE005BCAE9 /* usersyncs.json in Resources */,
CEA8CA041F071B2300448B51 /* Images.xcassets in Resources */,
B7168FBC1FACC6F900A48DB5 /* LaunchScreen.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
09AACF901317746B37188A7B /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-iOSNativeSwiftTemplate/Pods-iOSNativeSwiftTemplate-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-iOSNativeSwiftTemplate/Pods-iOSNativeSwiftTemplate-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iOSNativeSwiftTemplate/Pods-iOSNativeSwiftTemplate-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C8758747059070ECA4C1FAA1 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-iOSNativeSwiftTemplate-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
4FD6C4701B754AF1002F9F90 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -341,16 +410,19 @@
};
4FD6C4941B754AF1002F9F90 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0FEBAE0F50CDBC23E1D48FF4 /* Pods-iOSNativeSwiftTemplate.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = iOSNativeSwiftTemplate/iOSNativeSwiftTemplate.entitlements;
DEVELOPMENT_TEAM = XD7TD9S6ZU;
INFOPLIST_FILE = iOSNativeSwiftTemplate/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_SWIFT_FLAGS = "-DSIGNPOST_ENABLED";
PRODUCT_BUNDLE_IDENTIFIER = "com.salesforce.${PRODUCT_NAME:rfc1034identifier}";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = com.salesforce.iOSNativeSwift;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "iOSNativeSwiftTemplate/Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand All @@ -359,15 +431,18 @@
};
4FD6C4951B754AF1002F9F90 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 04E2305AC10D65D17D80DF60 /* Pods-iOSNativeSwiftTemplate.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_ENTITLEMENTS = iOSNativeSwiftTemplate/iOSNativeSwiftTemplate.entitlements;
DEVELOPMENT_TEAM = XD7TD9S6ZU;
INFOPLIST_FILE = iOSNativeSwiftTemplate/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.salesforce.${PRODUCT_NAME:rfc1034identifier}";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = com.salesforce.iOSNativeSwift;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "iOSNativeSwiftTemplate/Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class AppDelegate : UIResponder, UIApplicationDelegate {
MobileSyncSDKManager.initializeSDK()

// Uncomment when disabling log in via Salesforce UI Bridge API generated QR codes
JohnsonEricAtSalesforce marked this conversation as resolved.
Show resolved Hide resolved
// MobileSyncSDKManager.shared.isQrCodeLoginEnabled = true
// UserAccountManager.shared.loginViewControllerConfig.loginViewControllerCreationBlock = {
// return LoginTypeSelectionViewController()
// }
MobileSyncSDKManager.shared.isQrCodeLoginEnabled = true
UserAccountManager.shared.loginViewControllerConfig.loginViewControllerCreationBlock = {
return LoginTypeSelectionViewController()
}
}

// MARK: UISceneSession Lifecycle
Expand Down
4 changes: 2 additions & 2 deletions iOSNativeSwiftTemplate/iOSNativeSwiftTemplate/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSCameraUsageDescription</key>
<string>This app requires camera usage permissions to capture QR codes for log in.</string>
<key>SFDCOAuthLoginHost</key>
<string>login.salesforce.com</string>
<key>UIApplicationSceneManifest</key>
Expand Down Expand Up @@ -66,7 +68,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>NSCameraUsageDescription</key>
<string>This app requires camera usage permissions to capture QR codes for log in.</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class LoginTypeSelectionViewController: SalesforceLoginViewController {
self,
action: #selector(loginWithQrCodeButtonTapped),
for: .touchUpInside)
loginWithQrCodeButton.setTitle("Log In With QR Code", for: .normal)
loginWithQrCodeButton.setTitle("Log In with QR Code", for: .normal)

view.addSubview(loginWithQrCodeButton)
}
Expand All @@ -68,15 +68,22 @@ class LoginTypeSelectionViewController: SalesforceLoginViewController {
oauthView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true

if let biometricButton = biometricButton {
biometricButton.layer.borderColor = UIColor.white.cgColor
biometricButton.layer.borderWidth = 2.0
biometricButton.translatesAutoresizingMaskIntoConstraints = false
biometricButton.topAnchor.constraint(equalTo: oauthView.bottomAnchor, constant: 22.0).isActive = true
biometricButton.widthAnchor.constraint(equalToConstant: 250.0).isActive = true
biometricButton.heightAnchor.constraint(equalToConstant: 44.0).isActive = true
biometricButton.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
loginWithQrCodeButton.topAnchor.constraint(equalTo: biometricButton.bottomAnchor, constant: 22.0).isActive = true
} else {
loginWithQrCodeButton.topAnchor.constraint(equalTo: oauthView.bottomAnchor, constant: 22.0).isActive = true
}

loginWithQrCodeButton.layer.borderColor = UIColor.white.cgColor
loginWithQrCodeButton.layer.borderWidth = 2.0
loginWithQrCodeButton.translatesAutoresizingMaskIntoConstraints = false
loginWithQrCodeButton.widthAnchor.constraint(equalToConstant: 200.0).isActive = true
loginWithQrCodeButton.widthAnchor.constraint(equalToConstant: 250.0).isActive = true
loginWithQrCodeButton.heightAnchor.constraint(equalToConstant: 44.0).isActive = true
loginWithQrCodeButton.centerXAnchor.constraint(equalTo: view.centerXAnchor).isActive = true
loginWithQrCodeButton.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -22.0).isActive = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<plist version="1.0">
<dict>
<key>remoteAccessConsumerKey</key>
<string>3MVG98dostKihXN53TYStBIiS8FC2a3tE3XhGId0hQ37iQjF0xe4fxMSb2mFaWZn9e3GiLs1q67TNlyRji.Xw</string>
<string>3MVG9.AgwtoIvERSd8i8lePrqfnKG_MM7P9KAJ4g53iaPA4EN8zUt3__o.8YA_hCeRn_kGR.Xe9I9_pnsFuAW</string>
<key>oauthRedirectURI</key>
<string>testsfdc:///mobilesdk/detect/oauth/done</string>
<string>mobilesdk://android/pn/tester</string>
<key>oauthScopes</key>
<array>
<string>web</string>
Expand Down