From 08a94f98b907569ef0c2b28b90d2239a188ba890 Mon Sep 17 00:00:00 2001 From: Allan Lang Date: Fri, 17 Jun 2022 17:00:37 +0100 Subject: [PATCH 1/4] Basic Rollbar integration --- .pouch.yml | 1 + Tree Tracker.xcodeproj/project.pbxproj | 33 ++++++++++++++++++++++++++ Tree Tracker/AppDelegate.swift | 9 +++++++ 3 files changed, 43 insertions(+) diff --git a/.pouch.yml b/.pouch.yml index 79514fb..4d55942 100644 --- a/.pouch.yml +++ b/.pouch.yml @@ -10,5 +10,6 @@ secrets: - TEST_AIRTABLE_API_KEY - TEST_AIRTABLE_BASE_ID - TEST_AIRTABLE_TABLE_NAME_PREFIX +- ROLLBAR_AUTH_TOKEN outputs: - ./Tree Tracker/Secrets.swift \ No newline at end of file diff --git a/Tree Tracker.xcodeproj/project.pbxproj b/Tree Tracker.xcodeproj/project.pbxproj index 3caa4a5..af59528 100644 --- a/Tree Tracker.xcodeproj/project.pbxproj +++ b/Tree Tracker.xcodeproj/project.pbxproj @@ -108,6 +108,9 @@ 85DC214625E0FCBF003F0721 /* GRDBImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85DC214525E0FCBF003F0721 /* GRDBImageCache.swift */; }; 85E0E05E25B33F8C009D8FC0 /* TappableButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85E0E05D25B33F8C009D8FC0 /* TappableButton.swift */; }; 85E0E06225B35744009D8FC0 /* UIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 85E0E06125B35744009D8FC0 /* UIView.swift */; }; + 9D01D562285CD2E50009F753 /* RollbarCommon in Frameworks */ = {isa = PBXBuildFile; productRef = 9D01D561285CD2E50009F753 /* RollbarCommon */; }; + 9D01D564285CD2E50009F753 /* RollbarNotifier in Frameworks */ = {isa = PBXBuildFile; productRef = 9D01D563285CD2E50009F753 /* RollbarNotifier */; }; + 9D01D566285CD2E50009F753 /* RollbarSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 9D01D565285CD2E50009F753 /* RollbarSwift */; }; 9D5CDBD727BBC080007D4F0A /* ExportOptions.plist in Resources */ = {isa = PBXBuildFile; fileRef = 9D5CDBD627BBC080007D4F0A /* ExportOptions.plist */; }; 9D5D5E28284B630D00F3AD3E /* SpeciesService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D5D5E27284B630D00F3AD3E /* SpeciesService.swift */; }; 9D5D5E2A284B635900F3AD3E /* AirtableSpeciesService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D5D5E29284B635900F3AD3E /* AirtableSpeciesService.swift */; }; @@ -281,7 +284,10 @@ 85A0EF7F25A226D9003CE744 /* GRDB in Frameworks */, 85B83A0D25B87C0D0008E167 /* BSImagePicker in Frameworks */, 9DCC548C28073F0A00CF67AA /* Resolver in Frameworks */, + 9D01D566285CD2E50009F753 /* RollbarSwift in Frameworks */, + 9D01D564285CD2E50009F753 /* RollbarNotifier in Frameworks */, 85A0EF8325A2271C003CE744 /* Alamofire in Frameworks */, + 9D01D562285CD2E50009F753 /* RollbarCommon in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -649,6 +655,9 @@ 85A0EF8225A2271C003CE744 /* Alamofire */, 85B83A0C25B87C0D0008E167 /* BSImagePicker */, 9DCC548B28073F0A00CF67AA /* Resolver */, + 9D01D561285CD2E50009F753 /* RollbarCommon */, + 9D01D563285CD2E50009F753 /* RollbarNotifier */, + 9D01D565285CD2E50009F753 /* RollbarSwift */, ); productName = "Tree Tracker"; productReference = 853ABD522596144900144B0D /* Tree Tracker.app */; @@ -688,6 +697,7 @@ 85A0EF8125A2271C003CE744 /* XCRemoteSwiftPackageReference "Alamofire" */, 85B83A0B25B87C0D0008E167 /* XCRemoteSwiftPackageReference "BSImagePicker" */, 9DCC548A28073F0A00CF67AA /* XCRemoteSwiftPackageReference "Resolver" */, + 9D01D560285CD2E50009F753 /* XCRemoteSwiftPackageReference "rollbar-apple" */, ); productRefGroup = 853ABD532596144900144B0D /* Products */; projectDirPath = ""; @@ -1146,6 +1156,14 @@ minimumVersion = 3.3.1; }; }; + 9D01D560285CD2E50009F753 /* XCRemoteSwiftPackageReference "rollbar-apple" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/rollbar/rollbar-apple.git"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.0.0; + }; + }; 9DCC548A28073F0A00CF67AA /* XCRemoteSwiftPackageReference "Resolver" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/hmlongco/Resolver.git"; @@ -1172,6 +1190,21 @@ package = 85B83A0B25B87C0D0008E167 /* XCRemoteSwiftPackageReference "BSImagePicker" */; productName = BSImagePicker; }; + 9D01D561285CD2E50009F753 /* RollbarCommon */ = { + isa = XCSwiftPackageProductDependency; + package = 9D01D560285CD2E50009F753 /* XCRemoteSwiftPackageReference "rollbar-apple" */; + productName = RollbarCommon; + }; + 9D01D563285CD2E50009F753 /* RollbarNotifier */ = { + isa = XCSwiftPackageProductDependency; + package = 9D01D560285CD2E50009F753 /* XCRemoteSwiftPackageReference "rollbar-apple" */; + productName = RollbarNotifier; + }; + 9D01D565285CD2E50009F753 /* RollbarSwift */ = { + isa = XCSwiftPackageProductDependency; + package = 9D01D560285CD2E50009F753 /* XCRemoteSwiftPackageReference "rollbar-apple" */; + productName = RollbarSwift; + }; 9D5CDBD427BBB7D2007D4F0A /* Alamofire */ = { isa = XCSwiftPackageProductDependency; package = 85A0EF8125A2271C003CE744 /* XCRemoteSwiftPackageReference "Alamofire" */; diff --git a/Tree Tracker/AppDelegate.swift b/Tree Tracker/AppDelegate.swift index 3b0f71c..a61d5ca 100644 --- a/Tree Tracker/AppDelegate.swift +++ b/Tree Tracker/AppDelegate.swift @@ -1,10 +1,19 @@ import UIKit +import RollbarNotifier @main class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + let config = RollbarConfig() + config.destination.accessToken = Secrets.rollbarAuthToken + config.destination.environment = "local" + config.setServerHost(nil, root: nil, branch: nil, codeVersion: "0.8.2") + + Rollbar.initWithConfiguration(config) + Rollbar.infoMessage("See this message on your Rollbar Project Dashboard...") + window = UIWindow() window?.rootViewController = MainFlowViewController() window?.makeKeyAndVisible() From 148a718c24b3cc7deb4b6601e447afe7b49c1459 Mon Sep 17 00:00:00 2001 From: Allan Lang Date: Wed, 6 Jul 2022 08:03:39 +0100 Subject: [PATCH 2/4] Configure token in build --- .github/workflows/build-release.yaml | 1 + Tree Tracker/AppDelegate.swift | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml index 1f78d9b..030f59e 100644 --- a/.github/workflows/build-release.yaml +++ b/.github/workflows/build-release.yaml @@ -30,6 +30,7 @@ jobs: TEST_AIRTABLE_API_KEY: ${{ secrets.TEST_AIRTABLE_API_KEY }} TEST_AIRTABLE_BASE_ID: ${{ secrets.TEST_AIRTABLE_BASE_ID }} TEST_AIRTABLE_TABLE_NAME_PREFIX: ${{ secrets.TEST_AIRTABLE_TABLE_NAME_PREFIX }} + ROLLBAR_AUTH_TOKEN: ${{ secrets.ROLLBAR_AUTH_TOKEN }} run: pouch - name: Set build number run: agvtool new-version $GITHUB_RUN_NUMBER diff --git a/Tree Tracker/AppDelegate.swift b/Tree Tracker/AppDelegate.swift index a61d5ca..8630be9 100644 --- a/Tree Tracker/AppDelegate.swift +++ b/Tree Tracker/AppDelegate.swift @@ -9,10 +9,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { let config = RollbarConfig() config.destination.accessToken = Secrets.rollbarAuthToken config.destination.environment = "local" + // TODO: Get app version from Bundle info dictionary config.setServerHost(nil, root: nil, branch: nil, codeVersion: "0.8.2") Rollbar.initWithConfiguration(config) - Rollbar.infoMessage("See this message on your Rollbar Project Dashboard...") + Rollbar.infoMessage("App startup") window = UIWindow() window?.rootViewController = MainFlowViewController() From 476139d9a512ed55334a506ca3596a0124fa1611 Mon Sep 17 00:00:00 2001 From: Allan Lang Date: Wed, 6 Jul 2022 09:13:16 +0100 Subject: [PATCH 3/4] Remove extraneous config settings --- Tree Tracker/AppDelegate.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/Tree Tracker/AppDelegate.swift b/Tree Tracker/AppDelegate.swift index 8630be9..35c724b 100644 --- a/Tree Tracker/AppDelegate.swift +++ b/Tree Tracker/AppDelegate.swift @@ -8,9 +8,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let config = RollbarConfig() config.destination.accessToken = Secrets.rollbarAuthToken - config.destination.environment = "local" - // TODO: Get app version from Bundle info dictionary - config.setServerHost(nil, root: nil, branch: nil, codeVersion: "0.8.2") Rollbar.initWithConfiguration(config) Rollbar.infoMessage("App startup") From 8a35178f03092acc631bd823cf55b0bf27eb1252 Mon Sep 17 00:00:00 2001 From: Allan Lang Date: Wed, 6 Jul 2022 09:32:19 +0100 Subject: [PATCH 4/4] Configure environment --- Tree Tracker/AppDelegate.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tree Tracker/AppDelegate.swift b/Tree Tracker/AppDelegate.swift index 35c724b..e79518f 100644 --- a/Tree Tracker/AppDelegate.swift +++ b/Tree Tracker/AppDelegate.swift @@ -8,7 +8,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { let config = RollbarConfig() config.destination.accessToken = Secrets.rollbarAuthToken - + config.destination.environment = "local" + Rollbar.initWithConfiguration(config) Rollbar.infoMessage("App startup")