kandi background
Explore Kits

sp-react-native-in-app-updates | app updater for the native version | iOS library

 by   SudoPlz TypeScript Version: Current License: MIT

 by   SudoPlz TypeScript Version: Current License: MIT

Download this library from

kandi X-RAY | sp-react-native-in-app-updates Summary

sp-react-native-in-app-updates is a TypeScript library typically used in Mobile, iOS, React Native applications. sp-react-native-in-app-updates has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.
This is a react-native native module that works on both iOS and Android, and checks the stores (play/app) for a new version of your app and can prompt your user for an update. It uses embedded in-app-updates via Play-Core on Android (to check & download google play patches natively from within the app), and react-native-siren on iOS (to check & navigate the user to the AppStore).
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • sp-react-native-in-app-updates has a low active ecosystem.
  • It has 144 star(s) with 25 fork(s). There are 6 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 10 open issues and 35 have been closed. On average issues are closed in 26 days. There are 11 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of sp-react-native-in-app-updates is current.
This Library - Support
Best in #iOS
Average in #iOS
This Library - Support
Best in #iOS
Average in #iOS

quality kandi Quality

  • sp-react-native-in-app-updates has 0 bugs and 17 code smells.
This Library - Quality
Best in #iOS
Average in #iOS
This Library - Quality
Best in #iOS
Average in #iOS

securitySecurity

  • sp-react-native-in-app-updates has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • sp-react-native-in-app-updates code analysis shows 0 unresolved vulnerabilities.
  • There are 7 security hotspots that need review.
This Library - Security
Best in #iOS
Average in #iOS
This Library - Security
Best in #iOS
Average in #iOS

license License

  • sp-react-native-in-app-updates is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
This Library - License
Best in #iOS
Average in #iOS
This Library - License
Best in #iOS
Average in #iOS

buildReuse

  • sp-react-native-in-app-updates releases are not available. You will need to build from source code and install.
  • Installation instructions, examples and code snippets are available.
  • It has 378 lines of code, 21 functions and 24 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
This Library - Reuse
Best in #iOS
Average in #iOS
This Library - Reuse
Best in #iOS
Average in #iOS
Top functions reviewed by kandi - BETA

kandi has reviewed sp-react-native-in-app-updates and discovered the below as its top functions. This is intended to give you an instant insight into sp-react-native-in-app-updates implemented functionality, and help decide if they suit your requirements.

  • Starts the update flow .
  • Checks if the application needs an update .
  • Returns the constant values .
  • Initialize Flipper
  • Creates native modules .
  • Initialize Flipper
  • Create view managers .
  • The main component name of the main component .
  • Get the react native host .

sp-react-native-in-app-updates Key Features

An in-app updater for the native version of your react-native app.

Installation

copy iconCopydownload iconDownload
<key>LSApplicationQueriesSchemes</key>
<array>
  <string>itms-apps</string>
</array>

Usage

copy iconCopydownload iconDownload
import SpInAppUpdates, {
  NeedsUpdateResponse,
  IAUUpdateKind,
  StartUpdateOptions,
} from 'sp-react-native-in-app-updates';

const inAppUpdates = new SpInAppUpdates(
  false // isDebug
);
// curVersion is optional if you don't provide it will automatically take from the app using react-native-device-info
inAppUpdates.checkNeedsUpdate({ curVersion: '0.0.8' }).then((result) => {
  if (result.shouldUpdate) {
    let updateOptions: StartUpdateOptions = {};
    if (Platform.OS === 'android') {
      // android only, on iOS the user will be promped to go to your app store page
      updateOptions = {
        updateType: IAUUpdateKind.FLEXIBLE,
      };
    }
    inAppUpdates.startUpdate(updateOptions); // https://github.com/SudoPlz/sp-react-native-in-app-updates/blob/master/src/types.ts#L78
  }
});

Usage with app updates for specific country (iOS only)

copy iconCopydownload iconDownload
//                              👇🏻 (optional)
inAppUpdates.checkNeedsUpdate({ country: 'it' }).then(result => {
  if (result.shouldUpdate) {
    const updateOptions: StartUpdateOptions = Platform.select({
      ios: {
        title: 'Update available',
        message: "There is a new version of the app available on the App Store, do you want to update it?",
        buttonUpgradeText: 'Update',
        buttonCancelText: 'Cancel',
        country: 'it', // 👈🏻 the country code for the specific version to lookup for (optional)
      },
      android: {
        updateType: IAUUpdateKind.IMMEDIATE,
      },
    });
    inAppUpdates.startUpdate(updateOptions);
  }
});

Community Discussions

Trending Discussions on Mobile
  • Error: Property 'body' cannot be accessed on 'Response?' because it is potentially null
  • CSS how to prevent keyboard from shifting content up?
  • React native - Function call doesn't do anything
  • Item Counter with oval/elipse shape in Flutter
  • Flutter: How do I disable scrolling for a GridView widget, but have scrolling enabled for the page as a whole?
  • Flutter: A value of type 'ListTileThemeData' can't be assigned to a variable of type 'ListTileTheme'
  • Flutter - how to scroll to the bottom of a listview?
  • Firemonkey Listview & mobile screen orientation in Delphi 11
  • Flutter: Circular Color Picker (Package: flutter_colorpicker)
  • Changing published mobile application developing language from ionic to flutter
Trending Discussions on Mobile

QUESTION

Error: Property 'body' cannot be accessed on 'Response?' because it is potentially null

Asked 2022-Mar-29 at 00:29

so I'am trying to learn dart and flutter and everything went well so far. But now I'am stuck at an error which I cannot handle. I coded a function which is supposed to asynchronously return the actual BTC price from https://blockchain.info/ticker.

Only thing it returns is errors:

Error: Property 'body' cannot be accessed on 'Response?' because it is potentially null.
 - 'Response' is from 'package:http/src/response.dart' ('/D:/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/response.dart').
Try accessing using ?. instead.
          return Text("${BTCPrice.fromJson(jsonDecode(snapshot.data.body)).eur}");
                                                                    ^^^^
/D:/flutter/packages/flutter/lib/src/widgets/async.dart:242:12: Context: 'data' refers to a property so it couldn't be promoted.
See http://dart.dev/go/non-promo-property
  final T? data;
           ^

My Code:

import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;

Future<http.Response> fetchBTCPrice() async {
  final response = await http.get(Uri.https('blockhain.info', 'ticker'));
  return response;
}

Widget buildBTCPrice() {
  return FutureBuilder<http.Response>(
    future: fetchBTCPrice(),
    builder: (context, snapshot) {
      if (snapshot.hasData) {
        int? statusCode = snapshot.data?.statusCode;
        if (statusCode == 200) {
          return Text("${BTCPrice.fromJson(jsonDecode(snapshot.data.body)).eur}");
        }
        return Text('$statusCode');

      } else if (snapshot.hasError) {
        return Text('${snapshot.error}');
      }
      return CircularProgressIndicator();
    },
  );
}

class BTCPrice {
  final double eur;
  BTCPrice({required this.eur});

  factory BTCPrice.fromJson(Map<String, dynamic> json) {
    print(json);
    return BTCPrice(
      eur: json['eur']['15m']
    );
  }
}

Last things to mention: I'am running the application on a Android Emulator powerd by Android Studio; and please feel free to hand over any advice you have (in terms of code improvement), even if it is not fixing my issue.

ANSWER

Answered 2022-Mar-29 at 00:29

To get rid of that error you need to use the bang operator to tell the compiler that snapshot.data won't be null.

if (statusCode == 200) {
  return Text(
 "${BTCPrice.fromJson(jsonDecode(snapshot.data!.body)).eur}"); // adding ! on data
}
Edit

The unrelated error you mentioned in your comment:

unexpected character (at character 1) <html><head><title>loading...</title></head><body><script type='text/javasc... ^

would be fixed by changing your GET request from this

final response = await http.get(Uri.https('blockhain.info', 'ticker'));

to this

final response = await http.get(Uri.parse('https://blockchain.info/ticker'));

Source https://stackoverflow.com/questions/71640944

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install sp-react-native-in-app-updates

On iOS you may need to also add the following lines in your Info.plist to be able to launch the store deep link. It uses react-native-device-info to get curVersion. Install it if you want to avoid curVersion option.

Support

Keep in mind that this library is JUST a WRAPPER of the in-app-update api, so if you have trouble making in-app-updates work it's most probably because you're doing something wrong with google play.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Explore Related Topics

Share this Page

share link
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.