Skip to content

Commit

Permalink
fix various bugs and upgrade dependencies (#219)
Browse files Browse the repository at this point in the history
* roll back ios project name changes

* add key ITSAppUsesNonExemptEncryption

* fix iphone status bar overlay

* move camera higher for mobile phones

* add new rotation model implementation

* rotate current location

* get plate id for current location

* rotate points with the new rotate() function

* update to ionic 7

* upgrade capacitor

* change IonLabels for new ion framework

* use gplates npm package

* update dependencies

* update sql

* update packages

* update packages

* improve code a bit

* add build workflow

* update build workflow

* update build.yml

* udpate build.yml

* fix package.json

* fix package.json

* fix build.yml

* fix package.json

* update readme

* add a new folder

* rename archive.md -> ARCHIVE.md

* update readme

* Update README.md
  • Loading branch information
michaelchin authored Jun 6, 2023
1 parent 2d2b102 commit b3b49c5
Show file tree
Hide file tree
Showing 37 changed files with 5,199 additions and 2,452 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: GPlates App Build

on:
workflow_dispatch:

push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci --legacy-peer-deps
- run: npm install -g @ionic/cli
- run: CI=false npm run build --if-present
- run: npm test
85 changes: 25 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,44 @@
# GPlates App

The “GPlates-in-schools” program is funded by [AuScope](https://www.auscope.org.au/), comprising a GPlates app with integrated lesson plans, to provide an Earth Science-focused education engagement initiative.

## How to contribute code

- Open an issue
- Create a new branch for the issue
- Work on the new branch
- Create a pull request for code review and merge
- Remove the branch

## Run the app in the simulators

You need Java 11 and Android studio 2021.2.1 or newer.
<p align="center">
<img width="600" src="https://github.com/GPlates/gplates-app/assets/2688316/63fd5c22-e28c-484b-8204-a3af4e240c45">
</p>

**Important: You need to export the correct JAVA_HOME and ANDROID_SDK_ROOT in set-env.sh**
![build workflow](https://github.com/gplates/gplates-app/actions/workflows/build.yml/badge.svg)

The following steps worked on my Macbook Pro.

- `nvm use 18`
- `npm install`
- `source ./set-env.sh`
- `ionic capacitor run android`
- `ionic capacitor run ios`

## Serve as a web page

- `npm start`/`ionic serve`

or
# GPlates App

- `npm install -g serve`
- `serve -s build`
The “GPlates-in-schools” program is funded by [AuScope](https://www.auscope.org.au/), comprising a GPlates app with integrated lesson plans, to provide an Earth Science-focused education engagement initiative.

## Deploy on Android device
## Screenshots

- `ionic build --prod`
- `npx cap sync`
- `npx cap open android`
- choose your device and click the "run" button in Android Studio
### Topography globe with G20 capital cities

Or
<img width="600" alt="Topography" src="https://github.com/GPlates/gplates-app/assets/2688316/b86c953e-bd4f-4081-9753-fb45055242fb">

- Run `ionic capacitor run android` and select your device
### Paleo-bathymetry at 100Ma

## Deploy on ios device
<img width="600" alt="Paleo-bathymetry" src="https://github.com/GPlates/gplates-app/assets/2688316/3279f7ae-9d7b-4d29-96d1-1df8fe0fd211">

- `ionic capacitor copy ios`
- `npx cap sync`
- install pods (see below for notes on how to install CocoaPods): `cd ios/App/; pod install; cd ../..`
- Open XCode with `npx cap open ios`
- Add an account with your Apple ID and choose the team under "signing&capabilities" in XCode
<img width="800" alt="add account" src="https://user-images.githubusercontent.com/2688316/167048512-49d68826-ff34-4b48-8a89-45f6ae194f04.png">
<img width="800" alt="select team" src="https://user-images.githubusercontent.com/2688316/167048695-05d4bc9c-eb0f-4c6a-a109-b0f02c43a281.png">
If you get a profile error, select the device can fix the error.
<img width="800" alt="select device" src="https://user-images.githubusercontent.com/2688316/167048749-1cda74f4-4551-4a70-b431-f515d3ec4bf8.png">
### Built-in Tutorial

- Run the app in XCode or run this command `ionic capacitor run ios -l --external`
- On your ios device, go to "Settings > General > Device Management" to trust the developer
<img width="600" alt="Built-in Tutorial" src="https://github.com/GPlates/gplates-app/assets/2688316/8efae96b-7f56-4490-a408-da8d436ca28e">

### CocoaPods on macs
## Troubleshooting

CocoaPods is required to create the 'ios/App/Pods' folder, and the XCode build will fail without this.
### Reloading App could be useful when a bug or mishap caused the App to enter and stuck in a messy state.

You can try `sudo gem install cocoapods` to install [CocoaPods](https://cocoapods.org) on your Mac. However, this [**does not**](https://github.com/CocoaPods/CocoaPods/issues/11056) work on an M1 chip.
- Step 1: open the "Settings" window

To install CocoaPods on an [M1](https://stackoverflow.com/questions/64901180/how-to-run-cocoapods-on-apple-silicon-m1) mac, use HomeBrew: `brew install cocoapods`
<img width="437" alt="Settings" src="https://github.com/GPlates/gplates-app/assets/2688316/01c385fd-229d-4233-9cd7-c9ebfbb0fdf9">

### Upgrade @capacitor-community/sqlite
- Step 2: hit the "Reload App" button

**Important:**
⚠ Remember to copy manually the file sql-wasm.wasm from nodes_modules/sql.js/dist/sql-wasm.wasm to the public/assets folder of YOUR_APP
<img width="593" alt="Reload App" src="https://github.com/GPlates/gplates-app/assets/2688316/c34ed7fa-2bbd-4b51-a370-b2586b0593ac">

### Firebase Deploy

<https://gplates-app-5e092.web.app> @gplatesearthbyte@gmail.com
## How to contribute code

#### use chrome inspect to debug android chrome://inspect/#devices
- Open an issue
- Create a new branch for the issue
- Work on the new branch
- Create a pull request for code review and merge
- Remove the branch
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ android {
applicationId "earthbyte.gplates.edu"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionCode 2
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
Expand Down
File renamed without changes.
72 changes: 72 additions & 0 deletions dev-doc/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
## Run the app in the simulators

You need Java 11 and Android studio 2021.2.1 or newer.

**Important: You need to export the correct JAVA_HOME and ANDROID_SDK_ROOT in set-env.sh**

The following steps worked on my Macbook Pro.

- `nvm use 18`
- `npm install`
- `source ./set-env.sh`
- `ionic capacitor run android`
- `ionic capacitor run ios`

## Serve as a web page

- `npm start`/`ionic serve`

or

- `npm install -g serve`
- `serve -s build`

## Deploy on Android device

- `ionic build --prod`
- `npx cap sync`
- `npx cap open android`
- choose your device and click the "run" button in Android Studio

Or

- Run `ionic capacitor run android` and select your device

## Deploy on ios device

- `ionic capacitor copy ios`
- `npx cap sync`
- install pods (see below for notes on how to install CocoaPods): `cd ios/App/; pod install; cd ../..`
- Open XCode with `npx cap open ios`
- Add an account with your Apple ID and choose the team under "signing&capabilities" in XCode
<img width="800" alt="add account" src="https://user-images.githubusercontent.com/2688316/167048512-49d68826-ff34-4b48-8a89-45f6ae194f04.png">
<img width="800" alt="select team" src="https://user-images.githubusercontent.com/2688316/167048695-05d4bc9c-eb0f-4c6a-a109-b0f02c43a281.png">
If you get a profile error, select the device can fix the error.
<img width="800" alt="select device" src="https://user-images.githubusercontent.com/2688316/167048749-1cda74f4-4551-4a70-b431-f515d3ec4bf8.png">

- Run the app in XCode or run this command `ionic capacitor run ios -l --external`
- On your ios device, go to "Settings > General > Device Management" to trust the developer

### CocoaPods on macs

CocoaPods is required to create the 'ios/App/Pods' folder, and the XCode build will fail without this.

You can try `sudo gem install cocoapods` to install [CocoaPods](https://cocoapods.org) on your Mac. However, this [**does not**](https://github.com/CocoaPods/CocoaPods/issues/11056) work on an M1 chip.

To install CocoaPods on an [M1](https://stackoverflow.com/questions/64901180/how-to-run-cocoapods-on-apple-silicon-m1) mac, use HomeBrew: `brew install cocoapods`

### Upgrade @capacitor-community/sqlite

⚠ Remember to copy manually the file sql-wasm.wasm from nodes_modules/sql.js/dist/sql-wasm.wasm to the public/assets folder of YOUR_APP

### Firebase Deploy

<https://gplates-app-5e092.web.app> @gplatesearthbyte@gmail.com

#### use chrome inspect to debug android chrome://inspect/#devices

### Change project name in XCode

⚠ DO NOT DO THAT!! The Capacitor hardcoded "App" as the name. If you change the name, some Capacitor commands will not work.

### append "&BGCOLOR=0x0000FF" to WMS request to get a background
7 changes: 3 additions & 4 deletions PUBLISHING.md → dev-doc/PUBLISHING.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,9 @@ For more detailed instructions on the following section, refer to [Prepare and r
- `View > Navigators > Project`, or
- Shortcut: `⌘ + 1`
3. Open `App.xcodeproj` (i.e., click `App`)
4. In the `General` tab, set the version numbers (see [Set the version number and build string](https://help.apple.com/xcode/mac/current/#/devba7f53ad4) for details)
- `Version` is the user-visible version number. Follows the `<major>.<minor>.<patch>` format
- `Build` is the machine-readable version number. Also follows the `<major>.<minor>.<patch>` format, but unused points can be dropped (e.g., `1` == `1.0.0` and `10.5` == `10.5.0`)
- Both are used by the App Store for versioning. See [this SO answer](https://stackoverflow.com/a/38009895/15379768)
4. In the `Info` tab, set the version numbers
- Bundle version
- Bundle version string (short)
5. If this is your first time building on this machine, assign a team in the `Signing & Capabilities` tab
- See [Assign a project to a team](https://help.apple.com/xcode/mac/current/#/dev23aab79b4) for details
6. Set the build destination to `Any iOS Device (arm64)`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
/* Begin PBXFileReference section */
2FAD9762203C412B000D30F8 /* config.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = config.xml; sourceTree = "<group>"; };
50379B222058CBB4000EE86E /* capacitor.config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = capacitor.config.json; sourceTree = "<group>"; };
504EC3041FED79650016851F /* GPlates.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GPlates.app; sourceTree = BUILT_PRODUCTS_DIR; };
504EC3041FED79650016851F /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
504EC3071FED79650016851F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
504EC30C1FED79650016851F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
504EC30E1FED79650016851F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -65,7 +65,7 @@
504EC3051FED79650016851F /* Products */ = {
isa = PBXGroup;
children = (
504EC3041FED79650016851F /* GPlates.app */,
504EC3041FED79650016851F /* App.app */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -97,9 +97,9 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
504EC3031FED79650016851F /* GPlates */ = {
504EC3031FED79650016851F /* App */ = {
isa = PBXNativeTarget;
buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "GPlates" */;
buildConfigurationList = 504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */;
buildPhases = (
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */,
504EC3001FED79650016851F /* Sources */,
Expand All @@ -111,9 +111,9 @@
);
dependencies = (
);
name = GPlates;
name = App;
productName = App;
productReference = 504EC3041FED79650016851F /* GPlates.app */;
productReference = 504EC3041FED79650016851F /* App.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand All @@ -132,7 +132,7 @@
};
};
};
buildConfigurationList = 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "GPlates" */;
buildConfigurationList = 504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */;
compatibilityVersion = "Xcode 8.0";
developmentRegion = en;
hasScannedForEncodings = 0;
Expand All @@ -145,7 +145,7 @@
projectDirPath = "";
projectRoot = "";
targets = (
504EC3031FED79650016851F /* GPlates */,
504EC3031FED79650016851F /* App */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -352,16 +352,16 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 0.0.1;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = DV848AV82F;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = GPlates;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.0.1;
MARKETING_VERSION = 1.0.0;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = org.gplates.app;
PRODUCT_BUNDLE_IDENTIFIER = app.gplates.org;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 5.0;
Expand All @@ -375,15 +375,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 0.0.1;
CURRENT_PROJECT_VERSION = 4;
DEVELOPMENT_TEAM = DV848AV82F;
INFOPLIST_FILE = App/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = GPlates;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.education";
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = org.gplates.app;
MARKETING_VERSION = 1.0.0;
PRODUCT_BUNDLE_IDENTIFIER = app.gplates.org;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "";
SWIFT_VERSION = 5.0;
Expand All @@ -394,7 +394,7 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
504EC2FF1FED79650016851F /* Build configuration list for PBXProject "GPlates" */ = {
504EC2FF1FED79650016851F /* Build configuration list for PBXProject "App" */ = {
isa = XCConfigurationList;
buildConfigurations = (
504EC3141FED79650016851F /* Debug */,
Expand All @@ -403,7 +403,7 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "GPlates" */ = {
504EC3161FED79650016851F /* Build configuration list for PBXNativeTarget "App" */ = {
isa = XCConfigurationList;
buildConfigurations = (
504EC3171FED79650016851F /* Debug */,
Expand Down
2 changes: 1 addition & 1 deletion ios/App/App.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ios/App/App/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
Expand All @@ -21,7 +19,9 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
Expand Down
Loading

0 comments on commit b3b49c5

Please sign in to comment.