#120 Handle errors gracefully
Merged 2 years ago by amitosh. Opened 2 years ago by amitosh.
amitosh/Fedora-app error-handling  into  master

@@ -0,0 +1,85 @@ 

+ <?xml version="1.0" encoding="UTF-8" standalone="no"?>

+ <!-- Created with Inkscape (http://www.inkscape.org/) -->

+ 

+ <svg

+    xmlns:dc="http://purl.org/dc/elements/1.1/"

+    xmlns:cc="http://creativecommons.org/ns#"

+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

+    xmlns:svg="http://www.w3.org/2000/svg"

+    xmlns="http://www.w3.org/2000/svg"

+    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"

+    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"

+    width="33.866665mm"

+    height="33.865509mm"

+    viewBox="0 0 119.99999 119.9959"

+    id="svg5311"

+    version="1.1"

+    inkscape:version="0.91 r13725"

+    sodipodi:docname="logo.svg">

+   <defs

+      id="defs5313" />

+   <sodipodi:namedview

+      id="base"

+      pagecolor="#ffffff"

+      bordercolor="#666666"

+      borderopacity="1.0"

+      inkscape:pageopacity="0.0"

+      inkscape:pageshadow="2"

+      inkscape:zoom="0.35"

+      inkscape:cx="720.61746"

+      inkscape:cy="-365.81321"

+      inkscape:document-units="px"

+      inkscape:current-layer="layer1"

+      showgrid="false"

+      fit-margin-top="0"

+      fit-margin-left="0"

+      fit-margin-right="0"

+      fit-margin-bottom="0"

+      inkscape:window-width="1366"

+      inkscape:window-height="704"

+      inkscape:window-x="0"

+      inkscape:window-y="27"

+      inkscape:window-maximized="1" />

+   <metadata

+      id="metadata5316">

+     <rdf:RDF>

+       <cc:Work

+          rdf:about="">

+         <dc:format>image/svg+xml</dc:format>

+         <dc:type

+            rdf:resource="http://purl.org/dc/dcmitype/StillImage" />

+         <dc:title></dc:title>

+       </cc:Work>

+     </rdf:RDF>

+   </metadata>

+   <g

+      inkscape:label="Layer 1"

+      inkscape:groupmode="layer"

+      id="layer1"

+      transform="translate(862.76032,-46.553102)">

+     <g

+        transform="matrix(1.0016156,0,0,1.0016156,-1551.8414,-53.608799)"

+        id="g5241">

+       <path

+          inkscape:connector-curvature="0"

+          style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:expanded;font-size:11.72808552px;line-height:89.99999762%;font-family:Comfortaa;-inkscape-font-specification:'Comfortaa Bold Expanded';text-align:start;writing-mode:lr-tb;text-anchor:start;fill:#3c6eb4;fill-opacity:1;stroke:none"

+          id="path5239"

+          d="m 799.33773,208.89468 0,4.61564 c 0,0.30924 -0.18707,0.49631 -0.5612,0.56121 l -0.0401,0 c -0.31687,0 -0.51158,-0.19661 -0.58411,-0.58984 l 0,-7.3186 c 0.0458,-0.42376 0.22524,-0.63564 0.5383,-0.63565 l 0.0859,0 c 0.31687,10e-6 0.52875,0.22525 0.63565,0.67574 l 2.62851,5.87549 c 0.0344,-0.13362 0.61083,-1.47555 1.72944,-4.0258 l 1.0766,-2.31927 c 0.12979,-0.13743 0.27105,-0.20615 0.42377,-0.20616 l 0.0859,0 c 0.31304,10e-6 0.49248,0.21189 0.5383,0.63565 l 0,7.3186 c -0.0725,0.39323 -0.26725,0.58984 -0.58412,0.58984 l -0.0401,0 c -0.37415,-0.0649 -0.56122,-0.25197 -0.56121,-0.56121 l 0,-4.62136 c -1.4202,3.21453 -2.16275,4.87334 -2.22765,4.97641 -0.15653,0.13744 -0.30924,0.20616 -0.45813,0.20616 -0.33596,0 -0.61275,-0.33978 -0.83036,-1.01933 l -1.85542,-4.15752 m -7.79387,-3.39015 5.3601,0 c 0.36268,0.0687 0.54402,0.2558 0.54402,0.56121 l 0,0.0859 c 0,0.31306 -0.21189,0.49249 -0.63565,0.5383 l -1.99286,0 0,6.82038 c 0,0.30924 -0.19089,0.49631 -0.57266,0.56121 l -0.0286,0 c -0.31688,0 -0.51158,-0.19661 -0.58411,-0.58984 l 0,-6.79175 -2.03867,0 c -0.39323,-0.0763 -0.58985,-0.28251 -0.58985,-0.61847 0.084,-0.37795 0.26343,-0.56693 0.53831,-0.56694" />

+       <path

+          inkscape:connector-curvature="0"

+          style="fill:#294172;fill-opacity:1"

+          id="path35"

+          d="m 807.77586,159.90439 c 0,-33.08386 -26.81923,-59.90405 -59.90309,-59.90405 -33.06851,0 -59.87718,26.79812 -59.90117,59.86183 l -0.002,-0.002 0,46.35579 0.002,0.002 c 0.0182,7.50719 6.10631,13.58472 13.61831,13.58472 0.0211,0 0.0422,-0.002 0.0643,-0.002 l 0.004,0.002 46.23777,0 0,0 c 33.07426,-0.0134 59.88006,-26.82403 59.88006,-59.89829 z" />

+       <path

+          inkscape:connector-curvature="0"

+          style="fill:#3c6eb4;fill-opacity:1"

+          id="path39"

+          d="m 765.46056,114.20011 c -15.52773,0 -28.11456,12.58684 -28.11456,28.11456 0,0.006 0,0.0125 0,0.0202 l 0,14.88103 -14.83401,0 c -0.003,0 -0.003,0 -0.005,0 -15.52869,0 -28.11457,12.52542 -28.11457,28.05123 0,15.52773 12.58588,28.11553 28.11457,28.11553 15.52677,0 28.11456,-12.58876 28.11456,-28.11553 0,-0.005 0,-0.0125 0,-0.0182 l 0,-14.94435 14.83305,0 c 0.003,0 0.005,0 0.006,0 15.52677,0 28.11457,-12.4621 28.11457,-27.98983 0,-15.52772 -12.5878,-28.11456 -28.11457,-28.11456 z m -28.1136,71.09192 c -0.0134,8.18365 -6.65324,14.81577 -14.83881,14.81577 -8.19516,0 -14.90021,-6.64459 -14.90021,-14.83976 0,-8.19612 6.70505,-14.9645 14.90021,-14.9645 0.008,0 0.0144,0.002 0.0201,0.002 l 12.71445,0 c 0.004,0 0.007,-0.002 0.01,-0.002 1.15717,0 2.09653,0.93649 2.09653,2.09365 0,9.6e-4 -9.6e-4,0.003 -9.6e-4,0.005 l 0,12.89004 -9.6e-4,0 z m 28.11264,-28.07714 c -0.005,0 -0.01,0 -0.0144,0 l -12.72308,0 c -0.002,0 -0.006,0 -0.006,0 -1.15909,0 -2.09557,-0.9384 -2.09557,-2.09557 l 0,-0.002 0,-12.82767 c 0.0144,-8.18653 6.65228,-14.81578 14.83784,-14.81578 8.19613,0 14.90213,6.64364 14.90213,14.84072 0.002,8.19517 -6.70504,14.90022 -14.90117,14.90022 z" />

+       <path

+          inkscape:connector-curvature="0"

+          style="fill:#ffffff"

+          id="path41"

+          d="m 737.34696,157.21489 0,-14.88102 c 0,-0.008 0,-0.0144 0,-0.0202 0,-15.52773 12.58683,-28.11457 28.11456,-28.11457 2.35656,0 4.02994,0.26387 6.21186,0.83573 3.17885,0.83286 5.77624,3.43792 5.7772,6.47093 9.6e-4,3.66532 -2.65975,6.32988 -6.63596,6.32988 -1.89503,0 -2.57916,-0.3627 -5.35406,-0.3627 -8.18557,0 -14.82345,6.62925 -14.83784,14.81578 l 0,12.82767 0,0.002 c 0,1.15717 0.93648,2.09557 2.09557,2.09557 0,0 0.004,0 0.006,0 l 9.74382,0 c 3.63174,0 6.56304,2.90539 6.56591,6.54577 0,3.64325 -2.93513,6.54289 -6.56591,6.54289 l -11.84514,0 0,14.94434 c 0,0.006 0,0.0134 0,0.0202 0,15.52581 -12.58779,28.11361 -28.11457,28.11361 -2.35559,0 -4.02993,-0.26578 -6.2109,-0.83573 -3.17885,-0.8319 -5.7772,-3.43888 -5.77816,-6.47093 0,-3.66532 2.65976,-6.33084 6.63693,-6.33084 1.89311,0 2.57915,0.36366 5.35213,0.36366 8.18557,0 14.82537,-6.63021 14.83977,-14.81578 0,0 0,-12.89388 0,-12.89388 0,-1.15525 -0.93936,-2.09173 -2.09653,-2.09173 -0.002,0 -0.003,0 -0.006,0 l -9.74285,-0.002 c -3.63174,0 -6.56688,-2.89771 -6.56688,-6.53905 -0.002,-3.66436 2.96489,-6.5496 6.63597,-6.5496 l 11.77509,0 0,0 z" />

+     </g>

+   </g>

+ </svg>

file modified
+2 -2

@@ -44,7 +44,7 @@ 

          <ion-list *ngIf="socialposts.length !== 0">

            <ion-card *ngFor="let update of socialposts" tappable (click)="openUpdate(update)">

              <ion-card-header>

-               <img src="./assets/img/logo.svg" height="34px">

+               <img src="./assets/img/fedora_colored.svg" height="34px">

                <div>

                  <span class="active-title">Fedora</span>

                  <span class="body-subtitle">

@@ -59,4 +59,4 @@ 

        </ion-list>

      </div>

    </div>

- </ion-content> 

\ No newline at end of file

+ </ion-content>

file modified
+24 -8

@@ -1,5 +1,5 @@ 

  import { Component } from '@angular/core';

- import { NavController } from 'ionic-angular';

+ import { NavController, ToastController } from 'ionic-angular';

  import { NotificationsPage } from '../../pages/notifications/notifications'

  import { Browser } from '../../providers/browser/browser';

  import { FacebookProvider } from '../../providers/social/facebook';

@@ -29,23 +29,24 @@ 

    /**

     * List of Facebook and Twitter Posts

     */

-   private socialposts: SocialMediaPost[];

+   socialposts: SocialMediaPost[];

  

    /**

     * List of images fetched from FedoraMag showing top 5 latest events

     */

-   private carousel: Image[];

+   carousel: Image[];

  

    /**

     * List of posts from Fedora Community Blog

     */

-   private blogposts: Post[];

+   blogposts: Post[];

  

    constructor(public navCtrl: NavController, private browser: Browser,

                private fb: FacebookProvider,

                private twitter: TwitterProvider,

                private fedoraMag: FedoraMagazineService,

-               private communityblog: CommunityBlogService) {

+               private communityblog: CommunityBlogService,

+               private toast: ToastController) {

      this.socialposts = [];

      this.blogposts = [];

      this.carousel = [];

@@ -60,7 +61,12 @@ 

      combineLatest(this.fb.getPosts(HANDLE.FB), this.twitter.getPosts(HANDLE.TWITTER))

        .subscribe(values => {

          this.socialposts = [...values[0], ...values[1]] as SocialMediaPost[];

-       });

+       }, () => this.toast.create({

+           message: 'Could not load feed',

+           position: 'bottom',

+           duration: 2000,

+         }).present()

+       );

    }

  

    /**

@@ -70,7 +76,12 @@ 

      this.fedoraMag.getImages()

        .subscribe(images => {

          this.carousel = images;

-       });

+       }, () => this.toast.create({

+         message: 'Could not update header',

+         position: 'bottom',

+         duration: 2000,

+       }).present()

+     );

    }

  

    /**

@@ -80,7 +91,12 @@ 

      this.communityblog.getBlogPosts('null')

        .subscribe(blogposts => {

          this.blogposts = blogposts;

-       });

+       }, () => this.toast.create({

+         message: 'Could not load blog posts',

+         position: 'bottom',

+         duration: 2000,

+       }).present()

+     );

    }

  

    ngOnInit() {

Handle network and other HTTP errors and allow app to work as intended, from offline content

Pull-Request has been merged by amitosh

2 years ago