@momo-kits/native-kits 0.160.1-scrolltotop.25-debug → 0.160.1-scrolltotop.26-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/compose/build.gradle.kts
CHANGED
package/compose/compose.podspec
CHANGED
package/gradle.properties
CHANGED
|
@@ -18,7 +18,7 @@ kotlin.apple.xcodeCompatibility.nowarn=true
|
|
|
18
18
|
name="ComposeKits"
|
|
19
19
|
group=vn.momo.kits
|
|
20
20
|
artifact.id=kits
|
|
21
|
-
version=0.160.1-scrolltotop.
|
|
21
|
+
version=0.160.1-scrolltotop.26
|
|
22
22
|
|
|
23
23
|
repo=GitLab
|
|
24
24
|
url=https://gitlab.mservice.com.vn/api/v4/projects/5400/packages/maven
|
|
@@ -3,26 +3,13 @@
|
|
|
3
3
|
#import <objc/runtime.h>
|
|
4
4
|
#import "StatusBarTap.h"
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
+ (void)install { /* installed automatically via +load below */ }
|
|
9
|
-
@end
|
|
10
|
-
|
|
11
|
-
// MARK: - Swizzle on UIStatusBarManager
|
|
12
|
-
// Runs once at framework-load time. Uses the canonical add-or-exchange
|
|
13
|
-
// idiom so we never accidentally swizzle an inherited (superclass) IMP.
|
|
14
|
-
|
|
15
|
-
@interface UIStatusBarManager (MoMoStatusBarTap)
|
|
16
|
-
@end
|
|
17
|
-
|
|
18
|
-
@implementation UIStatusBarManager (MoMoStatusBarTap)
|
|
19
|
-
|
|
20
|
-
+ (void)load {
|
|
6
|
+
// Performs the actual swizzle once per process. Safe to call multiple times.
|
|
7
|
+
static void mm_installStatusBarTapSwizzleOnce(void) {
|
|
21
8
|
static dispatch_once_t onceToken;
|
|
22
9
|
dispatch_once(&onceToken, ^{
|
|
23
|
-
Class cls = [
|
|
10
|
+
Class cls = [UIStatusBarManager class];
|
|
24
11
|
SEL originalSelector = NSSelectorFromString(@"handleTapAction:");
|
|
25
|
-
SEL swizzledSelector = @
|
|
12
|
+
SEL swizzledSelector = NSSelectorFromString(@"mm_handleTapAction:");
|
|
26
13
|
|
|
27
14
|
Method originalMethod = class_getInstanceMethod(cls, originalSelector);
|
|
28
15
|
Method swizzledMethod = class_getInstanceMethod(cls, swizzledSelector);
|
|
@@ -55,10 +42,31 @@
|
|
|
55
42
|
});
|
|
56
43
|
}
|
|
57
44
|
|
|
45
|
+
@implementation MoMoStatusBarTap
|
|
46
|
+
+ (NSNotificationName)notificationName { return @"statusBarSelected"; }
|
|
47
|
+
+ (void)install { mm_installStatusBarTapSwizzleOnce(); }
|
|
48
|
+
@end
|
|
49
|
+
|
|
50
|
+
// MARK: - Swizzle target on UIStatusBarManager
|
|
51
|
+
// `mm_handleTapAction:` is the replacement IMP. After the add/exchange,
|
|
52
|
+
// this selector points at the original UIKit IMP — calling it inside
|
|
53
|
+
// the body invokes UIKit's real handler so UIScrollView.scrollsToTop
|
|
54
|
+
// and any other side effects continue to work.
|
|
55
|
+
|
|
56
|
+
@interface UIStatusBarManager (MoMoStatusBarTap)
|
|
57
|
+
@end
|
|
58
|
+
|
|
59
|
+
@implementation UIStatusBarManager (MoMoStatusBarTap)
|
|
60
|
+
|
|
61
|
+
// Auto-install at framework load. Commented out so the swizzle stays
|
|
62
|
+
// opt-in via `[MoMoStatusBarTap install]`. Uncomment to revert to
|
|
63
|
+
// auto-installation before main().
|
|
64
|
+
//
|
|
65
|
+
// + (void)load {
|
|
66
|
+
// mm_installStatusBarTapSwizzleOnce();
|
|
67
|
+
// }
|
|
68
|
+
|
|
58
69
|
- (void)mm_handleTapAction:(id)action {
|
|
59
|
-
// After the swap, this selector points at the original UIKit IMP —
|
|
60
|
-
// call it first so UIScrollView.scrollsToTop and other UIKit side
|
|
61
|
-
// effects fire normally, then notify our observers.
|
|
62
70
|
[self mm_handleTapAction:action];
|
|
63
71
|
[[NSNotificationCenter defaultCenter] postNotificationName:MoMoStatusBarTap.notificationName
|
|
64
72
|
object:nil];
|