Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
mezhendosina committed Nov 29, 2023
2 parents e60969c + dbc109a commit dd1fcfc
Show file tree
Hide file tree
Showing 162 changed files with 1,905 additions and 1,377 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
README.md in progress...
README.md in progress...
3 changes: 2 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Исправление багов
- Исправление багов
- Ренейминг: теперь не SGO app, а че задали :)
42 changes: 36 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,30 @@ plugins {
id 'com.google.firebase.firebase-perf'
id 'com.google.firebase.crashlytics'

// id "kotlin-kapt"
id 'kotlin-kapt'
id 'com.google.dagger.hilt.android'
}

android {
compileSdk 34
signingConfigs {
rustore_release {
def keystoreProperties = new Properties()
def keystorePropsFile = file("keystore/keystore_config")

if (keystorePropsFile.exists()) {
file("keystore/keystore_config").withInputStream { keystoreProperties.load(it) }
storeFile file("$keystoreProperties.storeFile")
storePassword "$keystoreProperties.storePassword"
keyAlias "$keystoreProperties.keyAlias"
keyPassword "$keystoreProperties.keyPassword"
} else {
storeFile file("keystore/mezhendosina_key.jks")
storePassword System.getenv('KEYSTORE_PASSWORD')
keyAlias System.getenv('RELEASE_SIGN_KEY_ALIAS')
keyPassword System.getenv('RELEASE_SIGN_KEY_PASSWORD')
}
}
release {
def keystoreProperties = new Properties()
def keystorePropsFile = file("keystore/keystore_config")
Expand All @@ -33,8 +51,8 @@ android {
applicationId "com.mezhendosina.sgo.app"
minSdk 24
targetSdk 33
versionCode 37
versionName '3.0.2'
versionCode 39
versionName '3.0.3'

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

Expand All @@ -57,6 +75,14 @@ android {
resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "true")
manifestPlaceholders = [crashlyticsCollectionEnabled: "false"]
}
rustore_release {
signingConfig signingConfigs.release
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
manifestPlaceholders = [crashlyticsCollectionEnabled: "true"]
resValue("bool", "FIREBASE_ANALYTICS_DEACTIVATED", "false")

}
release {
signingConfig signingConfigs.release
minifyEnabled false
Expand All @@ -67,11 +93,11 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = '17'
}
viewBinding {
enabled true
Expand Down Expand Up @@ -176,4 +202,8 @@ dependencies {
// get color pallete from image
implementation 'androidx.palette:palette-ktx:1.0.0'

// hilt
implementation "com.google.dagger:hilt-android:2.48.1"
kapt "com.google.dagger:hilt-compiler:2.48.1"

}
210 changes: 105 additions & 105 deletions app/src/androidTest/java/com/mezhendosina/sgo/app/NetSchoolUnitTests.kt
Original file line number Diff line number Diff line change
@@ -1,106 +1,106 @@
/*
* Copyright 2023 Eugene Menshenin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

///*
// * Copyright 2023 Eugene Menshenin
// *
// * Licensed under the Apache License, Version 2.0 (the "License");
// * you may not use this file except in compliance with the License.
// * You may obtain a copy of the License at
// *
// * http://www.apache.org/licenses/LICENSE-2.0
// *
// * Unless required by applicable law or agreed to in writing, software
// * distributed under the License is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// * See the License for the specific language governing permissions and
// * limitations under the License.
// */
//
package com.mezhendosina.sgo.app

import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import com.mezhendosina.sgo.app.netschool.api.login.entities.SchoolEntity
import com.mezhendosina.sgo.data.netschool.NetSchoolExpectedResults
import com.mezhendosina.sgo.data.netschool.NetSchoolSingleton
import junit.framework.TestCase.assertEquals
import kotlinx.coroutines.runBlocking
import org.junit.After
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class NetSchoolUnitTests : NetSchoolTestInterface {

private val netSchoolSingleton = NetSchoolSingleton

@Before
override fun login() {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
val login = System.getenv("SGO_LOGIN")
val password = System.getenv("SGO_PASSWORD")
runBlocking {
if (!login.isNullOrEmpty() && !password.isNullOrEmpty()) {
netSchoolSingleton.loginRepository.login(
appContext,
login,
password,
89
)
} else {
throw RuntimeException("Login or password is null or empty")
}
}
}

@Test
override fun region() {
assertEquals(
NetSchoolExpectedResults.region,
netSchoolSingleton.regionsRepository.getRegions()
)
}

@Test
override fun school() {
runBlocking {
netSchoolSingleton.loginRepository.findSchool("68")
val itemsListType = object : TypeToken<List<SchoolEntity>>() {}.type
assertEquals(
netSchoolSingleton.schools,
Gson().fromJson(NetSchoolExpectedResults.schools, itemsListType)
)
}
}

@Test
override fun announcements() {
runBlocking {
netSchoolSingleton.announcementsRepository.announcements()
}
}

@Test
override fun attachments() {

}

@Test
override fun grades() {
}

@Test
override fun diary() {
}

@Test
override fun settings() {
}

@After
override fun logout() {
}


}
//
//import androidx.test.ext.junit.runners.AndroidJUnit4
//import androidx.test.platform.app.InstrumentationRegistry
//import com.google.gson.Gson
//import com.google.gson.reflect.TypeToken
//import com.mezhendosina.sgo.app.netschool.api.login.entities.SchoolEntity
//import com.mezhendosina.sgo.data.netschool.NetSchoolExpectedResults
//import com.mezhendosina.sgo.data.netschool.NetSchoolSingleton
//import junit.framework.TestCase.assertEquals
//import kotlinx.coroutines.runBlocking
//import org.junit.After
//import org.junit.Before
//import org.junit.Test
//import org.junit.runner.RunWith
//
//@RunWith(AndroidJUnit4::class)
//class NetSchoolUnitTests : NetSchoolTestInterface {
//
// private val netSchoolSingleton = NetSchoolSingleton
//
// @Before
// override fun login() {
// val appContext = InstrumentationRegistry.getInstrumentation().targetContext
// val login = System.getenv("SGO_LOGIN")
// val password = System.getenv("SGO_PASSWORD")
// runBlocking {
// if (!login.isNullOrEmpty() && !password.isNullOrEmpty()) {
// netSchoolSingleton.loginRepository.login(
// appContext,
// login,
// password,
// 89
// )
// } else {
// throw RuntimeException("Login or password is null or empty")
// }
// }
// }
//
// @Test
// override fun region() {
// assertEquals(
// NetSchoolExpectedResults.region,
// netSchoolSingleton.regionsRepository.getRegions()
// )
// }
//
// @Test
// override fun school() {
// runBlocking {
// netSchoolSingleton.loginRepository.findSchool("68")
// val itemsListType = object : TypeToken<List<SchoolEntity>>() {}.type
// assertEquals(
// netSchoolSingleton.schools,
// Gson().fromJson(NetSchoolExpectedResults.schools, itemsListType)
// )
// }
// }
//
// @Test
// override fun announcements() {
// runBlocking {
// netSchoolSingleton.announcementsRepository.announcements()
// }
// }
//
// @Test
// override fun attachments() {
//
// }
//
// @Test
// override fun grades() {
// }
//
// @Test
// override fun diary() {
// }
//
// @Test
// override fun settings() {
// }
//
// @After
// override fun logout() {
// }
//
//
//}
13 changes: 7 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<!-- <uses-permission-->
<!-- android:name="android.permission.WRITE_EXTERNAL_STORAGE"-->
<!-- android:maxSdkVersion="32" />-->
<!-- <uses-permission-->
<!-- android:name="android.permission.READ_EXTERNAL_STORAGE"-->
<!-- android:maxSdkVersion="28" />-->

<application
android:name=".App"
android:allowBackup="true"
android:hardwareAccelerated="true"
android:icon="@mipmap/ic_launcher"
Expand Down
Binary file modified app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 15 additions & 5 deletions app/src/main/java/com/mezhendosina/sgo/Singleton.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package com.mezhendosina.sgo

import androidx.lifecycle.MutableLiveData
import com.google.android.material.tabs.TabLayout
import com.mezhendosina.sgo.app.BuildConfig
import com.mezhendosina.sgo.app.model.journal.DiaryStyle
import com.mezhendosina.sgo.app.model.journal.entities.DiaryUiEntity
import com.mezhendosina.sgo.app.model.journal.entities.LessonUiEntity
Expand All @@ -31,8 +32,11 @@ import com.mezhendosina.sgo.data.netschool.api.announcements.AnnouncementsRespon
import com.mezhendosina.sgo.data.netschool.api.diary.entities.PastMandatoryEntity
import com.mezhendosina.sgo.data.netschool.api.grades.entities.GradesItem
import com.mezhendosina.sgo.data.netschool.api.settings.entities.MySettingsResponseEntity
import okhttp3.internal.http2.Header

object Singleton {
var loggedIn = false
var at = ""
var welcomeShowed = false
var announcements: List<AnnouncementsResponseEntity> = emptyList()
var selectedAnnouncement: AnnouncementsResponseEntity? = null
Expand Down Expand Up @@ -66,10 +70,16 @@ object Singleton {

val mainContainerScreen = MutableLiveData<String>(ContainerFragment.JOURNAL)

// --- database
// val database: AppDatabase by lazy {
// Room.databaseBuilder(applicationContext, AppDatabase::class.java, "database.db").build()
// }

val STATIC_HEADERS = mutableListOf(
Header("UserAgent", "che-zadali-app v${BuildConfig.VERSION_NAME}"),
Header("X-Requested-With", "XMLHttpRequest"),
Header("Sec-Fetch-Site", "same-origin"),
Header("Sec-Fetch-Mode", "cors"),
Header("Sec-Fetch-Dest", "empty"),
Header(
"sec-ch-ua",
"\" Not A;Brand\";v=\"99\", \"Chromium\";v=\"105\", \"Microsoft Edge\";v=\"105\""
)
)
}

8 changes: 8 additions & 0 deletions app/src/main/java/com/mezhendosina/sgo/app/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.mezhendosina.sgo.app

import android.app.Application
import dagger.hilt.android.HiltAndroidApp


@HiltAndroidApp
class App : Application()
Loading

0 comments on commit dd1fcfc

Please sign in to comment.