Skip to content

Commit

Permalink
feat: direct download.
Browse files Browse the repository at this point in the history
fix: Instagram Not working
fix: Add pagination for HistoryFragment
  • Loading branch information
Udhayarajan committed Jul 27, 2023
1 parent 2886a49 commit 22153be
Show file tree
Hide file tree
Showing 27 changed files with 765 additions and 560 deletions.
2 changes: 1 addition & 1 deletion .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.

3 changes: 3 additions & 0 deletions .idea/misc.xml

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

47 changes: 24 additions & 23 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ plugins {
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'kotlin-android'

id 'kotlinx-serialization'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}

android {
compileSdkVersion 33
compileSdkVersion 34
buildToolsVersion "30.0.3"

lintOptions {
Expand All @@ -24,8 +26,8 @@ android {
applicationId "com.mugames.vidsnap"
minSdkVersion 21
targetSdkVersion 33
versionCode 13
versionName "6.1.0"
versionCode 14
versionName "6.1.1"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down Expand Up @@ -76,21 +78,24 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics'

implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.activity:activity-ktx:1.6.1"
implementation "androidx.fragment:fragment-ktx:1.5.5"
implementation 'com.google.android.material:material:1.8.0'
implementation "androidx.activity:activity-ktx:1.7.2"
implementation "androidx.fragment:fragment-ktx:1.6.0"
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.3.0'

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core-ktx:1.10.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"

implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'com.google.firebase:firebase-config:'
implementation 'com.google.firebase:firebase-database:20.1.0'
implementation 'com.google.firebase:firebase-database:20.2.2'

// Ktor
implementation 'io.ktor:ktor-client-android:2.3.1'

//Fetch
implementation "androidx.tonyodev.fetch2okhttp:xfetch2okhttp:3.1.6"
Expand All @@ -106,7 +111,8 @@ dependencies {
implementation 'androidx.browser:browser:1.5.0'

//FCM
implementation 'com.google.firebase:firebase-messaging-ktx:23.1.2'
implementation 'com.google.firebase:firebase-messaging-ktx:23.2.0'
implementation 'androidx.core:core-ktx:+'

annotationProcessor 'com.github.bumptech.glide:compiler:4.13.1'

Expand All @@ -118,18 +124,13 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'


implementation 'androidx.paging:paging-runtime-ktx:3.1.1'
//Room
def room_version = "2.5.0"
def room_version = "2.6.0-alpha02"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
// optional - RxJava2 support for Room
implementation "androidx.room:room-rxjava2:$room_version"
// optional - RxJava3 support for Room
implementation "androidx.room:room-rxjava3:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation "androidx.room:room-guava:$room_version"
// optional - Test helpers
testImplementation "androidx.room:room-testing:$room_version"
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"


//LeakCanary
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
Expand All @@ -143,7 +144,7 @@ dependencies {
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'

//VidSnapKit
implementation 'io.github.udhayarajan:VidSnapKit:4.0.3'
implementation 'io.github.udhayarajan:VidSnapKit:5.6.13'


}
1 change: 1 addition & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@
-dontwarn org.osgi.framework.BundleContext
-dontwarn org.osgi.framework.FrameworkUtil
-dontwarn org.osgi.framework.ServiceReference
-dontwarn org.slf4j.impl.StaticLoggerBinder
87 changes: 0 additions & 87 deletions app/src/main/java/com/mugames/vidsnap/database/History.java

This file was deleted.

92 changes: 92 additions & 0 deletions app/src/main/java/com/mugames/vidsnap/database/History.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/*
* This file is part of VidSnap.
*
* VidSnap is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* VidSnap is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with VidSnap. If not, see <https://www.gnu.org/licenses/>.
*/
package com.mugames.vidsnap.database

import android.net.Uri
import android.text.format.DateFormat
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
import androidx.room.TypeConverters
import com.mugames.vidsnap.utility.UtilityClass
import com.mugames.vidsnap.utility.bundles.DownloadDetails
import java.util.Date

@Entity(tableName = "HISTORY")
@TypeConverters(DateConverter::class)
class History {
@JvmField
@PrimaryKey(autoGenerate = true)
var id = 0
@JvmField
var fileName: String? = null
@JvmField
var fileType: String? = null
@JvmField
var source: String? = null
@JvmField
var date: Date? = null
@JvmField
var size: String? = null
@JvmField
var uriString: String? = null
@JvmField
var image: String? = null

@JvmField
@ColumnInfo(name = "source_url")
var sourceUrl: String? = null

constructor() {}
constructor(details: DownloadDetails, uri: Uri) {
fileName = details.fileName
fileType = details.fileType
source = details.src
date = DateConverter.toDate(Date().time)
size = details.videoSize.toString()
uriString = uri.toString()
sourceUrl = details.srcUrl
image = UtilityClass.bitmapToString(details.thumbNail)
}

val uri: Uri
get() = Uri.parse(uriString)

fun getDate(): String {
return DateFormat.format("dd-MM-yyyy", date) as String
}

override fun equals(o: Any?): Boolean {
if (this === o) return true
if (o == null || javaClass != o.javaClass) return false
val history = o as History
return fileName == history.fileName && fileType == history.fileType && source == history.source && date == history.date && size == history.size && uriString == history.uriString && image == history.image && sourceUrl == history.sourceUrl
}

override fun hashCode(): Int {
var result = id
result = 31 * result + (fileName?.hashCode() ?: 0)
result = 31 * result + (fileType?.hashCode() ?: 0)
result = 31 * result + (source?.hashCode() ?: 0)
result = 31 * result + (date?.hashCode() ?: 0)
result = 31 * result + (size?.hashCode() ?: 0)
result = 31 * result + (uriString?.hashCode() ?: 0)
result = 31 * result + (image?.hashCode() ?: 0)
result = 31 * result + (sourceUrl?.hashCode() ?: 0)
return result
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,28 @@
* You should have received a copy of the GNU General Public License
* along with VidSnap. If not, see <https://www.gnu.org/licenses/>.
*/
package com.mugames.vidsnap.database

package com.mugames.vidsnap.database;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import java.util.List;
import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query

@Dao
public interface HistoryDao {

interface HistoryDao {
@Insert
void insertItem(History history);
fun insertItem(history: History)

@Query("DELETE FROM HISTORY")
void deleteTable();

@Query("SELECT * from HISTORY ORDER BY date DESC")
LiveData<List<History>> getAllValues();
fun deleteTable()

@Query("SELECT COUNT(1) FROM HISTORY")
LiveData<Boolean> isEntryAvailable();
fun isEntryAvailable(): LiveData<Boolean?>?

@Query("SELECT * from HISTORY ORDER BY date DESC LIMIT :limit OFFSET :offset")
suspend fun paginatedHistory(limit: Int, offset: Int): List<History>?

@Delete
void removeItem(History history);
}
fun removeItem(history: History)
}
Loading

0 comments on commit 22153be

Please sign in to comment.