Commit 0794b371 authored by Claudio Marforio's avatar Claudio Marforio
Browse files

Version 1.1.0

- Security-related enhancements (sdk-to-backend communication)
- Update sample app
- Update version of futuarekit.aar to 1.1.0
parent 2af22458
...@@ -48,7 +48,7 @@ dependencies { ...@@ -48,7 +48,7 @@ dependencies {
implementation 'com.google.firebase:firebase-core:16.0.7' implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-messaging:17.4.0' implementation 'com.google.firebase:firebase-messaging:17.4.0'
implementation('com.futurae.sdk:futuraekit:1.0.0') implementation('com.futurae.sdk:futuraekit:1.1.0')
} }
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
...@@ -96,17 +96,17 @@ public class MainActivity extends AppCompatActivity { ...@@ -96,17 +96,17 @@ public class MainActivity extends AppCompatActivity {
String userId = FuturaeClient.getUserIdFromUri(uriCall); String userId = FuturaeClient.getUserIdFromUri(uriCall);
String sessionToken = FuturaeClient.getSessionTokenFromUri(uriCall); String sessionToken = FuturaeClient.getSessionTokenFromUri(uriCall);
FuturaeClient.sharedClient().sessionInfoByToken(userId, sessionToken, FuturaeClient.sharedClient().sessionInfoByToken(userId, sessionToken,
new FuturaeResultCallback<SessionInfo>() { new FuturaeResultCallback<SessionInfo>() {
@Override @Override
public void success(SessionInfo sessionInfo) { public void success(SessionInfo sessionInfo) {
showApproveAlertDialog(new ApproveSession(sessionInfo), true); showApproveAlertDialog(new ApproveSession(sessionInfo), true);
} }
@Override @Override
public void failure(Throwable t) { public void failure(Throwable t) {
Log.e(TAG, "QR Code authentication failed: " + t.getLocalizedMessage()); Log.e(TAG, "QR Code authentication failed: " + t.getLocalizedMessage());
} }
}); });
return; return;
} }
...@@ -177,19 +177,19 @@ public class MainActivity extends AppCompatActivity { ...@@ -177,19 +177,19 @@ public class MainActivity extends AppCompatActivity {
Barcode qrcode = data.getParcelableExtra(FTRQRCodeActivity.PARAM_BARCODE); Barcode qrcode = data.getParcelableExtra(FTRQRCodeActivity.PARAM_BARCODE);
Log.i(TAG, "Scanned activation code from the QR code; will enroll device"); Log.i(TAG, "Scanned activation code from the QR code; will enroll device");
FuturaeClient.sharedClient().enroll(qrcode.rawValue, FuturaeClient.sharedClient().enroll(qrcode.rawValue,
new FuturaeCallback() { new FuturaeCallback() {
@Override @Override
public void success() { public void success() {
Log.i(TAG, "Enrollment successful"); Log.i(TAG, "Enrollment successful");
showAlert("Success", "Enrollment successful"); showAlert("Success", "Enrollment successful");
} }
@Override @Override
public void failure(Throwable throwable) { public void failure(Throwable throwable) {
Log.e(TAG, "Enrollment failed: " + throwable.getLocalizedMessage()); Log.e(TAG, "Enrollment failed: " + throwable.getLocalizedMessage());
showAlert("Error", "Enrollment failed"); showAlert("Error", "Enrollment failed");
} }
}); });
} }
private void onAuthQRCodeScanned(Intent data) { private void onAuthQRCodeScanned(Intent data) {
...@@ -198,17 +198,17 @@ public class MainActivity extends AppCompatActivity { ...@@ -198,17 +198,17 @@ public class MainActivity extends AppCompatActivity {
String sessionToken = FuturaeClient.getSessionTokenFromQrcode(qrcode.rawValue); String sessionToken = FuturaeClient.getSessionTokenFromQrcode(qrcode.rawValue);
FuturaeClient.sharedClient().sessionInfoByToken(userId, sessionToken, FuturaeClient.sharedClient().sessionInfoByToken(userId, sessionToken,
new FuturaeResultCallback<SessionInfo>() { new FuturaeResultCallback<SessionInfo>() {
@Override @Override
public void success(SessionInfo sessionInfo) { public void success(SessionInfo sessionInfo) {
showApproveAlertDialog(new ApproveSession(sessionInfo), false); showApproveAlertDialog(new ApproveSession(sessionInfo), false);
} }
@Override @Override
public void failure(Throwable t) { public void failure(Throwable t) {
Log.e(TAG, "QR Code authentication failed: " + t.getLocalizedMessage()); Log.e(TAG, "QR Code authentication failed: " + t.getLocalizedMessage());
} }
}); });
} }
// Approve dialog // Approve dialog
...@@ -329,7 +329,8 @@ public class MainActivity extends AppCompatActivity { ...@@ -329,7 +329,8 @@ public class MainActivity extends AppCompatActivity {
Log.d(TAG, NotificationUtils.INTENT_ACCOUNT_UNENROLL_MESSAGE); Log.d(TAG, NotificationUtils.INTENT_ACCOUNT_UNENROLL_MESSAGE);
String userId = intent.getStringExtra(NotificationUtils.PARAM_USER_ID); String userId = intent.getStringExtra(NotificationUtils.PARAM_USER_ID);
Log.i(TAG, "Received logout and deleted account: " + userId); String deviceId = intent.getStringExtra(NotificationUtils.PARAM_DEVICE_ID);
Log.i(TAG, "Received logout and deleted account: " + userId + " for device ID: " + deviceId);
break; break;
case NotificationUtils.INTENT_APPROVE_AUTH_MESSAGE: case NotificationUtils.INTENT_APPROVE_AUTH_MESSAGE:
...@@ -352,7 +353,7 @@ public class MainActivity extends AppCompatActivity { ...@@ -352,7 +353,7 @@ public class MainActivity extends AppCompatActivity {
case NotificationUtils.INTENT_APPROVE_CANCEL_MESSAGE: case NotificationUtils.INTENT_APPROVE_CANCEL_MESSAGE:
if (approveDialog != null && approveDialog.isShowing()) { if (approveDialog != null && approveDialog.isShowing()) {
approveDialog.dismiss(); approveDialog.dismiss();
} }
break; break;
......
...@@ -50,7 +50,7 @@ repositories { ...@@ -50,7 +50,7 @@ repositories {
} }
dependencies { dependencies {
implementation('com.futurae.sdk:futuraekit:1.0.0') implementation('com.futurae.sdk:futuraekit:1.1.0')
} }
``` ```
...@@ -63,11 +63,11 @@ This repository also contains a simple demo app to show how the SDK can be integ ...@@ -63,11 +63,11 @@ This repository also contains a simple demo app to show how the SDK can be integ
To integrate the FuturaeKit SDK into your project, copy `futuraekit.aar` into the `src/main/libs` folder of your app. To integrate the FuturaeKit SDK into your project, copy `futuraekit.aar` into the `src/main/libs` folder of your app.
Then, in your modules `build.gradle` (the one under "app"), add the following dependencies: Then, in your modules `build.gradle` (the one under "app"), add the following dependencies:
``` ```
implementation 'com.squareup.retrofit2:retrofit:2.3.0' implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-moshi:2.3.0' implementation 'com.squareup.retrofit2:converter-moshi:2.4.0'
implementation 'com.squareup.moshi:moshi-adapters:1.4.0' implementation 'com.squareup.moshi:moshi-adapters:1.6.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.0' implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0' implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.github.nisrulz:easydeviceinfo-base:2.4.1' implementation 'com.github.nisrulz:easydeviceinfo-base:2.4.1'
implementation files('src/main/libs/futuraekit.aar') implementation files('src/main/libs/futuraekit.aar')
``` ```
...@@ -328,9 +328,10 @@ FuturaeClient.sharedClient().logout(userId, new FuturaeCallback() { ...@@ -328,9 +328,10 @@ FuturaeClient.sharedClient().logout(userId, new FuturaeCallback() {
Typically this should happen either when the user removes the account manually from the app, or when a user has been logged out remotely by the server. In the former case, calling the `logout()` method is enough, as it notifies the server of the logout and deletes the account from the SDK too. In the latter case, the server will send a FCM notification to the app, and the default handler of the notification will delete the account from the SDK as well. In this case, the notification handler will also send a local broadcast to the app (see `INTENT_ACCOUNT_UNENROLL_MESSAGE` [above](#local-intents), so that the app can also perform any further action required (e.g. refresh the list of active accounts in an account view). Typically this should happen either when the user removes the account manually from the app, or when a user has been logged out remotely by the server. In the former case, calling the `logout()` method is enough, as it notifies the server of the logout and deletes the account from the SDK too. In the latter case, the server will send a FCM notification to the app, and the default handler of the notification will delete the account from the SDK as well. In this case, the notification handler will also send a local broadcast to the app (see `INTENT_ACCOUNT_UNENROLL_MESSAGE` [above](#local-intents), so that the app can also perform any further action required (e.g. refresh the list of active accounts in an account view).
The intent contains the User ID as an extra: The intent contains the User ID, as well as the Device ID, as an extra:
```java ```java
String userId = intent.getStringExtra(FTRUnenrollNotification.PARAM_USER_ID); String userId = intent.getStringExtra(NotificationUtils.PARAM_USER_ID);
String deviceId = intent.getStringExtra(NotificationUtils.PARAM_DEVICE_ID);
``` ```
### <a id="account-status" />Account Status ### <a id="account-status" />Account Status
......
No preview for this file type
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment