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

Commit cbdbcc4

Browse files
Updated maintenance information (#436)
1 parent 03fd9e3 commit cbdbcc4

File tree

4 files changed

+103
-2
lines changed

4 files changed

+103
-2
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## Maintanance
2+
This repository is no longer maintained, but the project is continued in a fork called [BitBanana][bitbanana].
3+
14
# Zap Android
25

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

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

8588
## License
8689

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

9194
[issues]: https://github.com/LN-Zap/zap-android/issues
9295
[slack]: https://join.slack.com/t/zaphq/shared_invite/enQtMzgyNDA2NDI2Nzg0LTQwZWQ2ZWEzOWFhMjRiNWZkZWMwYTA4MzA5NzhjMDNhNTM5YzliNDA4MmZkZWZkZTFmODM4ODJkYzU3YmI3ZmI
96+
[bitbanana]: https://github.com/michaelWuensch/BitBanana

app/src/main/java/zapsolutions/zap/HomeActivity.java

+16
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,22 @@ public void onPageScrollStateChanged(int state) {
215215

216216
// Register observer to detect if app goes to background
217217
ProcessLifecycleOwner.get().getLifecycle().addObserver(this);
218+
219+
new UserGuardian(HomeActivity.this, null, new UserGuardian.OnMaintenanceSelectionListener() {
220+
@Override
221+
public void onDownload() {
222+
String url = "https://play.google.com/store/apps/details?id=app.michaelwuensch.bitbanana";
223+
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
224+
startActivity(browserIntent);
225+
}
226+
227+
@Override
228+
public void onMore() {
229+
String url = "https://github.com/michaelWuensch/BitBanana/blob/master/docs/REBRANDING.md";
230+
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
231+
startActivity(browserIntent);
232+
}
233+
}).informationMaintenance();
218234
}
219235

220236
// This schedule keeps us up to date on exchange rates

app/src/main/java/zapsolutions/zap/util/UserGuardian.java

+81
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
import android.app.AlertDialog;
44
import android.app.Dialog;
55
import android.content.Context;
6+
import android.content.DialogInterface;
67
import android.view.LayoutInflater;
78
import android.view.View;
89
import android.view.WindowManager;
10+
import android.widget.Button;
911
import android.widget.CheckBox;
1012

1113
import zapsolutions.zap.R;
@@ -33,13 +35,15 @@ public class UserGuardian {
3335
private static final String DIALOG_EXTERNAL_LINK = "guardianExternalLink";
3436
private static final String DIALOG_ZERO_AMOUNT_INVOICE = "guardianZeroAmountInvoice";
3537
private static final String DIALOG_CERTIFICATE_VERIFICATION = "guardianCertificateVerification";
38+
private static final String DIALOG_MAINTENANCE = "guardianMaintenance";
3639

3740
public static final int CLIPBOARD_DATA_TYPE_ONCHAIN = 0;
3841
public static final int CLIPBOARD_DATA_TYPE_LIGHTNING = 1;
3942
public static final int CLIPBOARD_DATA_TYPE_NODE_URI = 2;
4043

4144
private final Context mContext;
4245
private OnGuardianConfirmedListener mListener;
46+
private OnMaintenanceSelectionListener mMaintenanceListener;
4347
private String mCurrentDialogName;
4448
private CheckBox mDontShowAgain;
4549

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

59+
public UserGuardian(Context ctx, OnGuardianConfirmedListener listener, OnMaintenanceSelectionListener maintenanceListener) {
60+
mContext = ctx;
61+
mListener = listener;
62+
mMaintenanceListener = maintenanceListener;
63+
}
64+
5565
/**
5666
* Reset all "do not show again" selections.
5767
*/
@@ -68,6 +78,7 @@ public static void reenableAllSecurityWarnings() {
6878
.putBoolean(DIALOG_EXTERNAL_LINK, true)
6979
.putBoolean(DIALOG_ZERO_AMOUNT_INVOICE, true)
7080
.putBoolean(DIALOG_CERTIFICATE_VERIFICATION, true)
81+
.putBoolean(DIALOG_MAINTENANCE, true)
7182
.apply();
7283
}
7384

@@ -108,6 +119,16 @@ public void securityCopyToClipboard(String data, int type) {
108119
showGuardianDialog(adb);
109120
}
110121

122+
/**
123+
* Warn the user to not disable screen protection.
124+
*/
125+
public void informationMaintenance() {
126+
mCurrentDialogName = DIALOG_MAINTENANCE;
127+
AlertDialog.Builder adb = createMaintenanceDontShowAgainDialog();
128+
adb.setMessage(R.string.guardian_maintenance);
129+
showGuardianDialog(adb);
130+
}
131+
111132
/**
112133
* Warn the user about pasting a payment request from clipboard.
113134
*/
@@ -282,6 +303,41 @@ private AlertDialog.Builder createDialog(Boolean hasCancelOption) {
282303
return adb;
283304
}
284305

306+
/**
307+
* Create a dialog with a "do not show again" option that is already set up
308+
* except the message.
309+
* This helps keeping the dialog functions organized and simple.
310+
*
311+
* @return returns a preconfigured AlertDialog.Builder which can be further configured later
312+
*/
313+
private AlertDialog.Builder createMaintenanceDontShowAgainDialog() {
314+
AlertDialog.Builder adb = new AlertDialog.Builder(mContext);
315+
LayoutInflater adbInflater = LayoutInflater.from(mContext);
316+
View DialogLayout = adbInflater.inflate(R.layout.dialog_checkbox, null);
317+
mDontShowAgain = DialogLayout.findViewById(R.id.skip);
318+
View titleView = adbInflater.inflate(R.layout.guardian_title, null);
319+
adb.setView(DialogLayout);
320+
adb.setCustomTitle(titleView);
321+
adb.setPositiveButton(R.string.ok, (dialog, which) -> {
322+
if (mDontShowAgain.isChecked()) {
323+
PrefsUtil.editPrefs().putBoolean(mCurrentDialogName, false).apply();
324+
}
325+
326+
if (mListener != null) {
327+
// Execute interface callback on "OK"
328+
mListener.onGuardianConfirmed();
329+
}
330+
});
331+
adb.setNegativeButton("Info", null);
332+
adb.setNeutralButton("Download", (dialog, which) -> {
333+
if (mMaintenanceListener != null) {
334+
mMaintenanceListener.onDownload();
335+
}
336+
});
337+
338+
return adb;
339+
}
340+
285341

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

293349
if (PrefsUtil.getPrefs().getBoolean(mCurrentDialogName, true)) {
294350
Dialog dlg = adb.create();
351+
if (mCurrentDialogName.equals(DIALOG_MAINTENANCE)){
352+
// This is done here to prevent the dialog from closing when hitting "INFO" button.
353+
dlg.setOnShowListener(new DialogInterface.OnShowListener() {
354+
@Override
355+
public void onShow(DialogInterface dialogInterface) {
356+
Button button =((AlertDialog)dlg).getButton(AlertDialog.BUTTON_NEGATIVE);
357+
button.setOnClickListener(new View.OnClickListener() {
358+
@Override
359+
public void onClick(View view) {
360+
if (mMaintenanceListener != null) {
361+
mMaintenanceListener.onMore();
362+
} else {
363+
dlg.dismiss();
364+
}
365+
}
366+
});
367+
}
368+
});
369+
}
295370
// Apply FLAG_SECURE to dialog to prevent screen recording
296371
if (PrefsUtil.isScreenRecordingPrevented()) {
297372
dlg.getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
@@ -307,4 +382,10 @@ private void showGuardianDialog(AlertDialog.Builder adb) {
307382
public interface OnGuardianConfirmedListener {
308383
void onGuardianConfirmed();
309384
}
385+
386+
public interface OnMaintenanceSelectionListener {
387+
void onDownload();
388+
389+
void onMore();
390+
}
310391
}

app/src/main/res/values/strings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@
223223
<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>
224224
<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>
225225
<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>
226-
226+
<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>
227227

228228
<string name="settings_category_general">General</string>
229229
<string name="settings_category_security">Security</string>

0 commit comments

Comments
 (0)