Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fa57d3d
EXAMPLEAND-72 Migrate to RxJava3 (WIP)
Mar 6, 2020
beec1c9
Prepare next development version
Mar 25, 2020
cd543e9
bump min sdk version to 21 (the same as in the onegini sdk)
marcin-onegini Mar 30, 2020
71ddbbe
EXAMPLEAND-73 Add missing errors cases in switch statements
aleknow Apr 9, 2020
712e722
Merge pull request #176 from Onegini/EXAMPLEAND-73
marcin-onegini Apr 10, 2020
198627c
EXAMPLEAND-74 Update gradle plugin and build tools
May 5, 2020
dd47071
Merge pull request #177 from Onegini/EXAMPLEAND-74
marcin-onegini May 5, 2020
51d0ac1
SDKAND-1091 update retrofit adapter
marcin-onegini May 6, 2020
fa6e464
SDKAND-1153 update retrofit
marcin-onegini Jun 9, 2020
51dba06
Merge pull request #178 from Onegini/SDKAND-1153
marcin-onegini Jun 9, 2020
d7906b7
Merge remote-tracking branch 'origin/develop' into EXAMPLEAND-72
Jul 31, 2020
55f3617
EXAMPLEAND-72 Update RxJava adapter
Jul 31, 2020
ddc57ca
Merge pull request #179 from Onegini/EXAMPLEAND-72
marcin-onegini Aug 3, 2020
0eea38b
Update build.gradle
Oct 15, 2020
d5ce693
Merge pull request #180 from Onegini/SDKAND-1207
marcin-onegini Oct 23, 2020
4b1f0ae
SDKAND-1241 update rxjava
marcin-onegini Dec 31, 2020
13a6f78
Merge pull request #182 from Onegini/SDKAND-1241
marcin-onegini Dec 31, 2020
02cf14f
EXAMPLEAND-76 update dependencies
marcin-onegini Jan 18, 2021
dbb7ffb
Merge pull request #183 from Onegini/EXAMPLEAND-76
Jan 22, 2021
c7db74f
Merge remote-tracking branch 'origin' into develop
Jan 25, 2021
59f6ed9
Prepare 7.0.0 release
Jan 25, 2021
e8b5aa7
Prepare 7.0.0 release
Jan 28, 2021
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
46 changes: 18 additions & 28 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ allprojects {
}

android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
compileSdkVersion 30
buildToolsVersion '30.0.2'

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -54,10 +54,10 @@ android {

defaultConfig {
applicationId "com.onegini.mobile.exampleapp"
minSdkVersion 19
targetSdkVersion 29
versionCode 19
versionName "6.1.0"
minSdkVersion 23
targetSdkVersion 30
versionCode 20
versionName "7.0.0"
multiDexEnabled true
}
buildTypes {
Expand All @@ -79,45 +79,35 @@ android {

dependencies {
// Onegini SDK
api('com.onegini.mobile.sdk.android:onegini-sdk:10.2.2@aar') {
api('com.onegini.mobile.sdk.android:onegini-sdk:11.0.0@aar') {
transitive = true
}

// Rest Client
implementation 'com.squareup.retrofit2:adapter-rxjava:2.6.4'
implementation 'com.squareup.retrofit2:adapter-rxjava3:2.9.0'

// Google Support
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.legacy:legacy-support-core-ui:1.0.0'
implementation 'androidx.media:media:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//Bottom navigation bar
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'

// QR code reader
implementation 'com.google.android.gms:play-services-vision:19.0.0'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
// Google Play Services availability check
implementation 'com.google.android.gms:play-services-base:17.1.0'
implementation 'com.google.android.gms:play-services-base:17.5.0'
//Firebase Cloud Messaging (FCM)
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.google.firebase:firebase-messaging:21.0.1'
// Support for multidex
implementation 'androidx.multidex:multidex:2.0.1'
// DI for views
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
// RxJava
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.17'
}

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == "com.android.support" && !requested.name.startsWith("multidex")) {
details.useVersion "27.+"
}
}
implementation 'io.reactivex.rxjava3:rxjava:3.0.9'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
}

//according to google documentation, this plugin has to be applied at the end of the file
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
android:screenOrientation="portrait"/>

<service android:name=".network.fcm.FCMListenerService"
android:stopWithTask="false">
android:stopWithTask="false"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
Expand All @@ -166,4 +167,4 @@

</application>

</manifest>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Onegini B.V.
* Copyright (c) 2016-2021 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,10 +25,11 @@ public class OneginiConfigModel implements OneginiClientConfigModel {
private final String appIdentifier = "ExampleApp";
private final String appPlatform = "android";
private final String redirectionUri = "oneginiexample://loginsuccess";
private final String appVersion = "6.1.0";
private final String appVersion = "7.0.0";
private final String baseURL = "https://demo-msp.onegini.com";
private final String resourceBaseURL = "https://demo-msp.onegini.com/resources/";
private final String keystoreHash = "b243b00e336e0b8f0c212779e0a276a382768a99706e452098ab0f3f77e8f616";
private final String keystoreHash = "b76a556a9b19645ef4b1f9dbb620ca5aa98a25d50bea4af06381604f70e48b9b";
private final String serverPublicKey = "7BE84689A28B993F917C47EBE74A089C8C9A7B8F8898D43C9AD9A8D7E8B16298";

@Override
public String getAppIdentifier() {
Expand Down Expand Up @@ -75,6 +76,11 @@ public String getDeviceName() {
return Build.BRAND + " " + Build.MODEL;
}

@Override
public String getServerPublicKey() {
return serverPublicKey;
}

@Override
public String toString() {
return "ConfigModel{" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Onegini B.V.
* Copyright (c) 2016-2020 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,9 +20,9 @@
import com.onegini.mobile.exampleapp.model.ApplicationDetails;
import com.onegini.mobile.exampleapp.network.client.AnonymousClient;
import com.onegini.mobile.exampleapp.network.client.SecureResourceClient;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers;

public class AnonymousService {

Expand All @@ -46,4 +46,4 @@ public Single<ApplicationDetails> getApplicationDetails() {
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Onegini B.V.
* Copyright (c) 2016-2020 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,9 +20,9 @@
import com.onegini.mobile.exampleapp.model.ImplicitUserDetails;
import com.onegini.mobile.exampleapp.network.client.ImplicitUserClient;
import com.onegini.mobile.exampleapp.network.client.SecureResourceClient;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers;

public class ImplicitUserService {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Onegini B.V.
* Copyright (c) 2016-2020 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,9 +20,9 @@
import com.onegini.mobile.exampleapp.network.client.SecureResourceClient;
import com.onegini.mobile.exampleapp.network.client.UserClient;
import com.onegini.mobile.exampleapp.network.response.DevicesResponse;
import io.reactivex.Single;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.schedulers.Schedulers;

public class UserService {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Onegini B.V.
* Copyright (c) 2016-2020 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@
package com.onegini.mobile.exampleapp.network.client;

import com.onegini.mobile.exampleapp.model.ApplicationDetails;
import io.reactivex.Single;
import io.reactivex.rxjava3.core.Single;
import retrofit2.http.GET;

public interface AnonymousClient {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Onegini B.V.
* Copyright (c) 2016-2020 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@
package com.onegini.mobile.exampleapp.network.client;

import com.onegini.mobile.exampleapp.model.ImplicitUserDetails;
import io.reactivex.Single;
import io.reactivex.rxjava3.core.Single;
import retrofit2.http.GET;

public interface ImplicitUserClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import com.onegini.mobile.sdk.android.client.OneginiClient;
import okhttp3.OkHttpClient;
import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class SecureResourceClient {
Expand Down Expand Up @@ -50,9 +50,9 @@ private static <T> T prepareSecuredRetrofitClient(final Class<T> clazz, final Co
.client(okHttpClient)
.baseUrl(oneginiClient.getConfigModel().getResourceBaseUrl())
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addCallAdapterFactory(RxJava3CallAdapterFactory.create())
.build();

return retrofit.create(clazz);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Onegini B.V.
* Copyright (c) 2016-2020 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,7 +17,7 @@
package com.onegini.mobile.exampleapp.network.client;

import com.onegini.mobile.exampleapp.network.response.DevicesResponse;
import io.reactivex.Single;
import io.reactivex.rxjava3.core.Single;
import retrofit2.http.GET;

public interface UserClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
import android.content.Context;
import android.util.Log;
import com.google.firebase.FirebaseApp;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.messaging.FirebaseMessaging;
import com.onegini.mobile.exampleapp.OneginiSDK;
import com.onegini.mobile.exampleapp.R;
import com.onegini.mobile.exampleapp.storage.FCMStorage;
import com.onegini.mobile.sdk.android.client.UserClient;
import com.onegini.mobile.sdk.android.handlers.OneginiMobileAuthWithPushEnrollmentHandler;
Expand All @@ -43,14 +42,9 @@ public FCMRegistrationService(final Context context) {

public void enrollForPush(final PushEnrollmentHandler enrollmentHandler) {
FirebaseApp.initializeApp(context);
FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(instanceIdResult -> {
final String fcmRefreshToken = instanceIdResult.getToken();
if (fcmRefreshToken.isEmpty()) {
enrollmentHandler.onError(new Exception(context.getString(R.string.push_token_is_null_error_message)));
} else {
enrollUserForMobileAuthWithPush(enrollmentHandler, fcmRefreshToken);
}
}).addOnFailureListener(enrollmentHandler::onError);
FirebaseMessaging.getInstance().getToken()
.addOnSuccessListener(token -> enrollUserForMobileAuthWithPush(enrollmentHandler, token))
.addOnFailureListener(enrollmentHandler::onError);
}

private void enrollUserForMobileAuthWithPush(final PushEnrollmentHandler enrollmentHandler, final String fcmRefreshToken) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018 Onegini B.V.
* Copyright (c) 2016-2020 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -34,7 +34,7 @@
import com.onegini.mobile.exampleapp.model.Device;
import com.onegini.mobile.exampleapp.network.UserService;
import com.onegini.mobile.exampleapp.network.response.DevicesResponse;
import io.reactivex.disposables.Disposable;
import io.reactivex.rxjava3.disposables.Disposable;

public class DevicesListActivity extends AppCompatActivity {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (c) 2016-2020 Onegini B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.onegini.mobile.exampleapp.view.activity;

import static com.onegini.mobile.exampleapp.view.helper.ErrorMessageParser.parseErrorMessage;
Expand Down Expand Up @@ -29,7 +45,7 @@
import com.onegini.mobile.sdk.android.handlers.error.OneginiError;
import com.onegini.mobile.sdk.android.handlers.error.OneginiImplicitTokenRequestError;
import com.onegini.mobile.sdk.android.model.entity.UserProfile;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.rxjava3.disposables.CompositeDisposable;

public class InfoActivity extends AppCompatActivity {

Expand Down
Loading