Skip to content

Latest commit

 

History

History
208 lines (149 loc) · 6.03 KB

DEVELOPING.adoc

File metadata and controls

208 lines (149 loc) · 6.03 KB

Developing

Guide for our development process, project setup and how to write code.

Table Of Contents

Installation

Install Java & Kotlin

You could use Homebrew to install on mac

brew tap adoptopenjdk/openjdk
brew install adoptopenjdk11
brew install kotlin

OR The easiest way to install Java and Kotlin is to use SDK MAN

Just open your terminal and enter:

curl -s "https://get.sdkman.io" | bash

Follow the setup instructions and verify that your installation works:

sdk version

If it shows you something like 5.11.5+713 then your good to continue.

Just install the mentioned dependencies:

sdk install java 11.0.11.hs-adpt
sdk install kotlin 1.6.10

Check your installation by:

java -version
kotlin -version

Android Studio

For better interop with iOS you may install the Kotlin Multiplaform Mobile (KMM) plugin for Android Studio. It let’s you run, test and debug shared code on Android and iOS without switching the IDEs.

Development Process

Features

Every change has to branch of from main and use this branch naming convention:

  • feature/{type_of_change}-{short_description} or with ticket id feature/{ticket_id}/{type_of_change}-{short_description}

main must be always in releasable state.

Type Of Change

  • add for new features or functionality

  • change for changes in existing features or functionality

  • remove for removed features or functionality

  • fix for any bug fixes

  • bump for dependency updates

  • security in case of vulnerabilities

Examples:

  • feature/SDK-456/add-awesome-hashing-algorithm

  • feature/add-awesome-hashing-algorithm

  • feature/remove-not-so-awesome-algorithm

  • feature/fix-algorithm-corner-case

  • feature/bump-lib-to-1.3.0

Release

A release branches of from main branch with following pattern:

  • release/{major}.{minor}(.{patch})/prepare-{major}.{minor}.{patch} while patch is optional

Add following changes:

  • Update CHANGELOG.adoc by creating a new Unreleased section and change current unreleased to release version

  • Update README.adoc project-version to release version

  • Update the latest release badge HowTo

Releases are automatically created when a tag in the form of v{major}.{minor}.{patch} is added.

For release management, we use GitHub Releases. So just create a new release, set the tag according to Semantic Versioning and publish.

Develop

There are several requirements for building and developing the SDK.

Config files

Before you can start to compile the SDK you need to add d4l-client-config-android.json and d4l-test-config-android.json files in the project root folder and add following content.

d4l-client-config-android.json needs to contain a config for every environment LOCAL, DEVELOPMENT, STAGING, SANDBOX, PRODUCTION.

📎
The CI expects this configuration from environment variables stored in GitHub secrets: D4L_CLIENT_CONFIG_ANDROID and D4L_CLIENT_CONFIG_IOS
// d4l-client-config-android.json
{
  "platform": "D4L",
  "configs": {
    "LOCAL": {
      "id": "{CLIENT_ID}",
      "secret": "{CLIENT_SECRET}",
      "redirectScheme": "{CLIENT_REDIRECT_SCHEME}"
    },
    "DEVELOPMENT": {
      "id": "{CLIENT_ID}",
      "secret": "{CLIENT_SECRET}",
      "redirectScheme": "{CLIENT_REDIRECT_SCHEME}"
    }
  }
}
// d4l-test-config-android.json
{
  "user": {
    "email": "{USER_EMAIL}",
    "password": "{USER_PASSWORD}",
    "phoneCountryCode": "{USER_PHONE_COUNTRY_CODE}",
    "phoneLocalNumber": "{USER_PHONE_LOCAL_NUMBER}"
  },
  "twillio": {
    "accountSid": "{TWILLIO_ACCOUNT_SID}",
    "authSid": "{TWILLIO_AUTH_SID}",
    "authToken": "{TWILLIO_AUTH_TOKEN}"
  }
}

To provide the test config to the different modules run the following gradle task in the root directory of the project.

./gradlew provideTestConfig

Maintaining

Certificate pinning is done by providing a set of certificates by hash of the public key. To get the hash from certificate use the following:

openssl x509 -inform der -in sandbox.hpihc.de.cer -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

Certificate Pin

To get the Base64 encoded sha256 of the HTTPS public key pinning use the following command in the terminal

openssl s_client -servername api.data4life.care -connect app.data4life.care:443 | openssl x509 -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64

See HTTP Public Key Pinning for more information.

Documentation

We use AsciiDoctor to write our documentation.

The documentation is located in the docs folder. It’s main purpose is to be easily copied to d4l.io.

The 01_sdk_setup.adoc is an exact copy of the README sections from About the project to Usage.