Skip to content

Commit

Permalink
Swapping the Android Repo (#58)
Browse files Browse the repository at this point in the history
Merging in the new Hacker News android app!

Gracefully merged gradle configs and copied over the previous proguard
rules.
  • Loading branch information
Rahkeen authored Jul 9, 2024
1 parent cb26249 commit 8c0ee62
Show file tree
Hide file tree
Showing 95 changed files with 1,934 additions and 1,790 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android_emerge_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
java-version: '17'
distribution: 'adopt'
- name: Emerge size analysis
run: ./gradlew :app:emergeUploadReleasePerfBundle
run: ./gradlew :app:emergeUploadReleaseAab
env:
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
Expand Down
9 changes: 0 additions & 9 deletions android/.editorconfig

This file was deleted.

17 changes: 10 additions & 7 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
build/
*.iml
.gradle

/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx

/local.properties
local.properties

.idea/
*.iml
1 change: 1 addition & 0 deletions android/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
97 changes: 48 additions & 49 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.emerge)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.compose.compiler)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.emerge)
}

android {
compileSdk = 34
namespace = "com.emergetools.hackernews"
compileSdk = 34

defaultConfig {
applicationId = "com.emergetools.hackernews"
minSdk = 24
minSdk = 30
targetSdk = 34
versionCode = 1
versionName = "1.0"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}

buildTypes {
debug {
isDebuggable = true
applicationIdSuffix = ".debug"
}
release {
isMinifyEnabled = true
isShrinkResources = true
Expand All @@ -28,9 +36,6 @@ android {
)
signingConfig = signingConfigs.getByName("debug")
}
debug {
applicationIdSuffix = ".debug"
}
}
buildFeatures {
compose = true
Expand All @@ -43,61 +48,55 @@ android {
jvmTarget = JavaVersion.VERSION_17.toString()
}
composeOptions {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.extension.get()
}
}

emerge {
// apiToken is implicitly set from the EMERGE_API_TOKEN environment variable

performance {
projectPath.set(":performance")
kotlinCompilerExtensionVersion = libs.versions.composeCompilerExtension.get()
}
emerge {
snapshots {
tag.set("snapshot")
}

snapshots {
tag.set("snapshot")
vcs {
gitHub {
repoName.set("hackernews")
repoOwner.set("EmergeTools")
}
}
}

vcs {
gitHub {
repoName.set("hackernews")
repoOwner.set("EmergeTools")
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}

dependencies {

implementation(libs.accompanist.navigationanim)
implementation(libs.accompanist.webview)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.viewmodel)
implementation(libs.androidx.navigation)
implementation(libs.androidx.activity.compose)
implementation(libs.emerge.snapshots.annotations)
implementation(libs.androidx.datastore.preferences)
implementation(libs.kotlinx.serialization)
implementation(libs.material.core)
implementation(libs.material.compose.core)
implementation(libs.material.compose.icons)
implementation(libs.mavericks.compose)
implementation(libs.navigation.compose.core)
implementation(libs.navigation.compose.ktx)
implementation(libs.okhttp)
implementation(libs.retrofit.core)
implementation(libs.retrofit.serialization)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
implementation(libs.androidx.browser)

implementation(platform(libs.compose.bom))
implementation(libs.compose.ui.tooling)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.okhttp)
implementation(libs.retrofit)
implementation(libs.retrofit.kotlinx.serialization)
implementation(libs.kotlinx.serialization.json)

debugImplementation(libs.compose.ui.test.manifest)
implementation(libs.accompanist.webview)

testImplementation(libs.junit)

androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
androidTestImplementation(libs.emerge.snapshots)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.androidx.core)
androidTestImplementation(libs.androidx.fragment)
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.rules)
}

debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
2 changes: 1 addition & 1 deletion android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@

-keep class okio.** { *; }

-dontobfuscate
-dontobfuscate

This file was deleted.

This file was deleted.

71 changes: 30 additions & 41 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:name="com.emergetools.hackernews.HNApplication"
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.HackerNews">

<activity
android:name="com.emergetools.hackernews.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

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

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

<data
android:host="news.ycombinator.com"
android:scheme="yc" />
</intent-filter>
</activity>

<profileable android:shell="true" />

</application>

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

</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

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

<application
android:name="com.emergetools.HackerNewsApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.HackerNews"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name"
android:theme="@style/Theme.HackerNews">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

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

</manifest>
22 changes: 22 additions & 0 deletions android/app/src/main/java/com/emergetools/HackerNewsApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.emergetools

import android.app.Application
import android.content.Context
import com.emergetools.hackernews.data.HackerNewsBaseClient
import com.emergetools.hackernews.data.HackerNewsSearchClient
import kotlinx.serialization.json.Json

class HackerNewsApplication: Application() {
private val json = Json { ignoreUnknownKeys = true }

val baseClient = HackerNewsBaseClient(json)
val searchClient = HackerNewsSearchClient(json)
}

fun Context.baseClient(): HackerNewsBaseClient {
return (this.applicationContext as HackerNewsApplication).baseClient
}

fun Context.searchClient(): HackerNewsSearchClient {
return (this.applicationContext as HackerNewsApplication).searchClient
}
Loading

0 comments on commit 8c0ee62

Please sign in to comment.