Skip to content

Commit df8c876

Browse files
authored
cleanup native names. sanity check modules exist on the js side. fix android log send name difference (keybase#25030)
1 parent 9016f1c commit df8c876

15 files changed

Lines changed: 327 additions & 235 deletions

File tree

‎shared/actions/platform-specific/index.native.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ export const showShareActionSheet = async (options: {
171171
} else {
172172
if (!options.filePath && options.message) {
173173
try {
174-
await NativeModules.ShareFiles?.shareText(options.message, options.mimeType)
174+
await NativeModules.AndroidShareFiles?.shareText(options.message, options.mimeType)
175175
return {completed: true, method: ''}
176176
} catch (_) {
177177
return {completed: false, method: ''}
178178
}
179179
}
180180

181181
try {
182-
await NativeModules.ShareFiles?.share(options.filePath ?? '', options.mimeType)
182+
await NativeModules.AndroidShareFiles?.share(options.filePath ?? '', options.mimeType)
183183
return {completed: true, method: ''}
184184
} catch (_) {
185185
return {completed: false, method: ''}
@@ -189,7 +189,7 @@ export const showShareActionSheet = async (options: {
189189

190190
const openAppSettings = async () => {
191191
if (isAndroid) {
192-
NativeModules.NativeSettings?.open()
192+
NativeModules.AndroidSettings?.open()
193193
} else {
194194
const settingsURL = 'app-settings:'
195195
const can = await Linking.canOpenURL(settingsURL)

‎shared/actions/platform-specific/push.native.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ function* deletePushToken(state: Container.TypedState, action: ConfigGen.LogoutH
262262
const requestPermissionsFromNative = async () =>
263263
isIOS ? PushNotificationIOS.requestPermissions() : Promise.resolve()
264264
const askNativeIfSystemPushPromptHasBeenShown = () =>
265-
isIOS ? NativeModules.PushPrompt?.getHasShownPushPrompt() ?? Promise.resolve(false) : Promise.resolve(false)
265+
isIOS
266+
? NativeModules.IOSPushPrompt?.getHasShownPushPrompt() ?? Promise.resolve(false)
267+
: Promise.resolve(false)
266268
const checkPermissionsFromNative = async () =>
267269
new Promise(resolve => isIOS && PushNotificationIOS.checkPermissions(resolve))
268270
const monsterStorageKey = 'shownMonsterPushPrompt'

‎shared/android/app/src/main/java/io/keybase/ossifrage/modules/LogSend.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import static io.keybase.ossifrage.MainActivity.isTestDevice;
1111

1212
public class LogSend extends ReactContextBaseJavaModule {
13-
private static final String NAME = "KBLogSend";
13+
private static final String NAME = "LogSend";
1414
private boolean misTestDevice;
1515

1616
public LogSend(final ReactApplicationContext reactContext) {

‎shared/android/app/src/main/java/io/keybase/ossifrage/modules/NativeLogger.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020
public class NativeLogger extends ReactContextBaseJavaModule {
21-
private static final String NAME = "KBNativeLogger";
21+
private static final String NAME = "NativeLogger";
2222
private static final String RN_NAME = "ReactNativeJS";
2323

2424

‎shared/android/app/src/main/java/io/keybase/ossifrage/modules/NativeSettings.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public NativeSettings(ReactApplicationContext reactContext) {
2020

2121
@Override
2222
public String getName() {
23-
return "NativeSettings";
23+
return "AndroidSettings";
2424
}
2525

2626
@ReactMethod

‎shared/android/app/src/main/java/io/keybase/ossifrage/modules/ScreenProtector.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ public void run() {
7777

7878
@Override
7979
public String getName() {
80-
return "ScreenProtector";
80+
return "AndroidScreenProtector";
8181
}
8282
}

‎shared/android/app/src/main/java/io/keybase/ossifrage/modules/ShareFiles.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public ShareFiles(ReactApplicationContext reactContext) {
3131

3232
@Override
3333
public String getName() {
34-
return "ShareFiles";
34+
return "AndroidShareFiles";
3535
}
3636

3737
@ReactMethod

‎shared/constants/platform.native.tsx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ type SetSecure = (s: boolean) => Promise<boolean> // true on successful write
77
type GetSecure = () => Promise<boolean>
88

99
export const setSecureFlagSetting: SetSecure =
10-
NativeModules?.ScreenProtector?.setSecureFlagSetting ?? (async (_s: boolean) => Promise.resolve(false))
10+
NativeModules?.AndroidScreenProtector?.setSecureFlagSetting ??
11+
(async (_s: boolean) => Promise.resolve(false))
1112
export const getSecureFlagSetting: GetSecure =
12-
NativeModules?.ScreenProtector?.getSecureFlagSetting ?? (async () => Promise.resolve(false))
13+
NativeModules?.AndroidScreenProtector?.getSecureFlagSetting ?? (async () => Promise.resolve(false))
1314
export const {version, androidIsTestDevice, uses24HourClock, androidIsDeviceSecure, fsCacheDir} =
1415
NativeModules.KeybaseEngine
1516
// Currently this is given to us as a boolean, but no real documentation on this, so just in case it changes in the future.

0 commit comments

Comments
 (0)