diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index f2b5c0376..8ccf7883f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,15 +6,10 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/App.java b/app/src/main/java/com/fastaccess/App.java index e5e6006f4..907d90ce7 100644 --- a/app/src/main/java/com/fastaccess/App.java +++ b/app/src/main/java/com/fastaccess/App.java @@ -9,10 +9,7 @@ import com.fastaccess.helper.TypeFaceHelper; import com.fastaccess.provider.colors.ColorsProvider; import com.fastaccess.provider.emoji.EmojiManager; -import com.fastaccess.provider.fabric.FabricProvider; import com.fastaccess.provider.tasks.notification.NotificationSchedulerJobTask; -import com.google.firebase.messaging.FirebaseMessaging; -import com.miguelbcr.io.rx_billing_service.RxBillingService; import io.requery.Persistable; import io.requery.android.sqlite.DatabaseSource; @@ -44,8 +41,6 @@ public class App extends Application { } private void init() { - FabricProvider.INSTANCE.initFabric(this); - RxBillingService.register(this); deleteDatabase("database.db"); getDataStore(); setupPreference(); @@ -55,9 +50,6 @@ private void init() { EmojiManager.load(); ColorsProvider.load(); DeviceNameGetter.getInstance().loadDevice(); - try { - FirebaseMessaging.getInstance().subscribeToTopic("FastHub"); - } catch (Exception ignored) {} } private void setupPreference() { diff --git a/app/src/main/java/com/fastaccess/helper/AppHelper.java b/app/src/main/java/com/fastaccess/helper/AppHelper.java index 4e5fbde4b..16df9c728 100644 --- a/app/src/main/java/com/fastaccess/helper/AppHelper.java +++ b/app/src/main/java/com/fastaccess/helper/AppHelper.java @@ -21,8 +21,6 @@ import com.fastaccess.App; import com.fastaccess.BuildConfig; import com.fastaccess.R; -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GoogleApiAvailability; import java.util.Locale; @@ -177,8 +175,7 @@ public static boolean isGoogleAvailable(@NonNull Context context) { } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } - return applicationInfo != null && applicationInfo.enabled && - GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS; + return true; } public static boolean isDeviceAnimationEnabled(@NonNull Context context) { diff --git a/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt b/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt deleted file mode 100644 index fc57ba4ba..000000000 --- a/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.fastaccess.provider.fabric - -import android.content.Context -import com.crashlytics.android.Crashlytics -import com.crashlytics.android.answers.Answers -import com.crashlytics.android.answers.PurchaseEvent -import com.crashlytics.android.core.CrashlyticsCore -import com.fastaccess.BuildConfig -import io.fabric.sdk.android.Fabric -import java.math.BigDecimal -import java.math.RoundingMode - -/** - * Created by kosh on 14/08/2017. - */ - -object FabricProvider { - - fun initFabric(context: Context) { - val fabric = Fabric.Builder(context) - .kits(Crashlytics.Builder() - .core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) - .build()) - .debuggable(BuildConfig.DEBUG) - .build() - Fabric.with(fabric) - } - - fun logPurchase(productKey: String, price: Long? = null, priceText: String? = null) { - val purchaseEvent = PurchaseEvent() - .putItemName(productKey) - .putSuccess(true) - - priceText?.let { - purchaseEvent.putItemType(priceText) - } - price?.let { - purchaseEvent.putItemPrice(BigDecimal(price).setScale(2, RoundingMode.CEILING)) - } - Answers.getInstance().logPurchase(purchaseEvent) - } -} diff --git a/app/src/main/java/com/fastaccess/provider/fcm/PushNotificationService.java b/app/src/main/java/com/fastaccess/provider/fcm/PushNotificationService.java deleted file mode 100644 index 64a3d8d82..000000000 --- a/app/src/main/java/com/fastaccess/provider/fcm/PushNotificationService.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.fastaccess.provider.fcm; - -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.support.v4.app.NotificationCompat; - -import com.fastaccess.R; -import com.fastaccess.data.dao.model.FastHubNotification; -import com.fastaccess.provider.rest.RestProvider; -import com.fastaccess.ui.modules.main.MainActivity; -import com.google.firebase.messaging.FirebaseMessagingService; -import com.google.firebase.messaging.RemoteMessage; - -import org.json.JSONObject; - -import java.util.Date; - -/** - * Created by Kosh on 16 Apr 2017, 1:17 PM - */ - -public class PushNotificationService extends FirebaseMessagingService { - - @Override public void onMessageReceived(RemoteMessage remoteMessage) { - super.onMessageReceived(remoteMessage); - if (remoteMessage != null) { - if (remoteMessage.getData() != null && !remoteMessage.getData().isEmpty()) { - Date date = new Date(remoteMessage.getSentTime()); - FastHubNotification fastHubNotification = RestProvider.gson - .fromJson(new JSONObject(remoteMessage.getData()).toString(), FastHubNotification.class); - fastHubNotification.setDate(date); - FastHubNotification.save(fastHubNotification); - } else if (remoteMessage.getNotification() != null) { - String title = remoteMessage.getNotification().getTitle(); - String body = remoteMessage.getNotification().getBody(); - if (remoteMessage.getData() != null && !remoteMessage.getData().isEmpty()) { - title = title == null ? remoteMessage.getData().get("title") : title; - body = body == null ? remoteMessage.getData().get("message") : body; - } - Intent intent = new Intent(this, MainActivity.class); - intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); - NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, "In App-Notifications") - .setSmallIcon(R.drawable.ic_notification) - .setContentTitle(title) - .setContentText(body) - .setAutoCancel(true) - .setContentIntent(pendingIntent); - NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); - if (notificationManager != null) { - notificationManager.notify(1, notificationBuilder.build()); - } - } - } - } -} diff --git a/app/src/main/java/com/fastaccess/provider/tasks/slack/SlackInvitationService.java b/app/src/main/java/com/fastaccess/provider/tasks/slack/SlackInvitationService.java deleted file mode 100644 index d8c0ed14a..000000000 --- a/app/src/main/java/com/fastaccess/provider/tasks/slack/SlackInvitationService.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.fastaccess.provider.tasks.slack; - -import android.app.IntentService; -import android.content.Intent; -import android.support.annotation.Nullable; - -import com.fastaccess.App; -import com.fastaccess.R; -import com.fastaccess.data.dao.SlackInvitePostModel; -import com.fastaccess.data.dao.model.Login; -import com.fastaccess.helper.RxHelper; -import com.fastaccess.provider.rest.RestProvider; - -import es.dmoral.toasty.Toasty; - -/** - * Created by Kosh on 01 May 2017, 1:09 AM - */ - -public class SlackInvitationService extends IntentService { - - public SlackInvitationService() { - super(SlackInvitationService.class.getName()); - } - - @Override protected void onHandleIntent(@Nullable Intent intent) { - Login login = Login.getUser(); - if (login != null) { - SlackInvitePostModel body = new SlackInvitePostModel(); - body.setEmail(login.getEmail()); - body.setFirst_name(login.getName()); - body.setLast_name(login.getLogin()); - RxHelper.getObservable(RestProvider.getSlackService() - .invite(body)) - .subscribe(response -> { - if (response != null) { - if (response.isOk()) { - Toasty.success(App.getInstance(), getString(R.string.successfully_invited)).show(); - } else { - Toasty.info(App.getInstance(), response.getError().replaceAll("_", " ")).show(); - } - } - }, Throwable::printStackTrace); - } - } -} diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/premium/GmsTaskListeners.java b/app/src/main/java/com/fastaccess/ui/modules/main/premium/GmsTaskListeners.java deleted file mode 100644 index e15fd70c5..000000000 --- a/app/src/main/java/com/fastaccess/ui/modules/main/premium/GmsTaskListeners.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.github.b3er.rxfirebase.common; - -import android.support.annotation.NonNull; -import com.google.android.gms.tasks.OnCompleteListener; -import com.google.android.gms.tasks.Task; -import io.reactivex.CompletableEmitter; -import io.reactivex.SingleEmitter; - -public final class GmsTaskListeners { - - private GmsTaskListeners() { - throw new AssertionError("No instances"); - } - - public static OnCompleteListener listener(@NonNull final SingleEmitter emitter) { - return new OnCompleteListener() { - @Override public void onComplete(@NonNull Task task) { - if (!task.isSuccessful()) { - if (!emitter.isDisposed()) { - emitter.onError(task.getException()); - } - return; - } - - if (!emitter.isDisposed()) { - emitter.onSuccess(task.getResult()); - } - } - }; - } - - public static OnCompleteListener listener(@NonNull final CompletableEmitter emitter) { - return new OnCompleteListener() { - @Override public void onComplete(@NonNull Task task) { - if (!task.isSuccessful()) { - if (!emitter.isDisposed()) { - emitter.onError(task.getException()); - } - return; - } - - if (!emitter.isDisposed()) { - emitter.onComplete(); - } - } - }; - } -} \ No newline at end of file diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumActivity.kt index 36f791bf9..967055d36 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumActivity.kt +++ b/app/src/main/java/com/fastaccess/ui/modules/main/premium/PremiumActivity.kt @@ -18,11 +18,8 @@ import com.airbnb.lottie.LottieAnimationView import com.fastaccess.BuildConfig import com.fastaccess.R import com.fastaccess.helper.* -import com.fastaccess.provider.fabric.FabricProvider import com.fastaccess.ui.base.BaseActivity import com.fastaccess.ui.modules.main.donation.DonateActivity -import com.miguelbcr.io.rx_billing_service.RxBillingService -import com.miguelbcr.io.rx_billing_service.entities.ProductType import io.reactivex.Observable import io.reactivex.disposables.Disposable @@ -137,7 +134,6 @@ class PremiumActivity : BaseActivity(), Premi ViewHelper.hideKeyboard(editText) hideProgress() successActivationHolder.visibility = View.VISIBLE - FabricProvider.logPurchase(InputHelper.toString(editText)) successActivationView.addAnimatorListener(object : Animator.AnimatorListener { override fun onAnimationRepeat(p0: Animator?) {} override fun onAnimationEnd(p0: Animator?) { diff --git a/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragment.kt b/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragment.kt index 0e79bf0b5..c06495a36 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragment.kt +++ b/app/src/main/java/com/fastaccess/ui/modules/theme/fragment/ThemeFragment.kt @@ -155,7 +155,6 @@ class ThemeFragment : BaseFragment