Skip to content

Commit dd12ea8

Browse files
authored
Merge pull request #82 from protect-earth/al/slim
Remove add site functionality and all Airtable redundant code
2 parents 6278bfc + 4a19720 commit dd12ea8

36 files changed

+36
-1608
lines changed

.pouch.yml

-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
secrets:
2-
- AIRTABLE_API_KEY
3-
- AIRTABLE_BASE_ID
4-
- AIRTABLE_TREES_TABLE_NAME
5-
- AIRTABLE_SPECIES_TABLE_NAME
6-
- AIRTABLE_SUPERVISORS_TABLE_NAME
7-
- AIRTABLE_SITES_TABLE_NAME
82
- CLOUDINARY_CLOUD_NAME
93
- CLOUDINARY_UPLOAD_PRESET_NAME
10-
- TEST_AIRTABLE_API_KEY
11-
- TEST_AIRTABLE_BASE_ID
12-
- TEST_AIRTABLE_TABLE_NAME_PREFIX
134
- PROTECT_EARTH_API_TOKEN
145
- PROTECT_EARTH_API_BASE_URL
156
- PROTECT_EARTH_ENV_NAME

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Tree Tracker
22

3-
## Next
3+
## 0.10.3
4+
- Airtable integration is entirely replaced with Protect Earth custom API backend
5+
- Removal of all redundant code
6+
- Adoption of Resolver framework for dependency injection throughout
7+
- Integration of Rollbar for error tracking and general telemetry so we can see how the app is behaving in the wild
48

59
## 0.7.0
610
- Updated the UI

README.md

+12-55
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,41 @@
11
# Tree Tracker
2-
App for taking pictures of trees and storing that on a remote server. Mainly used by people who plant trees so they don't have to manually type coordinates with pictures they took and then try to guess the site/species afterwards.
2+
App for cataloguing trees planted and allowing the recorded trees to be uploaded via a custom API to a centralised database. Mainly used by people who plant trees so they don't have to manually type coordinates with pictures they took and then try to guess the site/species afterwards.
33

44
## Running the app from Xcode with Mock server
55
1. Make sure you have downloaded Xcode 13.4+
66
2. Open the project in Xcode (you'll notice the dependencies will start to fetch in the background).
77
(In the meantime, Xcode will need to fetch dependencies for the project... 😴)
88
3. The signing settings for the project are configured for our CICD build pipeline, and will not allow you to build and run the app on your own device. To fix this, simply enable automatic signing in XCode and update the bundle identifier to something unique to you. This will update the .xcodeproj file accordingly. **NOTE** _Changes to signing settings must not be checked in, as these will break the automated builds._
9-
4. Running the `Tree Tracker` scheme will use the main Airtable base you [configure in your secrets file](#config) and will make inserts to your base tables. Running the `Tree Tracker (Mock server` scheme will use hard-coded mock API responses and will not touch Airtable.
9+
4. Running the `Tree Tracker` scheme will use the API settings you [configure in your secrets file](#config).
1010
5. When running on a device, you'll also need to trust the certificate in _Settings -> General -> Profiles_, otherwise you'll see an error after installing the build and before running it.
1111

12-
## Using your own Airtable/Cloudinary server
13-
Well, this is a bit complicated but still doable.
14-
Sign up for a free [Airtable](https://www.airtable.com) account, as you will need to provide the details of *2* Airtable bases - one
15-
to support the execution of integration tests, and one for the app to use when in normal usage.
16-
17-
For development purposes, the 2 bases
18-
can actually be the same. If you are doing this, it is recommended to create two sets of tables in the same base, and use a prefix on
19-
the table name. This can then be specified in the `TEST_AIRTABLE_TABLE_NAME_PREFIX` secret (see [later](#config)).
20-
21-
### Airtable tables
22-
Our current API type expects that you have 4 tables:
23-
24-
#### Trees Planted
25-
| ID | Notes | Image | Species | Supervisor | Sites | Coordinates | What3Words | CreatedDate | UploadedDate | ImageSignature |
26-
| - | - | - | - | - | - | - | - | - | - | - |
27-
| Auto Number | Long text | Attachment | Link to Species table | Link to Supervisors table | Link to Sites table | Text | Text | Date and time | Date and time | Text |
28-
| number | string | array of attachment objects | array of record IDs (strings) | array of record IDs (strings) | array of record IDs (strings) | string | string | string (ISO 8601 formatted date) | string (ISO 8601 formatted date) | string |
29-
30-
#### Species
31-
_(notice there is no "ID" field - this is because we use the auto-generated ID through Airtable, the "ID" in the column above is a custom Auto Number field added manually)_
32-
| Name |
33-
| - |
34-
| Long text |
35-
| Long text |
36-
37-
#### Supervisors
38-
_(the same structure as above)_
39-
| Name |
40-
| - |
41-
| Long text |
42-
| Long text |
43-
44-
#### Sites
45-
_(the same structure as above)_
46-
| Name |
47-
| - |
48-
| Long text |
49-
| Long text |
12+
## Using your own Cloudinary server
5013

5114
### Cloudinary setup
52-
Because Airtable doesn't support uploading images yet, we have to use an external provider to do so instead. We tried Imgur, but the API is really not user friendly due to its auth requisites. For now, we are using Cloudinary but it might change in the future.
15+
Cloudinary is used as an image storage and manipulation service, to temporarily hold captured images of the trees and allow these to be quickly resized for our needs.
5316

5417
1. Create a free account on [Cloudinary](https://cloudinary.com/users/register/free) (this will give you the needed Cloud name).
5518
2. Now create an [upload preset](https://cloudinary.com/console/settings/upload) (this will give you the Upload Preset name).
56-
3. Keep the keys as you'd need to add them to Secrets.xcconfig later on.
19+
3. Keep the keys as you'd need to add them to Secrets.swift later on.
5720

5821
## Rollbar
5922
We use [Rollbar](https://www.rollbar.com) for centralised logging of errors, to help us troubleshoot issues with the app during real world usage.
60-
If you wish, you can sign up for a free Rollbar account, generate your own API token and provide it through `ROLLBAR_AUTH_TOKEN` to see telemetry
61-
in Rollbar during development. This can be useful if you are specifically adding telemetry features, but otherwise is probably more complex than
62-
just looking at the logs in XCode console.
23+
If you wish, you can sign up for a free Rollbar account, generate your own API token and provide it through `ROLLBAR_AUTH_TOKEN` to see telemetry in Rollbar during development. This can be useful if you are specifically adding telemetry features, but otherwise is probably more complex than just looking at the logs in XCode console.
6324

6425
If you choose not to setup Rollbar, simply add a dummy value for `ROLLBAR_AUTH_TOKEN` and any Rollbar calls will silently fail.
6526

6627
## Additional project config {#config}
67-
Now, to run the project, we'll need to generate Secrets file. This means you need to run first install [`pouch`](https://github.com/sunshinejr/pouch) (the easiest is using `brew install sunshinejr/formulae/pouch`). Now, you need to have these environment variables available. Have this at the end of the file (bash: most likely in `.bash_profile` or `.bashrc`, zsh: most likely `.zshenv` or `.zshrc`):
28+
Now, to run the project, we'll need to generate the Secrets file. This means you need to run first install [`pouch`](https://github.com/sunshinejr/pouch) (the easiest is using `brew install sunshinejr/formulae/pouch`). Now, you need to have these environment variables available. It would be wise to prepare this file once and keep it somewhere obvious but take care not to check it in to Git. You can simply `source` the file whenever you need to regenerate Secrets.
29+
6830
```
69-
export AIRTABLE_API_KEY=yourKey123
70-
export AIRTABLE_BASE_ID=appNiceTree
71-
export AIRTABLE_TREES_TABLE_NAME="Trees Planted"
72-
export AIRTABLE_SPECIES_TABLE_NAME=Species
73-
export AIRTABLE_SUPERVISORS_TABLE_NAME=Supervisors
74-
export AIRTABLE_SITES_TABLE_NAME=Sites
7531
export CLOUDINARY_CLOUD_NAME=qqq2ek4mq
7632
export CLOUDINARY_UPLOAD_PRESET_NAME=iadfadff
77-
export TEST_AIRTABLE_API_KEY=yourTestKey123
78-
export TEST_AIRTABLE_BASE_ID=appNiceTreeTest
79-
export TEST_AIRTABLE_TABLE_NAME_PREFIX=test_
33+
export PROTECT_EARTH_API_TOKEN="n|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
34+
export PROTECT_EARTH_API_BASE_URL="api.endpoint.com"
35+
export PROTECT_EARTH_ENV_NAME=Development
8036
export ROLLBAR_AUTH_TOKEN=yourRollbarToken
8137
```
38+
8239
In the root folder, run `pouch`, which should generate a file at `./TreeTracker/Secrets.swift`.
8340

8441
With all that, you can switch the scheme to `Tree Tracker` and it _should_ run just fine.

0 commit comments

Comments
 (0)