Skip to content

Commit

Permalink
Added support for inviting new users within app. This option is avail…
Browse files Browse the repository at this point in the history
…ible while selecting payer if the user enters a valid phone number to invite.
  • Loading branch information
Raghav Bhasin authored and Raghav Bhasin committed Aug 25, 2018
1 parent 11a8644 commit 34e77bb
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Platform](https://img.shields.io/cocoapods/p/LFAlertController.svg?style=flat)](https://www.apple.com/ios/ios-11/)
[![Build Status](https://travis-ci.org/dwyl/esta.svg?branch=master)](https://travis-ci.org/dwyl/esta)

An iOS app to track/manage debt. This app allows users to create transactions, add descriptions, tag images, tag notes, and manage them. It features a rich and immersive user experience with 3D touch, quick actions, Actionable User Notifications, and Touch ID/Passcode capability for secure authentication.
An iOS and Web app to send/receive money and manage debt. This app allows users to create transactions, add descriptions, tag images, tag notes, and manage them. It features a rich and immersive user experience with 3D touch, quick actions, Actionable User Notifications, and Touch ID/Passcode capability for secure authentication.

![](img/logo.png)

Expand Down
21 changes: 21 additions & 0 deletions ios App/Dracker/Assets.xcassets/invite.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "invite.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion ios App/Dracker/Cell Models/Table View/UserCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class UserCell: BaseTableViewCell {
}

func load_cell(data: User) {
profile.init_from_S3(key: data.uid, bucket_name: .profiles)
if data.uid == "" {
profile.image = #imageLiteral(resourceName: "invite")
} else {
profile.init_from_S3(key: data.uid, bucket_name: .profiles)
}
name.text = data.name
}
}
24 changes: 23 additions & 1 deletion ios App/Dracker/Views/Payer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,24 @@ extension Payer: UITableViewDelegate, UITableViewDataSource {
}

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let user = users_list[indexPath.row]
var user: User
if search.isActive {
user = filtered_users_list[indexPath.row]
} else {
user = users_list[indexPath.row]
}
if user.uid == "" {
search.dismiss(animated: true) {[unowned self] in
self.search.searchBar.text = ""
let share_text = "Hey! Thought you would enjoy Dracker. It's an easy to use app to send/receive money and track debt. "
let share_url = URL(string: "https://github.com/raghavbhasin97/Dracker")!
let share_activity = UIActivityViewController(activityItems: [share_text, share_url], applicationActivities: [])
share_activity.excludedActivityTypes = [.addToReadingList, .assignToContact, .print, .saveToCameraRoll]
let parent = UIApplication.shared.keyWindow?.rootViewController
parent?.present(share_activity, animated: true, completion: nil)
}
return
}
parent?.phone_button.setTitle("@" + user.phone, for: .normal)
parent?.others_name = user.name
parent?.others_uid = user.uid
Expand All @@ -162,6 +179,11 @@ extension Payer: UISearchResultsUpdating, UISearchControllerDelegate {

self.filtered_users_list = []
let users = data.value as! [[String: Any]]
if users.isEmpty && text.count == 10 {
let new_user = User(phone: text, name: "Invite " + text + " to Dracker", uid: "")
self.filtered_users_list = [new_user]
}

for user in users {
let name = user["name"] as! String
let phone = user["phone"] as! String
Expand Down

0 comments on commit 34e77bb

Please sign in to comment.