diff --git a/Gemfile b/Gemfile index 7a118b49be..cdd3a6b349 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,6 @@ source "https://rubygems.org" gem "fastlane" + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/app/build.gradle b/app/build.gradle index a3a738a121..4e81272cfe 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,8 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' -apply plugin: 'io.fabric' +apply plugin: 'com.google.firebase.crashlytics' +apply plugin: 'com.google.gms.google-services' static def generateVersionName() { def gitCommitsCount = "git rev-list HEAD --count".execute().text.trim() @@ -29,24 +30,17 @@ android { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.debug - buildConfigField 'boolean', 'CRASHLYTICS', 'Boolean.parseBoolean("false")' - ext.enableCrashlytics = false } debug { debuggable true minifyEnabled false applicationIdSuffix ".dev" signingConfig signingConfigs.debug - buildConfigField 'boolean', 'CRASHLYTICS', 'Boolean.parseBoolean("false")' - ext.enableCrashlytics = false } debug_beta { initWith debug versionNameSuffix "-beta" applicationIdSuffix ".debug" - buildConfigField 'boolean', 'CRASHLYTICS', 'Boolean.parseBoolean("true")' - manifestPlaceholders = [fabric_api_key: properties.hasProperty('fabric_api_key') - ? project.property('fabric_api_key') : '000'] } } flavorDimensions "" @@ -75,7 +69,6 @@ android { repositories { maven { url "https://jitpack.io" } - maven { url 'https://maven.fabric.io/public' } } configurations { all*.exclude group: 'com.google.guava', module: 'listenablefuture' @@ -133,8 +126,8 @@ dependencies { // implementation 'com.github.stellar:java-stellar-sdk:0.4.1' implementation 'net.i2p.crypto:eddsa:0.3.0' - implementation('com.crashlytics.sdk.android:crashlytics:2.9.9') { transitive = true } - implementation('io.fabric.sdk.android:fabric:1.4.0@aar') { transitive = true } + implementation 'com.google.firebase:firebase-analytics:17.2.3' + implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta02' implementation files('libs/ripple-core-0.0.1.jar') //4 dependencies for ripple-core TODO: move to module? diff --git a/app/src/debug_beta/AndroidManifest.xml b/app/src/debug_beta/AndroidManifest.xml index 9f07ca1097..8cf74b318f 100644 --- a/app/src/debug_beta/AndroidManifest.xml +++ b/app/src/debug_beta/AndroidManifest.xml @@ -7,10 +7,6 @@ - - ) -> Unit) { if (this.config.issuer == null) { @@ -268,6 +275,10 @@ class CardManager( return } val personalizationCommand = PersonalizeCommand(config) + fun personalize(config: CardConfig, + issuer: Issuer, manufacturer: Manufacturer, acquirer: Acquirer? = null, + callback: (result: TaskEvent) -> Unit) { + val personalizationCommand = PersonalizeCommand(config, issuer, manufacturer, acquirer) val task = SingleCommandTask(personalizationCommand) task.performPreflightRead = false runTask(task, callback = callback) @@ -318,10 +329,7 @@ class CardManager( val terminalKeys = if (config.linkedTerminal) terminalKeysService?.getKeys() else null return CardEnvironment( cardId = cardId, - terminalKeys = terminalKeys, - manufacturerKeyPair = config.manufacturerKeyPair, - acquirerKeyPair = config.acquirerKeyPair, - issuer = config.issuer + terminalKeys = terminalKeys ) } diff --git a/tangem-core/src/main/java/com/tangem/Config.kt b/tangem-core/src/main/java/com/tangem/Config.kt index 2067f61920..2d1193e176 100644 --- a/tangem-core/src/main/java/com/tangem/Config.kt +++ b/tangem-core/src/main/java/com/tangem/Config.kt @@ -1,12 +1,6 @@ package com.tangem -import com.tangem.commands.personalization.entities.Issuer -import com.tangem.common.KeyPair - class Config( val linkedTerminal: Boolean = true, - val issuerPublicKey: ByteArray? = null, - val manufacturerKeyPair: KeyPair? = null, - val acquirerKeyPair: KeyPair? = null, - val issuer: Issuer? = null + val issuerPublicKey: ByteArray? = null ) \ No newline at end of file diff --git a/tangem-core/src/main/java/com/tangem/commands/personalization/PersonalizeCommand.kt b/tangem-core/src/main/java/com/tangem/commands/personalization/PersonalizeCommand.kt index 7e118ae9f0..1e91cdddd6 100644 --- a/tangem-core/src/main/java/com/tangem/commands/personalization/PersonalizeCommand.kt +++ b/tangem-core/src/main/java/com/tangem/commands/personalization/PersonalizeCommand.kt @@ -3,7 +3,10 @@ package com.tangem.commands.personalization import com.tangem.commands.Card import com.tangem.commands.CardData import com.tangem.commands.CommandSerializer +import com.tangem.commands.personalization.entities.Acquirer import com.tangem.commands.personalization.entities.Issuer +import com.tangem.commands.personalization.entities.Manufacturer +import com.tangem.commands.personalization.entities.Manufacturer import com.tangem.commands.personalization.util.CardIdCreator import com.tangem.common.CardEnvironment import com.tangem.common.apdu.CommandApdu @@ -24,21 +27,23 @@ import com.tangem.tasks.TaskError * Personalization is an initialization procedure, required before starting using a card. * During this procedure a card setting is set up. * During this procedure all data exchange is encrypted. - * @param config is a configuration file with all the card settings that are written on the card + * @property config is a configuration file with all the card settings that are written on the card * during personalization. - * @param cardId this parameter will set up CID, Unique Tangem card ID. + * @property issuer Issuer is a third-party team or company wishing to use Tangem cards. + * @property manufacturer Tangem Card Manufacturer. + * @property acquirer Acquirer is a trusted third-party company that operates proprietary + * (non-EMV) POS terminal infrastructure and transaction processing back-end. */ -class PersonalizeCommand(private val config: CardConfig) : CommandSerializer() { +class PersonalizeCommand( + private val config: CardConfig, + private val issuer: Issuer, private val manufacturer: Manufacturer, + private val acquirer: Acquirer? = null +) : CommandSerializer() { override fun serialize(cardEnvironment: CardEnvironment): CommandApdu { - if (cardEnvironment.issuer == null || cardEnvironment.manufacturerKeyPair == null) { - throw TaskError.SerializeCommandError() - } return CommandApdu( Instruction.Personalize, - serializePersonalizationData( - config, cardEnvironment.issuer, - cardEnvironment.manufacturerKeyPair.privateKey, cardEnvironment.acquirerKeyPair?.publicKey), + serializePersonalizationData(config), encryptionKey = devPersonalizationKey ) } @@ -99,12 +104,10 @@ class PersonalizeCommand(private val config: CardConfig) : CommandSerializer -