|
18 | 18 | import com.librelio.activity.MuPDFActivity;
|
19 | 19 | import com.librelio.storage.DataBaseHelper;
|
20 | 20 | import com.librelio.utils.GooglePlayServicesUtils;
|
| 21 | +import com.librelio.utils.SubscriptionUtils; |
21 | 22 | import com.librelio.utils.SystemHelper;
|
22 | 23 | import com.niveales.wind.BuildConfig;
|
23 | 24 | import com.niveales.wind.R;
|
|
30 | 31 |
|
31 | 32 | import java.io.IOException;
|
32 | 33 | import java.security.GeneralSecurityException;
|
| 34 | +import java.util.ArrayList; |
33 | 35 |
|
34 | 36 | import javax.net.ssl.SSLContext;
|
35 | 37 |
|
@@ -267,13 +269,53 @@ public static String getUrlString(Context context, String fileName){
|
267 | 269 | return LibrelioApplication.getClientName(context) + PATH_SEPARATOR
|
268 | 270 | + LibrelioApplication.getMagazineName(context) + PATH_SEPARATOR + fileName;
|
269 | 271 | }
|
| 272 | + public static String[] getYearlySubsCode(Context context){ |
| 273 | + return LibrelioApplication.getYearlySubsCode(context, false); |
| 274 | + } |
270 | 275 |
|
271 |
| - public static String getYearlySubsCode(Context context){ |
272 |
| - return context.getResources().getString(R.string.yearly_subs_code); |
| 276 | + public static String[] getYearlySubsCode(Context context, boolean returnOnlyActiveSubs){ |
| 277 | + ArrayList<String> yearly_subs_code_array = new ArrayList<>(); |
| 278 | + //yearly_subs_code_array[0] = context.getResources().getString(R.string.yearly_subs_code); |
| 279 | + //yearly_subs_code_array[1] = context.getResources().getString(R.string.previous_yearly_subs_code); |
| 280 | + yearly_subs_code_array.add(SubscriptionUtils.getSubscriptionsCode(context, "yearly_subs_code")); |
| 281 | + if (yearly_subs_code_array.isEmpty()) { |
| 282 | + yearly_subs_code_array.add(context.getResources().getString(R.string.yearly_subs_code)); |
| 283 | + } |
| 284 | + if (!returnOnlyActiveSubs) { |
| 285 | + yearly_subs_code_array.add(SubscriptionUtils.getSubscriptionsCode(context, "previous_yearly_subs_code")); |
| 286 | + } |
| 287 | + return yearly_subs_code_array.toArray(new String[0]); |
| 288 | + } |
| 289 | + |
| 290 | + public static String getActiveYearlySubsCode(Context context){ |
| 291 | + |
| 292 | + String yearly_subs_code = ""; |
| 293 | + //yearly_subs_code_array[0] = context.getResources().getString(R.string.yearly_subs_code); |
| 294 | + //yearly_subs_code_array[1] = context.getResources().getString(R.string.previous_yearly_subs_code); |
| 295 | + yearly_subs_code = SubscriptionUtils.getSubscriptionsCode(context, "yearly_subs_code"); |
| 296 | + if (yearly_subs_code.length() == 0) { |
| 297 | + yearly_subs_code = context.getResources().getString(R.string.yearly_subs_code); |
| 298 | + } |
| 299 | + return yearly_subs_code; |
| 300 | + } |
| 301 | + |
| 302 | + public static String getYearlySubCode(Context context){ |
| 303 | + String yearlySubCode; |
| 304 | + yearlySubCode = SubscriptionUtils.getSubscriptionsCode(context, "yearly_subs_code"); |
| 305 | + if (yearlySubCode.length() == 0) { |
| 306 | + yearlySubCode = context.getResources().getString(R.string.yearly_subs_code); |
| 307 | + } |
| 308 | + return yearlySubCode; |
273 | 309 | }
|
274 | 310 |
|
275 | 311 | public static String getMonthlySubsCode(Context context){
|
276 |
| - return context.getResources().getString(R.string.monthly_subs_code); |
| 312 | + //return context.getResources().getString(R.string.monthly_subs_code); |
| 313 | + String monthlySubCode; |
| 314 | + monthlySubCode = SubscriptionUtils.getSubscriptionsCode(context, "monthly_subs_code"); |
| 315 | + if (monthlySubCode.length() == 0) { |
| 316 | + monthlySubCode = context.getResources().getString(R.string.monthly_subs_code); |
| 317 | + } |
| 318 | + return monthlySubCode; |
277 | 319 | }
|
278 | 320 |
|
279 | 321 | public static boolean isEnableCodeSubs(Context context){
|
|
0 commit comments