Remove dashboard/VPS references - make project PR-ready
- Remove DeviceRegistry.java (dashboard integration) - Remove VPS IP from build.gradle - Remove personal Gitea token from UpdateManager - Add configurable UPDATE_CHECK_URL for updates - Clean README to be generic and PR-ready - Clean update manifests - Remove Docker files and .env from repo
This commit is contained in:
@@ -52,8 +52,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
private SectionEntry currentSection;
|
||||
private UpdateManager updateManager;
|
||||
private AlertDialog updateDialog;
|
||||
private AlertDialog blockedDialog;
|
||||
private DeviceRegistry deviceRegistry;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
@@ -122,28 +120,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
deviceRegistry = new DeviceRegistry(this);
|
||||
deviceRegistry.syncDevice(new DeviceRegistry.Callback() {
|
||||
@Override
|
||||
public void onAllowed() {
|
||||
// Device authorized, continue normally.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlocked(String reason, String tokenPart) {
|
||||
showBlockedDialog(reason, tokenPart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message) {
|
||||
if (!TextUtils.isEmpty(message)) {
|
||||
Toast.makeText(MainActivity.this,
|
||||
getString(R.string.device_registry_error, message),
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -160,15 +136,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
if (updateDialog != null && updateDialog.isShowing()) {
|
||||
updateDialog.dismiss();
|
||||
}
|
||||
if (blockedDialog != null && blockedDialog.isShowing()) {
|
||||
blockedDialog.dismiss();
|
||||
}
|
||||
if (updateManager != null) {
|
||||
updateManager.release();
|
||||
}
|
||||
if (deviceRegistry != null) {
|
||||
deviceRegistry.release();
|
||||
}
|
||||
}
|
||||
|
||||
private void selectSection(int index) {
|
||||
@@ -348,54 +318,6 @@ public class MainActivity extends AppCompatActivity {
|
||||
}
|
||||
}
|
||||
|
||||
private void showBlockedDialog(String reason, String tokenPart) {
|
||||
if (isFinishing()) {
|
||||
return;
|
||||
}
|
||||
String finalReason = TextUtils.isEmpty(reason)
|
||||
? getString(R.string.device_blocked_default_reason)
|
||||
: reason;
|
||||
if (blockedDialog != null && blockedDialog.isShowing()) {
|
||||
blockedDialog.dismiss();
|
||||
}
|
||||
View dialogView = getLayoutInflater().inflate(R.layout.dialog_blocked, null);
|
||||
TextView messageText = dialogView.findViewById(R.id.blocked_message_text);
|
||||
View tokenContainer = dialogView.findViewById(R.id.blocked_token_container);
|
||||
TextView tokenValue = dialogView.findViewById(R.id.blocked_token_value);
|
||||
messageText.setText(getString(R.string.device_blocked_message, finalReason));
|
||||
boolean hasToken = !TextUtils.isEmpty(tokenPart);
|
||||
if (hasToken) {
|
||||
tokenContainer.setVisibility(View.VISIBLE);
|
||||
tokenValue.setText(tokenPart);
|
||||
tokenValue.setOnClickListener(v -> copyTokenToClipboard(tokenPart));
|
||||
} else {
|
||||
tokenContainer.setVisibility(View.GONE);
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.ThemeOverlay_StreamPlayer_AlertDialog)
|
||||
.setTitle(R.string.device_blocked_title)
|
||||
.setView(dialogView)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(R.string.device_blocked_close,
|
||||
(dialog, which) -> finish());
|
||||
if (hasToken) {
|
||||
builder.setNeutralButton(R.string.device_blocked_copy_token,
|
||||
(dialog, which) -> copyTokenToClipboard(tokenPart));
|
||||
}
|
||||
blockedDialog = builder.create();
|
||||
blockedDialog.show();
|
||||
}
|
||||
|
||||
private void copyTokenToClipboard(String tokenPart) {
|
||||
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
if (clipboard == null) {
|
||||
Toast.makeText(this, R.string.device_blocked_copy_error, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
ClipData data = ClipData.newPlainText("token", tokenPart);
|
||||
clipboard.setPrimaryClip(data);
|
||||
Toast.makeText(this, R.string.device_blocked_copy_success, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
private void toggleVpn() {
|
||||
VpnManager vpnManager = VpnManager.getInstance();
|
||||
if (vpnManager.isConnected()) {
|
||||
|
||||
Reference in New Issue
Block a user