Skip to content

Commit

Permalink
Tech | API 31 (anyproto#2031)
Browse files Browse the repository at this point in the history
* Tech | API 30, Local Network Address (anyproto#2004)

* 30 api + java 11 + scoped storage

* update network address handler

* fix

* fix

* put back permission

* fix

* fix

* fix

* ci

* set tests off

Co-authored-by: konstantiniiv <[email protected]>

* Fix | JVM version (anyproto#2033)

* Tech | Update to API 31 (anyproto#2032)

* update to API 31

* fix

Co-authored-by: konstantiniiv <[email protected]>

* Fix | Network address handler (anyproto#2034)

* Tech | Editor, update permissions (anyproto#2039)

* add permission

* remove legacy

* fix permissions

* fix

* fix

* add ext fun

Co-authored-by: konstantiniiv <[email protected]>

* Tech | Permissions in Relations Value (anyproto#2041)

* add permission

* remove legacy

* fix permissions

* fix

* fix

* add ext fun

* permissions in relations

Co-authored-by: konstantiniiv <[email protected]>

* Tech | Update file logic to SAF (anyproto#2048)

* update file logic

* fixes

* fix

* fix

* fixes

* fixes

* fix

* fix

* rename

* fix

* fix

* style

* fix

* delete legacy test

* add kdoc

Co-authored-by: konstantiniiv <[email protected]>

* Tech | Add signing (anyproto#2047)

* add signing

* rename

* fixes

* debug signing

Co-authored-by: E. Kozlov <[email protected]>
Co-authored-by: konstantiniiv <[email protected]>

* Tech | API 31, files refactoring (anyproto#2053)

* refactoring

* fix

* fix

* fix

* fix

Co-authored-by: konstantiniiv <[email protected]>

* put back create page

* fix tests

* temporary turn off signing

* fix viewmodel nullable

* ci off

Co-authored-by: konstantiniiv <[email protected]>
Co-authored-by: E. Kozlov <[email protected]>
  • Loading branch information
3 people authored Jan 26, 2022
1 parent b5ff813 commit 3122897
Show file tree
Hide file tree
Showing 100 changed files with 1,023 additions and 493 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@
.externalNativeBuild
ktlint
.idea/*.xml
signing.properties
4 changes: 2 additions & 2 deletions analytics/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

Expand Down
45 changes: 33 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def apikeyPropertiesFile = rootProject.file("apikeys.properties")
def apikeyProperties = new Properties()
apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))

//def keystorePropertiesFile = rootProject.file("signing.properties")
//def keystoreProperties = new Properties()
//keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
def config = rootProject.extensions.getByName("ext")

Expand All @@ -26,15 +30,13 @@ android {
versionName getBuildVersionName()
testInstrumentationRunner config["test_runner"]
}

packagingOptions {
exclude 'LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
resources {
excludes += ['LICENSE.txt', 'META-INF/DEPENDENCIES', 'META-INF/ASL2.0', 'META-INF/NOTICE', 'META-INF/LICENSE']
}
}


lintOptions {
quiet true
abortOnError false
Expand All @@ -45,18 +47,39 @@ android {
disable 'IconMissingDensityFolder' //For testing purpose. This is safe to remove.
}

// signingConfigs {
// //For proper signing, use debuggable false for a build.
// release {
// keyAlias keystoreProperties['RELEASE_KEY_ALIAS']
// keyPassword keystoreProperties['RELEASE_KEY_PASSWORD']
// storeFile file(keystoreProperties['RELEASE_STORE_FILE'])
// storePassword keystoreProperties['RELEASE_STORE_PASSWORD']
// v1SigningEnabled true
// v2SigningEnabled true
// }
// debug {
// keyAlias keystoreProperties['DEBUG_KEY_ALIAS']
// keyPassword keystoreProperties['DEBUG_KEY_PASSWORD']
// storeFile file(keystoreProperties['DEBUG_STORE_FILE'])
// storePassword keystoreProperties['DEBUG_STORE_PASSWORD']
// v1SigningEnabled true
// v2SigningEnabled true
// }
// }

buildTypes {
release {
minifyEnabled false
useProguard false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
buildConfigField("String", "AMPLITUDE_KEY", apikeyProperties['amplitude.release'])
//signingConfig signingConfigs.release
}

debug {
applicationIdSuffix ".debug"
debuggable true
buildConfigField("String", "AMPLITUDE_KEY", apikeyProperties['amplitude.debug'])
//signingConfig signingConfigs.debug
}
}

Expand Down Expand Up @@ -90,12 +113,12 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = "1.8"
jvmTarget = JavaVersion.VERSION_11
}

androidExtensions {
Expand Down Expand Up @@ -131,7 +154,6 @@ dependencies {
//Compile time dependencies
kapt applicationDependencies.daggerCompiler
kapt applicationDependencies.glideCompiler
kapt applicationDependencies.permissionDispCompiler
compileOnly applicationDependencies.javaxAnnotation
compileOnly applicationDependencies.javaxInject

Expand All @@ -149,7 +171,6 @@ dependencies {
implementation applicationDependencies.dagger
implementation applicationDependencies.timber
implementation applicationDependencies.gson
implementation applicationDependencies.permissionDisp
implementation applicationDependencies.pickT
implementation applicationDependencies.emojiCompat

Expand Down
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<activity
android:name="com.anytypeio.anytype.ui.main.MainActivity"
android:screenOrientation="portrait"
android:exported="true"
android:launchMode="singleTop"
android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter android:label="filter">
Expand All @@ -43,6 +44,7 @@
<activity
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="fullSensor"
android:exported="false"
tools:replace="screenOrientation" />
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.anytypeio.anytype.di.common.ComponentManager
import com.anytypeio.anytype.di.main.ContextModule
import com.anytypeio.anytype.di.main.DaggerMainComponent
import com.anytypeio.anytype.di.main.MainComponent
import com.anytypeio.anytype.middleware.interactor.LocalNetworkAddressHandler
import timber.log.Timber
import javax.inject.Inject

Expand All @@ -21,6 +22,9 @@ class AndroidApplication : Application() {
@Inject
lateinit var amplitudeTracker: AmplitudeTracker

@Inject
lateinit var localNetworkAddressHandler: LocalNetworkAddressHandler

private val main: MainComponent by lazy {
DaggerMainComponent
.builder()
Expand All @@ -38,6 +42,7 @@ class AndroidApplication : Application() {
setupAnalytics()
setupEmojiCompat()
setupTimber()
setupLocalNetworkAddressHandler()
}

private fun setupEmojiCompat() {
Expand All @@ -61,4 +66,8 @@ class AndroidApplication : Application() {
private fun setupAnalytics() {
Amplitude.getInstance().initialize(this, BuildConfig.AMPLITUDE_KEY)
}

private fun setupLocalNetworkAddressHandler() {
localNetworkAddressHandler.start()
}
}
16 changes: 14 additions & 2 deletions app/src/main/java/com/anytypeio/anytype/di/feature/EditorDI.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.anytypeio.anytype.di.feature

import android.content.Context
import com.anytypeio.anytype.analytics.base.Analytics
import com.anytypeio.anytype.core_models.Block
import com.anytypeio.anytype.core_models.Id
Expand Down Expand Up @@ -52,6 +53,8 @@ import com.anytypeio.anytype.presentation.editor.render.DefaultBlockViewRenderer
import com.anytypeio.anytype.presentation.editor.selection.SelectionStateHolder
import com.anytypeio.anytype.presentation.editor.toggle.ToggleStateHolder
import com.anytypeio.anytype.presentation.relations.providers.*
import com.anytypeio.anytype.presentation.util.CopyFileToCacheDirectory
import com.anytypeio.anytype.presentation.util.DefaultCopyFileToCacheDirectory
import com.anytypeio.anytype.presentation.util.Dispatcher
import com.anytypeio.anytype.providers.DefaultCoverImageHashProvider
import com.anytypeio.anytype.ui.editor.EditorFragment
Expand Down Expand Up @@ -147,7 +150,8 @@ object EditorSessionModule {
objectTypesProvider: ObjectTypesProvider,
searchObjects: SearchObjects,
getDefaultEditorType: GetDefaultEditorType,
findObjectSetForType: FindObjectSetForType
findObjectSetForType: FindObjectSetForType,
copyFileToCacheDirectory: CopyFileToCacheDirectory
): EditorViewModelFactory = EditorViewModelFactory(
openPage = openPage,
closeObject = closePage,
Expand All @@ -173,7 +177,8 @@ object EditorSessionModule {
searchObjects = searchObjects,
getDefaultEditorType = getDefaultEditorType,
findObjectSetForType = findObjectSetForType,
createObjectSet = createObjectSet
createObjectSet = createObjectSet,
copyFileToCacheDirectory = copyFileToCacheDirectory
)

@JvmStatic
Expand Down Expand Up @@ -752,4 +757,11 @@ object EditorUseCaseModule {
fun provideCreateObjectSetUseCase(
repo: BlockRepository
): CreateObjectSet = CreateObjectSet(repo = repo)

@JvmStatic
@Provides
@PerScreen
fun provideCopyFileToCache(
context: Context
): CopyFileToCacheDirectory = DefaultCopyFileToCacheDirectory(context)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.anytypeio.anytype.di.feature

import android.content.Context
import com.anytypeio.anytype.core_models.Payload
import com.anytypeio.anytype.core_utils.di.scope.PerModal
import com.anytypeio.anytype.domain.`object`.ObjectTypesProvider
Expand All @@ -14,6 +15,8 @@ import com.anytypeio.anytype.presentation.relations.providers.ObjectRelationProv
import com.anytypeio.anytype.presentation.relations.providers.ObjectValueProvider
import com.anytypeio.anytype.presentation.sets.RelationValueDVViewModel
import com.anytypeio.anytype.presentation.sets.RelationValueViewModel
import com.anytypeio.anytype.presentation.util.CopyFileToCacheDirectory
import com.anytypeio.anytype.presentation.util.DefaultCopyFileToCacheDirectory
import com.anytypeio.anytype.presentation.util.Dispatcher
import com.anytypeio.anytype.ui.relations.RelationValueDVFragment
import com.anytypeio.anytype.ui.relations.RelationValueFragment
Expand Down Expand Up @@ -88,6 +91,13 @@ object ObjectRelationValueModule {
@Module
object ObjectSetObjectRelationValueModule {

@JvmStatic
@Provides
@PerModal
fun provideCopyFileToCache(
context: Context
): CopyFileToCacheDirectory = DefaultCopyFileToCacheDirectory(context)

@JvmStatic
@Provides
@PerModal
Expand All @@ -99,9 +109,9 @@ object ObjectSetObjectRelationValueModule {
removeTagFromDataViewRecord: RemoveTagFromDataViewRecord,
removeStatusFromDataViewRecord: RemoveStatusFromDataViewRecord,
urlBuilder: UrlBuilder,
dispatcher: Dispatcher<Payload>,
updateDataViewRecord: UpdateDataViewRecord,
addFileToRecord: AddFileToRecord
addFileToRecord: AddFileToRecord,
copyFileToCacheDirectory: CopyFileToCacheDirectory
): RelationValueDVViewModel.Factory = RelationValueDVViewModel.Factory(
relations = relations,
values = values,
Expand All @@ -110,9 +120,9 @@ object ObjectSetObjectRelationValueModule {
removeTagFromRecord = removeTagFromDataViewRecord,
removeStatusFromDataViewRecord = removeStatusFromDataViewRecord,
urlBuilder = urlBuilder,
dispatcher = dispatcher,
updateDataViewRecord = updateDataViewRecord,
addFileToRecord = addFileToRecord
addFileToRecord = addFileToRecord,
copyFileToCache = copyFileToCacheDirectory
)
}

Expand All @@ -130,7 +140,8 @@ object ObjectObjectRelationValueModule {
urlBuilder: UrlBuilder,
dispatcher: Dispatcher<Payload>,
updateDetail: UpdateDetail,
addFileToObject: AddFileToObject
addFileToObject: AddFileToObject,
copyFileToCacheDirectory: CopyFileToCacheDirectory
): RelationValueViewModel.Factory = RelationValueViewModel.Factory(
relations = relations,
values = values,
Expand All @@ -139,6 +150,7 @@ object ObjectObjectRelationValueModule {
urlBuilder = urlBuilder,
dispatcher = dispatcher,
updateDetail = updateDetail,
addFileToObject = addFileToObject
addFileToObject = addFileToObject,
copyFileToCache = copyFileToCacheDirectory
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.anytypeio.anytype.di.main

import com.anytypeio.anytype.middleware.interactor.LocalNetworkAddressHandler
import dagger.Module
import dagger.Provides
import javax.inject.Singleton

@Module
class LocalNetworkAddressModule {

@Singleton
@Provides
fun provideHandler(): LocalNetworkAddressHandler = LocalNetworkAddressHandler()
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import javax.inject.Singleton
UtilModule::class,
EmojiModule::class,
ClipboardModule::class,
AnalyticsModule::class
AnalyticsModule::class,
LocalNetworkAddressModule::class
]
)
interface MainComponent {
Expand Down
Loading

0 comments on commit 3122897

Please sign in to comment.