Skip to content

Commit c15ac40

Browse files
authored
Merge pull request #21 from getyoti/YM-23299
[YM-23299] - Allowing theme to be applied to the YotiSDKButton
2 parents 220952c + f71c3db commit c15ac40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1137
-171
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [1.3.0] - 2021-07-20
5+
### Added
6+
- Added attribute buttonTheme to the YotiSDKButton for applying the theme.
7+
- Added OnAppNotInstalledListener for listening to app not installed status.
8+
9+
### Changed
10+
- Deprecated the OnYotiAppNotInstalledListener
11+
412
## [1.2.0] - 2020-03-26
513
### Changed
614
Move some SDK configuration to gradle. This allows for creating skinned SDKs with different backends,

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,18 @@ android:id="@+id/my_id"
7575
android:layout_height="wrap_content"
7676
android:layout_width="wrap_content"
7777
android:text="My Yoti Button"
78-
yoti:useCaseId="YOUR_USE_CASE_ID"/>
78+
yoti:useCaseId="YOUR_USE_CASE_ID"
79+
yoti:buttonTheme="<Theme_Yoti | Theme_EasyId | Theme_Partnership>"/>
7980
```
81+
82+
In case ```yoti:buttonTheme``` is not provided, then ```Theme_Partnership``` is considered as a default theme.
83+
84+
When the theme is applied as ```Theme_Yoti``` or ```Theme_Partnership```
85+
* User can share attribute either through Yoti or EasyId app
86+
87+
When the theme is applied as ```Theme_EasyId```
88+
* User can share attribute only through EasyId app
89+
8090
[See this code in one of our sample apps](./sample-app/src/main/res/layout/activity_main.xml)
8191

8292
Alternatively, you can set the button's useCaseId with:
@@ -198,7 +208,7 @@ yotiSDKButton.setOnYotiButtonListener(new YotiSDKButton.OnYotiButtonClickListene
198208
There is also a listener that you can set to be notified when the intent has been sent to the Yoti app.
199209
When this happens you would probably want to restore your state.
200210

201-
211+
Attention: This listener is now deprecated.
202212
```java
203213
yotiSDKButton.setOnYotiCalledListener(new YotiSDKButton.OnYotiCalledListener() {
204214
@Override
@@ -207,6 +217,16 @@ When this happens you would probably want to restore your state.
207217
}
208218
});
209219
```
220+
Please use the below listener to get notified when the intent has been sent to app based on the specified theme:
221+
```java
222+
yotiSDKButton.setOnAppCalledListener(new YotiSDKButton.OnAppCalledListener() {
223+
@Override
224+
public void onAppCalled() {
225+
// Restore the original state
226+
}
227+
});
228+
```
229+
210230
[See this code in one of our sample apps](./sample-app/src/main/java/com/yoti/mobile/android/sdk/sampleapp/MainActivity.java)
211231

212232
You can activate a verbose mode for the SDK by using this method :
@@ -218,6 +238,7 @@ If the Yoti app is not installed in the user's phone by default the SDK will sen
218238
open a website that invites the user to download the Yoti app.
219239
Alternatively, an error listener can be set up so you can deal with this situation by yourself.
220240

241+
Attention: This listener is now deprecated.
221242
```java
222243
yotiSDKButton.setOnYotiAppNotInstalledListener(new YotiSDKButton.OnYotiAppNotInstalledListener() {
223244
@Override
@@ -226,6 +247,17 @@ Alternatively, an error listener can be set up so you can deal with this situati
226247
}
227248
});
228249
```
250+
Please use the below listener to determine whether the Yoti/EasyId app is not installed:
251+
```java
252+
mYotiSDKButton.setOnAppNotInstalledListener(new OnAppNotInstalledListener() {
253+
@Override
254+
public void onAppNotInstalled(final YotiSDKAppNotInstalledException cause, final String appURL) {
255+
// The exception will provide info on which app is not installed
256+
// appURL is the app's play store URL, launch the browser intent to allow user to download the app and proceed
257+
}
258+
});
259+
```
260+
[See this code in one of our sample apps](./sample-app/src/main/java/com/yoti/mobile/android/sdk/sampleapp/MainActivity.java)
229261

230262
## Running the Example
231263

gradle.properties

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
#org.gradle.daemon=true
2222

2323

24-
minSdkVersionVersion=15
24+
minSdkVersionVersion=21
2525
targetSdkVersion=28
2626
compileSdkVersion=28
2727

28-
yotiCommonUIVersion=0.0.5
28+
uiWidgetsVersion=1.9.0
2929
supportLibraryVersion=1.0.2
3030

3131
libJunitVersion=4.12
@@ -35,17 +35,30 @@ currentAppName=Mobile Button SDK
3535

3636
#Environment
3737
yotiAppPackage=com.yoti.mobile.android.live
38+
easyIdAppPackage=com.postofficeid.mobile.android.live
3839
yotiAppMinVersion=1622
3940
yotiBackendUrl=https://api.yoti.com
4041
yotiBackendPort=443
4142

43+
#app url
44+
yotiAppUrl=https://play.google.com/store/apps/details?id=com.yoti.mobile.android.live
45+
easyIdAppUrl=https://play.google.com/store/apps/details?id=com.postofficeid.mobile.android.live
46+
partnershipAppUrl=https://code.yoti.com/
47+
48+
#deeplink host url
49+
appHostUrl=code.yoti.com
50+
51+
#app scheme
52+
yotiAppScheme=yoti://
53+
easyIDScheme=easyid://
54+
4255
# Publication
4356
pomId=yoti-button-sdk
4457
pomGroup=com.yoti.mobile.android.sdk
4558
pomPackaging=aar
46-
pomVersion=1.2.1
59+
pomVersion=1.3.0
4760
pomDescription=Button SDK that allows 3rd party to trigger Yoti as support app
48-
currentVersionCode=000009
61+
currentVersionCode=000010
4962

5063
pomLicenseName=MIT
5164
pomLicenseUrl=https://github.com/getyoti/android-sdk-button/blob/master/LICENSE.md

sample-app-2/build.gradle

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,16 @@ android {
2121
}
2222
}
2323

24+
compileOptions {
25+
sourceCompatibility JavaVersion.VERSION_1_8
26+
targetCompatibility JavaVersion.VERSION_1_8
27+
}
2428
}
2529

2630
dependencies {
2731
implementation fileTree(dir: 'libs', include: ['*.jar'])
2832
implementation parent.ext.libAndroidSupport
29-
testImplementation 'junit:junit:4.12'
30-
implementation("com.yoti.mobile.android.sdk:yoti-button-sdk:1.1.0")
33+
//implementation("com.yoti.mobile.android.sdk:yoti-button-sdk:1.1.0")
34+
implementation project(path: ':yoti-sdk')
3135
implementation 'com.google.code.gson:gson:2.8.5'
3236
}

sample-app-2/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
<activity
1717
android:name="com.yoti.mobile.android.sampleapp2.MainActivity"
18-
android:launchMode="singleInstance">
18+
android:launchMode="singleInstance"
19+
android:theme="@style/SampleAppFullScreenTheme">
1920
<intent-filter>
2021
<action android:name="android.intent.action.MAIN" />
2122

sample-app-2/src/main/java/com/yoti/mobile/android/sampleapp2/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected void onCreate(Bundle savedInstanceState) {
3333

3434
processExtraData(getIntent());
3535

36-
yotiSDKButton.setOnYotiScenarioListener(new YotiSDKButton.OnYotiButtonClickListener() {
36+
yotiSDKButton.setOnYotiButtonClickListener(new YotiSDKButton.OnYotiButtonClickListener() {
3737
@Override
3838
public void onStartScenario() {
3939
yotiSDKButton.setVisibility(View.GONE);

sample-app-2/src/main/res/layout/activity_main.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
android:layout_centerVertical="true"
1616
android:layout_centerInParent="true"
1717
android:gravity="center"
18-
android:text=" Use Yoti"
1918
yoti:useCaseId="yoti_btn_1" />
2019

2120
<TextView
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<resources>
2+
3+
<style name="SampleAppFullScreenTheme" parent="AppTheme">
4+
<item name="android:background">@android:color/black</item>
5+
</style>
6+
7+
</resources>
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
4+
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
55
<!-- Customize your theme here. -->
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
88
<item name="colorAccent">@color/colorAccent</item>
99
</style>
1010

11+
<style name="SampleAppFullScreenTheme" parent="AppTheme">
12+
<item name="android:background">@android:color/white</item>
13+
</style>
14+
1115
</resources>

sample-app-3/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ android {
1111
versionName "1.0"
1212
}
1313

14+
compileOptions {
15+
sourceCompatibility JavaVersion.VERSION_1_8
16+
targetCompatibility JavaVersion.VERSION_1_8
17+
}
18+
1419
signingConfigs {
1520
debug {
1621
storeFile file('debug.keystore')

0 commit comments

Comments
 (0)