Skip to content

Commit

Permalink
v1.0.0 to v2.0.0 (Fixes #1, #2, Reference #3)
Browse files Browse the repository at this point in the history
* Massive changes to codebase- many new features added

* Added a custom fork of fontize library to manage fonts.

* Users can now choose default font for the app, change background colors and text colors as per their preference.

* Fixed many bugs

* Stability fixes
  • Loading branch information
gouravkhunger authored Oct 31, 2021
1 parent ceb0db1 commit d3e0ff3
Show file tree
Hide file tree
Showing 70 changed files with 1,467 additions and 244 deletions.
46 changes: 6 additions & 40 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.DS_Store

# Built application files
*.apk
*.aar
*.ap_
*.aab

# Files for the ART/Dalvik VM
*.dex
Expand All @@ -14,11 +14,8 @@
bin/
gen/
out/
# Uncomment the following line in case you need and you don't have the release build type files in your app
release/

# Gradle files
gradle.properties
.gradle/
build/

Expand All @@ -37,51 +34,20 @@ proguard/
# Android Studio captures folder
captures/

# IntelliJ
# Intellij
*.iml
.idea/
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/assetWizardSettings.xml
.idea/dictionaries
.idea/libraries
# Android Studio 3 in .gitignore file.
.idea/caches
.idea/modules.xml
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
.idea/navEditor.xml
.idea

# Keystore files
# Uncomment the following lines if you do not want to check your keystore files in.
#*.jks
#*.keystore
*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
.cxx/

# Google Services (e.g. APIs or Firebase)
google-services.json

# Freeline
freeline.py
freeline/
freeline_project_description.json

# fastlane
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
fastlane/readme.md

# Version control
vcs.xml

# lint
lint/intermediates/
lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/
freeline_project_description.json
24 changes: 17 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ plugins {
}

android {
compileSdk 30
compileSdk 31

defaultConfig {
applicationId "com.github.gouravkhunger.jekyllex"
minSdk 23
targetSdk 30
versionCode 1
versionName "1.0.0"
targetSdk 31
versionCode 2
versionName "2.0.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand Down Expand Up @@ -56,21 +56,22 @@ configurations.all {
dependencies {

// Core Dependencies
implementation "androidx.core:core-ktx:1.6.0"
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.appcompat:appcompat:1.3.1"
implementation "com.google.android.material:material:1.4.0"

// Architectural Components
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"

// Glide
implementation "com.github.bumptech.glide:glide:4.12.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation 'androidx.preference:preference-ktx:1.1.1'
annotationProcessor "com.github.bumptech.glide:compiler:4.12.0"

// Auth0
implementation "com.auth0.android:auth0:2.4.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.1"

// Retrofit
implementation "com.squareup.retrofit2:retrofit:2.9.0"
Expand All @@ -82,6 +83,9 @@ dependencies {
implementation "androidx.room:room-runtime:2.3.0"
kapt "androidx.room:room-compiler:2.3.0"

// needed to run room database on m1 macs
kapt "org.xerial:sqlite-jdbc:3.34.0"

// Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:2.3.0"

Expand All @@ -91,6 +95,12 @@ dependencies {
// App Updater
implementation "com.github.javiersantos:AppUpdater:2.7"

// Fontize
implementation project(":fontize")

// Colour Picker
implementation "io.github.vadiole:colorpicker:1.0.2"

// Markwon
final def markwon_version = "4.6.2"
implementation "io.noties.markwon:core:$markwon_version"
Expand Down
18 changes: 14 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,31 @@
android:theme="@style/SplashScreenTheme"
tools:replace="android:allowBackup">

<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="@string/app_name" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notification" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@android:color/transparent" />

<activity
android:name=".ui.settings.SettingsActivity"
android:exported="false"
android:parentActivityName=".ui.home.HomeActivity" />
<activity
android:name=".ui.content.ContentActivity"
android:label=""
android:exported="true" />
<activity
android:name=".ui.posts.PostsActivity"
android:label=""
android:parentActivityName=".ui.home.HomeActivity" />
<activity
android:name=".ui.editor.MarkdownEditor"
android:label=""
android:parentActivityName=".ui.posts.PostsActivity" />
<activity
android:name=".ui.profile.ProfileActivity"
android:label=""
android:parentActivityName=".ui.home.HomeActivity" />
<activity
android:name=".ui.home.HomeActivity"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ import retrofit2.http.Header
import retrofit2.http.Headers
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

interface GithubApi {
// Function to get all the repositories owned by a user.
@GET("/user/repos")
@GET("/user/repos?sort=full_name")
suspend fun getUserRepositories(
@Query("page", encoded = true) page: Int,
@Query("per_page", encoded = true) per_page: Int,
@Header("Authorization") accessToken: String
): Response<RepoModel>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import com.github.gouravkhunger.jekyllex.models.user.UserModel
// Database configurations
@Database(
entities = [UserModel::class],
version = 1
version = 2
)
@TypeConverters(IdentityConverter::class)
abstract class UserDataBase : RoomDatabase() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import com.github.gouravkhunger.jekyllex.models.CommitModel
class GithubContentRepository {

// Function to get a user's repositories from Github Api.
suspend fun getUserRepositories(accessToken: String) =
GithubApiInstance.api.getUserRepositories(accessToken)
suspend fun getUserRepositories(page: Int, per_page: Int, accessToken: String) =
GithubApiInstance.api.getUserRepositories(page, per_page, accessToken)

// Function to get content from a github repository at a specified folder (path)
suspend fun getRepoContent(repoName: String, path: String, accessToken: String) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import com.auth0.android.provider.WebAuthProvider
import com.auth0.android.provider.WebAuthProvider.resume
import com.auth0.android.result.Credentials
import com.auth0.android.result.UserProfile
import com.github.gouravkhunger.fontize.Fontize
import com.github.gouravkhunger.jekyllex.BuildConfig
import com.github.gouravkhunger.jekyllex.R
import com.github.gouravkhunger.jekyllex.databinding.ActivityAuthBinding
Expand All @@ -52,6 +53,10 @@ import com.github.gouravkhunger.jekyllex.db.userdb.UserDataBase
import com.github.gouravkhunger.jekyllex.repositories.UserRepository
import com.github.gouravkhunger.jekyllex.ui.home.HomeActivity
import com.github.gouravkhunger.jekyllex.util.preActivityStartChecks
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch

class AuthActivity : AppCompatActivity() {

Expand All @@ -66,6 +71,9 @@ class AuthActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

// Initialize Fontize
Fontize(this).setDefaultFont(R.font.josefinsans)

// initialise the view bindings required for this class
authBinding = ActivityAuthBinding.inflate(layoutInflater)
noInternetBinding = OtherNoInternetBinding.inflate(layoutInflater)
Expand Down Expand Up @@ -95,7 +103,7 @@ class AuthActivity : AppCompatActivity() {

val userRepository = UserRepository(UserDataBase(this))
val factory = AuthViewModelFactory(userRepository)
viewModel = ViewModelProvider(this, factory).get(AuthViewModel::class.java)
viewModel = ViewModelProvider(this, factory)[AuthViewModel::class.java]

account = Auth0(
BuildConfig.Auth0ClientId,
Expand Down Expand Up @@ -172,6 +180,13 @@ class AuthActivity : AppCompatActivity() {
goToHome()
}
})

// workaround to apply icon tint to login button
// after 100ms as it is not detected on inflation
CoroutineScope(context = Dispatchers.Main).launch {
delay(100)
authBinding.loginBtn.changeDrawableTint(true)
}
}

// Function to extract saved credentials frm auth0 client
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AuthViewModelFactory(
private val repository: UserRepository
) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return AuthViewModel(repository) as T
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ class ContentActivity : AppCompatActivity() {
setContentView(contentBinding.root)
setSupportActionBar(contentBinding.toolbarContent)
supportActionBar?.setHomeButtonEnabled(true)
supportActionBar?.setDisplayShowTitleEnabled(false)
contentBinding.toolbarContent.setNavigationIcon(R.drawable.ic_back)
contentBinding.toolbarContent.setNavigationOnClickListener {
onBackPressed()
}
contentBinding.toolbarContent.applyFont()

// if there is some data passed to this activity,
// try extracting the id of the content to be shown.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ class EditorViewModel(
}
}

fun setOriginalText(original: String) {
originalContent.postValue(original)
}

// save Meta-data for the current post
fun saveMetaData(data: String) {
postMetaData.postValue(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class EditorViewModelFactory(
private val repository: GithubContentRepository
) : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
override fun <T : ViewModel> create(modelClass: Class<T>): T {
return EditorViewModel(repository) as T
}
}
Loading

0 comments on commit d3e0ff3

Please sign in to comment.