mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
#1756 Generate newsletter forwarding email address
This commit is contained in:
parent
13581683f8
commit
bf94ae61f4
6 changed files with 28 additions and 3 deletions
|
@ -36,7 +36,12 @@ class NewslettersFragment : DialogFragment() {
|
|||
|
||||
private fun generateEmail(): String {
|
||||
val userDetails = PrefsUtils.getUserDetails(requireContext())
|
||||
return "${userDetails.username}-12345678@newsletters.newsblur.com"
|
||||
val extToken = PrefsUtils.getExtToken(requireContext())
|
||||
return if (userDetails.username.isNullOrBlank() && extToken.isNullOrBlank()) {
|
||||
"Error generating forwarding email address"
|
||||
} else {
|
||||
"${userDetails.username}-$extToken@newsletters.newsblur.com"
|
||||
}
|
||||
}
|
||||
|
||||
private fun copyToClipboard(message: String) {
|
||||
|
|
|
@ -39,6 +39,8 @@ public class FeedFolderResponse {
|
|||
public long premiumExpire;
|
||||
public boolean isStaff;
|
||||
public int starredCount;
|
||||
|
||||
public String shareExtToken;
|
||||
|
||||
public FeedFolderResponse(String json, Gson gson) {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
@ -49,6 +51,9 @@ public class FeedFolderResponse {
|
|||
if (asJsonObject.has("is_staff")) {
|
||||
this.isStaff = asJsonObject.get("is_staff").getAsBoolean();
|
||||
}
|
||||
if (asJsonObject.has("share_ext_token")) {
|
||||
this.shareExtToken = asJsonObject.get("share_ext_token").getAsString();
|
||||
}
|
||||
|
||||
JsonElement userProfile = asJsonObject.get("user_profile");
|
||||
if (userProfile != null) {
|
||||
|
|
|
@ -558,6 +558,7 @@ public class NBSyncService extends JobService {
|
|||
|
||||
PrefsUtils.setPremium(this, feedResponse.isPremium, feedResponse.premiumExpire);
|
||||
PrefsUtils.setArchive(this, feedResponse.isArchive, feedResponse.premiumExpire);
|
||||
PrefsUtils.setExtToken(this, feedResponse.shareExtToken);
|
||||
|
||||
// note all feeds that belong to some folder so we can find orphans
|
||||
for (Folder folder : feedResponse.folders) {
|
||||
|
|
|
@ -30,6 +30,8 @@ public class PrefConstants {
|
|||
public static final String IS_ARCHIVE = "is_archive";
|
||||
// don't update key value for backward compat
|
||||
public static final String SUBSCRIPTION_EXPIRE = "premium_expire";
|
||||
|
||||
public static final String EXT_TOKEN = "ext_token";
|
||||
|
||||
public static final String PREFERENCE_TEXT_SIZE = "default_reading_text_size";
|
||||
public static final String PREFERENCE_LIST_TEXT_SIZE = "list_text_size";
|
||||
|
|
|
@ -1088,4 +1088,17 @@ public class PrefsUtils {
|
|||
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
return prefs.getBoolean(PrefConstants.LOAD_NEXT_ON_MARK_READ, false);
|
||||
}
|
||||
|
||||
public static void setExtToken(Context context, String token) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
Editor editor = prefs.edit();
|
||||
editor.putString(PrefConstants.EXT_TOKEN, token);
|
||||
editor.commit();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getExtToken(Context context) {
|
||||
SharedPreferences prefs = context.getSharedPreferences(PrefConstants.PREFERENCES, 0);
|
||||
return prefs.getString(PrefConstants.EXT_TOKEN, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@
|
|||
|
||||
<item android:id="@+id/menu_newsletters"
|
||||
android:title="@string/menu_newsletters"
|
||||
app:showAsAction="never"
|
||||
android:visible="false" />
|
||||
app:showAsAction="never" />
|
||||
|
||||
<item android:id="@+id/menu_text_size"
|
||||
android:title="@string/menu_text_size" >
|
||||
|
|
Loading…
Add table
Reference in a new issue