|
@@ -4,7 +4,8 @@ import {
|
|
|
NavController,
|
|
|
MenuController,
|
|
|
InfiniteScroll,
|
|
|
- Refresher
|
|
|
+ Refresher,
|
|
|
+ LoadingController
|
|
|
} from "ionic-angular";
|
|
|
import { Storage } from "@ionic/storage";
|
|
|
import { WriteTweetPage } from "../write-tweet/write-tweet";
|
|
@@ -24,7 +25,8 @@ export class HomePage {
|
|
|
public navCtrl: NavController,
|
|
|
private menuCtrl: MenuController,
|
|
|
private storage: Storage,
|
|
|
- private feed: FeedProvider
|
|
|
+ private feed: FeedProvider,
|
|
|
+ private loadingCtrl: LoadingController
|
|
|
) {
|
|
|
this.storage.get("userId").then(userId => (this.userId = userId));
|
|
|
}
|
|
@@ -34,9 +36,14 @@ export class HomePage {
|
|
|
}
|
|
|
|
|
|
ionViewDidEnter() {
|
|
|
+ const loading = this.loadingCtrl.create();
|
|
|
+ loading.present();
|
|
|
+
|
|
|
this.feed
|
|
|
.loadHomeTimeline(this.userId)
|
|
|
- .then(tweets => (this.tweets = tweets));
|
|
|
+ .then(tweets => (this.tweets = tweets))
|
|
|
+ .catch(err => console.error(err))
|
|
|
+ .then(() => loading.dismiss());
|
|
|
}
|
|
|
|
|
|
doRefresh(refresher: Refresher) {
|