Skip to content

Commit

Permalink
Don't crash when app didn't export their CONNECT activity
Browse files Browse the repository at this point in the history
  • Loading branch information
grote authored and eighthave committed Oct 7, 2024
1 parent 3af7521 commit 224c634
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/src/main/java/info/guardianproject/ripple/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.LinkedHashSet;
Expand Down Expand Up @@ -199,14 +200,15 @@ class AppRowHolder extends RecyclerView.ViewHolder {
appLabelView = (TextView) row.findViewById(R.id.appLabel);
editableLabel = (TextView) row.findViewById(R.id.editableLabel);
onSwitch = (SwitchCompat) row.findViewById(R.id.on_switch);
onClickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
requestPackageName = rowPackageName;
Intent intent = new Intent(Panic.ACTION_CONNECT);
intent.setPackage(requestPackageName);
// TODO add TrustedIntents here
onClickListener = view -> {
requestPackageName = rowPackageName;
Intent intent = new Intent(Panic.ACTION_CONNECT);
intent.setPackage(requestPackageName);
// TODO add TrustedIntents here
try {
startActivityForResult(intent, CONNECT_RESULT);
} catch (Exception e) {
Toast.makeText(MainActivity.this, R.string.error_config, Toast.LENGTH_SHORT).show();
}
};

Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
<string name="edit">Edit</string>
<string name="got_it">Got it</string>
<string name="app_hides">App hides when triggered</string>
<string name="error_config">Could not launch app</string>
</resources>

0 comments on commit 224c634

Please sign in to comment.