Bump to SSO 1.3.0

To test:
add
FilesAppTypeRegistry.getInstance().init(new FilesAppType("com.nextcloud.cloud.android.client", "com.nextcloud.cloud", FilesAppType.Type.PROD));

in onCreate()

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2024-07-30 08:29:41 +02:00
parent 3015281e2f
commit 8b408434f0
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
4 changed files with 28 additions and 8 deletions

View file

@ -97,7 +97,7 @@ dependencies {
// Nextcloud SSO
implementation 'com.github.nextcloud.android-common:ui:0.22.0'
implementation 'com.github.nextcloud:Android-SingleSignOn:1.2.0'
implementation 'com.github.nextcloud:Android-SingleSignOn:1.3.0'
implementation 'com.github.stefan-niedermann:android-commons:1.0.0'
implementation "com.github.stefan-niedermann.nextcloud-commons:sso-glide:$commonsVersion"
implementation "com.github.stefan-niedermann.nextcloud-commons:exception:$commonsVersion"

View file

@ -19,7 +19,6 @@ import android.util.Log;
import android.webkit.WebView;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.preference.PreferenceManager;
import it.niedermann.owncloud.notes.preferences.DarkModeSetting;

View file

@ -18,9 +18,12 @@ import androidx.annotation.NonNull;
import androidx.core.util.Consumer;
import androidx.recyclerview.widget.RecyclerView;
import com.nextcloud.android.sso.FilesAppTypeRegistry;
import com.nextcloud.android.sso.helper.VersionCheckHelper;
import com.nextcloud.android.sso.model.FilesAppType;
import java.util.Optional;
import it.niedermann.owncloud.notes.FormattingHelpActivity;
import it.niedermann.owncloud.notes.R;
import it.niedermann.owncloud.notes.about.AboutActivity;
@ -84,10 +87,12 @@ public class MenuAdapter extends RecyclerView.Adapter<MenuViewHolder> {
// https://github.com/nextcloud/android/pull/8405#issuecomment-852966877
final int minVersionCode = 30170090;
try {
if (VersionCheckHelper.getNextcloudFilesVersionCode(context, FilesAppType.PROD) > minVersionCode) {
return generateTrashbinAppIntent(context, account, true);
} else if (VersionCheckHelper.getNextcloudFilesVersionCode(context, FilesAppType.DEV) > minVersionCode) {
return generateTrashbinAppIntent(context, account, false);
Optional<FilesAppType> prod = FilesAppTypeRegistry.getInstance().getTypes().stream().filter(t -> t.type == FilesAppType.Type.PROD).findFirst();
Optional<FilesAppType> dev = FilesAppTypeRegistry.getInstance().getTypes().stream().filter(t -> t.type == FilesAppType.Type.DEV).findFirst();
if (prod.isPresent() && VersionCheckHelper.getNextcloudFilesVersionCode(context, prod.get()) > minVersionCode) {
return generateTrashbinAppIntent(context, account, prod.get());
} else if (dev.isPresent() && VersionCheckHelper.getNextcloudFilesVersionCode(context, dev.get()) > minVersionCode) {
return generateTrashbinAppIntent(context, account, dev.get());
} else {
// Files app is too old to be able to switch the account when launching the TrashbinActivity
return generateTrashbinWebIntent(account);
@ -98,9 +103,9 @@ public class MenuAdapter extends RecyclerView.Adapter<MenuViewHolder> {
}
}
private static Intent generateTrashbinAppIntent(@NonNull Context context, @NonNull Account account, boolean prod) throws PackageManager.NameNotFoundException {
private static Intent generateTrashbinAppIntent(@NonNull Context context, @NonNull Account account, FilesAppType type) throws PackageManager.NameNotFoundException {
final var packageManager = context.getPackageManager();
final String packageName = prod ? FilesAppType.PROD.packageId : FilesAppType.DEV.packageId;
final String packageName = type.packageId;
final var intent = new Intent();
intent.setClassName(packageName, "com.owncloud.android.ui.trashbin.TrashbinActivity");
if (packageManager.resolveActivity(intent, 0) != null) {

View file

@ -729,6 +729,12 @@
<sha256 value="c14786bdad6e7b12289a70de7d4f6b68dc7920278044d8dbdefeb3c3a7172d3e" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.fragment" name="fragment-ktx" version="1.3.6">
<artifact name="fragment-ktx-1.3.6.module">
<sha256 value="a775bab4e5ef78605c2b0f8bc9dcd9e2c2dd6b5d5d9320012a69a5d01375059a"
origin="Generated by Gradle" reason="Artifact is not signed" />
</artifact>
</component>
<component group="androidx.interpolator" name="interpolator" version="1.0.0">
<artifact name="interpolator-1.0.0.aar">
<sha256 value="33193135a64fe21fa2c35eec6688f1a76e512606c0fc83dc1b689e37add7732a" origin="Generated by Gradle" reason="Artifact is not signed"/>
@ -3569,6 +3575,16 @@
<artifact name="Android-SingleSignOn-1.2.0.module">
<sha256 value="af2950feb4c17162a375171044ecdf3849cf4a62f2f6f8cc8ab7e61393a87987" origin="Generated by Gradle" reason="Artifact is not signed"/>
</artifact>
</component>
<component group="com.github.nextcloud" name="Android-SingleSignOn" version="1.3.0">
<artifact name="Android-SingleSignOn-1.3.0.aar">
<sha256 value="7977bc1d06ea90faee99f6c275ce2e3c62f291e9a583a8d1de745a789aad1c22"
origin="Generated by Gradle" reason="Artifact is not signed" />
</artifact>
<artifact name="Android-SingleSignOn-1.3.0.module">
<sha256 value="b36d6dc843a8881603fd3019a6bdacecb97e46028e984634566c00319519b436"
origin="Generated by Gradle" reason="Artifact is not signed" />
</artifact>
</component>
<component group="com.github.nextcloud" name="android-common" version="0.14.0">
<artifact name="android-common-0.14.0.jar">