Skip to content

Commit

Permalink
Bugfix: ThrowInvalidMutabilityException in requiredPermissions. (#9)
Browse files Browse the repository at this point in the history
* Bugfix: ThrowInvalidMutabilityException in requiredPermissions.

* Update: variable type 'var' to 'val' of requiredPermission.

Co-authored-by: HanPro <sjin.han@navercorp.com>
  • Loading branch information
HanSJin and HanPro authored Dec 2, 2021
1 parent aa4e784 commit c55f523
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.jetbrains.kotlin.cli.common.toBooleanLenient
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget

val isSnapshotUpload = System.getProperty("snapshot").toBooleanLenient() ?: false
val libVersion = "0.2.8"
val libVersion = "0.2.9"
val gitName = "abc-${project.name}"

buildscript {
Expand Down
2 changes: 1 addition & 1 deletion kmm_location.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'kmm_location'
spec.version = '0.2.8'
spec.version = '0.2.9'
spec.homepage = ''
spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
spec.authors = ''
Expand Down
2 changes: 1 addition & 1 deletion sample/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
kotlin("native.cocoapods")
}

val abcLocationLib = "com.linecorp.abc:kmm-location:0.2.8"
val abcLocationLib = "com.linecorp.abc:kmm-location:0.2.9"

version = "1.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ internal actual class LocationManager {
// -------------------------------------------------------------------------------------------

actual fun isPermissionAllowed() =
authorizationStatus == requiredPermission
authorizationStatus == requiredPermission.value

actual fun removeAllListeners() {
onAlwaysAllowsPermissionRequiredBlockMap.value = emptyMap()
Expand Down Expand Up @@ -58,7 +58,7 @@ internal actual class LocationManager {
// Public
// -------------------------------------------------------------------------------------------

var requiredPermission = LocationAuthorizationStatus.AuthorizedAlways
val requiredPermission = NativeAtomicReference(LocationAuthorizationStatus.AuthorizedAlways)
val previousAuthorizationStatus = NativeAtomicReference(LocationAuthorizationStatus.NotSet)

fun onAlwaysAllowsPermissionRequired(
Expand All @@ -79,7 +79,7 @@ internal actual class LocationManager {
// -------------------------------------------------------------------------------------------

private val isRequiredAllowAlways: Boolean
get() = requiredPermission == LocationAuthorizationStatus.AuthorizedAlways
get() = requiredPermission.value == LocationAuthorizationStatus.AuthorizedAlways

private val authorizationStatus: LocationAuthorizationStatus
get() = if (Version(UIDevice.currentDevice.systemVersion) >= Version("14")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.linecorp.abc.location.LocationAuthorizationStatus
typealias OnAlwaysAllowsPermissionRequiredBlock = () -> Unit

var ABCLocation.Companion.requiredPermission: LocationAuthorizationStatus
get() = locationManager.requiredPermission
set(value) { locationManager.requiredPermission = value }
get() = locationManager.requiredPermission.value
set(value) { locationManager.requiredPermission.value = value }

fun ABCLocation.Companion.onAlwaysAllowsPermissionRequired(
target: Any,
Expand Down

0 comments on commit c55f523

Please sign in to comment.