Skip to content

Commit

Permalink
Updated MPSDK Sample App
Browse files Browse the repository at this point in the history
  • Loading branch information
tamerbader committed Nov 13, 2024
1 parent 2671005 commit 3962f1b
Show file tree
Hide file tree
Showing 31 changed files with 1,133 additions and 563 deletions.
10 changes: 3 additions & 7 deletions Example/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Square Mobile Payments SDK Example Apps
# Square Mobile Payments SDK Example App


### Assumptions and prerequisites

These example apps make the following assumptions:
The example app make the following assumptions:

* You have read the [Mobile Payments SDK "Build on iOS"](https://developer.squareup.com/docs/mobile-payments-sdk/ios) documentation. These example apps focus on demonstrating how the Square Mobile Payments SDK works by using all of the provided user interfaces of the SDK.
* You have read the [Mobile Payments SDK "Build on iOS"](https://developer.squareup.com/docs/mobile-payments-sdk/ios) documentation. The example app focuses on demonstrating how the Square Mobile Payments SDK works by using all of the provided user interfaces of the SDK.
* You have a Square account enabled for payment processing. If you have not
enabled payment processing on your account (or you are not sure), visit
[squareup.com/activate](https://squareup.com/activate).
Expand All @@ -15,7 +15,3 @@ These example apps make the following assumptions:
* Confirm your environment meets the Square Mobile Payments SDK build requirements listed in the [root README] for this repo.
* Clone this repo (if you have not already):
`git clone https://github.com/square/mobile-payments-sdk-ios`


### Open an example app
There are both SwiftUI and UIKit example app. Choose the one that best fits the technology in your app.
9 changes: 6 additions & 3 deletions Example/Shared/Config.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
public enum Config {
public static let squareApplicationID: String? = nil // Replace with your squareApplicationID
public static let accessToken: String? = nil // Replace with your accessToken
public static let locationID: String? = nil // Replace with your locationID
static let squareApplicationID: String = "your_square_application_id"

// In a production application you should use your server to obtain an access token and locationID.
// For this sample app, we can just authorize Reader SDK using hardcoded values.
static let accessToken: String = "your_access_token"
static let locationID: String = "your_location_id"
}

This file was deleted.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{
"images" : [
{
"filename" : "iconCookie.png",
"filename" : "donut.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
17 changes: 5 additions & 12 deletions Example/Shared/Resources/Launch Screen.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_12" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -15,25 +16,18 @@
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch-background-gradient" translatesAutoresizingMaskIntoConstraints="NO" id="l4z-yJ-kTN">
<rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="square-logo" translatesAutoresizingMaskIntoConstraints="NO" id="jm1-Cu-PKf">
<rect key="frame" x="156.66666666666666" y="321.66666666666669" width="80" height="234.00000000000006"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="donut" translatesAutoresizingMaskIntoConstraints="NO" id="jm1-Cu-PKf">
<rect key="frame" x="96.666666666666686" y="314.66666666666669" width="200" height="248.00000000000006"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="2LC-bF-tvo"/>
<constraint firstAttribute="width" constant="200" id="2LC-bF-tvo"/>
</constraints>
</imageView>
</subviews>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="l4z-yJ-kTN" secondAttribute="trailing" id="OB7-fE-xzA"/>
<constraint firstItem="jm1-Cu-PKf" firstAttribute="centerY" secondItem="Bcu-3y-fUS" secondAttribute="centerY" id="Pkc-ec-dua"/>
<constraint firstItem="jm1-Cu-PKf" firstAttribute="centerX" secondItem="Bcu-3y-fUS" secondAttribute="centerX" id="ibB-mm-Vyv"/>
<constraint firstAttribute="bottom" secondItem="l4z-yJ-kTN" secondAttribute="bottom" id="nhL-CY-1EA"/>
<constraint firstItem="l4z-yJ-kTN" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="qdQ-bY-D1m"/>
<constraint firstItem="l4z-yJ-kTN" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="yga-mt-gPQ"/>
</constraints>
</view>
</viewController>
Expand All @@ -43,7 +37,6 @@
</scene>
</scenes>
<resources>
<image name="launch-background-gradient" width="1024" height="768"/>
<image name="square-logo" width="234" height="234"/>
<image name="donut" width="248" height="248"/>
</resources>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
objects = {

/* Begin PBXBuildFile section */
D09D322D2CE442F9002DB265 /* Payment+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09D322C2CE442F9002DB265 /* Payment+Extensions.swift */; };
D09D322F2CE445C4002DB265 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09D322E2CE445C4002DB265 /* String+Extensions.swift */; };
D09D32322CE4704E002DB265 /* IdempotencyKeyStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09D32312CE4704E002DB265 /* IdempotencyKeyStorage.swift */; };
D09D32342CE50F8E002DB265 /* Config+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D09D32332CE50F8E002DB265 /* Config+Extensions.swift */; };
D0D5BB652CDD75F20054771D /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0D5BB642CDD75F20054771D /* Color+Extensions.swift */; };
D0F1F9242CDEA4DC00E00BB6 /* PermissionRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0F1F9232CDEA4DC00E00BB6 /* PermissionRow.swift */; };
FB1E68D22C1CC55C004DC0A9 /* MobilePaymentsApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB1E68C32C1CC55C004DC0A9 /* MobilePaymentsApp.swift */; };
FB1E68D32C1CC55C004DC0A9 /* MobilePaymentsSDKViewHolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB1E68C52C1CC55C004DC0A9 /* MobilePaymentsSDKViewHolder.swift */; };
FB1E68D42C1CC55C004DC0A9 /* AppButtons.swift in Sources */ = {isa = PBXBuildFile; fileRef = FB1E68C62C1CC55C004DC0A9 /* AppButtons.swift */; };
Expand All @@ -24,6 +30,12 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
D09D322C2CE442F9002DB265 /* Payment+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Payment+Extensions.swift"; sourceTree = "<group>"; };
D09D322E2CE445C4002DB265 /* String+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Extensions.swift"; sourceTree = "<group>"; };
D09D32312CE4704E002DB265 /* IdempotencyKeyStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdempotencyKeyStorage.swift; sourceTree = "<group>"; };
D09D32332CE50F8E002DB265 /* Config+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Config+Extensions.swift"; sourceTree = "<group>"; };
D0D5BB642CDD75F20054771D /* Color+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extensions.swift"; sourceTree = "<group>"; };
D0F1F9232CDEA4DC00E00BB6 /* PermissionRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionRow.swift; sourceTree = "<group>"; };
FB1E68AD2C1CC50A004DC0A9 /* MobilePaymentsSwiftUIExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MobilePaymentsSwiftUIExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
FB1E68C32C1CC55C004DC0A9 /* MobilePaymentsApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MobilePaymentsApp.swift; sourceTree = "<group>"; };
FB1E68C52C1CC55C004DC0A9 /* MobilePaymentsSDKViewHolder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MobilePaymentsSDKViewHolder.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -52,6 +64,44 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
D09D32302CE4703B002DB265 /* Helpers */ = {
isa = PBXGroup;
children = (
D09D32312CE4704E002DB265 /* IdempotencyKeyStorage.swift */,
);
path = Helpers;
sourceTree = "<group>";
};
D0D5BB632CDD75DE0054771D /* Extensions */ = {
isa = PBXGroup;
children = (
D0D5BB642CDD75F20054771D /* Color+Extensions.swift */,
D09D322C2CE442F9002DB265 /* Payment+Extensions.swift */,
D09D322E2CE445C4002DB265 /* String+Extensions.swift */,
D09D32332CE50F8E002DB265 /* Config+Extensions.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
D0F1F9252CDEB44200E00BB6 /* Home */ = {
isa = PBXGroup;
children = (
FB1E68C82C1CC55C004DC0A9 /* HomeViewModel.swift */,
FB1E68C92C1CC55C004DC0A9 /* HomeView.swift */,
);
path = Home;
sourceTree = "<group>";
};
D0F1F9262CDEB44700E00BB6 /* Permissions */ = {
isa = PBXGroup;
children = (
FB1E68CA2C1CC55C004DC0A9 /* PermissionsView.swift */,
D0F1F9232CDEA4DC00E00BB6 /* PermissionRow.swift */,
FBA3341A2CAD99AE00CD889A /* PermissionsViewModel.swift */,
);
path = Permissions;
sourceTree = "<group>";
};
FB1E68A42C1CC50A004DC0A9 = {
isa = PBXGroup;
children = (
Expand All @@ -71,6 +121,8 @@
FB1E68AF2C1CC50A004DC0A9 /* MobilePaymentsSwiftUIExample */ = {
isa = PBXGroup;
children = (
D09D32302CE4703B002DB265 /* Helpers */,
D0D5BB632CDD75DE0054771D /* Extensions */,
FB1E68C42C1CC55C004DC0A9 /* Components */,
FB1E68C32C1CC55C004DC0A9 /* MobilePaymentsApp.swift */,
FB1E68C72C1CC55C004DC0A9 /* Screens */,
Expand All @@ -91,10 +143,8 @@
FB1E68C72C1CC55C004DC0A9 /* Screens */ = {
isa = PBXGroup;
children = (
FB1E68C82C1CC55C004DC0A9 /* HomeViewModel.swift */,
FB1E68C92C1CC55C004DC0A9 /* HomeView.swift */,
FB1E68CA2C1CC55C004DC0A9 /* PermissionsView.swift */,
FBA3341A2CAD99AE00CD889A /* PermissionsViewModel.swift */,
D0F1F9262CDEB44700E00BB6 /* Permissions */,
D0F1F9252CDEB44200E00BB6 /* Home */,
);
path = Screens;
sourceTree = "<group>";
Expand Down Expand Up @@ -229,13 +279,19 @@
buildActionMask = 2147483647;
files = (
FB1E68D22C1CC55C004DC0A9 /* MobilePaymentsApp.swift in Sources */,
D09D322F2CE445C4002DB265 /* String+Extensions.swift in Sources */,
FB1E68D32C1CC55C004DC0A9 /* MobilePaymentsSDKViewHolder.swift in Sources */,
FB1E68D62C1CC55C004DC0A9 /* HomeView.swift in Sources */,
FB1E68EB2C1CC5E8004DC0A9 /* MockMobilePaymentsSDK.swift in Sources */,
FBA3341B2CAD99AE00CD889A /* PermissionsViewModel.swift in Sources */,
D0D5BB652CDD75F20054771D /* Color+Extensions.swift in Sources */,
D09D32322CE4704E002DB265 /* IdempotencyKeyStorage.swift in Sources */,
FB1E68E92C1CC5E8004DC0A9 /* Config.swift in Sources */,
D0F1F9242CDEA4DC00E00BB6 /* PermissionRow.swift in Sources */,
D09D322D2CE442F9002DB265 /* Payment+Extensions.swift in Sources */,
FB1E68D52C1CC55C004DC0A9 /* HomeViewModel.swift in Sources */,
FB1E68D72C1CC55C004DC0A9 /* PermissionsView.swift in Sources */,
D09D32342CE50F8E002DB265 /* Config+Extensions.swift in Sources */,
FB1E68D42C1CC55C004DC0A9 /* AppButtons.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -371,9 +427,11 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"../Shared/Preview Content\"";
DEVELOPMENT_TEAM = J6PNP64J5X;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "Donut Counter";
INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "Square uses Bluetooth to connect and communicate with Square readers and compatible accessories.\n";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Square needs to know where transactions take place to reduce risk and minimize payment disputes.\n";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Some Square readers use the microphone to communicate payment card data to your device.\n";
Expand Down Expand Up @@ -407,9 +465,11 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"../Shared/Preview Content\"";
DEVELOPMENT_TEAM = J6PNP64J5X;
ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "Donut Counter";
INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "Square uses Bluetooth to connect and communicate with Square readers and compatible accessories.\n";
INFOPLIST_KEY_NSLocationWhenInUseUsageDescription = "Square needs to know where transactions take place to reduce risk and minimize payment disputes.\n";
INFOPLIST_KEY_NSMicrophoneUsageDescription = "Some Square readers use the microphone to communicate payment card data to your device.\n";
Expand Down
Loading

0 comments on commit 3962f1b

Please sign in to comment.