Skip to content

Commit

Permalink
commit before recording
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronak99 committed Jun 10, 2020
1 parent 08b2cc3 commit c25c90a
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 40 deletions.
7 changes: 7 additions & 0 deletions android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.example.skype_clone

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
32 changes: 32 additions & 0 deletions ios/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*

# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
13 changes: 13 additions & 0 deletions ios/Runner/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
1 change: 1 addition & 0 deletions ios/Runner/Runner-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#import "GeneratedPluginRegistrant.h"
58 changes: 58 additions & 0 deletions ios/hive_methods.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'dart:io';

import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
import 'package:skype_clone/models/log.dart';
import 'package:skype_clone/resources/local_db/interface/log_interface.dart';

class HiveMethods implements LogInterface {
String _hiveBox = "Call_Logs";

@override
init() async {
final Directory d = await getApplicationDocumentsDirectory();
Hive.init(d.path);
}

@override
addLogs(Log log) async {
final Box box = await Hive.openBox(_hiveBox);
var logMap = log.toMap(log);
int idOfInput = await box.add(logMap);
close();
return idOfInput;
}

updateLogs(int i, Log log) async {
final Box box = await Hive.openBox(_hiveBox);
var logMap = log.toMap(log);
await box.put(i, logMap);
close();
}

@override
Future<List<Log>> getLogs() async {
final Box box = await Hive.openBox(_hiveBox);
List<Log> list = [];

for (int i = 0; i < box.length; i++) {
var logMap = box.getAt(i);
list.add(
Log.fromMap(
logMap,
),
);
}

return list;
}

@override
deleteLogs(int logId) async {
final Box box = await Hive.openBox(_hiveBox);
await box.deleteAt(logId);
}

@override
close() => Hive.close();
}
53 changes: 17 additions & 36 deletions lib/resources/local_db/db/hive_methods.dart
Original file line number Diff line number Diff line change
@@ -1,54 +1,35 @@
import 'dart:io';

import 'package:hive/hive.dart';
import 'package:path_provider/path_provider.dart';
import 'package:skype_clone/models/log.dart';
import 'package:skype_clone/resources/local_db/interface/log_interface.dart';

class HiveMethods implements LogInterface {
String _hiveBox;

@override
openDb(String dbName) => _hiveBox = dbName;

@override
init() async {
final Directory d = await getApplicationDocumentsDirectory();
Hive.init(d.path);
addLogs(Log log) {
print("Adding values to hive db");
return null;
}

@override
addLogs(Log log) async {
final Box box = await Hive.openBox(_hiveBox);
var logMap = log.toMap(log);
int idOfInput = await box.add(logMap);
Hive.close();
return idOfInput;
close() {
// TODO: implement close
return null;
}

@override
Future<List<Log>> getLogs() async {
final Box box = await Hive.openBox(_hiveBox);
List<Log> list = [];

for (int i = 0; i < box.length; i++) {
var logMap = box.getAt(i);
list.add(
Log.fromMap(
logMap,
),
);
}

return list;
deleteLogs(int logId) {
// TODO: implement deleteLogs
return null;
}

@override
deleteLogs(int logId) async {
final Box box = await Hive.openBox(_hiveBox);
await box.deleteAt(logId);
Future<List<Log>> getLogs() {
// TODO: implement getLogs
return null;
}

@override
close() => Hive.close();
}
init() {
print("initialized hive db");
return null;
}
}
9 changes: 5 additions & 4 deletions lib/utils/call_utilities.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ class CallUtils {
LogRepository.addLogs(log);

Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CallScreen(call: call),
));
context,
MaterialPageRoute(
builder: (context) => CallScreen(call: call),
),
);
}
}
}

0 comments on commit c25c90a

Please sign in to comment.