Adding a class to hit the Event service until we get a response

pull/68/head
Oguzhan Gungor 7 years ago
parent f7a2336012
commit cf9b0cab9f
  1. 20
      Trust.xcodeproj/project.pbxproj
  2. 41
      Trust/Redeem/Helpers/RedeemEventListener.swift

@ -273,6 +273,7 @@
442FC258BAEFDE2D64E48D0D /* TicketsCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCC8150042FE9179D574A /* TicketsCoordinator.swift */; };
442FC2CC21FFFC4FAB33A300 /* Ticket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FC90F0768C43EF903465B /* Ticket.swift */; };
442FC546ED56F5C9D3D35471 /* TicketRedemptionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCBDB86579889BC773540 /* TicketRedemptionViewModel.swift */; };
442FC54FB6CADF0461F6C95F /* RedeemEventListener.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FC57AD0C04FAB66FB834D /* RedeemEventListener.swift */; };
442FC58B7558F28F9452D383 /* GetIsStormBirdCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCEBC98D0A367D258D2C3 /* GetIsStormBirdCoordinator.swift */; };
442FC5F70AF003F331F7C841 /* GetSymbolCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCB2726DB345481C1FDA1 /* GetSymbolCoordinator.swift */; };
442FC65BFA2D42879648EC06 /* Int.swift in Sources */ = {isa = PBXBuildFile; fileRef = 442FCCAC6A172506637A2FF6 /* Int.swift */; };
@ -733,6 +734,7 @@
442FC20E6470B92A46479342 /* TicketAdaptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketAdaptor.swift; sourceTree = "<group>"; };
442FC54DA900FA2F9BB73A63 /* QuantitySelectionViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QuantitySelectionViewModel.swift; sourceTree = "<group>"; };
442FC575B6A4A50B0555E1B0 /* NumberStepper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberStepper.swift; sourceTree = "<group>"; };
442FC57AD0C04FAB66FB834D /* RedeemEventListener.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RedeemEventListener.swift; sourceTree = "<group>"; };
442FC630874D29159799EEB6 /* GetNameCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GetNameCoordinator.swift; sourceTree = "<group>"; };
442FC6911EEE85B669D7BDA1 /* TicketDecode.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TicketDecode.swift; sourceTree = "<group>"; };
442FC72F9D22CC36AC015274 /* GetERC20Decimals.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GetERC20Decimals.swift; sourceTree = "<group>"; };
@ -2500,22 +2502,23 @@
name = Pods;
sourceTree = "<group>";
};
AAEF2CA92050A64F0038BE0D /* Helpers */ = {
AA574E612054EC8B00F4B3AF /* Rest */ = {
isa = PBXGroup;
children = (
76F1DF80932454E9F58B7830 /* CreateRedeem.swift */,
AAEF2CAA2050A68A0038BE0D /* SignatureHelper.swift */,
442FC203B8266AB92D8F4032 /* EndPoints.swift */,
AA574E622054ECA400F4B3AF /* RestClient.swift */,
);
path = Helpers;
path = Rest;
sourceTree = "<group>";
};
AA574E612054EC8B00F4B3AF /* Rest */ = {
AAEF2CA92050A64F0038BE0D /* Helpers */ = {
isa = PBXGroup;
children = (
442FC203B8266AB92D8F4032 /* EndPoints.swift */,
AA574E622054ECA400F4B3AF /* RestClient.swift */,
76F1DF80932454E9F58B7830 /* CreateRedeem.swift */,
AAEF2CAA2050A68A0038BE0D /* SignatureHelper.swift */,
442FC57AD0C04FAB66FB834D /* RedeemEventListener.swift */,
);
path = Rest;
path = Helpers;
sourceTree = "<group>";
};
C876FF69204A77B400B7D0EA /* Fonts */ = {
@ -3356,6 +3359,7 @@
442FCC0C672901AF791D320F /* Event.swift in Sources */,
442FC01053E2F1B59355A961 /* Arguments.swift in Sources */,
5E7C7CF06533EDACC8E220B3 /* StaticHTMLViewController.swift in Sources */,
442FC54FB6CADF0461F6C95F /* RedeemEventListener.swift in Sources */,
5E7C7D71D3184F44C397FFE7 /* AlphaWalletHelpViewController.swift in Sources */,
5E7C7D8173CB1089D622DA38 /* AlphaWalletHelpViewCell.swift in Sources */,
5E7C72C8A15397C5A40BFE76 /* WhatIsEthereumInfoViewController.swift in Sources */,

@ -0,0 +1,41 @@
//
// RedeemEventListener.swift
// Alpha-Wallet
//
// Created by Oguzhan Gungor on 3/12/18.
// Copyright © 2018 Alpha-Wallet. All rights reserved.
//
import Foundation
class RedeemEventListener {
var shouldListen = false
func start(completion: @escaping () -> Void) {
if !shouldListen {
return
}
EventsRest().getEvents { result in
print(result)
switch result {
case .success(let events):
print(events)
completion()
case .failure(let error):
print(error)
self.start(completion: completion)
}
}
}
func stop() {
shouldListen = false
RestClient.cancel()
}
deinit {
print("deinit")
}
}
Loading…
Cancel
Save