Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
6766e4f5
Commit
6766e4f5
authored
Jul 12, 2018
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate to Firebase Analytics
parent
ed9acb66
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
39 deletions
+13
-39
mobile/build.gradle
mobile/build.gradle
+0
-1
mobile/src/main/java/com/github/shadowsocks/App.kt
mobile/src/main/java/com/github/shadowsocks/App.kt
+2
-11
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
+1
-1
mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt
...le/src/main/java/com/github/shadowsocks/bg/BaseService.kt
+4
-2
mobile/src/main/java/com/github/shadowsocks/utils/Utils.kt
mobile/src/main/java/com/github/shadowsocks/utils/Utils.kt
+6
-1
mobile/src/main/res/xml/tracker.xml
mobile/src/main/res/xml/tracker.xml
+0
-23
No files found.
mobile/build.gradle
View file @
6766e4f5
...
@@ -70,7 +70,6 @@ dependencies {
...
@@ -70,7 +70,6 @@ dependencies {
implementation
'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation
'com.crashlytics.sdk.android:crashlytics:2.9.4'
implementation
'com.futuremind.recyclerfastscroll:fastscroll:0.2.5'
implementation
'com.futuremind.recyclerfastscroll:fastscroll:0.2.5'
implementation
"com.google.android.gms:play-services-ads:15.0.1"
implementation
"com.google.android.gms:play-services-ads:15.0.1"
implementation
"com.google.android.gms:play-services-analytics:16.0.0"
implementation
"com.google.android.gms:play-services-vision:15.0.2"
implementation
"com.google.android.gms:play-services-vision:15.0.2"
implementation
"com.google.firebase:firebase-config:16.0.0"
implementation
"com.google.firebase:firebase-config:16.0.0"
implementation
'com.google.firebase:firebase-core:16.0.0'
implementation
'com.google.firebase:firebase-core:16.0.0'
...
...
mobile/src/main/java/com/github/shadowsocks/App.kt
View file @
6766e4f5
...
@@ -48,10 +48,8 @@ import com.github.shadowsocks.preference.BottomSheetPreferenceDialogFragment
...
@@ -48,10 +48,8 @@ import com.github.shadowsocks.preference.BottomSheetPreferenceDialogFragment
import
com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.preference.IconListPreference
import
com.github.shadowsocks.preference.IconListPreference
import
com.github.shadowsocks.utils.*
import
com.github.shadowsocks.utils.*
import
com.google.android.gms.analytics.GoogleAnalytics
import
com.google.android.gms.analytics.HitBuilders
import
com.google.android.gms.analytics.Tracker
import
com.google.firebase.FirebaseApp
import
com.google.firebase.FirebaseApp
import
com.google.firebase.analytics.FirebaseAnalytics
import
com.google.firebase.remoteconfig.FirebaseRemoteConfig
import
com.google.firebase.remoteconfig.FirebaseRemoteConfig
import
com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat
import
com.takisoft.fix.support.v7.preference.PreferenceFragmentCompat
import
io.fabric.sdk.android.Fabric
import
io.fabric.sdk.android.Fabric
...
@@ -67,7 +65,7 @@ class App : Application() {
...
@@ -67,7 +65,7 @@ class App : Application() {
val
handler
by
lazy
{
Handler
(
Looper
.
getMainLooper
())
}
val
handler
by
lazy
{
Handler
(
Looper
.
getMainLooper
())
}
val
deviceContext
:
Context
by
lazy
{
if
(
Build
.
VERSION
.
SDK_INT
<
24
)
this
else
DeviceContext
(
this
)
}
val
deviceContext
:
Context
by
lazy
{
if
(
Build
.
VERSION
.
SDK_INT
<
24
)
this
else
DeviceContext
(
this
)
}
val
remoteConfig
:
FirebaseRemoteConfig
by
lazy
{
FirebaseRemoteConfig
.
getInstance
()
}
val
remoteConfig
:
FirebaseRemoteConfig
by
lazy
{
FirebaseRemoteConfig
.
getInstance
()
}
private
val
tracker
:
Tracker
by
lazy
{
GoogleAnalytics
.
getInstance
(
deviceContext
).
newTracker
(
R
.
xml
.
tracker
)
}
val
analytics
:
FirebaseAnalytics
by
lazy
{
FirebaseAnalytics
.
getInstance
(
deviceContext
)
}
val
info
:
PackageInfo
by
lazy
{
getPackageInfo
(
packageName
)
}
val
info
:
PackageInfo
by
lazy
{
getPackageInfo
(
packageName
)
}
val
directBootSupported
by
lazy
{
val
directBootSupported
by
lazy
{
Build
.
VERSION
.
SDK_INT
>=
24
&&
getSystemService
(
DevicePolicyManager
::
class
.
java
)
Build
.
VERSION
.
SDK_INT
>=
24
&&
getSystemService
(
DevicePolicyManager
::
class
.
java
)
...
@@ -94,13 +92,6 @@ class App : Application() {
...
@@ -94,13 +92,6 @@ class App : Application() {
return
result
return
result
}
}
// send event
fun
track
(
category
:
String
,
action
:
String
)
=
tracker
.
send
(
HitBuilders
.
EventBuilder
()
.
setCategory
(
category
)
.
setAction
(
action
)
.
setLabel
(
BuildConfig
.
VERSION_NAME
)
.
build
())
override
fun
onCreate
()
{
override
fun
onCreate
()
{
super
.
onCreate
()
super
.
onCreate
()
app
=
this
app
=
this
...
...
mobile/src/main/java/com/github/shadowsocks/MainActivity.kt
View file @
6766e4f5
...
@@ -359,7 +359,7 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
...
@@ -359,7 +359,7 @@ class MainActivity : AppCompatActivity(), ShadowsocksConnection.Interface, Drawe
DRAWER_PROFILES
->
displayFragment
(
ProfilesFragment
())
DRAWER_PROFILES
->
displayFragment
(
ProfilesFragment
())
DRAWER_GLOBAL_SETTINGS
->
displayFragment
(
GlobalSettingsFragment
())
DRAWER_GLOBAL_SETTINGS
->
displayFragment
(
GlobalSettingsFragment
())
DRAWER_ABOUT
->
{
DRAWER_ABOUT
->
{
app
.
track
(
TAG
,
"about"
)
app
.
analytics
.
logEvent
(
"about"
,
Bundle
()
)
displayFragment
(
AboutFragment
())
displayFragment
(
AboutFragment
())
}
}
DRAWER_FAQ
->
launchUrl
(
getString
(
R
.
string
.
faq_url
))
DRAWER_FAQ
->
launchUrl
(
getString
(
R
.
string
.
faq_url
))
...
...
mobile/src/main/java/com/github/shadowsocks/bg/BaseService.kt
View file @
6766e4f5
...
@@ -26,6 +26,7 @@ import android.content.Context
...
@@ -26,6 +26,7 @@ import android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.content.IntentFilter
import
android.content.IntentFilter
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.os.IBinder
import
android.os.IBinder
import
android.os.RemoteCallbackList
import
android.os.RemoteCallbackList
import
android.support.v4.os.UserManagerCompat
import
android.support.v4.os.UserManagerCompat
...
@@ -45,6 +46,7 @@ import com.github.shadowsocks.plugin.PluginManager
...
@@ -45,6 +46,7 @@ import com.github.shadowsocks.plugin.PluginManager
import
com.github.shadowsocks.plugin.PluginOptions
import
com.github.shadowsocks.plugin.PluginOptions
import
com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.utils.*
import
com.github.shadowsocks.utils.*
import
com.google.firebase.analytics.FirebaseAnalytics
import
okhttp3.FormBody
import
okhttp3.FormBody
import
okhttp3.OkHttpClient
import
okhttp3.OkHttpClient
import
okhttp3.Request
import
okhttp3.Request
...
@@ -291,7 +293,7 @@ object BaseService {
...
@@ -291,7 +293,7 @@ object BaseService {
val
data
=
data
val
data
=
data
data
.
changeState
(
STOPPING
)
data
.
changeState
(
STOPPING
)
app
.
track
(
tag
,
"stop"
)
app
.
analytics
.
logEvent
(
"stop"
,
Bundle
().
put
(
FirebaseAnalytics
.
Param
.
METHOD
,
tag
)
)
killProcesses
()
killProcesses
()
...
@@ -355,7 +357,7 @@ object BaseService {
...
@@ -355,7 +357,7 @@ object BaseService {
}
}
data
.
notification
=
createNotification
(
profile
.
formattedName
)
data
.
notification
=
createNotification
(
profile
.
formattedName
)
app
.
track
(
tag
,
"start"
)
app
.
analytics
.
logEvent
(
"start"
,
Bundle
().
put
(
FirebaseAnalytics
.
Param
.
METHOD
,
tag
)
)
data
.
changeState
(
CONNECTING
)
data
.
changeState
(
CONNECTING
)
...
...
mobile/src/main/java/com/github/shadowsocks/utils/Utils.kt
View file @
6766e4f5
...
@@ -10,6 +10,7 @@ import android.graphics.BitmapFactory
...
@@ -10,6 +10,7 @@ import android.graphics.BitmapFactory
import
android.graphics.ImageDecoder
import
android.graphics.ImageDecoder
import
android.net.Uri
import
android.net.Uri
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.support.annotation.AttrRes
import
android.support.annotation.AttrRes
import
android.support.v4.content.ContextCompat
import
android.support.v4.content.ContextCompat
import
android.support.v7.util.SortedList
import
android.support.v7.util.SortedList
...
@@ -81,4 +82,8 @@ fun printLog(t: Throwable) {
...
@@ -81,4 +82,8 @@ fun printLog(t: Throwable) {
Crashlytics
.
logException
(
t
)
Crashlytics
.
logException
(
t
)
t
.
printStackTrace
()
t
.
printStackTrace
()
}
}
fun
track
(
thread
:
Thread
,
t
:
Throwable
)
=
printLog
(
t
)
fun
Bundle
.
put
(
key
:
String
,
value
:
String
):
Bundle
{
putString
(
key
,
value
)
return
this
}
mobile/src/main/res/xml/tracker.xml
deleted
100644 → 0
View file @
ed9acb66
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Set a session timeout period of 1 week -->
<integer
name=
"ga_sessionTimeout"
>
604800
</integer>
<!-- Enable automatic Activity measurement -->
<bool
name=
"ga_autoActivityTracking"
>
true
</bool>
<!-- Enable exception reports -->
<bool
name=
"ga_reportUncaughtExceptions"
>
true
</bool>
<!-- The screen names that will appear in reports -->
<screenName
name=
"com.google.android.gms.analytics.samples.mobileplayground.ScreenviewFragment"
>
Shadowsocks ScreenView
</screenName>
<screenName
name=
"com.google.android.gms.analytics.samples.mobileplayground.EcommerceFragment"
>
Shadowsocks EcommerceView
</screenName>
<!-- The following value should be replaced with correct property id. -->
<string
name=
"ga_trackingId"
>
UA-37082941-1
</string>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment