Skip to content

Commit

Permalink
Remove Amplitude from Expo Go (expo#22523)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsapeta authored May 18, 2023
1 parent 4cd60de commit 0502d1f
Show file tree
Hide file tree
Showing 57 changed files with 14 additions and 921 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jarjar-rules.txt
# Template files
/android/app/src/main/AndroidManifest.xml
/android/app/google-services.json
/android/expoview/src/main/java/host/exp/exponent/generated/ExponentKeys.java
/apps/bare-expo/android/app/google-services.json
/apps/bare-expo/ios/BareExpo/GoogleService-Info.plist
/ios/Exponent/Generated/EXKeys.h
Expand Down
3 changes: 0 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,6 @@ dependencies {
// BEGIN_SDK_46
versionedImplementation(project(':expoview-abi46_0_0'))
// END_SDK_46

// This is not needed in shell apps, the Amplitude module will include this dep if installed
implementation 'com.amplitude:android-sdk:2.23.2'
}

// This has to be down here for some reason
Expand Down
3 changes: 0 additions & 3 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@
<init>(java.lang.Throwable);
}

##### Amplitude #####
-keep class com.amplitude.api.** {*;}

##### DBFlow #####
-keep class com.raizlabs.android.dbflow.config.GeneratedDatabaseHolder

Expand Down
3 changes: 0 additions & 3 deletions android/expoview/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,6 @@ dependencies {
api 'com.google.maps.android:android-maps-utils:0.5'
// Remember to update DetachAppTemplate build.gradle if you add any excludes or transitive = false here!

// Used only in Expo Go, see Analytics.java
compileOnly 'com.amplitude:android-sdk:2.23.2'

// expo-file-system
api 'com.squareup.okhttp3:okhttp:3.10.0'
api 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
Expand Down
3 changes: 0 additions & 3 deletions android/expoview/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,6 @@
<init>(java.lang.Throwable);
}

##### Amplitude #####
-keep class com.amplitude.api.** {*;}

##### DBFlow #####
-keep class * extends com.raizlabs.android.dbflow.config.DatabaseHolder { *; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.os.Debug
import androidx.multidex.MultiDexApplication
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.soloader.SoLoader
import host.exp.exponent.analytics.Analytics
import host.exp.exponent.analytics.EXL
import host.exp.exponent.branch.BranchManager
import host.exp.exponent.di.NativeModuleDepsProvider
Expand Down Expand Up @@ -74,7 +73,6 @@ abstract class ExpoApplication : MultiDexApplication() {
Debug.startMethodTracing("coldStart")
}

Analytics.markEvent(Analytics.TimedEvent.LAUNCHER_ACTIVITY_STARTED)
SoLoader.init(applicationContext, false)

// Add exception handler. This is used by the entire process, so only need to add it here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.app.IntentService
import android.content.Context
import android.content.Intent
import android.os.Handler
import host.exp.exponent.analytics.Analytics
import host.exp.exponent.di.NativeModuleDepsProvider
import host.exp.exponent.experience.ExperienceActivity
import host.exp.exponent.kernel.Kernel
Expand Down Expand Up @@ -59,7 +58,6 @@ class ExponentIntentService : IntentService("ExponentIntentService") {
sendBroadcast(intent)
}

Analytics.logEventWithManifestUrl(Analytics.AnalyticsEvent.RELOAD_EXPERIENCE, manifestUrl)
stopSelf()
}

Expand Down

This file was deleted.

13 changes: 0 additions & 13 deletions android/expoview/src/main/java/host/exp/exponent/analytics/EXL.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package host.exp.exponent.analytics

import android.util.Log
import host.exp.exponent.Constants
import org.json.JSONObject

// EXpo Log
object EXL {
Expand Down Expand Up @@ -32,17 +31,5 @@ object EXL {

@JvmStatic fun e(tag: String?, msg: String?) {
Log.e(tag, msg ?: "")

try {
val stackTrace = Log.getStackTraceString(Throwable())
val eventProperties = JSONObject().apply {
put("TAG", tag)
put("MESSAGE", msg)
put("STACK_TRACE", stackTrace)
}
Analytics.logEvent(Analytics.AnalyticsEvent.LOG_ERROR, eventProperties)
} catch (e: Throwable) {
Log.e(TAG, e.toString())
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import host.exp.exponent.Constants
import host.exp.exponent.LauncherActivity
import host.exp.exponent.analytics.Analytics
import host.exp.exponent.kernel.ExponentError
import host.exp.exponent.kernel.Kernel
import host.exp.expoview.databinding.ErrorActivityNewBinding
Expand Down Expand Up @@ -50,7 +49,6 @@ class ErrorActivity() : FragmentActivity() {
override fun onResume() {
super.onResume()
visibleActivity = this
Analytics.logEventWithManifestUrl(Analytics.AnalyticsEvent.ERROR_APPEARED, manifestUrl)
}

override fun onPause() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import host.exp.exponent.Constants
import host.exp.exponent.analytics.Analytics
import host.exp.exponent.analytics.EXL
import host.exp.expoview.R
import host.exp.expoview.databinding.ErrorFragmentBinding
import org.json.JSONObject

class ErrorFragment : Fragment() {
private var _binding: ErrorFragmentBinding? = null
Expand Down Expand Up @@ -72,16 +70,6 @@ class ErrorFragment : Fragment() {
}
}

try {
val eventProperties = JSONObject().apply {
put(Analytics.USER_ERROR_MESSAGE, userErrorMessage)
put(Analytics.DEVELOPER_ERROR_MESSAGE, developerErrorMessage)
put(Analytics.MANIFEST_URL, manifestUrl)
}
Analytics.logEvent(Analytics.AnalyticsEvent.ERROR_SCREEN, eventProperties)
} catch (e: Exception) {
EXL.e(TAG, e.message)
}
if (isHomeError || manifestUrl == null || manifestUrl == Constants.INITIAL_URL) {
// Cannot go home in any of these cases
binding.homeButton.visibility = View.GONE
Expand Down
Loading

0 comments on commit 0502d1f

Please sign in to comment.