Skip to content

Commit

Permalink
drop official snapdrop.net support (see #406)
Browse files Browse the repository at this point in the history
  • Loading branch information
fm-sys committed Feb 10, 2025
1 parent e65699c commit 769d4dd
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 10 deletions.
3 changes: 3 additions & 0 deletions app/src/main/java/com/fmsys/snapdrop/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ protected void onCreate(final Bundle savedInstanceState) {
return; // all this doesn't make sense if we have no base URL
}

if (baseURL.equals("https://snapdrop.net")) {
openSettingsResultLauncher.launch(OnboardingActivity.getServerSelectionIntent(this));
}

if (prefs.getBoolean(getString(R.string.pref_switch_keep_on), true)) {
transfer.setOnChangedListener(transferActive -> runOnUiThread(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ public void onViewCreated(final @NonNull View view, final Bundle savedInstanceSt
}, 500);

binding.continueButton.setOnClickListener(v -> {
viewModel.url("https://pairdrop.net");
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && Build.VERSION.SDK_INT < Build.VERSION_CODES.Q)
&& (ContextCompat.checkSelfPermission(requireContext(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED)) {
viewModel.launchFragment(OnboardingFragmentPermission.class);
} else {
viewModel.launchFragment(OnboardingFragment2.class);
viewModel.launchFragment(OnboardingFragment3.class);
}
});
binding.continueButton.requestFocus();
Expand Down
20 changes: 19 additions & 1 deletion app/src/main/java/com/fmsys/snapdrop/OnboardingFragment2.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fmsys.snapdrop.utils.NetworkUtils;
import com.fmsys.snapdrop.utils.ViewUtils;
import com.google.android.material.card.MaterialCardView;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;

import java.util.ArrayList;
import java.util.HashSet;
Expand Down Expand Up @@ -123,6 +124,23 @@ public void onViewCreated(final @NonNull View view, final Bundle savedInstanceSt
pref = PreferenceManager.getDefaultSharedPreferences(requireContext());
tempUrl.setValue(pref.getString(getString(R.string.pref_baseurl), "https://pairdrop.net"));

if (tempUrl.getValue().equals("https://snapdrop.net")) {
tempUrl.setValue("https://pairdrop.net");

binding.scrollview.setVisibility(View.INVISIBLE);
binding.continueButton.setVisibility(View.INVISIBLE);

new MaterialAlertDialogBuilder(requireContext())
.setTitle("Important Update")
.setMessage("The snapdrop.net website has been acquired by a company with unclear security and privacy practices. \n\nTo keep your data safe, this app will no longer support snapdrop.net and will instead switch all users to PairDrop, a more secure alternative. \n\nThank you for your understanding!")
.setPositiveButton("OK", null)
.setOnDismissListener(dialog -> {
binding.scrollview.setVisibility(View.VISIBLE);
binding.continueButton.setVisibility(View.VISIBLE);
})
.show();
}

reloadServerList();

binding.add.setOnClickListener(v -> ViewUtils.showEditTextWithResetPossibility(this, "Custom URL", null, null, Link.bind("https://github.com/RobinLinus/snapdrop/blob/master/docs/faq.md#inofficial-instances", R.string.baseurl_unofficial_instances), url -> {
Expand Down Expand Up @@ -174,7 +192,7 @@ private void reloadServerList() {

final List<ServerItem> servers = new ArrayList<>();
servers.add(new ServerItem("https://pairdrop.net", getString(R.string.onboarding_server_pairdrop_summary), null));
servers.add(new ServerItem("https://snapdrop.net", getString(R.string.onboarding_server_snapdrop_summary), null/*getString(R.string.onboarding_server_snapdrop_summary_server_warning)*/));
// servers.add(new ServerItem("https://snapdrop.net", getString(R.string.onboarding_server_snapdrop_summary), null/*getString(R.string.onboarding_server_snapdrop_summary_server_warning)*/));

for (String url : serverUrls) {
servers.add(new ServerItem(url, null, null));
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/fragment_onboarding_2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
tools:context=".OnboardingActivity">

<ScrollView
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/continue_button"
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<resources>
<string name="app_name" translatable="false">Snapdrop &amp; PairDrop</string>
<string name="app_name_long">Snapdrop &amp; PairDrop for Android</string>
<string name="app_name" translatable="false">PairDrop</string>
<string name="app_name_long">PairDrop for Android</string>
<string name="app_name_slogan">Transfer files seamlessly between all your devices.</string>
<string name="err_no_browser">Can\'t open browser</string>
<string name="err_no_app">No app installed to open this file</string>
Expand All @@ -12,7 +12,7 @@
<string name="onboarding_button_finish">finish</string>
<string name="onboarding_choose_server">Choose a server address</string>
<string name="onboarding_choose_server_short">choose server</string>
<string name="onboarding_choose_server_description">This app is an optimized client for the web apps Snapdrop and PairDrop.\nChoose one of the following instances or specify a custom url to connect to.\n\nNote: You have to choose the same URL on all devices.</string>
<string name="onboarding_choose_server_description">This app is an optimized client for the web apps Snapdrop and PairDrop.\n\nNote: You have to choose the same URL on all devices.</string>
<string name="onboarding_storage_permission">Storage permission</string>
<string name="onboarding_storage_permission_description">This app is a file sharing utility. Therefore, storage permission is required order to use it.</string>
<string name="onboarding_server_pairdrop_summary">(recommended)\nPairing feature, internet transfer and focus on stability.</string>
Expand Down Expand Up @@ -40,7 +40,7 @@

<!-- Settings / About -->
<string name="home_as_up_indicator_about">About</string>
<string name="title_activity_about">About Snapdrop &amp; PairDrop for Android</string>
<string name="title_activity_about">About PairDrop for Android</string>
<string name="pref_about_title">About this app</string>
<string name="view_downloads">View downloads</string>
<string name="pref_category_settings">Settings</string>
Expand All @@ -57,10 +57,10 @@
<string name="keep_on_summary">(Recommended) Many devices have problems with transfers being interrupted when the screen turns off</string>
<string name="keep_on_title">Keep screen on while transferring</string>
<string name="floating_text_selection_title">Floating text selection</string>
<string name="floating_text_selection_summary">When selecting text in other apps, an option \"Send with Snapdrop\" will be shown</string>
<string name="floating_text_selection_summary">When selecting text in other apps, an option \"Send with PairDrop\" will be shown</string>
<string name="show_connectivity_card_title">Connectivity warning</string>
<string name="show_connectivity_card_summary"> Show a warning when you are not connected with a WiFi network</string>
<string name="floating_text_selection_activity_label">Send with Snapdrop</string>
<string name="floating_text_selection_activity_label">Send with PairDrop</string>
<string name="permission_not_granted">please grant the necessary permission</string>
<string name="permission_not_granted_fallback">please grant the necessary permission manually</string>
<string name="open_settings">open settings</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.5.1'
classpath 'com.android.tools.build:gradle:8.8.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Feb 04 14:16:26 CET 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

0 comments on commit 769d4dd

Please sign in to comment.