Update SSO lib to 0.5.0-rc1
Signed-off-by: Unpublished <unpublished@gmx.net>
This commit is contained in:
parent
926b9e2395
commit
890828441b
4 changed files with 53 additions and 38 deletions
|
@ -131,7 +131,7 @@ dependencies {
|
|||
// implementation 'com.google.android.gms:play-services:4.2.42'
|
||||
//implementation project(':Android-SingleSignOn')
|
||||
//implementation project(path: ':MaterialShowcaseView:library', configuration: 'default')
|
||||
implementation 'com.github.nextcloud:Android-SingleSignOn:0.4.1'
|
||||
implementation 'com.github.nextcloud:Android-SingleSignOn:0.5.0-rc1'
|
||||
implementation 'com.github.David-Development:MaterialShowcaseView:bf6afa225d'
|
||||
|
||||
// https://mvnrepository.com/artifact/androidx.legacy/legacy-support-v4
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.util.Log;
|
|||
import com.nextcloud.android.sso.aidl.NextcloudRequest;
|
||||
import com.nextcloud.android.sso.api.NetworkRequest;
|
||||
import com.nextcloud.android.sso.api.NextcloudAPI;
|
||||
import com.nextcloud.android.sso.api.Response;
|
||||
import com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException;
|
||||
|
||||
import org.mockito.Mockito;
|
||||
|
@ -16,6 +17,7 @@ import org.mockito.Mockito;
|
|||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import de.luhmer.owncloudnewsreader.helper.GsonConfig;
|
||||
import de.luhmer.owncloudnewsreader.reader.nextcloud.API;
|
||||
|
@ -109,6 +111,13 @@ public class TestApiProvider extends ApiProvider {
|
|||
return inputStream;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Response performNetworkRequestV2(NextcloudRequest request, InputStream requestBodyInputStream) throws Exception {
|
||||
return new Response(
|
||||
performNetworkRequest(request, requestBodyInputStream), new ArrayList<>(0)
|
||||
);
|
||||
}
|
||||
|
||||
private InputStream handleFolders() {
|
||||
String folders = "{\"folders\":[{\"id\":2,\"name\":\"Comic\"},{\"id\":3,\"name\":\"Android\"}]}";
|
||||
return stringToInputStream(folders);
|
||||
|
|
|
@ -46,12 +46,10 @@ import android.widget.ImageView;
|
|||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.google.android.material.textfield.TextInputLayout;
|
||||
import com.nextcloud.android.sso.AccountImporter;
|
||||
import com.nextcloud.android.sso.api.NextcloudAPI;
|
||||
import com.nextcloud.android.sso.exceptions.AccountImportCancelledException;
|
||||
import com.nextcloud.android.sso.exceptions.AndroidGetAccountsPermissionNotGranted;
|
||||
import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotInstalledException;
|
||||
import com.nextcloud.android.sso.exceptions.NextcloudHttpRequestFailedException;
|
||||
|
@ -65,6 +63,8 @@ import java.net.URL;
|
|||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import butterknife.OnClick;
|
||||
|
@ -458,10 +458,13 @@ public class LoginDialogActivity extends AppCompatActivity {
|
|||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
AccountImporter.onActivityResult(requestCode, resultCode, data, LoginDialogActivity.this, account -> {
|
||||
LoginDialogActivity.this.importedAccount = account;
|
||||
loginSingleSignOn();
|
||||
});
|
||||
try {
|
||||
AccountImporter.onActivityResult(requestCode, resultCode, data, LoginDialogActivity.this, account -> {
|
||||
LoginDialogActivity.this.importedAccount = account;
|
||||
loginSingleSignOn();
|
||||
});
|
||||
} catch (AccountImportCancelledException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -42,26 +42,10 @@ import android.view.View;
|
|||
import android.widget.SearchView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.customview.widget.ViewDragHelper;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.nextcloud.android.sso.AccountImporter;
|
||||
import com.nextcloud.android.sso.api.NextcloudAPI;
|
||||
import com.nextcloud.android.sso.exceptions.AccountImportCancelledException;
|
||||
import com.nextcloud.android.sso.exceptions.NextcloudFilesAppAccountNotFoundException;
|
||||
import com.nextcloud.android.sso.exceptions.NextcloudFilesAppAccountPermissionNotGrantedException;
|
||||
import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotSupportedException;
|
||||
|
@ -84,6 +68,22 @@ import java.util.concurrent.TimeUnit;
|
|||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.app.ActionBarDrawerToggle;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.view.GravityCompat;
|
||||
import androidx.customview.widget.ViewDragHelper;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
import de.luhmer.owncloudnewsreader.ListView.SubscriptionExpandableListAdapter;
|
||||
|
@ -970,21 +970,24 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements
|
|||
}
|
||||
|
||||
|
||||
AccountImporter.onActivityResult(requestCode, resultCode, data, this, account -> {
|
||||
Log.d(TAG, "accountAccessGranted() called with: account = [" + account + "]");
|
||||
mApi.initApi(new NextcloudAPI.ApiConnectedListener() {
|
||||
@Override
|
||||
public void onConnected() {
|
||||
Log.d(TAG, "onConnected() called");
|
||||
}
|
||||
try {
|
||||
AccountImporter.onActivityResult(requestCode, resultCode, data, this, account -> {
|
||||
Log.d(TAG, "accountAccessGranted() called with: account = [" + account + "]");
|
||||
mApi.initApi(new NextcloudAPI.ApiConnectedListener() {
|
||||
@Override
|
||||
public void onConnected() {
|
||||
Log.d(TAG, "onConnected() called");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
Log.e(TAG, "onError() called with:", ex);
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void onError(Exception ex) {
|
||||
Log.e(TAG, "onError() called with:", ex);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
} catch (AccountImportCancelledException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue