Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit d1d672c

Browse files
committed
- updated spec / updated example app
1 parent 3c22b70 commit d1d672c

File tree

6 files changed

+176
-169
lines changed

6 files changed

+176
-169
lines changed

Example/Example.xcodeproj/project.pbxproj

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
3D492AD0366B814B92DF365A /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 331694F6A9E2715D8E8724C2 /* Pods_Example.framework */; };
10+
9009263228AE99B200796D1A /* AuthHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9009263128AE99B200796D1A /* AuthHelper.swift */; };
1111
90DF826228AD4F4B00D19F84 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90DF826128AD4F4B00D19F84 /* AppDelegate.swift */; };
1212
90DF826928AD4F4B00D19F84 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90DF826728AD4F4B00D19F84 /* Main.storyboard */; };
1313
90DF826E28AD4F4B00D19F84 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90DF826C28AD4F4B00D19F84 /* LaunchScreen.storyboard */; };
@@ -53,10 +53,12 @@
5353
90DF82D728AD509400D19F84 /* ContractProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90DF82C328AD509400D19F84 /* ContractProvider.swift */; };
5454
90DF82D828AD509400D19F84 /* Client.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90DF82C528AD509400D19F84 /* Client.swift */; };
5555
90DF82DA28AE263800D19F84 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 90DF82D928AE263800D19F84 /* SceneDelegate.swift */; };
56+
9F2AF0E70A03458D01DE4662 /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 370BB819149323E5B557ECA1 /* Pods_Example.framework */; };
5657
/* End PBXBuildFile section */
5758

5859
/* Begin PBXFileReference section */
59-
331694F6A9E2715D8E8724C2 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
60+
370BB819149323E5B557ECA1 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
61+
9009263128AE99B200796D1A /* AuthHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthHelper.swift; sourceTree = "<group>"; };
6062
90DF825E28AD4F4B00D19F84 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
6163
90DF826128AD4F4B00D19F84 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
6264
90DF826828AD4F4B00D19F84 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
@@ -115,7 +117,7 @@
115117
isa = PBXFrameworksBuildPhase;
116118
buildActionMask = 2147483647;
117119
files = (
118-
3D492AD0366B814B92DF365A /* Pods_Example.framework in Frameworks */,
120+
9F2AF0E70A03458D01DE4662 /* Pods_Example.framework in Frameworks */,
119121
);
120122
runOnlyForDeploymentPostprocessing = 0;
121123
};
@@ -134,7 +136,7 @@
134136
4AC268574886D73A44FBFEEB /* Frameworks */ = {
135137
isa = PBXGroup;
136138
children = (
137-
331694F6A9E2715D8E8724C2 /* Pods_Example.framework */,
139+
370BB819149323E5B557ECA1 /* Pods_Example.framework */,
138140
);
139141
name = Frameworks;
140142
sourceTree = "<group>";
@@ -336,6 +338,7 @@
336338
children = (
337339
90DF82C228AD509400D19F84 /* ClientProvider.swift */,
338340
90DF82C328AD509400D19F84 /* ContractProvider.swift */,
341+
9009263128AE99B200796D1A /* AuthHelper.swift */,
339342
);
340343
path = Providers;
341344
sourceTree = "<group>";
@@ -503,6 +506,7 @@
503506
90DF82C828AD509400D19F84 /* CreateDepositViewController.swift in Sources */,
504507
90DF82C928AD509400D19F84 /* CreateDepositViewModel.swift in Sources */,
505508
90DF82CD28AD509400D19F84 /* GiveLoadViewModel.swift in Sources */,
509+
9009263228AE99B200796D1A /* AuthHelper.swift in Sources */,
506510
90DF82D328AD509400D19F84 /* AddClientViewController.swift in Sources */,
507511
90DF82CF28AD509400D19F84 /* DepositAmountViewController.swift in Sources */,
508512
);
@@ -534,6 +538,7 @@
534538
isa = XCBuildConfiguration;
535539
buildSettings = {
536540
ALWAYS_SEARCH_USER_PATHS = NO;
541+
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
537542
CLANG_ANALYZER_NONNULL = YES;
538543
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
539544
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
@@ -594,6 +599,7 @@
594599
isa = XCBuildConfiguration;
595600
buildSettings = {
596601
ALWAYS_SEARCH_USER_PATHS = NO;
602+
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
597603
CLANG_ANALYZER_NONNULL = YES;
598604
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
599605
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";

Example/Example/Base.lproj/Main.storyboard

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Udw-Xo-51G">
33
<device id="retina6_1" orientation="portrait" appearance="light"/>
44
<dependencies>
5+
<deployment identifier="iOS"/>
56
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
67
<capability name="Named colors" minToolsVersion="9.0"/>
78
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
@@ -808,7 +809,7 @@
808809
</userDefinedRuntimeAttributes>
809810
</view>
810811
</subviews>
811-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
812+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
812813
<constraints>
813814
<constraint firstItem="JGX-HF-zAr" firstAttribute="centerX" secondItem="5Yi-xK-axT" secondAttribute="centerX" id="0Hf-GB-drr"/>
814815
<constraint firstItem="JGX-HF-zAr" firstAttribute="centerY" secondItem="5Yi-xK-axT" secondAttribute="centerY" id="Nrs-yi-uU0"/>
@@ -1298,7 +1299,7 @@
12981299
<constraint firstItem="CH4-qd-Y1g" firstAttribute="leading" secondItem="q8P-Mq-jSl" secondAttribute="trailing" constant="16" id="tck-tm-fMQ"/>
12991300
</constraints>
13001301
</tableViewCellContentView>
1301-
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
1302+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
13021303
<connections>
13031304
<outlet property="clientUserpicImageView" destination="6WQ-Gw-Vg9" id="BkA-zw-srw"/>
13041305
<outlet property="nameLabel" destination="CH4-qd-Y1g" id="DYj-qh-7fM"/>
@@ -1465,8 +1466,8 @@
14651466
<image name="loan_icon" width="24" height="24"/>
14661467
<image name="logo" width="177" height="25"/>
14671468
<image name="minus" catalog="system" width="128" height="24"/>
1468-
<image name="plus" catalog="system" width="128" height="113"/>
14691469
<image name="plus" width="12" height="12"/>
1470+
<image name="plus" catalog="system" width="128" height="113"/>
14701471
<image name="plus_green" width="12" height="12"/>
14711472
<image name="round_dashed_ellipse" width="36" height="36"/>
14721473
<namedColor name="Gray 200">
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// AuthHelper.swift
3+
// Example
4+
//
5+
// Created by Mykola on 18.08.2022.
6+
//
7+
8+
import Foundation
9+
import UIKit
10+
import SNiOSDocumentsSDK
11+
12+
class AuthenticationHelper {
13+
14+
func startSession(viewContext: UIViewController, completion: @escaping ()->()) {
15+
16+
authorize(viewContext: viewContext) { result in
17+
18+
switch result {
19+
20+
case .success(let authResult):
21+
22+
SNUserSession.current.start(authorizationResult: authResult) { sessionResult in
23+
24+
switch sessionResult {
25+
26+
case .success(_):
27+
completion()
28+
29+
case .failure(let error):
30+
31+
fatalError()
32+
}
33+
}
34+
case .failure(let error):
35+
36+
fatalError()
37+
}
38+
}
39+
}
40+
41+
private func authorize(viewContext: UIViewController, completion: @escaping (Swift.Result<SNAuthorization.Result, Error>)->()) {
42+
43+
SNWebAuthorization.authorize(configuration: .defaultAppConfig,
44+
viewContext: viewContext) { webAuthResult in
45+
46+
switch webAuthResult {
47+
case .success(let code):
48+
49+
SNAuthorization.authorize(configuration: .defaultAppConfig, code: code) { authResult in
50+
51+
switch authResult {
52+
53+
case .success(let result):
54+
completion(.success(result))
55+
56+
case .failure(let error):
57+
completion(.failure(error))
58+
}
59+
}
60+
61+
case .failure(let error):
62+
63+
completion(.failure(error))
64+
}
65+
}
66+
}
67+
68+
}

0 commit comments

Comments
 (0)