Skip to content

Commit

Permalink
expose restore method
Browse files Browse the repository at this point in the history
  • Loading branch information
rarescioroga committed Apr 16, 2024
1 parent 2c074f7 commit fbebc97
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,8 @@ public void stop() {
}

@ReactMethod
public void restore(Promise promise) {
public void restore() {
airshipAdapter().restore();

promise.resolve(airshipAdapter().isStarted());
}

@ReactMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract class RtnGimbalAirshipAdapterSpec extends ReactContextBaseJavaModule {

public abstract void stop();

public abstract void restore(Promise promise);
public abstract void restore();

public abstract void getGdprConsentRequirement(Promise promise);

Expand Down
2 changes: 1 addition & 1 deletion ios/GimbalService.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
*
* @return Boolean indicating whether or not the Adapter was started.
*/
- (BOOL)restore;
- (void)restore;

/**
* Stops the service.
Expand Down
1 change: 0 additions & 1 deletion ios/GimbalService.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ - (void)stop {

- (BOOL)restore {
[AirshipAdapter.shared restore];
return [AirshipAdapter.shared isStarted];
}

-(void)setAnalyticsId:(NSString *)id {
Expand Down
3 changes: 1 addition & 2 deletions ios/RtnGimbalAirshipAdapter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ + (BOOL)requiresMainQueueSetup {
}

RCT_EXPORT_METHOD(restore) {
[[GimbalService shared] restore];
resolve(@([[GimbalService shared] isStarted]));
[[GimbalService shared] stop];
}

RCT_REMAP_METHOD(isStarted,
Expand Down
3 changes: 1 addition & 2 deletions src/GimbalAirshipAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ export interface Spec {

/**
* Stops the Gimbal Adapter.
* @return A promise with a boolean result indicating whether the adapter successfully started.
*/
restore(): Promise<boolean>;
restore(): void;

/**
* Checks if the adapter is started.
Expand Down
2 changes: 1 addition & 1 deletion src/NativeGimbalAirshipAdapterModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface Spec extends TurboModule {
setGimbalApiKey(gimbalApiKey: string): void;
start(gimbalApiKey: string): Promise<boolean>;
stop(): void;
restore(): Promise<boolean>;
restore(): void;
isStarted(): Promise<boolean>;
getGdprConsentRequirement(): Promise<Int32>;
setUserConsent(consentType: Int32, state: Int32): void;
Expand Down
4 changes: 2 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ export const GimbalAirshipAdapter: GimbalAirshipAdapterSpec = {
GimbalAirshipAdapterModule.stop();
},

restore(): Promise<boolean> {
return GimbalAirshipAdapterModule.restore();
restore() {
GimbalAirshipAdapterModule.restore();
},

/**
Expand Down

0 comments on commit fbebc97

Please sign in to comment.