Skip to content

Commit 294e477

Browse files
authored
73 backports (keybase#26195)
* backports from 73 * dont do local bookkeeping for now
1 parent a3d43c7 commit 294e477

13 files changed

Lines changed: 111 additions & 72 deletions

File tree

‎rnmodules/react-native-drop-view/ios/DropViewView.mm‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#import "DropViewView.h"
33
#import "DropView.h"
44
#import "../../../shared/ios/Keybase/ItemProviderHelper.h"
5-
#import <React/RCTUIManager.h>
6-
#import <React/RCTViewManager.h>
75
#import <react/renderer/components/RNDropViewViewSpec/ComponentDescriptors.h>
86
#import <react/renderer/components/RNDropViewViewSpec/EventEmitters.h>
97
#import <react/renderer/components/RNDropViewViewSpec/Props.h>
@@ -20,27 +18,34 @@ @implementation DropViewView {
2018
UIView *_view;
2119
}
2220

23-
+ (ComponentDescriptorProvider)componentDescriptorProvider {
24-
return concreteComponentDescriptorProvider<DropViewViewComponentDescriptor>();
21+
+ (ComponentDescriptorProvider)componentDescriptorProvider
22+
{
23+
return concreteComponentDescriptorProvider<DropViewViewComponentDescriptor>();
2524
}
2625

27-
- (instancetype)initWithFrame:(CGRect)frame {
26+
- (instancetype)initWithFrame:(CGRect)frame
27+
{
2828
if (self = [super initWithFrame:frame]) {
29-
static const auto defaultProps =
30-
std::make_shared<const DropViewViewProps>();
29+
static const auto defaultProps = std::make_shared<const DropViewViewProps>();
3130
_props = defaultProps;
3231

33-
DropView *dv = [[DropView alloc] init];
34-
_view = dv;
32+
DropView *dv = [[DropView alloc] init];
33+
_view = dv;
3534

3635
self.contentView = _view;
3736
}
3837

3938
return self;
4039
}
4140

42-
Class<RCTComponentViewProtocol> DropViewViewCls(void) {
43-
return DropViewView.class;
41+
- (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
42+
{
43+
[super updateProps:props oldProps:oldProps];
44+
}
45+
46+
Class<RCTComponentViewProtocol> DropViewViewCls(void)
47+
{
48+
return DropViewView.class;
4449
}
4550

4651
@end

‎rnmodules/react-native-drop-view/react-native-drop-view.podspec‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Pod::Spec.new do |s|
1616

1717
s.source_files = "ios/**/*.{h,m,mm}"
1818

19+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
20+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
21+
if respond_to?(:install_modules_dependencies, true)
22+
install_modules_dependencies(s)
23+
else
1924
s.dependency "React-Core"
2025

2126
# Don't install the dependencies when we run `pod install` in the old architecture.
@@ -32,5 +37,6 @@ Pod::Spec.new do |s|
3237
s.dependency "RCTRequired"
3338
s.dependency "RCTTypeSafety"
3439
s.dependency "ReactCommon/turbomodule/core"
40+
end
3541
end
3642
end

‎rnmodules/react-native-kb/react-native-kb.podspec‎

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,38 @@ Pod::Spec.new do |s|
2020
"cpp/*.{h,cpp}"
2121
]
2222

23-
s.dependency "React-Core"
24-
25-
# Don't install the dependencies when we run `pod install` in the old architecture.
26-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
27-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
28-
s.pod_target_xcconfig = {
29-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" $(PODS_ROOT)/../../node_modules/msgpack-cxx-6.1.0/include $(PODS_ROOT)/../keybase.xcframework/ios-arm64/Keybase.framework/Headers",
30-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DMSGPACK_NO_BOOST=1",
31-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
32-
}
33-
s.dependency "React-Codegen"
34-
s.dependency "RCT-Folly"
35-
s.dependency "RCTRequired"
36-
s.dependency "RCTTypeSafety"
37-
s.dependency "ReactCommon/turbomodule/core"
23+
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
24+
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
25+
if respond_to?(:install_modules_dependencies, true)
26+
s.pod_target_xcconfig = {
27+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" $(PODS_ROOT)/../../node_modules/msgpack-cxx-6.1.0/include $(PODS_ROOT)/../keybase.xcframework/ios-arm64/Keybase.framework/Headers",
28+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DMSGPACK_NO_BOOST=1",
29+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
30+
}
31+
install_modules_dependencies(s)
3832
else
39-
s.pod_target_xcconfig = {
40-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" $(PODS_ROOT)/../../node_modules/msgpack-cxx-6.1.0/include $(PODS_ROOT)/../keybase.xcframework/ios-arm64/Keybase.framework/Headers",
41-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DMSGPACK_NO_BOOST=1",
42-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
43-
}
33+
s.dependency "React-Core"
34+
35+
# Don't install the dependencies when we run `pod install` in the old architecture.
36+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
37+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
38+
s.pod_target_xcconfig = {
39+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" $(PODS_ROOT)/../../node_modules/msgpack-cxx-6.1.0/include $(PODS_ROOT)/../keybase.xcframework/ios-arm64/Keybase.framework/Headers",
40+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DMSGPACK_NO_BOOST=1",
41+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
42+
}
43+
s.dependency "React-Codegen"
44+
s.dependency "RCT-Folly"
45+
s.dependency "RCTRequired"
46+
s.dependency "RCTTypeSafety"
47+
s.dependency "ReactCommon/turbomodule/core"
48+
else
49+
s.pod_target_xcconfig = {
50+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" $(PODS_ROOT)/../../node_modules/msgpack-cxx-6.1.0/include $(PODS_ROOT)/../keybase.xcframework/ios-arm64/Keybase.framework/Headers",
51+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DMSGPACK_NO_BOOST=1",
52+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
53+
}
54+
end
4455
end
56+
4557
end

‎shared/babel.config.js‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,16 @@ module.exports = function (api /*: any */) {
5151
// console.error('KB babel.config.js for ReactNative')
5252
return {
5353
plugins: [
54-
['module-resolver', {alias: {'@': './'}}],
54+
[
55+
'module-resolver',
56+
{
57+
alias: {
58+
'@': './',
59+
'react-native-kb': '../rnmodules/react-native-kb',
60+
'react-native-drop-view': '../rnmodules/react-native-drop-view',
61+
},
62+
},
63+
],
5564
...(skipAnimation ? [] : ['react-native-reanimated/plugin']),
5665
'@babel/plugin-proposal-numeric-separator',
5766
'@babel/plugin-transform-export-namespace-from',

‎shared/common-adapters/zoomable-box.ios.tsx‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,19 @@ export const ZoomableBox = (props: Props) => {
5454
const ref = React.useRef<ScrollView>(null)
5555
const onDoubleTap = React.useCallback(() => {
5656
const scroll = ref.current as unknown as null | {
57-
getScrollResponder?: () => {
58-
scrollResponderZoomTo: (p: {
59-
animated: boolean
60-
width: number
61-
height: number
62-
x?: number
63-
y?: number
64-
}) => void
65-
}
57+
getScrollResponder?:
58+
| undefined
59+
| (() =>
60+
| undefined
61+
| {
62+
scrollResponderZoomTo: (p: {
63+
animated: boolean
64+
width: number
65+
height: number
66+
x?: number
67+
y?: number
68+
}) => void
69+
})
6670
}
6771
scroll?.getScrollResponder?.()?.scrollResponderZoomTo(
6872
curScaleRef.current > 1.01

‎shared/constants/chat2/convostate.tsx‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,6 @@ const createSlice: Z.ImmerStateCreator<ConvoState> = (set, get) => {
457457
}
458458
}
459459

460-
let loadMessageCount = 0
461-
462460
const dispatch: ConvoState['dispatch'] = {
463461
addBotMember: (username, allowCommands, allowMentions, restricted, convs) => {
464462
const f = async () => {
@@ -913,10 +911,6 @@ const createSlice: Z.ImmerStateCreator<ConvoState> = (set, get) => {
913911
const {scrollDirection: sd = 'none', numberOfMessagesToLoad = numMessagesOnInitialLoad} = p
914912
const {forceClear = false, reason, messageIDControl, knownRemotes, centeredMessageID} = p
915913

916-
// ignore incoming calls if we've already started a new load
917-
loadMessageCount++
918-
const currentLoadMessageCount = loadMessageCount
919-
920914
const scrollDirectionToPagination = (sd: ScrollDirection, numberOfMessagesToLoad: number) => {
921915
const pagination = {
922916
last: false,
@@ -957,10 +951,6 @@ const createSlice: Z.ImmerStateCreator<ConvoState> = (set, get) => {
957951
const loadingKey = Common.waitingKeyThreadLoad(conversationIDKey)
958952
let calledClear = false
959953
const onGotThread = (thread: string) => {
960-
if (currentLoadMessageCount !== loadMessageCount) {
961-
return
962-
}
963-
964954
if (!thread) {
965955
return
966956
}
@@ -1010,9 +1000,6 @@ const createSlice: Z.ImmerStateCreator<ConvoState> = (set, get) => {
10101000
'chat.1.chatUi.chatThreadCached': p => onGotThread(p.thread || ''),
10111001
'chat.1.chatUi.chatThreadFull': p => onGotThread(p.thread || ''),
10121002
'chat.1.chatUi.chatThreadStatus': p => {
1013-
if (currentLoadMessageCount !== loadMessageCount) {
1014-
return
1015-
}
10161003
// if we're validated, never undo that
10171004
if (get().threadLoadStatus === T.RPCChat.UIChatThreadStatusTyp.validated) {
10181005
return

‎shared/desktop/app/node2.desktop.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,8 @@ const plumbEvents = () => {
431431
() => {},
432432
(c: boolean) => {
433433
R.remoteDispatch(RemoteGen.createEngineConnection({connected: c}))
434-
}
434+
},
435+
false
435436
)
436437

437438
const timeoutPromise = async (timeMs: number) =>

‎shared/engine/index-impl.tsx‎

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,17 @@ class Engine {
6060
this._emitWaiting(changes)
6161
}, 500)
6262

63-
constructor(emitWaiting: (changes: BatchParams) => void, onConnected: (c: boolean) => void) {
63+
constructor(
64+
emitWaiting: (changes: BatchParams) => void,
65+
onConnected: (c: boolean) => void,
66+
allowIncomingCalls = true
67+
) {
6468
this._onConnectedCB = onConnected
65-
const f = async () => {
66-
this._engineConstantsIncomingCall = (
67-
await import('@/constants')
68-
).useEngineState.getState().dispatch.onEngineIncoming
69+
// the node engine doesn't do this and we don't want to pull in any reqs
70+
if (allowIncomingCalls) {
71+
this._engineConstantsIncomingCall =
72+
require('@/constants/engine')._useState.getState().dispatch.onEngineIncoming
6973
}
70-
f()
71-
.then(() => {})
72-
.catch(() => {})
7374
this._emitWaiting = emitWaiting
7475
this._rpcClient = createClient(
7576
payload => this._rpcIncoming(payload as any),
@@ -124,8 +125,8 @@ class Engine {
124125

125126
// Got a cancelled sequence id
126127
_handleCancel(seqid: number) {
127-
const cancelledSessionID = Object.keys(this._sessionsMap).find(
128-
key => this._sessionsMap[key]?.hasSeqID(seqid)
128+
const cancelledSessionID = Object.keys(this._sessionsMap).find(key =>
129+
this._sessionsMap[key]?.hasSeqID(seqid)
129130
)
130131
if (cancelledSessionID) {
131132
const s = this._sessionsMap[cancelledSessionID]
@@ -184,6 +185,7 @@ class Engine {
184185
}
185186
}
186187
_engineConstantsIncomingCall = (_a: EngineGen.Actions): void => {
188+
logger.error('_engineConstantsIncomingCall not overriden')
187189
throw Error('needs override')
188190
}
189191

@@ -326,13 +328,19 @@ if (__DEV__) {
326328
engine = global.DEBUGEngine as Engine
327329
}
328330

329-
const makeEngine = (emitWaiting: (b: BatchParams) => void, onConnected: (c: boolean) => void) => {
331+
const makeEngine = (
332+
emitWaiting: (b: BatchParams) => void,
333+
onConnected: (c: boolean) => void,
334+
allowIncomingCalls = true
335+
) => {
330336
if (__DEV__ && engine) {
331337
logger.warn('makeEngine called multiple times')
332338
}
333339

334340
if (!engine) {
335-
engine = isTesting ? (new FakeEngine() as unknown as Engine) : new Engine(emitWaiting, onConnected)
341+
engine = isTesting
342+
? (new FakeEngine() as unknown as Engine)
343+
: new Engine(emitWaiting, onConnected, allowIncomingCalls)
336344
initEngine(engine as any)
337345
initEngineListener(engineListener)
338346
}

‎shared/engine/index.d.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export declare class Engine {
2929
export declare function getEngine(): Engine
3030
export declare function makeEngine(
3131
emitWaiting: (b: BatchParams) => void,
32-
onConnected: (c: boolean) => void
32+
onConnected: (c: boolean) => void,
33+
allowIncomingCalls?: boolean
3334
): Engine
3435
export default getEngine
3536
export type {IncomingCallMapType, CustomResponseIncomingCallMapType}

‎shared/engine/index.platform.desktop.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class ProxyNativeTransport extends TransportShared {
6868
}
6969

7070
send(msg: unknown) {
71+
// send over bridge to node to really send
7172
engineSend?.(msg as Uint8Array)
7273
return true
7374
}

0 commit comments

Comments
 (0)