Skip to content

Commit

Permalink
Merge pull request #23 from bcgov/task/fix-spread-distance
Browse files Browse the repository at this point in the history
- Updates plist requirements for App Store
- Fixes UI issue for slider pop up text
- Fixes back/flank spread distance
- Updates instructions for building and deploying to App Store
  • Loading branch information
brettedw authored Feb 13, 2025
2 parents 44a32f6 + 91e3a1f commit d44f425
Show file tree
Hide file tree
Showing 15 changed files with 149 additions and 123 deletions.
26 changes: 26 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "fbp-go (debug)",
"request": "launch",
"type": "dart",
"flutterMode": "debug"
},
{
"name": "fbp-go (profile mode)",
"request": "launch",
"type": "dart",
"flutterMode": "profile"
},
{
"name": "fbp-go (release mode)",
"request": "launch",
"type": "dart",
"flutterMode": "release"
}
]
}
102 changes: 55 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

Fire behaviour prediction application

Preview latest PWA build on: [https://sybrand.github.io/](https://sybrand.github.io/)
Preview latest PWA build on: [https://psu.nrs.gov.bc.ca/fbp-go](https://psu.nrs.gov.bc.ca/fbp-go)

[![Lifecycle:Maturing](https://img.shields.io/badge/Lifecycle-Maturing-007EC6)](<https://github.com/bcgov/fbp-go>)
[![Lifecycle:Maturing](https://img.shields.io/badge/Lifecycle-Maturing-007EC6)](https://github.com/bcgov/fbp-go)

## Build for web

Expand Down Expand Up @@ -56,7 +56,7 @@ Up the version in pubspec.yaml, then run
flutter pub get
```

NOTE: also had to up flutterVersionCode in android\app\build.gradle
NOTE: also had to up flutterVersionCode in android\app\build.gradle

Confirm that the targetSdkVersion is correct.

Expand Down Expand Up @@ -87,76 +87,72 @@ releases overview -> review it

#### Github Workflow

### Build for iOS - on M1 silicon
## iOS development notes

If you use the default ruby+gem setup that comes out of the box, you'll get errors about
ffi not being x86_64 - you COULD fix that by running:
You can view/test the app in a simulator by running the following

```zsh
# don't do this
sudo arch -x86_64 gem install ffi
open -a Simulator
open ios/Runner.xcworkspace
```

Who wants to run rosetta? That's nuts. Rather get the latest version of ruby and go from there.
(It's no use trying to run gem update --system with the system ruby, it's just going to break things for you)
This also solves having to run sudo with gem, everything neatly goes into .rbenv
Note: Once the simulator is open and before opening the xcworkspace in Xcode, you can also use the VSCode flutter extension to run the app in debug or release mode with hot reloading. This also works for Android simulators

### Build for iOS - on M1 silicon

Navigate to fbp-go/ios and run

```zsh
rbenv install 3.2.2
rbenv global 3.2.2
rbenv init
gem update --system
gem install cocoapods
pod install
```

Sometimes you'll get a build error saying your pods aren't up to date
If the app is built with `flutter build ios` or within Xcode, you may see a warning when validating the app:

```
gem update --system
gem update cocoapods
cd ios
flutter precache --ios
pod install
Uploads Symbols Failed: The archive did not include a dSYM for the Flutter.framework
```

### https://github.com/rbenv/rbenv
This is seemingly a new warning in xcode 16 and it's possibly updating flutter would solve the issue in the future.

To solve this, the easiest method is to build the ios release with flutter:

For rbenv you need to have the shim in your path.
```
flutter build ipa
```

PATH="/{home}/.rbenv/shims:$PATH
This will create an ipa file that can easily be validated and uploaded to the App Store/Testflight using [Apple Transporter](https://apps.apple.com/us/app/transporter/id1450874784?mt=12).
Creating an ipa file with flutter build tools seems to include the dSYM files, whereas other methods may not at this time.

## App store issues

You may receive an email warning: "ITMS-90078: Missing Push Notification Entitlement" from the app store. FBP Go doesn't use push notifications,
it seems to be a side efffect of some flutter stuff. See: https://github.com/flutter/flutter/issues/9984 ; this issue is unresolved at this point in time.

## iOS development notes

```zsh
open -a Simulator
open ios/Runner.xcworkspace
```

## Deploy to app store

Make sure you've got the build number correct! Build number must be unique! This can be validated in the below step:

1. Product -> Archive
Either follow the method above using Apple Transporter or follow the process below:

1. Product -> Archive
2. Open the "Organizer" window, Window -> Organizer
3. Select your archived build and click "Validate App" and follow the steps.
4. If it successfully validates, you can then click "Distribute App" in organize, otherwise fix the validation errors and re-archive.

## Updating signing cert and profile

1. When you receive the new cert/profile and credentials, follow the steps here to install: https://github.com/bcgov/mobile-signing-service/wiki/Apple-App-Signing#for-teams---steps-to-setup-your-xcode-for-local-application-signing
2. You may see an error after the Signing Certificate label, to fix this edit the `CODE_SIGN_IDENTITY` and `PROVISIONING_PROFILE_SPECIFIER` in `project.pbxproj` to be set to the new cert and profile names.

## Code Conventions

- Dart naming convention rules are often broken in order to conform with the CFFDRS R library. The R code has been
manually translated, and in order to debug and stay up to date with changes, it's just easier if the code looks
similar.
manually translated, and in order to debug and stay up to date with changes, it's just easier if the code looks
similar.
- Variable names throughout conform to conventions in [ST-X-3](https://cfs.nrcan.gc.ca/publications/download-pdf/10068) Appendix II and [GLC-X-10](https://cfs.nrcan.gc.ca/publications/download-pdf/31414) Appendix I. E.g. `GFL` instead of `grassFuelLoad` or `minGS` instead of `minGroundSlope`. Validating formulae an math in code can get very confusing if one does not conform to the acronyms used in the related scientific literature.

## Todo

- Add screenshots for iOS.
- Localization - implement en-CA and fr-CA.
- Coordinates - provide user feedback on location button. (e.g. fetching and failed state).
Expand All @@ -183,46 +179,58 @@ similar.
- Reset defaults feature.

Care should be exercised not to apply the system beyond its useful range. FBP Go/ FBP System can be used to make predictions for a fire spreading during one burning period from a point or line source of fire with the following assumptions:
Fuel conditions are representative one of the 18 benchmark fuel types.
The Fire Weather Index (FWI) values used are representative of the site conditions.
Fuels are uniform and continuous; topography is homogenous. and the wind is constant and one direction during the prediction period.
The fire is wind or wind/slope driven, and spread is not affected by a convection column.
Wind is measured in the open and is corrected to 10 m.
The rate of fire spread levels off at high wind speed and initial spread index (ISI) values.
The fire is unaffected by suppression activities (free burning).
The effect of short-range spotting of firebrands on spread is considered.
A fire starting from a point source will have an elliptical shape under the above conditions.
Fuel conditions are representative one of the 18 benchmark fuel types.
The Fire Weather Index (FWI) values used are representative of the site conditions.
Fuels are uniform and continuous; topography is homogenous. and the wind is constant and one direction during the prediction period.
The fire is wind or wind/slope driven, and spread is not affected by a convection column.
Wind is measured in the open and is corrected to 10 m.
The rate of fire spread levels off at high wind speed and initial spread index (ISI) values.
The fire is unaffected by suppression activities (free burning).
The effect of short-range spotting of firebrands on spread is considered.
A fire starting from a point source will have an elliptical shape under the above conditions.

The FBP System is based on observations of experimental fires and wildfires. There are very few records of sustained fire spread with wind speeds above 60 km and/or ISI > 70. Thus, the largest ROS values in this App roughly correspond to the upper limit of observed spread rates in each fuel type. Higher ROS values may occur with higher wind speeds and during gusts.
"

- [ ] Consider adding date dialog (important for FMC)
- [ ] FBP: Incorporate card sort feedback.


## Log of changes & decisions

### v1.1.0 (next phase)

- [ ] Add FWI.
- [ ] FBP: Consider input option without sliders.

### v1.0.12 (future)
### v1.0.13 (future)

- [ ] Tech: Automated build (apk + appbundle) in github workflow.
- [ ] FBP: In B.C. the standard is to use degrees, minutes and seconds for coordinates.
- [ ] FBP: Consider : decimal places on wind direction and aspect aren't useful, e.g. SSE can be 157 degrees, we don't need 157.5

### v1.0.11 (current)
### v1.0.12 (current)

- [x] Fix back/flank spread distance
- [x] Fix UI issue for slider pop up text

### v1.0.11

- [x] Update targetSdkVersion for Android release

### v1.0.10

- [x] New cert and profile for signing and distributing app

### v1.0.9

- [x] FBP: M3 + M4 should only have dead fir, no conifer slider.

### v1.0.8

#### Summary:

Improved validation on coordinate input, and resolved some crashes related to invalid values. Direction of spread was incorrectly showing the net effective wind direction.

#### Detail:

- [x] Web: About was crashing in web version.
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
ARG DOCKER_IMAGE=instrumentisto/flutter:3.13.9
ARG DOCKER_IMAGE=instrumentisto/flutter:3.22.0

# To build locally, point to a local base image you've already built (see openshift/wps-api-base)
# e.g. : docker build --build-arg DOCKER_IMAGE=wps-api-base:my-tag .

FROM ${DOCKER_IMAGE} as static
FROM ${DOCKER_IMAGE} AS static

WORKDIR /opt/app-root/fbp-go/

Expand All @@ -19,10 +19,10 @@ RUN flutter build web --base-href /fbp-go/
FROM registry.access.redhat.com/ubi8/nginx-122:1-55

# Add application sources
ADD ./openshift/nginx.conf "${NGINX_CONF_PATH}"
COPY ./openshift/nginx.conf "${NGINX_CONF_PATH}"

# Copy the static content:
COPY --from=static /opt/app-root/fbp-go/build/web .

EXPOSE 3000
CMD nginx -g "daemon off;"
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
14 changes: 7 additions & 7 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
geolocator_apple: d981750b9f47dbdb02427e1476d9a04397beb8d9
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
permission_handler_apple: 3787117e48f80715ff04a3830ca039283d6a4f29
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7

PODFILE CHECKSUM: 24c2993105c243ecc0879b364eafeeafb0552e37
PODFILE CHECKSUM: f042fcb7a26a3fc47a044bc7edcc6587b8cda493

COCOAPODS: 1.14.2
COCOAPODS: 1.16.2
24 changes: 15 additions & 9 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -201,10 +201,12 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down Expand Up @@ -254,6 +256,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -342,7 +345,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand All @@ -359,15 +362,16 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_TEAM = L796QSLV3E;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "FBP Go";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.10;
MARKETING_VERSION = 1.0.12;
PRODUCT_BUNDLE_IDENTIFIER = ca.bc.gov.FBPGo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -425,7 +429,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -494,15 +498,16 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_TEAM = L796QSLV3E;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "FBP Go";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.10;
MARKETING_VERSION = 1.0.12;
PRODUCT_BUNDLE_IDENTIFIER = ca.bc.gov.FBPGo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -522,15 +527,16 @@
CODE_SIGN_ENTITLEMENTS = Runner/RunnerRelease.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 8;
CURRENT_PROJECT_VERSION = 10;
DEVELOPMENT_TEAM = L796QSLV3E;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "FBP Go";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.10;
MARKETING_VERSION = 1.0.12;
PRODUCT_BUNDLE_IDENTIFIER = ca.bc.gov.FBPGo;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Loading

0 comments on commit d44f425

Please sign in to comment.