Skip to content

Commit

Permalink
Merge pull request #453 from doubleangels/dev
Browse files Browse the repository at this point in the history
Fix #451 and #452
  • Loading branch information
doubleangels authored Feb 24, 2025
2 parents 1a0cd81 + a55d36b commit 63e0721
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 29 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
applicationId "com.doubleangels.nextdnsmanagement"
minSdkVersion 32
targetSdk = 35
versionCode 258
versionName "5.5.9"
versionCode 259
versionName "5.5.10"
resourceConfigurations += ["en", "zh", "nl", "fi", "fr", "de", "in", "it", "ja", "pl", "pt", "es", "sv", "tr"]
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package com.doubleangels.nextdnsmanagement;

import static android.Manifest.permission.POST_NOTIFICATIONS;

import android.annotation.SuppressLint;
import android.app.DownloadManager;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Build;
Expand Down Expand Up @@ -33,8 +30,6 @@
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import androidx.lifecycle.LifecycleOwner;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.webkit.WebSettingsCompat;
Expand Down Expand Up @@ -101,7 +96,7 @@ protected void onCreate(Bundle savedInstanceState) {

setContentView(R.layout.activity_main);

// Initialize Sentry manager
// Initialize Sentry manager.
final SentryManager sentryManager = new SentryManager(this);
SharedPreferencesManager.init(this);

Expand Down Expand Up @@ -146,16 +141,10 @@ protected void onCreate(Bundle savedInstanceState) {
sentryManager.captureException(e);
}

// Request POST_NOTIFICATIONS permission if not granted.
if (ContextCompat.checkSelfPermission(this, POST_NOTIFICATIONS) == PackageManager.PERMISSION_DENIED) {
ActivityCompat.requestPermissions(this, new String[]{POST_NOTIFICATIONS}, 1);
}

try {
setupWebViewForActivity(getString(R.string.main_url));
} catch (Exception e) {
sentryManager.captureException(e);
Toast.makeText(this, "Error initializing WebView", Toast.LENGTH_SHORT).show();
}
}

Expand Down Expand Up @@ -212,15 +201,13 @@ public void onAuthenticationSucceeded() {

@Override
public void onAuthenticationError(String error) {
SentryManager.captureStaticException(new Exception("Biometric auth error: " + error));
Toast.makeText(MainActivity.this, "Authentication error", Toast.LENGTH_SHORT).show();
SentryManager.captureStaticException(new Exception("Biometric authentication error: " + error));
finish();
}

@Override
public void onAuthenticationFailed() {
SentryManager.captureStaticException(new Exception("Biometric auth failed"));
Toast.makeText(MainActivity.this, "Authentication failed", Toast.LENGTH_SHORT).show();
SentryManager.captureStaticException(new Exception("Biometric authentication failed!"));
finish();
}
}
Expand Down Expand Up @@ -315,7 +302,6 @@ public void setupWebViewForActivity(String url) {
}
} catch (Exception e) {
SentryManager.captureStaticException(e);
Toast.makeText(this, "Error restoring WebView state", Toast.LENGTH_SHORT).show();
}

WebSettings webViewSettings = webView.getSettings();
Expand Down Expand Up @@ -356,14 +342,12 @@ public void onPageFinished(WebView view, String url) {
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
SentryManager.captureStaticException(new Exception("WebView error: " + error.getDescription()));
Toast.makeText(MainActivity.this, "Error loading page", Toast.LENGTH_SHORT).show();
super.onReceivedError(view, request, error);
}

@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
SentryManager.captureStaticException(new Exception("HTTP error: " + errorResponse.getStatusCode()));
Toast.makeText(MainActivity.this, "HTTP error loading page", Toast.LENGTH_SHORT).show();
super.onReceivedHttpError(view, request, errorResponse);
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ protected void onCreate(Bundle savedInstanceState) {
setupWebViewForActivity(getString(R.string.main_url));
} catch (Exception e) {
sentryManager.captureException(e);
Toast.makeText(this, "Error initializing WebView", Toast.LENGTH_SHORT).show();
}
}

Expand Down Expand Up @@ -214,15 +213,13 @@ public void onAuthenticationSucceeded() {

@Override
public void onAuthenticationError(String error) {
SentryManager.captureStaticException(new Exception("Biometric auth error: " + error));
Toast.makeText(MainActivity.this, "Authentication error", Toast.LENGTH_SHORT).show();
SentryManager.captureStaticException(new Exception("Biometric authentication error: " + error));
finish();
}

@Override
public void onAuthenticationFailed() {
SentryManager.captureStaticException(new Exception("Biometric auth failed"));
Toast.makeText(MainActivity.this, "Authentication failed", Toast.LENGTH_SHORT).show();
SentryManager.captureStaticException(new Exception("Biometric authentication failed!"));
finish();
}
}
Expand Down Expand Up @@ -317,7 +314,6 @@ public void setupWebViewForActivity(String url) {
}
} catch (Exception e) {
SentryManager.captureStaticException(e);
Toast.makeText(this, "Error restoring WebView state", Toast.LENGTH_SHORT).show();
}

WebSettings webViewSettings = webView.getSettings();
Expand Down Expand Up @@ -358,14 +354,12 @@ public void onPageFinished(WebView view, String url) {
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
SentryManager.captureStaticException(new Exception("WebView error: " + error.getDescription()));
Toast.makeText(MainActivity.this, "Error loading page", Toast.LENGTH_SHORT).show();
super.onReceivedError(view, request, error);
}

@Override
public void onReceivedHttpError(WebView view, WebResourceRequest request, WebResourceResponse errorResponse) {
SentryManager.captureStaticException(new Exception("HTTP error: " + errorResponse.getStatusCode()));
Toast.makeText(MainActivity.this, "HTTP error loading page", Toast.LENGTH_SHORT).show();
super.onReceivedHttpError(view, request, errorResponse);
}
});
Expand Down

0 comments on commit 63e0721

Please sign in to comment.