1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-09-19 15:11:42 +02:00

Fix useragent update (#845)

* Test windows user agent

* Update dependencies

* Update KAU

* Switch back user agent and use android base

* Fix lint issues

* Fix lint part 2

* Test messenger user agent

* Update bugsnag release levels
This commit is contained in:
Allan Wang 2018-04-07 14:41:28 -04:00 committed by GitHub
parent 7c1671f343
commit 6943976bf1
12 changed files with 43 additions and 63 deletions

View File

@ -5,7 +5,7 @@ android:
components:
- tools
- platform-tools
- build-tools-27.0.2
- build-tools-27.0.3
- android-27
- extra-android-support
- extra-android-m2repository

View File

@ -1,27 +1,8 @@
plugins {
id 'com.gladed.androidgitversion' version '0.4.3'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.github.triplet.play'
apply plugin: 'com.getkeepsafe.dexcount'
def withPlaySigning = file('../files/gplay-keys.json').exists()
/*
* Feel free to check the gitignore under the files/ folder to see what is required for the signing
* It is assumed that if one of those files exist, all remaining ones exist as well
*/
if (withPlaySigning)
play {
jsonFile = file('../files/gplay-keys.json')
track = 'alpha'
errorOnSizeLimit = true
uploadImages = false
untrackOld = true
}
apply plugin: 'com.gladed.androidgitversion'
android {
compileSdkVersion kau.targetSdk
@ -64,18 +45,6 @@ android {
signingConfigs {
if (withPlaySigning) {
def releaseProps = new Properties()
file("../files/play.properties").withInputStream { releaseProps.load(it) }
release {
storeFile file("../files/play.keystore")
storePassword releaseProps.getProperty('storePassword')
keyAlias releaseProps.getProperty('keyAlias')
keyPassword releaseProps.getProperty('keyPassword')
}
}
debug {
storeFile file("../files/debug.keystore")
storePassword "debugKey"
@ -89,6 +58,7 @@ android {
keyAlias "testKey"
keyPassword "testkey"
}
}
buildTypes {
@ -116,7 +86,6 @@ android {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (withPlaySigning) signingConfig signingConfigs.release
resValue "string", "frost_name", "Frost"
resValue "string", "frost_web", "Frost Web"
}
@ -137,7 +106,6 @@ repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
@ -178,7 +146,9 @@ dependencies {
implementation"com.mikepenz:fastadapter-extensions:${kau.fastAdapter}@aar"
//noinspection GradleDependency
implementation "com.github.bumptech.glide:okhttp3-integration:${kau.glide}"
//noinspection GradleDependency
kapt "com.github.bumptech.glide:compiler:${kau.glide}"
implementation "com.fasterxml.jackson.core:jackson-databind:2.9.3"

View File

@ -68,10 +68,18 @@ class FrostApp : Application() {
// refWatcher = LeakCanary.install(this)
if (!BuildConfig.DEBUG) {
Bugsnag.init(this)
Bugsnag.setAutoCaptureSessions(true)
Bugsnag.getClient().setUserId(Prefs.frostId)
val releaseStage = setOf("production", "releaseTest", "github", "release")
Bugsnag.setNotifyReleaseStages(*releaseStage.toTypedArray(), "unnamed")
val versionSegments = BuildConfig.VERSION_NAME.split("_")
if (versionSegments.size > 1) {
Bugsnag.setAppVersion(versionSegments.first())
Bugsnag.setReleaseStage(if (versionSegments.last() in releaseStage) versionSegments.last()
else "unnamed")
Bugsnag.setUserName(BuildConfig.VERSION_NAME)
}
// setUser("userId", "user@email.com", "User Name")
Bugsnag.setAutoCaptureSessions(true)
Bugsnag.setUserId(Prefs.frostId)
}
KL.shouldLog = { BuildConfig.DEBUG }
Prefs.verboseLogging = false

View File

@ -52,7 +52,7 @@ import com.pitchedapps.frost.dbflow.loadFbTabs
import com.pitchedapps.frost.enums.MainActivityLayout
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.FbItem
import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL
import com.pitchedapps.frost.facebook.profilePictureUrl
import com.pitchedapps.frost.fragments.BaseFragment
import com.pitchedapps.frost.fragments.WebFragment
import com.pitchedapps.frost.parsers.FrostSearch
@ -191,7 +191,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
selectionSecondLineShown = false
cookies().forEach { (id, name) ->
profile(name = name ?: "") {
iconUrl = PROFILE_PICTURE_URL(id)
iconUrl = profilePictureUrl(id)
textColor = Prefs.textColor.toLong()
selectedTextColor = Prefs.textColor.toLong()
selectedColor = 0x00000001.toLong()

View File

@ -20,7 +20,7 @@ import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.dbflow.fetchUsername
import com.pitchedapps.frost.dbflow.loadFbCookiesAsync
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL
import com.pitchedapps.frost.facebook.profilePictureUrl
import com.pitchedapps.frost.glide.FrostGlide
import com.pitchedapps.frost.glide.GlideApp
import com.pitchedapps.frost.glide.transform
@ -110,7 +110,7 @@ class LoginActivity : BaseActivity() {
private fun loadProfile(id: Long) {
profileLoader.load(PROFILE_PICTURE_URL(id))
profileLoader.load(profilePictureUrl(id))
.transform(FrostGlide.roundCorner).listener(object : RequestListener<Drawable> {
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
profileSubject.onSuccess(true)

View File

@ -54,7 +54,7 @@ enum class OverlayContext(private val menuItem: FrostMenuItem?) : EnumBundle<Ove
class FrostMenuItem(
val id: Int,
val fbItem: FbItem,
val showAsAction: Int = MenuItem.SHOW_AS_ACTION_ALWAYS) {
val showAsAction: Int = MenuItem.SHOW_AS_ACTION_IF_ROOM) {
fun addToMenu(context: Context, menu: Menu, index: Int) {
val item = menu.add(Menu.NONE, id, index, fbItem.titleId)
item.icon = fbItem.icon.toDrawable(context, 18)

View File

@ -8,12 +8,13 @@ const val FACEBOOK_COM = "facebook.com"
const val FBCDN_NET = "fbcdn.net"
const val HTTPS_FACEBOOK_COM = "https://$FACEBOOK_COM"
const val FB_URL_BASE = "https://m.$FACEBOOK_COM/"
fun PROFILE_PICTURE_URL(id: Long) = "https://graph.facebook.com/$id/picture?type=large"
fun profilePictureUrl(id: Long) = "https://graph.facebook.com/$id/picture?type=large"
const val FB_LOGIN_URL = "${FB_URL_BASE}login"
const val USER_AGENT_FULL = "Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-G900T Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36"
const val USER_AGENT_BASIC = "Mozilla/5.0 (BB10; Kbd) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.1.0.4633 Mobile Safari/537.10+"
const val USER_AGENT_BASIC_OLD = "Mozilla/5.0 (Linux; Android 6.0) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.1.0.4633 Mobile Safari/537.10+"
const val USER_AGENT_MESSENGER = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"
const val USER_AGENT_BASIC = USER_AGENT_MESSENGER
/**
* Animation transition delay, just to ensure that the styles

View File

@ -14,7 +14,7 @@ import com.bumptech.glide.request.target.Target
import com.mikepenz.google_material_typeface_library.GoogleMaterial
import com.pitchedapps.frost.R
import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL
import com.pitchedapps.frost.facebook.profilePictureUrl
import com.pitchedapps.frost.glide.FrostGlide
import com.pitchedapps.frost.glide.GlideApp
import com.pitchedapps.frost.utils.Prefs
@ -32,7 +32,7 @@ class AccountItem(val cookie: CookieModel?) : KauIItem<AccountItem, AccountItem.
text.setTextColor(Prefs.textColor)
if (cookie != null) {
text.text = cookie.name
GlideApp.with(itemView).load(PROFILE_PICTURE_URL(cookie.id))
GlideApp.with(itemView).load(profilePictureUrl(cookie.id))
.transform(FrostGlide.roundCorner).listener(object : RequestListener<Drawable> {
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
text.fadeIn()

View File

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/frame_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" />
android:fitsSystemWindows="true"
tools:ignore="MergeRootFrame" />

View File

@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:ignore="MergeRootFrame">
<View
android:id="@+id/pseudo_toolbar"

View File

@ -1,25 +1,21 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "ca.allanwang:kau:${KAU}"
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.android.tools.build:gradle:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN}"
classpath "com.bugsnag:bugsnag-android-gradle-plugin:${BUGSNAG_PLUGIN}"
classpath 'com.github.triplet.gradle:play-publisher:1.2.0'
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.2'
}
wrapper {
distributionType = "all"
classpath "com.getkeepsafe.dexcount:dexcount-gradle-plugin:${DEX_PLUGIN}"
classpath "gradle.plugin.com.gladed.gradle.androidgitversion:gradle-android-git-version:${GIT_PLUGIN}"
}
wrapper.setDistributionType(Wrapper.DistributionType.ALL)
}
apply plugin: 'ca.allanwang.kau'

View File

@ -14,20 +14,21 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
APP_ID=Frost
APP_GROUP=com.pitchedapps
KAU=e97db5c
KOTLIN=1.2.30
KAU=b3a4e35
KOTLIN=1.2.31
BUGSNAG=4.3.2
BUGSNAG_PLUGIN=3.2.5
DEX_PLUGIN=0.8.2
GIT_PLUGIN=0.4.3
COMMONS_TEXT=1.2
CRASHLYTICS=2.9.1
DBFLOW=4.2.4
EXOMEDIA=4.1.0
JSOUP=1.11.2
LEAK_CANARY=1.5.4
MATERIAL_DRAWER_KT=1.3.3
OKHTTP=3.10.0
PAPER_PARCEL=2.0.4
PAPER_PARCEL=2.0.5
ROBOELECTRIC=3.4
RX_ANDROID=2.0.2
RX_BINDING=2.0.0