Commit 5161edb1 authored by Prakhar Agrawal's avatar Prakhar Agrawal
Browse files

Initial Commit.

parent 198c49f6
Loading
Loading
Loading
Loading

Leegality.podspec

0 → 100644
+13 −0
Original line number Diff line number Diff line
Pod::Spec.new do |s|

  s.name         = "Leegality"
  s.version      = "1.0.0"
  s.summary      = "Leegality framework to integrate eSigning functionality in iOS apps."
  s.homepage     = "https://www.leegality.com"
  s.license      = "MIT"
  s.author             = "Prakhar Agrawal"
  s.platform     = :ios, "10.0"
  s.source       = { :git => "https://github.com/leegalitygspl/Leegality-iOS.git", :tag => "1.0.0" }
  s.source_files     = "Leegality", "Leegality/**/*.{h,m,swift}"

end
+8 −0
Original line number Diff line number Diff line
@@ -8,12 +8,14 @@

/* Begin PBXBuildFile section */
		1CF6AD4A20160E5A00F54E51 /* Leegality.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CF6AD4820160E5A00F54E51 /* Leegality.h */; settings = {ATTRIBUTES = (Public, ); }; };
		1CF6AD5120160E6F00F54E51 /* Leegality.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1CF6AD5020160E6F00F54E51 /* Leegality.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
		1CF6AD4520160E5A00F54E51 /* Leegality.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Leegality.framework; sourceTree = BUILT_PRODUCTS_DIR; };
		1CF6AD4820160E5A00F54E51 /* Leegality.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Leegality.h; sourceTree = "<group>"; };
		1CF6AD4920160E5A00F54E51 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
		1CF6AD5020160E6F00F54E51 /* Leegality.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Leegality.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
@@ -48,6 +50,7 @@
			children = (
				1CF6AD4820160E5A00F54E51 /* Leegality.h */,
				1CF6AD4920160E5A00F54E51 /* Info.plist */,
				1CF6AD5020160E6F00F54E51 /* Leegality.swift */,
			);
			path = Leegality;
			sourceTree = "<group>";
@@ -95,6 +98,7 @@
				TargetAttributes = {
					1CF6AD4420160E5A00F54E51 = {
						CreatedOnToolsVersion = 9.2;
						LastSwiftMigration = 0920;
						ProvisioningStyle = Automatic;
					};
				};
@@ -131,6 +135,7 @@
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
				1CF6AD5120160E6F00F54E51 /* Leegality.swift in Sources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
@@ -253,6 +258,7 @@
		1CF6AD4E20160E5A00F54E51 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				CLANG_ENABLE_MODULES = YES;
				CODE_SIGN_IDENTITY = "";
				CODE_SIGN_STYLE = Automatic;
				DEFINES_MODULE = YES;
@@ -266,6 +272,7 @@
				PRODUCT_BUNDLE_IDENTIFIER = com.leegality.Leegality;
				PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
				SKIP_INSTALL = YES;
				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
				SWIFT_VERSION = 4.0;
				TARGETED_DEVICE_FAMILY = "1,2";
			};
@@ -274,6 +281,7 @@
		1CF6AD4F20160E5A00F54E51 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				CLANG_ENABLE_MODULES = YES;
				CODE_SIGN_IDENTITY = "";
				CODE_SIGN_STYLE = Automatic;
				DEFINES_MODULE = YES;
+82 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
   LastUpgradeVersion = "0920"
   version = "1.3">
   <BuildAction
      parallelizeBuildables = "YES"
      buildImplicitDependencies = "YES">
      <BuildActionEntries>
         <BuildActionEntry
            buildForTesting = "YES"
            buildForRunning = "YES"
            buildForProfiling = "YES"
            buildForArchiving = "YES"
            buildForAnalyzing = "YES">
            <BuildableReference
               BuildableIdentifier = "primary"
               BlueprintIdentifier = "1CF6AD4420160E5A00F54E51"
               BuildableName = "Leegality.framework"
               BlueprintName = "Leegality"
               ReferencedContainer = "container:Leegality.xcodeproj">
            </BuildableReference>
         </BuildActionEntry>
      </BuildActionEntries>
   </BuildAction>
   <TestAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      language = ""
      shouldUseLaunchSchemeArgsEnv = "YES">
      <Testables>
      </Testables>
      <AdditionalOptions>
      </AdditionalOptions>
   </TestAction>
   <LaunchAction
      buildConfiguration = "Debug"
      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
      language = ""
      launchStyle = "0"
      useCustomWorkingDirectory = "NO"
      ignoresPersistentStateOnLaunch = "NO"
      debugDocumentVersioning = "YES"
      debugServiceExtension = "internal"
      allowLocationSimulation = "YES">
      <MacroExpansion>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "1CF6AD4420160E5A00F54E51"
            BuildableName = "Leegality.framework"
            BlueprintName = "Leegality"
            ReferencedContainer = "container:Leegality.xcodeproj">
         </BuildableReference>
      </MacroExpansion>
      <AdditionalOptions>
      </AdditionalOptions>
   </LaunchAction>
   <ProfileAction
      buildConfiguration = "Release"
      shouldUseLaunchSchemeArgsEnv = "YES"
      savedToolIdentifier = ""
      useCustomWorkingDirectory = "NO"
      debugDocumentVersioning = "YES">
      <MacroExpansion>
         <BuildableReference
            BuildableIdentifier = "primary"
            BlueprintIdentifier = "1CF6AD4420160E5A00F54E51"
            BuildableName = "Leegality.framework"
            BlueprintName = "Leegality"
            ReferencedContainer = "container:Leegality.xcodeproj">
         </BuildableReference>
      </MacroExpansion>
   </ProfileAction>
   <AnalyzeAction
      buildConfiguration = "Debug">
   </AnalyzeAction>
   <ArchiveAction
      buildConfiguration = "Release"
      revealArchiveInOrganizer = "YES">
   </ArchiveAction>
</Scheme>
+8 −0
Original line number Diff line number Diff line
@@ -10,5 +10,13 @@
			<integer>0</integer>
		</dict>
	</dict>
	<key>SuppressBuildableAutocreation</key>
	<dict>
		<key>1CF6AD4420160E5A00F54E51</key>
		<dict>
			<key>primary</key>
			<true/>
		</dict>
	</dict>
</dict>
</plist>
+49 −0
Original line number Diff line number Diff line
//
//  Leegality.swift
//  Leegality
//
//  Created by Prakhar Agrawal on 22/01/18.
//  Copyright © 2018 Grey Swift Private Limited. All rights reserved.
//

import Foundation
import UIKit

public protocol LeegalityProtocol {
    func getResult(value : [String : String])
}

public class Leegality: UIViewController, UIWebViewDelegate {
    
    public var url: String!
    public var delegate: LeegalityProtocol?
    
    override public func viewDidLoad() {
        super.viewDidLoad()
        let requestUrl = URL(string: url+"&device=ios")!
        let requestObj = URLRequest(url: requestUrl)
        let webView:UIWebView = UIWebView(frame: UIScreen.main.bounds)
        webView.delegate = self
        webView.loadRequest(requestObj)
        self.view.addSubview(webView)
    }
    
    override public func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    public func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
        let scheme = request.url?.scheme
        if scheme == "leegality" {
            let string = request.url?.absoluteString
            let strings = string!.components(separatedBy: "://")[1].components(separatedBy: ":")
            var dict = [String: String]()
            dict[strings[0]] = strings[1].removingPercentEncoding!
            delegate?.getResult(value: dict)
            self.dismiss(animated: true, completion: nil)
        }
        return true
    }
}