-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a SettingsViewController, so users can enter their Internet Arc…
…hive S3 access and secret key.
- Loading branch information
1 parent
9b27f2e
commit cf94e02
Showing
5 changed files
with
189 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// | ||
// InternetArchive.swift | ||
// OpenArchive | ||
// | ||
// Created by Benjamin Erhart on 05.07.18. | ||
// Copyright © 2018 Open Archive. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class InternetArchive { | ||
|
||
private static let ACCESS_KEY = "ACCESS_KEY" | ||
private static let SECRET_KEY = "SECRET_KEY" | ||
|
||
public static var accessKey: String? { | ||
get { | ||
return UserDefaults.standard.string(forKey: InternetArchive.ACCESS_KEY) | ||
} | ||
set { | ||
UserDefaults.standard.set(newValue, forKey: InternetArchive.ACCESS_KEY) | ||
} | ||
} | ||
|
||
public static var secretKey: String? { | ||
get { | ||
return UserDefaults.standard.string(forKey: InternetArchive.SECRET_KEY) | ||
} | ||
set { | ||
UserDefaults.standard.set(newValue, forKey: InternetArchive.SECRET_KEY) | ||
} | ||
} | ||
} |
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 @@ | ||
// | ||
// SettingsViewController.swift | ||
// OpenArchive | ||
// | ||
// Created by Benjamin Erhart on 05.07.18. | ||
// Copyright © 2018 Open Archive. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class SettingsViewController: UITableViewController { | ||
|
||
@IBOutlet var accessKeyTf: UITextField! | ||
@IBOutlet var secretKeyTf: UITextField! | ||
|
||
private let defaults = UserDefaults.standard | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
accessKeyTf.text = InternetArchive.accessKey | ||
secretKeyTf.text = InternetArchive.secretKey | ||
} | ||
|
||
@IBAction func changed(_ sender: UITextField) { | ||
switch sender { | ||
case accessKeyTf: | ||
InternetArchive.accessKey = sender.text | ||
default: | ||
InternetArchive.secretKey = sender.text | ||
} | ||
} | ||
} |
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,6 @@ | ||
# OpenArchive | ||
|
||
## Internet Archive S3 reference: | ||
https://archive.org/help/abouts3.txt | ||
https://github.com/vmbrasseur/IAS3API | ||
http://internetarchive.readthedocs.io/en/latest/api.html |