Skip to content

Commit

Permalink
add refresh button to refetch photos from GoPro
Browse files Browse the repository at this point in the history
  • Loading branch information
sultanmyrza committed Dec 27, 2021
1 parent fb497cd commit 31e451f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = G7NB5YCKAP;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
Expand All @@ -383,7 +383,7 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = G7NB5YCKAP;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<mat-icon>arrow_back</mat-icon>
</button>
<span>GoPro Media on Camera</span>

<button (click)="fetchFilesFromGoProWiFi()" mat-icon-button>
<mat-icon>refresh</mat-icon>
</button>
</mat-toolbar>

<ion-content>
Expand All @@ -24,7 +28,7 @@ <h4 *ngIf="fetchingFilesError">
{{ fetchingFilesError }}
</h4>

<h4 *ngIf="fetchingFiles">Fetching files</h4>
<h4 *ngIf="fetchingFiles">Fetching files...</h4>

<div class="go-pro-container">
<mat-grid-list cols="3" gutterSize="8px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ export class GoProMediaListOnCameraComponent implements OnInit {
public toastController: ToastController
) {}

async ngOnInit() {
ngOnInit() {
this.checkWiFiConnection();
}

async checkWiFiConnection() {
this.connectedWifiSSID = await this.goProWifiService.getConnectedWifiSSID();
this.isConnectedToGoProWifi =
Expand All @@ -41,9 +42,18 @@ export class GoProMediaListOnCameraComponent implements OnInit {
this.fetchFilesFromGoProWiFi();
}
}

async fetchFilesFromGoProWiFi() {
const result = await this.goProMediaService.getFilesFromGoPro();
this.allMediaFiles = result;
try {
this.fetchingFilesError = undefined;
this.fetchingFiles = true;
this.allMediaFiles = await this.goProMediaService.getFilesFromGoPro();
this.fetchingFiles = false;
} catch (error: any) {
this.fetchingFilesError = error.toString();
this.allMediaFiles = [];
this.fetchingFiles = false;
}
}

async connectToGoProWifi() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class GoProMediaService {

const data = response.data;

const files = data.media[0].fs as any[];
const files = (data.media[0].fs as any[]).reverse();

const fileNames: string[] = files.map(e => e.n);

Expand Down

0 comments on commit 31e451f

Please sign in to comment.