Skip to content

Commit

Permalink
feat: rename updateApp to downloadApp in module spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Андрей Непеин committed Dec 17, 2022
1 parent 3693ba5 commit 66bba1a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
Expand Up @@ -47,8 +47,8 @@ public String getName() {
}

@ReactMethod
public void updateApp(String apkUrl) {
DownloadUtils.updateApp(activity, apkUrl);
public void downloadApp(String apkUrl) {
DownloadUtils.downloadApp(activity, apkUrl);
}

@ReactMethod
Expand Down
Expand Up @@ -6,7 +6,7 @@
import com.reactnativeinappupdate.Constants;

public class DownloadUtils {
public static void updateApp(final Activity context, final String downloadUrl) {
public static void downloadApp(final Activity context, final String downloadUrl) {
Intent intent = new Intent(context.getApplicationContext(), DownloadService.class);
intent.putExtra(Constants.APK_DOWNLOAD_URL, downloadUrl);

Expand Down
2 changes: 1 addition & 1 deletion android/src/oldarch/AppUpdateSpec.java
Expand Up @@ -9,7 +9,7 @@ abstract class AppUpdateSpec extends ReactContextBaseJavaModule {
super(context);
}

public abstract void updateApp(String apkUrl);
public abstract void downloadApp(String apkUrl);

public abstract void getVersionCode(Promise promise);

Expand Down
5 changes: 2 additions & 3 deletions example/package.json
Expand Up @@ -10,13 +10,12 @@
},
"dependencies": {
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-update-in-app": "../"
"react-native": "0.70.6"
},
"devDependencies": {
"@babel/core": "7.12.9",
"@babel/runtime": "7.12.5",
"babel-plugin-module-resolver": "4.1.0",
"metro-react-native-babel-preset": "0.72.3"
}
}
}
3 changes: 0 additions & 3 deletions example/yarn.lock
Expand Up @@ -3722,9 +3722,6 @@ react-native-gradle-plugin@^0.70.3:
resolved "https://registry.yarnpkg.com/react-native-gradle-plugin/-/react-native-gradle-plugin-0.70.3.tgz#cbcf0619cbfbddaa9128701aa2d7b4145f9c4fc8"
integrity sha512-oOanj84fJEXUg9FoEAQomA8ISG+DVIrTZ3qF7m69VQUJyOGYyDZmPqKcjvRku4KXlEH6hWO9i4ACLzNBh8gC0A==

react-native-update-in-app@../:
version "0.4.3"

react-native@0.70.6:
version "0.70.6"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.70.6.tgz#d692f8b51baffc28e1a8bc5190cdb779de937aa8"
Expand Down
2 changes: 1 addition & 1 deletion src/AppUpdate.ts
Expand Up @@ -25,7 +25,7 @@ const AppUpdate = {
return AppUpdateModule.getVersionCode();
},
downloadApp(apkUrl: string) {
AppUpdateModule.updateApp(apkUrl);
AppUpdateModule.downloadApp(apkUrl);
},
installApp(apkFileName: string): Promise<null> {
return AppUpdateModule.installApp(apkFileName);
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/NativeAppUpdate.ts
Expand Up @@ -3,7 +3,7 @@ import { TurboModuleRegistry } from 'react-native';

export interface Spec extends TurboModule {
getVersionCode(): Promise<number>;
updateApp(apkUrl: string): void;
downloadApp(apkUrl: string): void;
installApp(apkFileName: string): Promise<null>;

addListener(eventName: string): void;
Expand Down

0 comments on commit 66bba1a

Please sign in to comment.