-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from k-angama/bugfix/redirect-uri-mode-sandbox
Fix error invalid redirect URL
- Loading branch information
Showing
15 changed files
with
147 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
Sources/LinkyAPI/Common/Extentions/LinkyURL+Extentions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// LinkyURL+Extentions.swift | ||
// LinkyAPI | ||
// | ||
// Created by Karim Angama on 12/01/2024. | ||
// | ||
|
||
import Foundation | ||
|
||
extension URL { | ||
func formatted() -> URL? { | ||
if(self.scheme == nil) { | ||
return URL(string: "https://\(self)") | ||
} | ||
if(self.host == nil) { | ||
return nil | ||
} | ||
return self | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// LinkyURLFormatted.swift | ||
// LinkyAPITests | ||
// | ||
// Created by Karim Angama on 12/01/2024. | ||
// | ||
|
||
import XCTest | ||
@testable import LinkyAPI | ||
|
||
final class LinkyURLFormatted: XCTestCase { | ||
|
||
func testURLFormattedWithHostAndPath() throws { | ||
let url = URL(string: "https://fake.url-redirect.com/test/")?.formatted() | ||
XCTAssertEqual(url?.absoluteString, "https://fake.url-redirect.com/test/") | ||
} | ||
|
||
func testURLFormattedWithHost() throws { | ||
let url = URL(string: "https://fake.url-redirect.com")?.formatted() | ||
XCTAssertEqual(url?.absoluteString, "https://fake.url-redirect.com") | ||
} | ||
|
||
func testURLFormattedWithoutHost() throws { | ||
let url = URL(string: "fake.url-redirect.com")?.formatted() | ||
XCTAssertEqual(url?.absoluteString, "https://fake.url-redirect.com") | ||
} | ||
|
||
func testInvalidURLFormatted() throws { | ||
let url = URL(string: "monApp://")?.formatted() | ||
XCTAssertEqual(url?.absoluteString, nil) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters