Skip to content

Commit

Permalink
Update formatting and remove import
Browse files Browse the repository at this point in the history
  • Loading branch information
amytang0 committed Sep 23, 2020
1 parent cc852a1 commit ec273fc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 7 additions & 2 deletions app/src/main/java/com/plaid/linksample/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MainActivity : AppCompatActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
result = findViewById(R.id.result)
tokenResult = findViewById<TextView>(R.id.public_token_result)
tokenResult = findViewById(R.id.public_token_result)

val button = findViewById<View>(R.id.open_link)
button.setOnClickListener {
Expand All @@ -76,7 +76,12 @@ class MainActivity : AppCompatActivity() {
}

private fun onLinkTokenSuccess(linkToken: String) {
Plaid.create(this.application, LinkTokenConfiguration.Builder().token(linkToken).build())
Plaid.create(
this.application,
LinkTokenConfiguration.Builder()
.token(linkToken)
.build()
)
.open(this)
}

Expand Down
11 changes: 5 additions & 6 deletions app/src/main/java/com/plaid/linksample/MainActivityJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@

import com.plaid.link.Plaid;
import com.plaid.link.configuration.LinkTokenConfiguration;
import com.plaid.link.configuration.PlaidProduct;
import com.plaid.link.result.LinkResultHandler;
import com.plaid.linksample.network.LinkTokenRequester;

import kotlin.Unit;

import java.util.ArrayList;


public class MainActivityJava extends AppCompatActivity {

Expand Down Expand Up @@ -89,14 +86,16 @@ private void setOptionalEventListener() {
* <a href="https://plaid.com/docs/link/android/#parameter-reference">parameter reference</>
*/
private void openLink() {
ArrayList<PlaidProduct> products = new ArrayList<>();
products.add(PlaidProduct.TRANSACTIONS);
LinkTokenRequester.INSTANCE.getToken()
.subscribe(this::onLinkTokenSuccess, this::onLinkTokenError);
}

private void onLinkTokenSuccess(String token) {
Plaid.create(getApplication(), new LinkTokenConfiguration.Builder().token(token).build())
Plaid.create(
getApplication(),
new LinkTokenConfiguration.Builder()
.token(token)
.build())
.open(this);
}

Expand Down

0 comments on commit ec273fc

Please sign in to comment.