Skip to content

Commit

Permalink
fixed user sign in / out flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaji Khan committed Feb 27, 2024
1 parent d4b513d commit 61a10c5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public static byte[] readFileByBytes(File file) {
}

float [] decode (Uri uri, String mime, int _sampleRate) throws IOException {
if (uri == null) {
Log.e(TAG, "decode: null uri passed", null);
}
ParcelFileDescriptor pfd =
mainActivity.getContentResolver().
openFileDescriptor(uri, "r");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}

if (resultCode == RESULT_OK && requestCode > 4999) {
if (resultCode == RESULT_OK && requestCode > 4999 && requestCode < 5020) {
int plugin = requestCode - 5000 ;
AudioDecoder audioDecoder = new AudioDecoder(this);
MediaCodecList supported = new MediaCodecList(MediaCodecList.ALL_CODECS);
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/com/shajikhan/ladspa/amprack/Presets.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public void onClick(View view) {
}

public class PresetAdapter extends FragmentStateAdapter {
private ArrayList<Fragment> arrayList = new ArrayList<>();
public ArrayList<Fragment> arrayList = new ArrayList<>();
public MyPresets libraryPresets ;
public MyPresets myPresets;

Expand Down Expand Up @@ -333,7 +333,7 @@ private void signIn() {
}

private void updateUI(FirebaseUser user) {

fragmentStateAdapter.myPresets.db.loadUserPresets(fragmentStateAdapter.myPresets.myPresetsAdapter, false, false);
}
private void onSignInResult(FirebaseAuthUIAuthenticationResult result) {
IdpResponse response = result.getIdpResponse();
Expand All @@ -347,6 +347,8 @@ private void onSignInResult(FirebaseAuthUIAuthenticationResult result) {
.show();
loginNotice.setVisibility(View.GONE);
tabLayout.setVisibility(View.VISIBLE);
progressPreset.setVisibility(View.VISIBLE);
updateUI(user);
// ...
} else {
// Sign in failed. If response is null the user canceled the
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/shajikhan/ladspa/amprack/Rack.java
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,10 @@ public void onClick(DialogInterface dialog, int id) {

mainActivity.presets.loginNotice.setVisibility(View.VISIBLE);
mainActivity.presets.tabLayout.setVisibility(View.INVISIBLE);
if (mainActivity.presets.fragmentStateAdapter.myPresets.myPresetsAdapter != null)
mainActivity.presets.fragmentStateAdapter.myPresets.myPresetsAdapter.removeAll();
logout.setVisible(false);
mainActivity.presets.progressPreset.setVisibility(View.INVISIBLE);

Toast.makeText(mainActivity.getApplicationContext(),
"You have been logged out",
Expand Down

0 comments on commit 61a10c5

Please sign in to comment.