This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# shellcheck disable=SC2034 | |
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
# shellcheck disable=SC1090 source=commons.sh | |
source "$SCRIPT_DIR/commons.sh" | |
logger dependencies "$@" # register own debug tag & logger functions | |
#set -x # Uncomment to DEBUG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
#set -x # Uncomment to DEBUG | |
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
source "$SCRIPT_DIR/logger.sh" | |
logger token "$@" # controlled by DEBUG=token,* | |
logger refresh "$@" # controlled by DEBUG=refresh,* | |
# terminal colors and utility functions, like: cl_grey, cl_reset |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# shellcheck disable=SC2034 | |
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
# shellcheck disable=SC1090 source=commons.sh | |
source "$SCRIPT_DIR/commons.sh" | |
logger dependencies "$@" # register own debug tag & logger functions | |
#set -x # Uncomment to DEBUG |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# shellcheck disable=SC2155,SC2034,SC2059 | |
# get script directory | |
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
# | |
# Register debug logger functions that are controlled by DEBUG= environment variable | |
# Examples: | |
# DEBUG=* - print all logs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -x # uncomment to debug | |
# required for Homebrew | |
xcode-select —-install | |
sudo xcodebuild -license accept | |
# install https://brew.sh/ | |
which brew || (/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get root folder path of the project under git | |
# Output: /Users/oleksandr.kucherenko/projects/klarna-app | |
git rev-parse --show-toplevel | |
# Get latest commit hash | |
# Output: 1b03718dabad03aaef917eff3ea8bb15e4fa1c46 | |
git rev-parse @ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@Config(sdk = Build.VERSION_CODES.P) | |
public void testFingerprintConfigured_api28() throws Exception { | |
// GIVEN: | |
// API28 android version | |
// for api24+ system feature should be enabled | |
// fingerprints are configured | |
ReactApplicationContext context = getRNContext(); | |
shadowOf(context.getPackageManager()).setSystemFeature(PackageManager.FEATURE_FINGERPRINT, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@Config(sdk = Build.VERSION_CODES.M) | |
public void testFingerprintConfigured_api23() throws Exception { | |
// GIVEN: | |
// API23 android version | |
// Fingerprints are configured | |
// fingerprint feature is ignored by android os | |
ReactApplicationContext context = getRNContext(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@Config(sdk = Build.VERSION_CODES.M) | |
public void testFingerprintAvailableButNotConfigured_api23() throws Exception { | |
// GIVEN: | |
// fingerprint api available but not configured properly | |
// API23 android version | |
ReactApplicationContext context = getRNContext(); | |
KeychainModule module = new KeychainModule(context); | |
// set that hardware is available |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
@Config(sdk = Build.VERSION_CODES.LOLLIPOP) | |
public void testFingerprintNoHardware_api21() throws Exception { | |
// GIVEN: API21 android version | |
ReactApplicationContext context = getRNContext(); | |
KeychainModule module = new KeychainModule(context); | |
// WHEN: verify availability | |
final int result = BiometricManager.from(context).canAuthenticate(); | |
final boolean isFingerprintAvailable = module.isFingerprintAuthAvailable(); |