Skip to content

Commit

Permalink
Merge pull request #314 from icerockdev/develop
Browse files Browse the repository at this point in the history
Release 0.2.2
  • Loading branch information
Alex009 authored Apr 27, 2023
2 parents 20fcb75 + 7ad2152 commit d88a745
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 173 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:widgets:0.2.1")
commonMainApi("dev.icerock.moko:widgets-bottomsheet:0.2.1") // show bottom sheets
commonMainApi("dev.icerock.moko:widgets-collection:0.2.1") // collection widget
commonMainApi("dev.icerock.moko:widgets-datetime-picker:0.2.1") // show datepicker
commonMainApi("dev.icerock.moko:widgets-image-network:0.2.1") // images with load from url
commonMainApi("dev.icerock.moko:widgets-sms:0.2.1") // input with sms autofill
commonMainApi("dev.icerock.moko:widgets-media:0.2.1") // moko-media integration
commonMainApi("dev.icerock.moko:widgets-permissions:0.2.1") // moko-permissions integration
commonMainApi("dev.icerock.moko:widgets:0.2.2")
commonMainApi("dev.icerock.moko:widgets-bottomsheet:0.2.2") // show bottom sheets
commonMainApi("dev.icerock.moko:widgets-collection:0.2.2") // collection widget
commonMainApi("dev.icerock.moko:widgets-datetime-picker:0.2.2") // show datepicker
commonMainApi("dev.icerock.moko:widgets-image-network:0.2.2") // images with load from url
commonMainApi("dev.icerock.moko:widgets-sms:0.2.2") // input with sms autofill
commonMainApi("dev.icerock.moko:widgets-media:0.2.2") // moko-media integration
commonMainApi("dev.icerock.moko:widgets-permissions:0.2.2") // moko-permissions integration
}
```

Expand All @@ -230,7 +230,7 @@ buildscript {
}
dependencies {
classpath "dev.icerock.moko.widgets:gradle-plugin:0.2.1"
classpath "dev.icerock.moko.widgets:gradle-plugin:0.2.2"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
kotlinVersion = "1.8.10"

mokoWidgetsVersion = "0.2.1"
mokoWidgetsVersion = "0.2.2"
mokoResourcesVersion = "0.21.2"
mokoMvvmVersion = "0.16.0"
mokoFieldsVersion = "0.12.0"
Expand Down
4 changes: 2 additions & 2 deletions moko-widgets-bottomsheet.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'moko-widgets-bottomsheet'
spec.version = '0.1.0'
spec.version = '0.2.2'
spec.homepage = 'https://github.com/icerockdev/moko-widgets'
spec.source = { :git => "https://github.com/icerockdev/moko-widgets.git", :tag => "release/#{spec.version}" }
spec.authors = 'IceRock Development'
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |spec|
spec.source_files = "widgets-bottomSheet/src/iosMain/swift/**/*.{h,m,swift}"
spec.resources = "widgets-bottomSheet/src/iosMain/bundle/**/*"

spec.dependency 'FloatingPanel', '~> 1.7.2'
spec.dependency 'FloatingPanel', '~> 2.6.1'

spec.ios.deployment_target = '11.0'
spec.swift_version = '5.0'
Expand Down
2 changes: 1 addition & 1 deletion moko-widgets-collection.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'moko-widgets-collection'
spec.version = '0.1.0'
spec.version = '0.2.2'
spec.homepage = 'https://github.com/icerockdev/moko-widgets'
spec.source = { :git => "https://github.com/icerockdev/moko-widgets.git", :tag => "release/#{spec.version}" }
spec.authors = 'IceRock Development'
Expand Down
4 changes: 2 additions & 2 deletions moko-widgets-datetime-picker.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'moko-widgets-datetime-picker'
spec.version = '0.1.0'
spec.version = '0.2.2'
spec.homepage = 'https://github.com/icerockdev/moko-widgets'
spec.source = { :git => "https://github.com/icerockdev/moko-widgets.git", :tag => "release/#{spec.version}" }
spec.authors = 'IceRock Development'
Expand All @@ -11,7 +11,7 @@ Pod::Spec.new do |spec|
spec.source_files = "widgets-datetime-picker/src/iosMain/swift/**/*.{h,m,swift}"
spec.resources = "widgets-datetime-picker/src/iosMain/bundle/**/*"

spec.dependency 'FloatingPanel', '~> 1.7.2'
spec.dependency 'FloatingPanel', '~> 2.6.1'

spec.ios.deployment_target = '11.0'
spec.swift_version = '5.0'
Expand Down
2 changes: 1 addition & 1 deletion moko-widgets-image-network.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |spec|
spec.name = 'moko-widgets-image-network'
spec.version = '0.1.0'
spec.version = '0.2.2'
spec.homepage = 'https://github.com/icerockdev/moko-widgets'
spec.source = { :git => "https://github.com/icerockdev/moko-widgets.git", :tag => "release/#{spec.version}" }
spec.authors = 'IceRock Development'
Expand Down
18 changes: 9 additions & 9 deletions sample/ios-app/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
PODS:
- FloatingPanel (1.7.2)
- moko-widgets-bottomsheet (0.1.0):
- FloatingPanel (~> 1.7.2)
- FloatingPanel (2.6.1)
- moko-widgets-bottomsheet (0.2.0):
- FloatingPanel (~> 2.6.1)
- moko-widgets-collection (0.1.0)
- moko-widgets-datetime-picker (0.1.0):
- FloatingPanel (~> 1.7.2)
- moko-widgets-datetime-picker (0.2.0):
- FloatingPanel (~> 2.6.1)
- moko-widgets-image-network (0.1.0):
- SDWebImage (~> 5.0)
- mppLibraryIos (0.1.0)
Expand Down Expand Up @@ -41,15 +41,15 @@ EXTERNAL SOURCES:
:path: "../mpp-library"

SPEC CHECKSUMS:
FloatingPanel: b275a35d0a09be4bd37025e710a6a1d063bfc161
moko-widgets-bottomsheet: 302953af27d9bcb6b0f0f51511ccce5e8ff3aa92
FloatingPanel: de6bb891912ede28da7b1140f7b583c474fec28a
moko-widgets-bottomsheet: 45cb9eec56ad3d44f0f3f81421f1ae81b671cfdb
moko-widgets-collection: 722c6fca0b0dcab0b54fdb674b4638d4f715434c
moko-widgets-datetime-picker: 0d8e11202cfc6041ca70234f2e6994900161fb04
moko-widgets-datetime-picker: d25eb6926078eae46a311af26294c78b09f0058d
moko-widgets-image-network: 074870717767dfcc1a0e942a0a070ad183c01195
mppLibraryIos: 72c3984fbaa53978d678e62096fd613e67839f0c
MultiPlatformLibrary: 176fb8ade516666cd47e93de1b71ba0441a541bb
SDWebImage: 7edb9c3ea661e77a66661f7f044de8c1b55d1120

PODFILE CHECKSUM: dd6f9b7e6c038aff8581037bf3a09cf3c1c947f9

COCOAPODS: 1.11.3
COCOAPODS: 1.12.0
61 changes: 36 additions & 25 deletions widgets-bottomsheet/src/iosMain/swift/BottomSheetController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import FloatingPanel

private var AssociatedDelegateHandle: UInt8 = 0

@objc public class BottomSheetController: NSObject, FloatingPanelControllerDelegate {
@objc public class BottomSheetController: NSObject {

private weak var controller: FloatingPanelController?
private var onDismiss: ((Bool) -> Void)?
Expand Down Expand Up @@ -48,6 +48,9 @@ private var AssociatedDelegateHandle: UInt8 = 0
fpc.delegate = delegate
fpc.backdropView.backgroundColor = UIColor.black
fpc.isRemovalInteractionEnabled = true
let surface = SurfaceAppearance()
surface.cornerRadius = 14
fpc.surfaceView.appearance = surface

view.superview?.layer.maskedCorners = [CACornerMask.layerMinXMinYCorner, CACornerMask.layerMaxXMinYCorner]
view.superview?.layer.masksToBounds = true
Expand Down Expand Up @@ -76,44 +79,52 @@ class FloatingDelegate: FloatingPanelControllerDelegate {
self.onDismiss = onDismiss
}

func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? {
func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout {
return floatingLayout
}

func floatingPanelDidEndDecelerating(_ vc: FloatingPanelController) {
if vc.position == .hidden {
if vc.state == .hidden {
vc.removePanelFromParent(animated: true)
vc.dismiss(animated: false, completion: nil)
onDismiss(false)
}
}

func floatingPanelDidEndRemove(_ vc: FloatingPanelController) {
func floatingPanelDidRemove(_ vc: FloatingPanelController) {
onDismiss(false)
}
}

class BottomSheetLayout: FloatingPanelLayout {
var initialPosition: FloatingPanelPosition = .full

private let preferredHeight: CGFloat

init(preferredHeight: CGFloat) {
self.preferredHeight = preferredHeight
}

func insetFor(position: FloatingPanelPosition) -> CGFloat? {
switch (position) {
case .half: return 0
case .full: return UIScreen.main.bounds.size.height - preferredHeight - 30.0
case .tip: return 0
case .hidden: return 0
private let preferredHeight: CGFloat

var position: FloatingPanelPosition {
return .bottom
}

var initialState: FloatingPanelState {
return .full
}

var anchors: [FloatingPanelState : FloatingPanelLayoutAnchoring] {
return [
.full: FloatingPanelLayoutAnchor(absoluteInset: preferredHeight, edge: .bottom, referenceGuide: .safeArea)
]
}

init(preferredHeight: CGFloat) {
self.preferredHeight = preferredHeight
}

func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint] {
return [
surfaceView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 0.0),
surfaceView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor, constant: 0.0),
]
}

func backdropAlpha(for state: FloatingPanelState) -> CGFloat {
return state == .full ? 0.3 : 0.0
}
}

var supportedPositions: Set<FloatingPanelPosition> = [.full, .hidden]

func backdropAlphaFor(position: FloatingPanelPosition) -> CGFloat {
return 0.3
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import FloatingPanel

private var AssociatedDelegateHandle: UInt8 = 0

@objc public class DateBottomSheetController: NSObject, FloatingPanelControllerDelegate {
@objc public class DateBottomSheetController: NSObject {

private weak var controller: FloatingPanelController?
private var onDismiss: ((Bool) -> Void)?
Expand Down Expand Up @@ -41,9 +41,8 @@ private var AssociatedDelegateHandle: UInt8 = 0
fpc.backdropView.backgroundColor = UIColor.black
fpc.isRemovalInteractionEnabled = true
fpc.surfaceView.grabberHandle.isHidden = true
fpc.surfaceView.grabberHandleHeight = 0
fpc.surfaceView.grabberTopPadding = 0
fpc.surfaceView.contentInsets = .zero
fpc.surfaceView.grabberHandleSize.height = 0
fpc.surfaceView.grabberHandlePadding = 0

controller = fpc
self.onDismiss = onDismiss
Expand All @@ -68,12 +67,12 @@ class FloatingDelegate: FloatingPanelControllerDelegate {
self.onDismiss = onDismiss
}

func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? {
func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout {
return floatingLayout
}

func floatingPanelDidEndDecelerating(_ vc: FloatingPanelController) {
if vc.position == .hidden {
if vc.state == .hidden {
vc.removePanelFromParent(animated: true)
vc.dismiss(animated: false, completion: nil)
onDismiss(false)
Expand All @@ -86,26 +85,34 @@ class FloatingDelegate: FloatingPanelControllerDelegate {
}

class BottomSheetLayout: FloatingPanelLayout {
var initialPosition: FloatingPanelPosition = .half

private let preferredHeight: CGFloat

init(preferredHeight: CGFloat) {
self.preferredHeight = preferredHeight
}

func insetFor(position: FloatingPanelPosition) -> CGFloat? {
switch (position) {
case .half: return preferredHeight
case .full: return 0
case .tip: return 0
case .hidden: return 0
private let preferredHeight: CGFloat

var position: FloatingPanelPosition {
return .bottom
}

var initialState: FloatingPanelState {
return .half
}

var anchors: [FloatingPanelState : FloatingPanelLayoutAnchoring] {
return [
.half: FloatingPanelLayoutAnchor(absoluteInset: preferredHeight, edge: .bottom, referenceGuide: .safeArea)
]
}

init(preferredHeight: CGFloat) {
self.preferredHeight = preferredHeight
}

func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint] {
return [
surfaceView.leftAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leftAnchor, constant: 0.0),
surfaceView.rightAnchor.constraint(equalTo: view.safeAreaLayoutGuide.rightAnchor, constant: 0.0),
]
}

func backdropAlpha(for state: FloatingPanelState) -> CGFloat {
return 0.3
}
}

var supportedPositions: Set<FloatingPanelPosition> = [.half, .hidden]

func backdropAlphaFor(position: FloatingPanelPosition) -> CGFloat {
return 0.3
}
}
4 changes: 4 additions & 0 deletions widgets/src/iosMain/def/objcAddtition.def
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ NSURLSessionDataTask* dataTask(NSURLSession* session, NSURL* url, void (^complet
}
];
}

@protocol KeyValueObserver
- (void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id)object change:(nullable NSDictionary<NSKeyValueChangeKey, id> *)change context:(nullable void *)context;
@end
Loading

0 comments on commit d88a745

Please sign in to comment.