Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Dev #2

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions .idea/androidTestResultsUserPreferences.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .idea/deploymentTargetDropDown.xml

This file was deleted.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# *CoolbbsYou*
项目使用了Jetpack Compose Ui框架,MVI架构编写的第三方酷安。

## dev分支提交内容说明
### 23.09.24-19:10
#### 插件更新
1. compose bom version 23.8.0 -> 23.9.0;
2. kotlin version 1.8.10 -> 1.9.0;
3. compose version 1.4.3 -> 1.5.1;
4. ksp version -> 1.9.0-1.0.13;
#### 功能改进
1. 重构部分功能;
#### 错误修复
1. 修复当首页头条为游戏推广动态时,“extra_type”字段格式类型错误,Gson转换抛出异常导致的闪退;

## 声明
1. 本项目属于个人学习项目,仅用于学习和测试,切勿滥用,切勿滥用,切勿滥用。
2. 使用本项目中造成的不良影响及后果与本人无关。
Expand Down
23 changes: 18 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
alias(libs.plugins.ksp)
}

android {
namespace = "com.anpe.coolbbsyou"
compileSdk = 33
compileSdk = 34

defaultConfig {
applicationId = "com.anpe.coolbbsyou"
minSdk = 26
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "0.23.0726"
versionName = "0.23.11141"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand All @@ -37,11 +38,14 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
kotlin {
jvmToolchain(8)
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.3"
kotlinCompilerExtensionVersion = "1.5.1" // previous version 1.4.3
}
packaging {
resources {
Expand All @@ -59,6 +63,7 @@ dependencies {
implementation(libs.ui.graphics)
implementation(libs.ui.tooling.preview)
implementation(libs.material3)
implementation(libs.windowsSizeClass)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.espresso.core)
Expand All @@ -72,14 +77,22 @@ dependencies {
implementation(libs.navigation.compose)
implementation(libs.accompanist.swiperefresh)
implementation(libs.accompanist.systemuicontroller)
implementation(libs.accompanist.adaptive)
implementation(libs.gson)
implementation(libs.coil.compose)
implementation(libs.coil.gif)
implementation(libs.retrofit)
implementation(libs.converter.gson)
implementation(libs.richtext.ui.material3)
implementation(libs.converter.moshi)
implementation(libs.material)
implementation(libs.paging.runtime)
implementation(libs.paging.compose)
implementation(libs.jbcrypt)
implementation(libs.jsoup)
implementation(libs.room.runtime)
implementation(libs.room.ktx)
implementation(libs.moshi.kotlin)

ksp(libs.room.compiler)
ksp(libs.moshi.kotlin.codegen)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.anpe.coolbbsyou

import android.os.Build
import android.provider.Settings
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

Expand Down
46 changes: 44 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name=".util.MyApplication"
Expand All @@ -20,13 +20,55 @@
<activity
android:name=".ui.main.MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.CoolbbsYou">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="market" />
</intent-filter>

<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="coolmarket" android:host="feed" android:pathPattern="/.*" />

<data android:scheme="coolmarket" android:pathPattern="/.*" />

<data android:scheme="coolmarket" android:host="com.coolapk.com" android:pathPattern="/.*" />

<data android:scheme="coolmarket" android:host="www.coolapk.com" android:pathPattern="/.*" />

<data android:scheme="http" android:host="coolapk.com" android:pathPattern="/" />

<data android:scheme="http" android:host="coolapk.com" android:pathPattern="/feed/.*" />

<data android:scheme="http" android:host="www.coolapk.com" android:pathPattern="/" />

<data android:scheme="http" android:host="www.coolapk.com" android:pathPattern="/feed/.*" />

<data android:scheme="https" android:host="coolapk.com" android:pathPattern="/" />

<data android:scheme="https" android:host="coolapk.com" android:pathPattern="/feed/.*" />

<data android:scheme="https" android:host="www.coolapk.com" android:pathPattern="/" />

<data android:scheme="https" android:host="www.coolapk.com" android:pathPattern="/feed/.*" />

<data android:scheme="intent" android:host="www.coolapk.com" android:path="/feed/.*" />
</intent-filter>
</activity>
</application>

Expand Down
23 changes: 20 additions & 3 deletions app/src/main/java/com/anpe/coolbbsyou/constant/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
package com.anpe.coolbbsyou.constant

object Constants {
const val USER_AGENT ="Dalvik/2.1.0 (Linux; U; Android 7.1.2; SM-G977N Build/LMY48Z) (#Build; samsung; SM-G977N; beyond1qlteue-user 7.1.2 LMY48Z 701230529 release-keys; 7.1.2) +CoolMarket/13.3.1-2307121-universal"
const val USER_AGENT_KEY = "User-Agent"
const val USER_AGENT_VALUE = "Dalvik/2.1.0 (Linux; U; Android 7.1.2; SM-G977N Build/LMY48Z) (#Build; samsung; SM-G977N; beyond1qlteue-user 7.1.2 LMY48Z 701230529 release-keys; 7.1.2) +CoolMarket/13.3.1-2307121-universal"
const val USER_AGENT_VALUE_BAK = "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Mobile Safari/537.36 Edg/117.0.2045.40"

const val APP_LABEL = "token://com.coolapk.market/dcf01e569c1e3db93a3d0fcf191a622c"
const val APP_ID = "com.coolapk.market"
const val REQUEST_WIDTH = "XMLHttpRequest"

const val REQUEST_WIDTH_KEY = "X-Requested-With"
const val APP_ID_KEY = "X-App-Id"
const val APP_ID_VALUE = "com.coolapk.market"
const val REQUEST_WIDTH_VALUE = "XMLHttpRequest"
const val DEVICE_CODE_KEY = "X-App-Device"
const val DEVICE_TOKEN_KEY = "X-App-Token"
const val APP_CODE_KEY = "X-App-Code"

const val APP_CODE_VALUE = "2301171"

const val HEADER_REQUEST_WIDTH = "X-Requested-With: $REQUEST_WIDTH_VALUE"
const val HEADER_APP_ID = "X-App-Id: $APP_ID_VALUE"

const val CONFIG_PREFS = "Config_Prefs"
const val USER_INFO_PREFS = "User_Info_Prefs"
const val COOKIE_PREFS = "Cookies_Prefs"
}
25 changes: 25 additions & 0 deletions app/src/main/java/com/anpe/coolbbsyou/data/dao/CookieDao.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.anpe.coolbbsyou.data.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Query
import androidx.room.Upsert
import com.anpe.coolbbsyou.data.entity.cookie.CookieEntity

@Dao
interface CookieDao {
@Upsert
fun upsert(vararg cookieEntity: CookieEntity)

@Delete
fun delete(vararg cookieEntity: CookieEntity): Int

@Query("DELETE FROM cookie_table")
fun deleteAll(): Int

@Query("SELECT * FROM cookie_table")
fun getAll(): List<CookieEntity>

@Query("SELECT * FROM cookie_table WHERE domain=:host")
fun find(host: String): List<CookieEntity>
}
23 changes: 23 additions & 0 deletions app/src/main/java/com/anpe/coolbbsyou/data/dao/DeviceDao.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.anpe.coolbbsyou.data.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Query
import androidx.room.Upsert
import com.anpe.coolbbsyou.data.entity.device.DeviceEntity
import kotlinx.coroutines.flow.Flow

@Dao
interface DeviceDao {
@Upsert
fun upsert(vararg device: DeviceEntity)

@Delete
fun delete(vararg device: DeviceEntity)

@Query("DELETE FROM device_info")
fun deleteAll()

@Query("SELECT * FROM device_info")
fun getDeviceAll(): Flow<List<DeviceEntity>>
}
23 changes: 23 additions & 0 deletions app/src/main/java/com/anpe/coolbbsyou/data/dao/LaterDao.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.anpe.coolbbsyou.data.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Query
import androidx.room.Upsert
import com.anpe.coolbbsyou.data.entity.later.LaterEntity
import kotlinx.coroutines.flow.Flow

@Dao
interface LaterDao {
@Upsert
fun upsertLater(vararg laterEntity: LaterEntity)

@Delete
fun deleteLater(vararg laterEntity: LaterEntity)

@Query("DELETE FROM later_table")
fun deleteAllLater()

@Query("SELECT * FROM later_table")
fun getAllLater(): Flow<List<LaterEntity>>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.anpe.coolbbsyou.data.database

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.anpe.coolbbsyou.data.dao.LaterDao
import com.anpe.coolbbsyou.data.entity.later.LaterEntity

@Database(entities = [LaterEntity::class], version = 1, exportSchema = false)
abstract class LaterDatabase: RoomDatabase() {
companion object {
private var instance: LaterDatabase? = null

@Synchronized
fun getDatabase(context: Context): LaterDatabase {
if (instance == null) {
instance = Room.databaseBuilder(
context = context,
klass = LaterDatabase::class.java,
name = "later_database"
).build()
}

return instance as LaterDatabase
}
}

abstract fun getLaterDao(): LaterDao
}
Loading