Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/product 16887 restore url in start transaction #39

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 6 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()

}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
plugins {
id 'com.android.application' version '8.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.9.0' apply false
id 'com.google.dagger.hilt.android' version '2.48.1' apply false
id("com.google.firebase.crashlytics") version "2.9.9" apply false
id 'com.google.devtools.ksp' version '1.9.0-1.0.13' apply false
}
80 changes: 79 additions & 1 deletion demo/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,79 @@
/build
# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/runConfigurations.xml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/jarRepositories.xml
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json


# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Android Profiling
*.hprof
9 changes: 4 additions & 5 deletions demo/src/main/java/ramp/network/demo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ class MainActivity : AppCompatActivity() {
val config = Config(
hostLogoUrl = "https://ramp.network/assets/images/Logo.svg",
hostAppName = "My App",
url = "https://app.dev.ramp-network.org",
hostApiKey = "3qncr4yvxfpro6endeaeu6npkh8qc23e9uadtazq",
url = "https://app.demo.ramp.network",
hostApiKey = "udr4csh6vje38gvndow6p3f32j3zq3jbkfgrsn22",
userAddress = "0x81A4362705891615d7395135d5591BaaC9f21d3D",
swapAsset = "GOERLI_ETH",
enabledFlows = setOf(Flow.OFFRAMP, Flow.ONRAMP)
)
// 4. Implement callbacks
val callback = object : RampCallback {
override fun onPurchaseFailed() {
Log.d("MainActivity", "onPurchaseFailed")
}

override fun onPurchaseCreated(
purchase: Purchase,
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
kotlin.code.style=official
android.defaults.buildfeatures.buildconfig=true
80 changes: 79 additions & 1 deletion rampsdk/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,79 @@
/build
# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
# release/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# IntelliJ
*.iml
.idea/runConfigurations.xml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
.idea/jarRepositories.xml
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
# google-services.json


# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Android Profiling
*.hprof
47 changes: 16 additions & 31 deletions rampsdk/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@ plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-parcelize'
id 'kotlin-kapt'
id 'com.google.devtools.ksp'
id 'maven-publish'
}

group = 'com.github.RampNetwork'

repositories {
mavenCentral()
google()
maven { url "https://jitpack.io" }
}

android {
compileSdkVersion 32
buildToolsVersion "30.0.3"
compileSdk 32
buildToolsVersion "34.0.0"


defaultConfig {
Expand All @@ -27,6 +21,13 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
buildConfigField 'String', 'VERSION', "\"${defaultConfig.versionName}\""

namespace "network.ramp.sdk"

}

kotlinOptions {
jvmTarget = "1.8"
}

buildTypes {
Expand All @@ -37,6 +38,7 @@ android {
}

buildFeatures {
buildConfig true
viewBinding true
}

Expand All @@ -50,20 +52,16 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.core:core-ktx:1.7.0'
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.7.10"

implementation 'com.squareup.moshi:moshi:1.14.0'
implementation 'com.squareup.moshi:moshi-adapters:1.14.0'
implementation 'com.squareup.moshi:moshi-kotlin:1.14.0'
implementation("com.squareup.moshi:moshi-kotlin:1.15.0")
implementation 'com.squareup.moshi:moshi-adapters:1.15.0'

kapt("com.squareup.moshi:moshi-kotlin-codegen:1.14.0")
ksp("com.squareup.moshi:moshi-kotlin-codegen:1.15.0")

def dagger_version = "2.40.4"
implementation "com.google.dagger:dagger:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"

implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.1'
Expand All @@ -76,16 +74,3 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
from components.release
groupId = 'com.github.RampNetwork'
artifactId = 'ramp-sdk-android'
version = '3.0.4'
}
}
}
}
4 changes: 1 addition & 3 deletions rampsdk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="network.ramp.sdk">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" android:required="true"/>

<application
android:allowBackup="false"
android:launchMode="singleTask"
android:usesCleartextTraffic="false"
tools:targetApi="m">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ sealed class Event(val type: EventType) {
}
}

@JsonClass(generateAdapter = true)
data class Close(var payload: WidgetClosePayload? = null) : Event(EventType.CLOSE) // TO_VERIFY Not in documentation but in received events
@JsonClass(generateAdapter = true)
data class WidgetClose(var payload: WidgetClosePayload? = null) : Event(EventType.WIDGET_CLOSE)

Expand Down Expand Up @@ -48,6 +50,7 @@ internal data class OfframpSaleCreated(var payload: OfframpSaleCreatedPayload) :

@JsonClass(generateAdapter = false)
enum class EventType {
CLOSE,
WIDGET_CLOSE,
OPEN_LINK,
WIDGET_CONFIG_DONE,
Expand Down
16 changes: 5 additions & 11 deletions rampsdk/src/main/java/network/ramp/sdk/events/model/Payloads.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,9 @@ data class OfframpSaleCreatedPayload(
data class Purchase(
val id: String,
val endTime: String, // purchase validity time, ISO date-time string
@Deprecated("This parameter will be removed in future release")
val escrowAddress: String? = null, // filled only for escrow-backend purchases
val cryptoAmount: String, // number-string, in wei or token units
val fiatCurrency: String, // three-letter currency code
val fiatValue: Long, // total value the user pays for the purchase, in fiatCurrency
@Deprecated("This parameter will be removed in future")
val assetExchangeRateEur: Double,
@Deprecated("This parameter will be removed in future")
val fiatExchangeRateEur: Long,
val fiatValue: Double, // total value the user pays for the purchase, in fiatCurrency
val baseRampFee: Double, // base Ramp fee before any modifications, in fiatCurrency
val networkFee: Double, // network fee for transferring the purchased asset, in fiatCurrency
val appliedFee: Double, // final fee the user pays (included in fiatValue), in fiatCurrency
Expand All @@ -65,11 +59,9 @@ data class Purchase(
val asset: Asset, // description of the purchased asset (address, symbol, name, decimals)
val receiverAddress: String, // blockchain address of the buyer
val assetExchangeRate: Double,// price of 1 whole token of purchased asset, in fiatCurrency
@Deprecated("This parameter will be removed in future")
val purchaseViewToken: String,
val status: String, // purchase status
val paymentMethodType: String, // type of payment method used to pay for the swap: 'MANUAL_BANK_TRANSFER' | 'AUTO_BANK_TRANSFER' | 'CARD_PAYMENT' | 'APPLE_PAY'
val finalTxHash: String? = null // hash of the crypto transfer blockchain transaction, filled once available
val finalTxHash: String? = null // TO_VERIFY() not in recived json
)

@JsonClass(generateAdapter = true)
Expand Down Expand Up @@ -97,8 +89,10 @@ data class Fiat(
data class Asset(
val address: String? = null, // 0x-prefixed address for ERC-20 tokens, `null` for ETH
val symbol: String, // asset symbol, for example `ETH`, `DAI`, `USDC`
val apiV3Symbol: String, // TO VERIFY new
val name: String,
val decimals: Long, // token decimals, e.g. 18 for ETH/DAI, 6 for USDC
val type: String, // asset type & network, e.g. `ETH`, `ERC20`, `MATIC_ERC20`
val chain: String // asset chain, for example `ETH`, `BSC`, `POLKADOT`
val chain: String, // asset chain, for example `ETH`, `BSC`, `POLKADOT`
val apiV3Type: String // TO_VERIFY() new
) : Parcelable
Loading