Skip to main content

silent_ios 0.0.1 copy "silent_ios: ^0.0.1" to clipboard
silent_ios: ^0.0.1 copied to clipboard

PlatformiOS
unlistedoutdated

Silent SDK is a technical solution for collecting some end user and mobile device data in the host application with minimal influence on the user experience.

example/lib/main.dart

import 'package:customized/customized.dart';
import 'package:flutter/material.dart';
import 'package:silent_ios/silent_ios.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await SilentIos.instance.initialize(
      packageName: 'com.lis.ewalletguita',
      appId: '1931be517520a37f87db3c47769f5f3f',
      appSecret: '5e507181017efe1ef2ae6678984ff935');

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Silent SDK',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Silent SDK'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  bool _isValidated = false;
  bool _isTelephonyRequested = false;
  bool _isLocationRequested = false;

  void onRequestLocation() async {
    var result = await SilentIos.instance.requestLocation();
    setState(() => _isLocationRequested = result);
    print('accepted: $result');
  }

  void onRequestTelephony() async {
    var result = await SilentIos.instance.requestTelephony();
    setState(() => _isTelephonyRequested = result);
    print('accepted: $result');
  }

  void onCapture() async {
    var uid = '3593569363956739';
    var loadId = DateTime.now().toIso8601String();

    var result = await SilentIos.instance.capture(uid: uid, loadId: loadId);

    print('captured: $result');
  }

  void onInitialize() async {
    await Future.delayed(const Duration(seconds: 2));
    var isValidated = await SilentIos.instance.isValidated();
    setState(() => _isValidated = isValidated);
  }

  Widget _itemInfoBody({required String value, required String label}) {
    return Container(
      alignment: Alignment.centerLeft,
      child: Text.rich(TextSpan(children: [
        TextSpan(
            text: label,
            style:
            const TextStyle(fontWeight: FontWeight.bold, fontSize: 18.0)),
        TextSpan(text: ': ', style: const TextStyle(fontSize: 18.0)),
        TextSpan(text: value, style: const TextStyle(fontSize: 18.0))
      ])),
    );
  }

  @override
  void initState() {
    super.initState();
    onInitialize();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Container(
          padding: EdgeInsets.all(18.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              _itemInfoBody(
                  label: 'Silent SDK initialized?', value: '$_isValidated'),
              SizedBox(
                height: 8.0,
              ),
              _itemInfoBody(
                  label: 'Location Requested?', value: '$_isLocationRequested'),
              SizedBox(
                height: 8.0,
              ),
              _itemInfoBody(
                  label: 'Telephony Requested?',
                  value: '$_isTelephonyRequested'),
              SizedBox(
                height: 50.0,
              ),
              DefaultButton(
                text: 'Request Location',
                onPressed: onRequestLocation,
              ),
              SizedBox(
                height: 16.0,
              ),
              DefaultButton(
                text: 'Request Telephony',
                onPressed: onRequestTelephony,
              ),
              SizedBox(
                height: 16.0,
              ),
              DefaultButton(
                text: 'Capture Data',
                onPressed: onCapture,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
150
points
13
downloads

Documentation

API reference

Publisher

verified publisheredvaldomartins.dev

Weekly Downloads

Silent SDK is a technical solution for collecting some end user and mobile device data in the host application with minimal influence on the user experience.

Repository

License

MIT (license)

Dependencies

flutter, plugin_platform_interface, silent_platform_interface

More

Packages that depend on silent_ios

Packages that implement silent_ios