Skip to content

Commit

Permalink
Added github sponsor link
Browse files Browse the repository at this point in the history
  • Loading branch information
choiman1559 committed Sep 4, 2024
1 parent cfc48ac commit c3234e5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: choiman1559
2 changes: 1 addition & 1 deletion .idea/deploymentTargetSelector.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions app/src/main/java/com/noti/main/ui/options/AccountPreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import android.content.res.Configuration;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

Expand Down Expand Up @@ -102,7 +103,7 @@ public class AccountPreference extends PreferenceFragmentCompat {
ServiceToggle.setChecked(false);
}
} else {
ServiceToggle.setEnabled(!prefs.getString("UID", "").equals(""));
ServiceToggle.setEnabled(!prefs.getString("UID", "").isEmpty());
}
}
};
Expand All @@ -129,7 +130,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
AlreadySubscribed.setVisible(true);

String UID = prefs.getString("UID", "");
if (!UID.equals("")) {
if (!UID.isEmpty()) {
new Thread(() -> {
try {
Pushy.subscribe(UID, mContext);
Expand Down Expand Up @@ -174,11 +175,11 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
AlreadySubscribed = findPreference("AlreadySubscribed");
ServerInfo = findPreference("ServerInfo");

boolean ifUIDBlank = prefs.getString("UID", "").equals("");
boolean ifUIDBlank = prefs.getString("UID", "").isEmpty();
if (!ifUIDBlank) {
Login.setSummary("Logined as " + prefs.getString("Email", ""));
Login.setTitle(R.string.Logout);
if (prefs.getString("Email", "").equals("") && mAuth.getCurrentUser() != null)
if (prefs.getString("Email", "").isEmpty() && mAuth.getCurrentUser() != null)
prefs.edit().putString("Email", mAuth.getCurrentUser().getEmail()).apply();
if (prefs.getString("server", "Firebase Cloud Message").equals("Pushy")) {
if (mBillingHelper.isSubscribed()) {
Expand Down Expand Up @@ -315,12 +316,16 @@ public boolean onPreferenceTreeClick(Preference preference) {
case "serverSelect":
mContext.startActivity(new Intent(mContext, NetSelectActivity.class));
break;

case "GithubSponsors":
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/sponsors/choiman1559")));
break;
}
return super.onPreferenceTreeClick(preference);
}

private void accountTask() {
if (prefs.getString("UID", "").equals("")) {
if (prefs.getString("UID", "").isEmpty()) {
ConnectivityManager cm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();

Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/account_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,10 @@
android:title="Donate to developer"
android:summary="Please help us make the app even better!"
android:icon="@drawable/ic_fluent_gift_24_regular"/>
<Preference
android:key="GithubSponsors"
android:title="Github Sponsors"
android:summary="Please help keep NotiSender open source!"
android:icon="@drawable/ic_fluent_gift_open_24_regular"/>
</PreferenceCategory>
</PreferenceScreen>

0 comments on commit c3234e5

Please sign in to comment.