Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Updated maintenance information (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelWuensch authored Apr 16, 2023
1 parent 03fd9e3 commit cbdbcc4
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## Maintanance
This repository is no longer maintained, but the project is continued in a fork called [BitBanana][bitbanana].

# Zap Android

[![Screenshot of Zap Android app](docs/screenshot.png)](https://zaphq.io/)
Expand Down Expand Up @@ -80,7 +83,7 @@ If you want to setup a testing environment, please see the [Regtest Guide](docs/
And if you want to build the app yourself take a look at the [Installation Guide](docs/INSTALL.md)

## Maintainers
- [Michael Wünsch](https://github.com/michaelWuensch)
Unmaintained for now.

## License

Expand All @@ -90,3 +93,4 @@ This project is open source under the MIT license, which means you have full acc

[issues]: https://github.com/LN-Zap/zap-android/issues
[slack]: https://join.slack.com/t/zaphq/shared_invite/enQtMzgyNDA2NDI2Nzg0LTQwZWQ2ZWEzOWFhMjRiNWZkZWMwYTA4MzA5NzhjMDNhNTM5YzliNDA4MmZkZWZkZTFmODM4ODJkYzU3YmI3ZmI
[bitbanana]: https://github.com/michaelWuensch/BitBanana
16 changes: 16 additions & 0 deletions app/src/main/java/zapsolutions/zap/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,22 @@ public void onPageScrollStateChanged(int state) {

// Register observer to detect if app goes to background
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);

new UserGuardian(HomeActivity.this, null, new UserGuardian.OnMaintenanceSelectionListener() {
@Override
public void onDownload() {
String url = "https://play.google.com/store/apps/details?id=app.michaelwuensch.bitbanana";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);
}

@Override
public void onMore() {
String url = "https://github.com/michaelWuensch/BitBanana/blob/master/docs/REBRANDING.md";
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(browserIntent);
}
}).informationMaintenance();
}

// This schedule keeps us up to date on exchange rates
Expand Down
81 changes: 81 additions & 0 deletions app/src/main/java/zapsolutions/zap/util/UserGuardian.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.CheckBox;

import zapsolutions.zap.R;
Expand Down Expand Up @@ -33,13 +35,15 @@ public class UserGuardian {
private static final String DIALOG_EXTERNAL_LINK = "guardianExternalLink";
private static final String DIALOG_ZERO_AMOUNT_INVOICE = "guardianZeroAmountInvoice";
private static final String DIALOG_CERTIFICATE_VERIFICATION = "guardianCertificateVerification";
private static final String DIALOG_MAINTENANCE = "guardianMaintenance";

public static final int CLIPBOARD_DATA_TYPE_ONCHAIN = 0;
public static final int CLIPBOARD_DATA_TYPE_LIGHTNING = 1;
public static final int CLIPBOARD_DATA_TYPE_NODE_URI = 2;

private final Context mContext;
private OnGuardianConfirmedListener mListener;
private OnMaintenanceSelectionListener mMaintenanceListener;
private String mCurrentDialogName;
private CheckBox mDontShowAgain;

Expand All @@ -52,6 +56,12 @@ public UserGuardian(Context ctx, OnGuardianConfirmedListener listener) {
mListener = listener;
}

public UserGuardian(Context ctx, OnGuardianConfirmedListener listener, OnMaintenanceSelectionListener maintenanceListener) {
mContext = ctx;
mListener = listener;
mMaintenanceListener = maintenanceListener;
}

/**
* Reset all "do not show again" selections.
*/
Expand All @@ -68,6 +78,7 @@ public static void reenableAllSecurityWarnings() {
.putBoolean(DIALOG_EXTERNAL_LINK, true)
.putBoolean(DIALOG_ZERO_AMOUNT_INVOICE, true)
.putBoolean(DIALOG_CERTIFICATE_VERIFICATION, true)
.putBoolean(DIALOG_MAINTENANCE, true)
.apply();
}

Expand Down Expand Up @@ -108,6 +119,16 @@ public void securityCopyToClipboard(String data, int type) {
showGuardianDialog(adb);
}

/**
* Warn the user to not disable screen protection.
*/
public void informationMaintenance() {
mCurrentDialogName = DIALOG_MAINTENANCE;
AlertDialog.Builder adb = createMaintenanceDontShowAgainDialog();
adb.setMessage(R.string.guardian_maintenance);
showGuardianDialog(adb);
}

/**
* Warn the user about pasting a payment request from clipboard.
*/
Expand Down Expand Up @@ -282,6 +303,41 @@ private AlertDialog.Builder createDialog(Boolean hasCancelOption) {
return adb;
}

/**
* Create a dialog with a "do not show again" option that is already set up
* except the message.
* This helps keeping the dialog functions organized and simple.
*
* @return returns a preconfigured AlertDialog.Builder which can be further configured later
*/
private AlertDialog.Builder createMaintenanceDontShowAgainDialog() {
AlertDialog.Builder adb = new AlertDialog.Builder(mContext);
LayoutInflater adbInflater = LayoutInflater.from(mContext);
View DialogLayout = adbInflater.inflate(R.layout.dialog_checkbox, null);
mDontShowAgain = DialogLayout.findViewById(R.id.skip);
View titleView = adbInflater.inflate(R.layout.guardian_title, null);
adb.setView(DialogLayout);
adb.setCustomTitle(titleView);
adb.setPositiveButton(R.string.ok, (dialog, which) -> {
if (mDontShowAgain.isChecked()) {
PrefsUtil.editPrefs().putBoolean(mCurrentDialogName, false).apply();
}

if (mListener != null) {
// Execute interface callback on "OK"
mListener.onGuardianConfirmed();
}
});
adb.setNegativeButton("Info", null);
adb.setNeutralButton("Download", (dialog, which) -> {
if (mMaintenanceListener != null) {
mMaintenanceListener.onDownload();
}
});

return adb;
}


/**
* Show the dialog or execute callback if it should not be shown.
Expand All @@ -292,6 +348,25 @@ private void showGuardianDialog(AlertDialog.Builder adb) {

if (PrefsUtil.getPrefs().getBoolean(mCurrentDialogName, true)) {
Dialog dlg = adb.create();
if (mCurrentDialogName.equals(DIALOG_MAINTENANCE)){
// This is done here to prevent the dialog from closing when hitting "INFO" button.
dlg.setOnShowListener(new DialogInterface.OnShowListener() {
@Override
public void onShow(DialogInterface dialogInterface) {
Button button =((AlertDialog)dlg).getButton(AlertDialog.BUTTON_NEGATIVE);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mMaintenanceListener != null) {
mMaintenanceListener.onMore();
} else {
dlg.dismiss();
}
}
});
}
});
}
// Apply FLAG_SECURE to dialog to prevent screen recording
if (PrefsUtil.isScreenRecordingPrevented()) {
dlg.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
Expand All @@ -307,4 +382,10 @@ private void showGuardianDialog(AlertDialog.Builder adb) {
public interface OnGuardianConfirmedListener {
void onGuardianConfirmed();
}

public interface OnMaintenanceSelectionListener {
void onDownload();

void onMore();
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
<string name="guardian_oldLndVersion_remote">Please update.\n\nThe node you are connected to runs an old version of LND. Versions below %1$s are no longer actively supported.</string>
<string name="guardian_zero_amount_invoice">This invoice does not specify an amount. Though very unlikely, invoices without a specific amount can be exploited and the recipient will receive less than expected in that case. If possible use an invoice with a specific amount.</string>
<string name="guardian_certificate_verification">If certificate verification is disabled, you are vulnerable to a man-in-the-middle attack. Only do this if you know what you are doing.\n\nIt is advised to get the certificate setup correct instead.\nThis means the certificate from your node has to have the hostname included that you are using in this connection setting. Add the hostname to tlsextradomain in the lnd.conf before recreating the certificate.</string>

<string name="guardian_maintenance">Zap Android is continued by the same developer in a fork called BitBanana!\n\nBitBanana is nearly identical but it already comes with lots of new features. You\'ll have to download the new app manually, but it\'s well worth it. Use the \"INFO\" button to learn more about the reasons behind the rebranding.\n\nZap Android will continue to function, but it is no longer maintained.</string>

<string name="settings_category_general">General</string>
<string name="settings_category_security">Security</string>
Expand Down

0 comments on commit cbdbcc4

Please sign in to comment.