From 5275b40e1e783309460fe3b33d7edba640c914ae Mon Sep 17 00:00:00 2001 From: Ashok Dandaboina Date: Tue, 17 Dec 2024 06:11:20 -0700 Subject: [PATCH] Connect Transfer Android SDK Release 1.0.0 Main Branch --- .gitignore | 16 ++ .idea/.gitignore | 3 + .idea/.name | 1 + .idea/compiler.xml | 6 + .idea/deploymentTargetSelector.xml | 10 + .idea/gradle.xml | 18 ++ .idea/migrations.xml | 10 + .idea/misc.xml | 9 + .idea/vcs.xml | 6 + CHANGELOG.md | 6 + LICENSE | 21 ++ README.md | 176 +++++++++++------ app/.gitignore | 1 + app/build.gradle | 45 +++++ app/proguard-rules.pro | 21 ++ app/release/baselineProfiles/0/app-release.dm | Bin 0 -> 3940 bytes app/release/baselineProfiles/1/app-release.dm | Bin 0 -> 3868 bytes app/release/output-metadata.json | 37 ++++ .../demo/ExampleInstrumentedTest.java | 26 +++ app/src/main/AndroidManifest.xml | 26 +++ .../ConsoleConnectAtomicEventHandler.java | 54 +++++ .../connecttransfer/demo/MainActivity.java | 64 ++++++ app/src/main/res/drawable/bg.xml | 12 ++ .../res/drawable/ic_launcher_background.xml | 170 ++++++++++++++++ .../res/drawable/ic_launcher_foreground.xml | 30 +++ app/src/main/res/drawable/rounded_corner.xml | 5 + app/src/main/res/layout/activity_main.xml | 78 ++++++++ .../res/mipmap-anydpi-v26/ic_launcher.xml | 6 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 6 + app/src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 1404 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2898 bytes app/src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 982 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1772 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1900 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3918 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 2884 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5914 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 3844 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 7778 bytes app/src/main/res/values-night/themes.xml | 7 + app/src/main/res/values/colors.xml | 7 + app/src/main/res/values/strings.xml | 8 + app/src/main/res/values/themes.xml | 9 + app/src/main/res/xml/backup_rules.xml | 13 ++ .../main/res/xml/data_extraction_rules.xml | 19 ++ .../connecttransfer/demo/ExampleUnitTest.java | 17 ++ build.gradle | 32 +++ gradle.properties | 21 ++ gradle/libs.versions.toml | 23 +++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 185 ++++++++++++++++++ gradlew.bat | 89 +++++++++ settings.gradle | 23 +++ 54 files changed, 1266 insertions(+), 56 deletions(-) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/.name create mode 100644 .idea/compiler.xml create mode 100644 .idea/deploymentTargetSelector.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/migrations.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/release/baselineProfiles/0/app-release.dm create mode 100644 app/release/baselineProfiles/1/app-release.dm create mode 100644 app/release/output-metadata.json create mode 100644 app/src/androidTest/java/com/mastercard/openbanking/connecttransfer/demo/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/mastercard/openbanking/connecttransfer/demo/ConsoleConnectAtomicEventHandler.java create mode 100644 app/src/main/java/com/mastercard/openbanking/connecttransfer/demo/MainActivity.java create mode 100644 app/src/main/res/drawable/bg.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/drawable/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/rounded_corner.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/values-night/themes.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/main/res/xml/backup_rules.xml create mode 100644 app/src/main/res/xml/data_extraction_rules.xml create mode 100644 app/src/test/java/com/mastercard/openbanking/connecttransfer/demo/ExampleUnitTest.java create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/libs.versions.toml create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4988b6e --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties +/connect-transfer-sdk diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..efbdf8e --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +ConnectTransfer \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..b589d56 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml new file mode 100644 index 0000000..b268ef3 --- /dev/null +++ b/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..32522c1 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/.idea/migrations.xml b/.idea/migrations.xml new file mode 100644 index 0000000..f8051a6 --- /dev/null +++ b/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..55c0ec2 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,9 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cda352e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,6 @@ +# Connect Transfer Android SDK Changelog + +### 1.0.0 (December 17, 2024) + +Initial Release: +- Connect Transfer Android SDK to support Payroll Deposit Switch. \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8bafa2a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 MasterCardOpenBanking + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 8398e05..25ad52f 100644 --- a/README.md +++ b/README.md @@ -1,93 +1,157 @@ # Connect Transfer Android SDK +## Using the Connect Transfer Android SDK -## Getting started +The Connect Transfer Android SDK is distributed as a compiled binary in Maven Central which allows you to easily integrate our SDK into your development projects. +Maven central is Android’s officially supported format for distributing binary libraries to multiple platforms and architectures in a single bundle. -To make it easy for you to get started with GitLab, here's a list of recommended next steps. +## Compatibility -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! +The Connect Android SDK supports the following Android versions. +* Android 7.0 (Lollipop) or later +* minSdkVersion 24 or later -## Add your files -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: +## Install the Connect Transfer Android SDK +Install the Connect Android SDK using Maven Central +Modify your root-level Gradle file (build.gradle) as follows: + +``` +allprojects { + repositories { { + google() + mavenCentral() + } +} ``` -cd existing_repo -git remote add origin https://gitlab.fini.city/connect/connect-transfer-android-sdk.git -git branch -M main -git push -uf origin main +Modify your app-level Gradle file (build.gradle) as follows: + ``` +android { + defaultConfig { + minSdkVersion 24 // or greater + } +} -## Integrate with your tools -- [ ] [Set up project integrations](https://gitlab.fini.city/connect/connect-transfer-android-sdk/-/settings/integrations) +dependencies { + // ... + implementation 'com.mastercard.openbanking.connect:connect-transfer-sdk:' +} +``` +Note: The latest version of the Connect Transfer Android SDK can be found in [Maven Central](https://central.sonatype.com/artifact/com.mastercard.openbanking.connect/connect-transfer-sdk) -## Collaborate with your team -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) +## Update Android application settings -## Test and Deploy +The Connect Android SDK requires internet access to connect with our servers, so you need to add internet permissions to the AndroidManifest.xml file: -Use the built-in continuous integration in GitLab. +``` + +``` -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) -*** -# Editing this README +## Integration -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. +**ConnectTransfer Class** -## Suggestions for a good README +The ConnectTransfer class contains a start method that when called, starts an activity with the supplied event listener. The SDK only allows a single instance of the ConnectTransfer activity to run. If you start ConnectTransfer while a ConnectTransfer activity is already running, a RuntimeException is thrown. -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. +The ConnectTransfer Android SDK’s main component is the ConnectTransfer class that contains a static start method, which runs an activity that connects with the ConnectTransferEventListener. -## Name -Choose a self-explaining name for your project. +To access the APIs in the SDK include the following imports: -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. +``` +import com.mastercard.openbanking.connect.transfer.ui.activity.ConnectTransfer; +import com.mastercard.openbanking.connect.transfer.events.ConnectTransferEventListener; +``` -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. +The ConnectTransfer.start() method launches the activity, requiring: -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. +* A valid Context. +* The Connect Transfer URL. +* An instance of ConnectTransferEventListener to handle SDK events. -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. +**Java:** + +``` +ConnectTransfer.start(context, url, new ConnectTransferEventListener() { + @Override + public void onInitializeConnectTransfer(JSONObject data) { + Log.d("ConnectTransfer", "onInitializeConnectTransfer: " + data.toString()); + } + + @Override + public void onTermsAndConditionsAccepted(JSONObject data) { + Log.d("ConnectTransfer", "onTermsAndConditionsAccepted: " + data.toString()); + } + + @Override + public void onLaunchTransferSwitch(JSONObject data) { + Log.d("ConnectTransfer", "onLaunchTransferSwitch: " + data.toString()); + } + + @Override + public void onTransferEnd(JSONObject data) { + Log.d("ConnectTransfer", "onTransferEnd: " + data.toString()); + } + + @Override + public void onUserEvent(JSONObject data) { + Log.d("ConnectTransfer", "onUserEvent: " + data.toString()); + } +}); +``` + +**Kotlin:** + +``` +ConnectTransfer.start(context, url, object : ConnectTransferEventListener { + override fun onInitializeConnectTransfer(data: JSONObject) { + Log.d("ConnectTransfer", "onInitializeConnectTransfer: ${data.toString()}") + } + + override fun onTermsAndConditionsAccepted(data: JSONObject) { + Log.d("ConnectTransfer", "onTermsAndConditionsAccepted: ${data.toString()}") + } + + override fun onLaunchTransferSwitch(data: JSONObject) { + Log.d("ConnectTransfer", "onLaunchTransferSwitch: ${data.toString()}") + } + + override fun onTransferEnd(data: JSONObject) { + Log.d("ConnectTransfer", "onTransferEnd: ${data.toString()}") + } + + override fun onUserEvent(data: JSONObject) { + Log.d("ConnectTransfer", "onUserEvent: ${data.toString()}") + } +}) +``` +Throughout Connect Transfer's flow events about the state of the application are sent as JSONObjects to the ConnectTransferEventListener methods. -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. +The onInitializeConnectTransfer, onTermsAndConditionsAccepted, onLaunchTransferSwitch, onTransferEnd, and onUserEvent callback functions will have a JSONObject parameter that contains data about the event. -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. +**Parameters** -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. +Java: -## Contributing -State if you are open to contributions and what your requirements are for accepting them. +`public static void start(Context context, String connectTransferUrl, ConnectTransferEventListener listener) +` -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. +Kotlin: -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. +`fun start(context: Context,connectTransferUrl: String, listener: ConnectTransferEventListener) +` -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. +**Details:** -## License -For open source projects, say how it is licensed. +| Parameter | Type | Description | +|:-----------|:---------|:-------------------------------| +| `context` | `Context` | The context from which the function is called, typically an Activity or Fragment context. | +| `connectTransferUrl` | `String` | The Connect Transfer URL required to initiate the ConnectTransfer flow. | +| `listener` | `ConnectTransferEventListener`| An instance of ConnectTransferEventListener to receive callbacks for various events, such as when the transfer is initialized, terms are accepted, and the transfer is completed. | -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..7047842 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,45 @@ +//plugins { +// alias(libs.plugins.android.application) +//} +apply plugin: 'com.android.application' + + +android { + namespace 'com.mastercard.openbanking.connecttransfer.demo' + compileSdk 34 + + defaultConfig { + applicationId "com.mastercard.openbanking.connecttransfer.demo" + minSdk 24 + targetSdk 34 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation libs.appcompat + implementation libs.material + implementation libs.activity + implementation libs.constraintlayout + testImplementation libs.junit + androidTestImplementation libs.ext.junit + androidTestImplementation libs.espresso.core + + implementation 'com.mastercard.openbanking.connect:connect-transfer-sdk:1.0.0' + +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/release/baselineProfiles/0/app-release.dm b/app/release/baselineProfiles/0/app-release.dm new file mode 100644 index 0000000000000000000000000000000000000000..5fe98e6ac59ba17c5dee24ff3c9ae171a92dfd5d GIT binary patch literal 3940 zcmb7HXHXN`whq!f(o_T~3MvZHdky7?2cm|epai4@q}KqU*Mo?Nlu)GzLAsOx0Vx8Z zN+P|NfDn2O5JHLci!=AW>%BAY&Ahc|&062A@?)(%v-kHDOignQaPi_rz^tjW5#Tpr zJojDQ?VT;$eZ^eeVK!8^m# z3;+Nw5CFIUSlti7Ub+bY40Qki3;;_f3pm^wE@oxzgDI@a-nsz*d?o+@jQ@A-P(hGk@j)=D`*jU&TzmG;QRV`vH=fk_HSpr$+W<{h?d z+nQd|6CDM$3fg^Sdan0zh6$owTfZ|FYRM(o`3*X1Q;S+jp@(noS#OyV^4=1%f(&vh z>irbB*eIP~_Ob>A|Fy2ZFv=OT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2 ztB@hScs7$e6k*gg!tMWk`7<1`quZADIG3F&U$$8Ynj0U?xhfC*q*P&?F=!klBEA_zYEm=?fm`LU#$IY7f#aOJK+X8 S45xpUPn|5^lRbg;SN0E#t8k$J literal 0 HcmV?d00001 diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json new file mode 100644 index 0000000..a93757e --- /dev/null +++ b/app/release/output-metadata.json @@ -0,0 +1,37 @@ +{ + "version": 3, + "artifactType": { + "type": "APK", + "kind": "Directory" + }, + "applicationId": "com.mastercard.openbanking.connecttransfer.demo", + "variantName": "release", + "elements": [ + { + "type": "SINGLE", + "filters": [], + "attributes": [], + "versionCode": 3, + "versionName": "1.3", + "outputFile": "app-release.apk" + } + ], + "elementType": "File", + "baselineProfiles": [ + { + "minApi": 28, + "maxApi": 30, + "baselineProfiles": [ + "baselineProfiles/1/app-release.dm" + ] + }, + { + "minApi": 31, + "maxApi": 2147483647, + "baselineProfiles": [ + "baselineProfiles/0/app-release.dm" + ] + } + ], + "minSdkVersionForDexing": 24 +} \ No newline at end of file diff --git a/app/src/androidTest/java/com/mastercard/openbanking/connecttransfer/demo/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/mastercard/openbanking/connecttransfer/demo/ExampleInstrumentedTest.java new file mode 100644 index 0000000..8e9f861 --- /dev/null +++ b/app/src/androidTest/java/com/mastercard/openbanking/connecttransfer/demo/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.mastercard.openbanking.connecttransfer.demo; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.mastercard.openbanking.connecttransfer.demo", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..800ed68 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/mastercard/openbanking/connecttransfer/demo/ConsoleConnectAtomicEventHandler.java b/app/src/main/java/com/mastercard/openbanking/connecttransfer/demo/ConsoleConnectAtomicEventHandler.java new file mode 100644 index 0000000..fbb962b --- /dev/null +++ b/app/src/main/java/com/mastercard/openbanking/connecttransfer/demo/ConsoleConnectAtomicEventHandler.java @@ -0,0 +1,54 @@ +package com.mastercard.openbanking.connecttransfer.demo; + +import android.util.Log; + +import com.mastercard.openbanking.connect.transfer.events.ConnectTransferEventListener; + +import org.json.JSONException; +import org.json.JSONObject; + +public class ConsoleConnectAtomicEventHandler implements ConnectTransferEventListener { + private static final String TAG = "ConsoleEventHandler"; + + @Override + public void onInitializeConnectTransfer(JSONObject data) { + logJsonEvent("onInitializeConnectTransfer", data); + } + + @Override + public void onTermsAndConditionsAccepted(JSONObject data) { + logJsonEvent("onTermsAndConditionsAccepted", data); + } + + @Override + public void onLaunchTransferSwitch(JSONObject data) { + logJsonEvent("onLaunchTransferSwitch", data); + } + + @Override + public void onTransferEnd(JSONObject data) { + logJsonEvent("onTransferEnd", data); + } + + @Override + public void onUserEvent(JSONObject data) { + logJsonEvent("onUserEvent", data); + } + + private void logJsonEvent(String eventName, JSONObject data) { + if (data == null) { + Log.i(TAG, ">>> ConsoleEventHandler: Received " + eventName + " event: No data received"); + return; + } + + String jsonString; + try { + jsonString = data.toString(4); // Pretty print with an indentation of 4 spaces + } catch (JSONException e) { + jsonString = data.toString(); // Fallback to unformatted JSON if an exception occurs + Log.e(TAG, "Failed to format JSON data: " + e.getMessage()); + } + + Log.i(TAG, ">>> ConsoleEventHandler: Received " + eventName + " event:\n>>>>>> " + jsonString); + } +} diff --git a/app/src/main/java/com/mastercard/openbanking/connecttransfer/demo/MainActivity.java b/app/src/main/java/com/mastercard/openbanking/connecttransfer/demo/MainActivity.java new file mode 100644 index 0000000..edf1705 --- /dev/null +++ b/app/src/main/java/com/mastercard/openbanking/connecttransfer/demo/MainActivity.java @@ -0,0 +1,64 @@ +package com.mastercard.openbanking.connecttransfer.demo; + + +import android.os.Bundle; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.appcompat.app.AppCompatActivity; + +import com.mastercard.openbanking.connect.transfer.ui.activity.ConnectTransfer; + + + +public class MainActivity extends AppCompatActivity { + private static final String TAG = "MainActivity"; + private EditText mEditConnectUrl; + + private TextView textViewTitle; + private EditText editConnectUrl; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + // Add click listener for EventListener + Button mStartButtonEventHandler = findViewById(R.id.startButtonEventHandler); + + mStartButtonEventHandler.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + launchActivity(new ConsoleConnectAtomicEventHandler()); + } + }); + + this.mEditConnectUrl = findViewById(R.id.editConnectUrl); + + textViewTitle = findViewById(R.id.textView); + editConnectUrl = findViewById(R.id.editConnectUrl); + } + + private void launchActivity(ConsoleConnectAtomicEventHandler eventHandler) { + String url = getEditConnectUrl(); + + if (url.length() > 0) { + // Null out text so we can repeat with new link after Connect Activity closes. + mEditConnectUrl.setText(""); + + Log.i(TAG, ">>> Launching Connect activity"); + + ConnectTransfer.start(this, url, new ConsoleConnectAtomicEventHandler()); + + } + } + + private String getEditConnectUrl() { + String rawUrl = this.mEditConnectUrl.getText().toString(); + return rawUrl.replace("localhost:", "10.0.2.2:"); + } +} diff --git a/app/src/main/res/drawable/bg.xml b/app/src/main/res/drawable/bg.xml new file mode 100644 index 0000000..ecc06bd --- /dev/null +++ b/app/src/main/res/drawable/bg.xml @@ -0,0 +1,12 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/rounded_corner.xml b/app/src/main/res/drawable/rounded_corner.xml new file mode 100644 index 0000000..99b4165 --- /dev/null +++ b/app/src/main/res/drawable/rounded_corner.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..807aedc --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,78 @@ + + + + + + + + + + +