Skip to content

Commit

Permalink
Final app and build updates
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlang committed Oct 1, 2023
1 parent 7c63f96 commit d96978b
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 27 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ jobs:
brew install sunshinejr/formulae/pouch
- name: Generate Secrets.swift
env:
CLOUDINARY_CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }}
CLOUDINARY_UPLOAD_PRESET_NAME: ${{ secrets.CLOUDINARY_UPLOAD_PRESET_NAME }}
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
AWS_BUCKET_NAME: ${{ vars.AWS_BUCKET_NAME }}
AWS_BUCKET_REGION: ${{ vars.AWS_BUCKET_REGION }}
AWS_BUCKET_PREFIX: ${{ vars.AWS_BUCKET_PREFIX }}
PROTECT_EARTH_API_TOKEN: ${{ secrets.PROTECT_EARTH_API_TOKEN }}
PROTECT_EARTH_API_BASE_URL: ${{ secrets.PROTECT_EARTH_API_BASE_URL }}
PROTECT_EARTH_ENV_NAME: ${{ secrets.PROTECT_EARTH_ENV_NAME }}
Expand Down Expand Up @@ -51,8 +54,11 @@ jobs:
brew install sunshinejr/formulae/pouch
- name: Generate Secrets.swift
env:
CLOUDINARY_CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }}
CLOUDINARY_UPLOAD_PRESET_NAME: ${{ secrets.CLOUDINARY_UPLOAD_PRESET_NAME }}
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
AWS_BUCKET_NAME: ${{ vars.AWS_BUCKET_NAME }}
AWS_BUCKET_REGION: ${{ vars.AWS_BUCKET_REGION }}
AWS_BUCKET_PREFIX: ${{ vars.AWS_BUCKET_PREFIX }}
PROTECT_EARTH_API_TOKEN: ${{ secrets.PROTECT_EARTH_API_TOKEN }}
PROTECT_EARTH_API_BASE_URL: ${{ secrets.PROTECT_EARTH_API_BASE_URL }}
PROTECT_EARTH_ENV_NAME: ${{ secrets.PROTECT_EARTH_ENV_NAME }}
Expand Down Expand Up @@ -120,8 +126,11 @@ jobs:
brew install sunshinejr/formulae/pouch
- name: Generate Secrets.swift
env:
CLOUDINARY_CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }}
CLOUDINARY_UPLOAD_PRESET_NAME: ${{ secrets.CLOUDINARY_UPLOAD_PRESET_NAME }}
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
AWS_BUCKET_NAME: ${{ vars.AWS_BUCKET_NAME }}
AWS_BUCKET_REGION: ${{ vars.AWS_BUCKET_REGION }}
AWS_BUCKET_PREFIX: ${{ vars.AWS_BUCKET_PREFIX }}
PROTECT_EARTH_API_TOKEN: ${{ secrets.PROTECT_EARTH_API_TOKEN }}
PROTECT_EARTH_API_BASE_URL: ${{ secrets.PROTECT_EARTH_API_BASE_URL }}
PROTECT_EARTH_ENV_NAME: ${{ secrets.PROTECT_EARTH_ENV_NAME }}
Expand Down
2 changes: 2 additions & 0 deletions .pouch.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
secrets:
- AWS_BUCKET_NAME
- AWS_BUCKET_REGION
- AWS_BUCKET_PREFIX
- AWS_ACCESS_KEY
- AWS_SECRET_KEY
- PROTECT_EARTH_API_TOKEN
Expand Down
30 changes: 15 additions & 15 deletions Tree Tracker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -101,8 +101,8 @@
9D2B454F2944F54000B09C84 /* LocationWarningOverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D2B454E2944F54000B09C84 /* LocationWarningOverlayView.swift */; };
9D2DB5F629606B220040B1DB /* UploadedTree.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D2DB5F529606B220040B1DB /* UploadedTree.swift */; };
9D36C7EB2A22950B00E04552 /* AWSS3Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D36C7EA2A22950B00E04552 /* AWSS3Configuration.swift */; };
9D3C323729F420C800462558 /* AWSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 9D3C323629F420C800462558 /* AWSCore */; };
9D3C323929F420C800462558 /* AWSS3 in Frameworks */ = {isa = PBXBuildFile; productRef = 9D3C323829F420C800462558 /* AWSS3 */; };
9D375F912AC8873C009AF2D2 /* AWSCore in Frameworks */ = {isa = PBXBuildFile; productRef = 9D375F902AC8873C009AF2D2 /* AWSCore */; };
9D375F932AC8873C009AF2D2 /* AWSS3 in Frameworks */ = {isa = PBXBuildFile; productRef = 9D375F922AC8873C009AF2D2 /* AWSS3 */; };
9D3C323B29F5BDEA00462558 /* UploadCompletionHolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D3C323A29F5BDEA00462558 /* UploadCompletionHolder.swift */; };
9D47D97F286F293000F7B92F /* ProtectEarthSupervisor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D47D97E286F293000F7B92F /* ProtectEarthSupervisor.swift */; };
9D47D982286F29E100F7B92F /* ProtectEarthCodableTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D47D981286F29E100F7B92F /* ProtectEarthCodableTests.swift */; };
Expand Down Expand Up @@ -294,8 +294,8 @@
85A0EF7F25A226D9003CE744 /* GRDB in Frameworks */,
85B83A0D25B87C0D0008E167 /* BSImagePicker in Frameworks */,
9DCC548C28073F0A00CF67AA /* Resolver in Frameworks */,
9D3C323929F420C800462558 /* AWSS3 in Frameworks */,
9D3C323729F420C800462558 /* AWSCore in Frameworks */,
9D375F932AC8873C009AF2D2 /* AWSS3 in Frameworks */,
9D375F912AC8873C009AF2D2 /* AWSCore in Frameworks */,
9D01D566285CD2E50009F753 /* RollbarSwift in Frameworks */,
9D01D564285CD2E50009F753 /* RollbarNotifier in Frameworks */,
85A0EF8325A2271C003CE744 /* Alamofire in Frameworks */,
Expand Down Expand Up @@ -666,8 +666,8 @@
9D01D561285CD2E50009F753 /* RollbarCommon */,
9D01D563285CD2E50009F753 /* RollbarNotifier */,
9D01D565285CD2E50009F753 /* RollbarSwift */,
9D3C323629F420C800462558 /* AWSCore */,
9D3C323829F420C800462558 /* AWSS3 */,
9D375F902AC8873C009AF2D2 /* AWSCore */,
9D375F922AC8873C009AF2D2 /* AWSS3 */,
);
productName = "Tree Tracker";
productReference = 853ABD522596144900144B0D /* Tree Tracker.app */;
Expand Down Expand Up @@ -708,7 +708,7 @@
85B83A0B25B87C0D0008E167 /* XCRemoteSwiftPackageReference "BSImagePicker" */,
9DCC548A28073F0A00CF67AA /* XCRemoteSwiftPackageReference "Resolver" */,
9D01D560285CD2E50009F753 /* XCRemoteSwiftPackageReference "rollbar-apple" */,
9D3C323529F420C800462558 /* XCRemoteSwiftPackageReference "aws-sdk-ios-spm" */,
9D375F8F2AC8873C009AF2D2 /* XCRemoteSwiftPackageReference "aws-sdk-ios-spm" */,
);
productRefGroup = 853ABD532596144900144B0D /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -1073,7 +1073,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = K5RUKV288P;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = K5RUKV288P;
INFOPLIST_FILE = "Tree Tracker/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
Expand Down Expand Up @@ -1185,12 +1185,12 @@
minimumVersion = 2.0.0;
};
};
9D3C323529F420C800462558 /* XCRemoteSwiftPackageReference "aws-sdk-ios-spm" */ = {
9D375F8F2AC8873C009AF2D2 /* XCRemoteSwiftPackageReference "aws-sdk-ios-spm" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/aws-amplify/aws-sdk-ios-spm";
requirement = {
kind = upToNextMinorVersion;
minimumVersion = 2.30.0;
minimumVersion = 2.33.0;
};
};
9DCC548A28073F0A00CF67AA /* XCRemoteSwiftPackageReference "Resolver" */ = {
Expand Down Expand Up @@ -1234,14 +1234,14 @@
package = 9D01D560285CD2E50009F753 /* XCRemoteSwiftPackageReference "rollbar-apple" */;
productName = RollbarSwift;
};
9D3C323629F420C800462558 /* AWSCore */ = {
9D375F902AC8873C009AF2D2 /* AWSCore */ = {
isa = XCSwiftPackageProductDependency;
package = 9D3C323529F420C800462558 /* XCRemoteSwiftPackageReference "aws-sdk-ios-spm" */;
package = 9D375F8F2AC8873C009AF2D2 /* XCRemoteSwiftPackageReference "aws-sdk-ios-spm" */;
productName = AWSCore;
};
9D3C323829F420C800462558 /* AWSS3 */ = {
9D375F922AC8873C009AF2D2 /* AWSS3 */ = {
isa = XCSwiftPackageProductDependency;
package = 9D3C323529F420C800462558 /* XCRemoteSwiftPackageReference "aws-sdk-ios-spm" */;
package = 9D375F8F2AC8873C009AF2D2 /* XCRemoteSwiftPackageReference "aws-sdk-ios-spm" */;
productName = AWSS3;
};
9D5CDBD427BBB7D2007D4F0A /* Alamofire */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/aws-amplify/aws-sdk-ios-spm",
"state" : {
"revision" : "51d99d74be7249ac6444581bd1e394fb60ea86a3",
"version" : "2.30.4"
"revision" : "ca31418963a90bac80538e13f6b7af87ea14d279",
"version" : "2.33.4"
}
},
{
Expand Down
5 changes: 4 additions & 1 deletion Tree Tracker/AppDelegate+Injection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Resolver
import Photos
import UIKit
import AWSS3
import AWSCore

extension Resolver: ResolverRegistering {

Expand All @@ -20,7 +21,9 @@ extension Resolver: ResolverRegistering {
register { UIScreenLockManager() }
register { PHCachingImageManager() }
register { RecentSpeciesManager(defaults: resolve(), strategy: .todayUsedSpecies) }
register { AWSS3Configuration(accessKey: Secrets.awsAccessKey, secretKey: Secrets.awsSecretKey, region: .EUWest1) }
register { AWSS3Configuration(accessKey: Secrets.awsAccessKey,
secretKey: Secrets.awsSecretKey,
region: Secrets.awsBucketRegion.aws_regionTypeValue()) }

// MARK: Services
register { ProtectEarthSessionFactory(baseUrl: Constants.Http.protectEarthApiBaseUrl,
Expand Down
5 changes: 4 additions & 1 deletion Tree Tracker/Screens/Settings/SettingsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ class SettingsController: UITableViewController {

private var entityTypes = ["Sites", "Supervisors", "Species"]
private var apiProperties = [Constants.Http.protectEarthApiBaseUrl,
Constants.Http.protectEarthEnvironmentName]
Constants.Http.protectEarthEnvironmentName,
Secrets.awsBucketName,
"\(Secrets.awsAccessKey.prefix(4))************\(Secrets.awsAccessKey.suffix(4))",
Secrets.awsBucketRegion]

override func viewDidLoad() {
super.viewDidLoad()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ProtectEarthTreeService: TreeService {

transferUtility.uploadData(data,
bucket: Secrets.awsBucketName,
key: tree.treeId,
key: "\(Secrets.awsBucketPrefix)/\(tree.treeId)",
contentType: "image/jpeg",
expression: expression,
completionHandler: completionHolder.completionHandler
Expand Down
3 changes: 2 additions & 1 deletion Tree Tracker/Utilities/UploadCompletionHolder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ class UploadCompletionHolder {

self.completionHandler = { (task, error) -> Void in
if let error = error {
completion(.failure(.remoteError(errorCode: 243, errorMessage: error.localizedDescription)))
let responseCode = task.response?.statusCode.description ?? "???"
completion(.failure(.remoteError(errorCode: 243, errorMessage: "Error in S3 upload - [\(responseCode)] \(error.localizedDescription)")))
}
else if task.status != .completed {
completion(.failure(.remoteError(errorCode: 245, errorMessage: "Unknown S3 error")))
Expand Down

0 comments on commit d96978b

Please sign in to comment.