mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-04-14 19:56:32 +00:00
Remove instabug
This commit is contained in:
parent
bc02b4661e
commit
7c552c5162
8 changed files with 5 additions and 187 deletions
|
|
@ -95,7 +95,6 @@ dependencies {
|
|||
|
||||
//Analytics
|
||||
implementation 'com.amplitude:android-sdk:2.22.1'
|
||||
implementation 'com.instabug.library:instabug:8.0.11'
|
||||
// Fresco Image Management Library
|
||||
implementation('com.facebook.fresco:fresco:1.13.0') {
|
||||
exclude module: 'bolts-android'
|
||||
|
|
|
|||
1
Habitica/proguard-rules.pro
vendored
1
Habitica/proguard-rules.pro
vendored
|
|
@ -179,4 +179,3 @@
|
|||
#-ignorewarnings
|
||||
|
||||
-keep class com.google.firebase.provider.FirebaseInitProvider
|
||||
-keep class com.example.instabug.**
|
||||
|
|
|
|||
4
Habitica/res/drawable/ic_close_grey_800_24dp.xml
Normal file
4
Habitica/res/drawable/ic_close_grey_800_24dp.xml
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:viewportHeight="24.0" android:viewportWidth="24.0" android:width="24dp">
|
||||
<path android:fillColor="#424242" android:pathData="M19,6.41L17.59,5 12,10.59 6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 12,13.41 17.59,19 19,17.59 13.41,12z"/>
|
||||
</vector>
|
||||
|
|
@ -46,7 +46,7 @@
|
|||
android:id="@+id/close_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_close"
|
||||
android:src="@drawable/ic_close_grey_800_24dp"
|
||||
android:background="@color/transparent"
|
||||
android:paddingLeft="@dimen/spacing_small"/>
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -30,12 +30,6 @@ import com.habitrpg.android.habitica.proxy.CrashlyticsProxy
|
|||
import com.habitrpg.android.habitica.ui.activities.IntroActivity
|
||||
import com.habitrpg.android.habitica.ui.activities.LoginActivity
|
||||
import com.habitrpg.android.habitica.ui.views.HabiticaIconsHelper
|
||||
import com.instabug.bug.BugReporting
|
||||
import com.instabug.bug.PromptOption
|
||||
import com.instabug.library.Instabug
|
||||
import com.instabug.library.invocation.InstabugInvocationEvent
|
||||
import com.instabug.library.ui.onboarding.WelcomeMessage
|
||||
import com.instabug.library.visualusersteps.State
|
||||
import com.squareup.leakcanary.LeakCanary
|
||||
import com.squareup.leakcanary.RefWatcher
|
||||
import io.reactivex.functions.Consumer
|
||||
|
|
@ -85,7 +79,6 @@ abstract class HabiticaBaseApplication : MultiDexApplication() {
|
|||
setupRemoteConfig()
|
||||
setupNotifications()
|
||||
refWatcher = LeakCanary.install(this)
|
||||
setupInstabug()
|
||||
createBillingAndCheckout()
|
||||
HabiticaIconsHelper.init(this)
|
||||
|
||||
|
|
@ -110,17 +103,6 @@ abstract class HabiticaBaseApplication : MultiDexApplication() {
|
|||
checkIfNewVersion()
|
||||
}
|
||||
|
||||
private fun setupInstabug() {
|
||||
Instabug.Builder(this, getString(R.string.instabug_key))
|
||||
.setInvocationEvents(InstabugInvocationEvent.SHAKE)
|
||||
.setReproStepsState(State.ENABLED_WITH_NO_SCREENSHOTS)
|
||||
.build()
|
||||
Instabug.setWelcomeMessageState(WelcomeMessage.State.DISABLED)
|
||||
Instabug.setUserAttribute("", lazyApiHelper.hostConfig.user)
|
||||
BugReporting.setShakingThreshold(900)
|
||||
BugReporting.setPromptOptionsEnabled(PromptOption.BUG, PromptOption.FEEDBACK)
|
||||
}
|
||||
|
||||
protected open fun setupRealm() {
|
||||
Realm.init(this)
|
||||
val builder = RealmConfiguration.Builder()
|
||||
|
|
@ -213,9 +195,6 @@ abstract class HabiticaBaseApplication : MultiDexApplication() {
|
|||
remoteConfig.setConfigSettings(configSettings)
|
||||
remoteConfig.setDefaults(R.xml.remote_config_defaults)
|
||||
remoteConfig.fetch(if (BuildConfig.DEBUG) 0 else 3600)
|
||||
.addOnCompleteListener {
|
||||
remoteConfig.activateFetched()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupNotifications() {
|
||||
|
|
|
|||
|
|
@ -1,155 +0,0 @@
|
|||
package com.habitrpg.android.habitica.helpers;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Environment;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.preference.PreferenceManager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
|
||||
import com.habitrpg.android.habitica.R;
|
||||
import com.habitrpg.android.habitica.data.UserRepository;
|
||||
import com.habitrpg.android.habitica.ui.AvatarView;
|
||||
|
||||
import net.glxn.qrgen.android.QRCode;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by keithholliday on 8/12/16.
|
||||
*/
|
||||
public class QrCodeManager {
|
||||
private static final String qrProfileUrl = "https://habitica.com/qr-code/user/";
|
||||
|
||||
private final UserRepository userRepository;
|
||||
//@TODO: Allow users to set other content
|
||||
private String content;
|
||||
private String userId;
|
||||
private Context context;
|
||||
|
||||
private ImageView qrCodeImageView;
|
||||
private Button qrCodeDownloadButton;
|
||||
private FrameLayout qrCodeWrapper;
|
||||
|
||||
private String albumnName;
|
||||
private String fileName;
|
||||
private String saveMessage;
|
||||
|
||||
public QrCodeManager(UserRepository userRepository, Context context) {
|
||||
this.context = context;
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this.context);
|
||||
String userId = prefs.getString(this.context.getString(R.string.SP_userID), "");
|
||||
|
||||
this.albumnName = this.context.getString(R.string.qr_album_name);
|
||||
this.fileName = this.context.getString(R.string.qr_file_name);
|
||||
this.saveMessage = this.context.getString(R.string.qr_save_message);
|
||||
|
||||
this.content = qrProfileUrl + userId;
|
||||
this.userId = userId;
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
public void setUpView(@Nullable LinearLayout qrLayout) {
|
||||
if (qrLayout == null) {
|
||||
return;
|
||||
}
|
||||
this.qrCodeImageView = qrLayout.findViewById(R.id.QRImageView);
|
||||
this.qrCodeDownloadButton = qrLayout.findViewById(R.id.QRDownloadButton);
|
||||
AvatarView avatarView = qrLayout.findViewById(R.id.avatarView);
|
||||
avatarView.configureView(false, false, false);
|
||||
this.qrCodeWrapper = qrLayout.findViewById(R.id.qrCodeWrapper);
|
||||
|
||||
if (userRepository != null) {
|
||||
userRepository.getUser(userId).firstElement().subscribe(avatarView::setAvatar, RxErrorHandler.handleEmptyError());
|
||||
}
|
||||
|
||||
this.displayQrCode();
|
||||
this.setDownloadQr();
|
||||
}
|
||||
|
||||
private void displayQrCode() {
|
||||
if (qrCodeImageView == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int qrCodeSize = (int) dipToPixels(400.0f);
|
||||
|
||||
Bitmap myBitmap = QRCode.from(this.content)
|
||||
.withErrorCorrection(ErrorCorrectionLevel.H)
|
||||
.withColor(0xFF432874, 0xFFFFFFFF)
|
||||
.withSize(qrCodeSize, qrCodeSize)
|
||||
.bitmap();
|
||||
qrCodeImageView.setImageBitmap(myBitmap);
|
||||
}
|
||||
|
||||
private float dipToPixels(float dipValue) {
|
||||
DisplayMetrics metrics = this.context.getResources().getDisplayMetrics();
|
||||
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, metrics);
|
||||
}
|
||||
|
||||
private void setDownloadQr() {
|
||||
if (qrCodeDownloadButton == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
qrCodeDownloadButton.setOnClickListener(view -> {
|
||||
File dir = getAlbumStorageDir(context, albumnName);
|
||||
dir.mkdirs();
|
||||
|
||||
File pathToQRCode = new File(dir, fileName);
|
||||
try {
|
||||
pathToQRCode.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
FileOutputStream outputStream = new FileOutputStream(pathToQRCode);
|
||||
qrCodeWrapper.setDrawingCacheEnabled(true);
|
||||
Bitmap b = qrCodeWrapper.getDrawingCache();
|
||||
b.compress(Bitmap.CompressFormat.JPEG, 95, outputStream);
|
||||
|
||||
outputStream.close();
|
||||
|
||||
Toast.makeText(context, saveMessage + pathToQRCode.getPath(),
|
||||
Toast.LENGTH_LONG).show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private File getAlbumStorageDir(Context context, String albumName) {
|
||||
// Get the directory for the app's private pictures directory.
|
||||
File file = new File(context.getExternalFilesDir(
|
||||
Environment.DIRECTORY_PICTURES), albumName);
|
||||
file.mkdirs();
|
||||
return file;
|
||||
}
|
||||
|
||||
public void showDialogue() {
|
||||
final Dialog dialog = new Dialog(context);
|
||||
dialog.setContentView(R.layout.qr_dialogue);
|
||||
dialog.setTitle(R.string.qr_dialogue_title);
|
||||
|
||||
LinearLayout qrLayout = dialog.findViewById(R.id.qrLayout);
|
||||
this.setUpView(qrLayout);
|
||||
Button dialogButton = dialog.findViewById(R.id.dialogButtonOK);
|
||||
|
||||
dialogButton.setOnClickListener(v -> dialog.dismiss());
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.habitrpg.android.habitica.ui.activities
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.MotionEvent
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.widget.Toolbar
|
||||
|
|
@ -10,7 +9,6 @@ import com.habitrpg.android.habitica.HabiticaBaseApplication
|
|||
import com.habitrpg.android.habitica.R
|
||||
import com.habitrpg.android.habitica.components.AppComponent
|
||||
import com.habitrpg.android.habitica.events.ShowConnectionProblemEvent
|
||||
import com.instabug.library.InstabugTrackingDelegate
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
|
|
@ -29,11 +27,6 @@ abstract class BaseActivity : AppCompatActivity() {
|
|||
|
||||
var isActivityVisible = false
|
||||
|
||||
override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
||||
InstabugTrackingDelegate.notifyActivityGotTouchEvent(ev, this)
|
||||
return super.dispatchTouchEvent(ev)
|
||||
}
|
||||
|
||||
override fun isDestroyed(): Boolean {
|
||||
return destroyed
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,4 +4,3 @@ amplitude_app_id=CHANGE_ME
|
|||
seeds_app_key=CHANGE_ME
|
||||
seeds_interstitial_gems=CHANGE_ME
|
||||
seeds_interstitial_sharing=CHANGE_ME
|
||||
instabug_key=CHANGE_ME
|
||||
|
|
|
|||
Loading…
Reference in a new issue