TODO Find Azurite seed data for the API (Tylah might be blind)
-
.NET 8 https://dotnet.microsoft.com/en-us/download/dotnet/8.0
-
IDE - Visual Studio Enterprise Latest // Jetbrains Rider // VS Code
-
Android SDK setup/ installed w/ Xamarin (https://docs.microsoft.com/en-us/xamarin/android/get-started/installation/android-sdk)
-
iOS SDK setup/installed w/ Xamarin (https://docs.microsoft.com/en-us/xamarin/ios/get-started/installation/)
-
Azure Storage Explorer (Easy way to upload and download files (see Local Emulator Database)
-
Azure Data Studio (Not required, can use IDE Tools for DB Querying)
-
Install Dev Tunnels or Ngrok see the rule https://ssw.com.au/rules/port-forwarding/
- dev tunnels (Recommended)
- ngrok
- XCode v15.0.1+
- Check or set
Command Line Tools
location - Preferences | Locations | Command Line Tools
- Check or set
- Clone this Repo https://github.com/SSWConsulting/SSW.Rewards.Mobile.git
- Download and install the .NET SDK version 8.0.402
- Get the Secrets from Keeper
- Client Secrets | SSW | SSW.Rewards | Developer Secrets
- Add them as .NET User Secrets for
WebAPI.csproj
- Create a Developer Certificate with command below
- Make sure you have folder
.aspnet\https
in your home directory - Run the script below (You can change change this, but the
docker-compose.yml
should be updated appropriately)
- Make sure you have folder
Windows Terminal
dotnet dev-certs https -ep $env:USERPROFILE\.aspnet\https\WebAPI.pfx -p ThisPassword
dotnet dev-certs https --trust
Mac
dotnet dev-certs https -ep ${HOME}/.aspnet/https/WebAPI.pfx -p ThisPassword
dotnet dev-certs https --trust
NOTE: If when creating WebAPI.pfx you get "A valid HTTPS certificate is already present." use dotnet dev-certs https --clean
to remove the existing certificate.
NOTE: See https://learn.microsoft.com/en-us/aspnet/core/security/docker-https?view=aspnetcore-8.0#certificates if there are any issues.
- Cd into the Repo
- Run the Docker Containers
- On Windows, open PowerShell and run:
./up.ps1
- On macOS or Linux, open a terminal and run:
pwsh ./up.ps1
Note: global.json
must have version
and workloadVersion
set to 8.0.402 due to breaking changes in the version 8.0.404.
You should now be able to access the AdminUI hosted locally at https://localhost:7137
You should now be able to access the WebAPI Swagger docs at https://localhost:5001/swagger/index.html
Note: You can run only the WebAPI or AdminUI by running:
docker compose --profile webapi up -d
OR
docker compose --profile admin up -d
Microsoft Learn has a great step-by-step process to get your first .NET MAUI project up and running, this will should allow you to run the Mobile UI with out much issue! https://learn.microsoft.com/en-us/dotnet/maui/get-started/first-app?view=net-maui-8.0&tabs=vsmac&pivots=devices-android
- Run the Docker containers (Only WebApi required)
- Start a Dev Tunnel for the API
devtunnel host -p 5001
- Update the
Constants.cs
ApiBaseUrl
in the #if DEBUG block to use your DevTunnel address - Run the MobileUI, targeting your Android Emulator
- Complete steps 1-3 above
- Run the MobileUI, targeting your Android Emulator
NOTE: if you cannot build and see an error relating to the provisioning profile/ app signing identity
NOTE: if the solution fails to load, open a terminal in the SSW.Rewards.Mobile folder and run: dotnet workload update dotnet workload restore
- Open up the iOS project settings by right clicking on SSW.Consulting.iOS and selecting Options.
- go to 'iOS Bundle Signing' and select your signing identity and provisioning profile.
- These should be automatic by default but if you get an error you can manually set them.
- If you don't have these, talk to another Team Member or Sys Admin and get them to add your AppleID to the Superior Software for Windows Pty Ltd Apple Developer Program Team
If you want to set up to deploy to your own iPhone, talk to an App Manager, it's hard! :) Or you can give it a go yourself. For that you will be using 2 portals - App Store Connect and Apple Developer Portal:
- Talk to a team member who has either Admin or App Manager role in App Store Connect. Give them your Apple ID (you can provide your personal one) and they will send you an invite to the Apple Developer team. If you've never used Apple products before, you will need to create an Apple ID. You need to be granted at least the App Manager role to be able to perform some of the steps below; otherwise ask someone with the App Manager Role or higher to assist you.
- On your mac create a Certificate Signing Request (CSR) using Keychain. Go to Keychain Access -> Certificate Assistant -> Request a certificate from a certificate authority. Fill the fields and save generated CSR somewhere.
- Go to https://developer.apple.com, scroll down and click "Certificates, IDs, & Profiles".
- Select the Certificates tab. Add a new Certificate of type
Apple Development
. For that you will need to upload the CSR. Once the certificate is created, the CSR is no longer needed and can be deleted. - Download the certificate on your mac and double click it to install.
- Go back to the developer portal and select the Devices tab.
- Add a device you are gonna be using for testing. To get your device's UDID connect it to your mac and open the Music app. Select your device on the left and then click a couple of times on the subtitle which displays your iPhone model, storage and battery level.
- Once your device is added to the developer portal, select the Profiles tab. Update the provisioning profile for iOS App Development
SSWRewards_Dev
. Select the certificate and device added on the previous steps. Tip: Any changes to the provisioning profile won't disrupt the work of your team. - Download the provisioning profile on your mac and double click to install it. Tip: provisioning profiles are installed to ~/Library/MobileDevice/Provisioning Profiles/
After that you should be able to deploy and debug the application on your iPhone.
Currently we have GitHub Actions which build and push the application to InternalTesting and TestFlight. But sometimes it's required to build and sign the application locally. Below is a detailed description how to do that.
Apple expects developers to have individual development certificates (up to 2 per developer) and share distribution certificates (up to 3 per team). To be able to build and sign an ipa file you need to have a distribution certificate and provisioning profile associated with it installed on your machine. All the secrets can be found in our password manager (PM).
- Get distribution certificate as a base-64 string from PM and run:
echo <cert-base64-string> | base64 --decode > DistributionCertificate.p12
- Double click the certificate to install it; use the password from PM
- Download distribution provisioning profile form the Apple Developer Portal
- Double click the provisioning profile to install it
- Go to the MobileUI folder
- Run
dotnet publish -f net8.0-ios -p:ArchiveOnBuild=true -p:CodesignKey="XXX" -p:CodesignProvision="YYY"
; XXX is the CertificateName (in PM) and YYY is ProfileName (same as in Apple Developer Portal) - The ipa file in the ../MobileUI/bin/Release/net8.0-ios/ios-arm64/publish/ folder is ready to be uploaded to TestFlight
- Find keystore info in PM
- Run
echo <keystore-base64-string> | base64 --decode > rewards.keystore
- To see the info about keystore run
keytool -list -v -keystore rewards.keystore
- Run
dotnet publish -f net8.0-android -p:AndroidKeyStore=true -p:AndroidSigningKeyStore=rewards.keystore -p:AndroidSigningKeyAlias=XXX -p:AndroidSigningKeyPass=YYY -p:AndroidSigningStorePass=YYY
; XXX and YYY can be found in PM - The signed aab file in the ../MobileUI/bin/Release/net8.0-android/publish/ folder is ready to be uploaded to InternalTesting
Now you are setup, lets get started on a PBI
Be sure to read the Definition of done and the Definition of ready